FORM SAVE_DATA.
LOOP AT IT_ALV.
DATA:LV_LEN TYPE I,
S TYPE I,
Y TYPE I,
T TYPE STRING.
LV_LEN = CL_ABAP_LIST_UTILITIES=>DYNAMIC_OUTPUT_LENGTH( IT_ALV-NOTE ).
S = LV_LEN / 274.
Y = LV_LEN MOD 274.
IF IT_ALV-NOTE IS NOT INITIAL AND Y = 0 AND S = 1.
IT_ZTBOSB03929-SALES_ORD_NUM = IT_ALV-ORDER.
IT_ZTBOSB03929-SALES_ORD_LINE_NUM = IT_ALV-LINE.
IT_ZTBOSB03929-NOTE_SOURCE = IT_ALV-SOURCE.
IT_ZTBOSB03929-NOTE_TYPE = IT_ALV-TYPE.
IT_ZTBOSB03929-NOTE_TEXT = IT_ALV-NOTE.
APPEND IT_ZTBOSB03929.
ELSEIF IT_ALV-NOTE IS NOT INITIAL AND ( Y = 0 AND S NE 1 ).
DO S TIMES.
IT_ZTBOSB03929-SALES_ORD_NUM = IT_ALV-ORDER.
IT_ZTBOSB03929-SALES_ORD_LINE_NUM = IT_ALV-LINE.
IT_ZTBOSB03929-NOTE_SOURCE = IT_ALV-SOURCE.
IT_ZTBOSB03929-NOTE_TYPE = IT_ALV-TYPE.
IT_ZTBOSB03929-NOTE_TEXT = IT_ALV-NOTE+(274).
APPEND IT_ZTBOSB03929.
T = IT_ALV-NOTE+(274).
SHIFT IT_ALV-NOTE LEFT DELETING LEADING T.
CLEAR:T,IT_ZTBOSB03929.
ENDDO.
ELSEIF IT_ALV-NOTE IS NOT INITIAL AND Y NE 0.
DO S + 1 TIMES.
IT_ZTBOSB03929-SALES_ORD_NUM = IT_ALV-ORDER.
IT_ZTBOSB03929-SALES_ORD_LINE_NUM = IT_ALV-LINE.
IT_ZTBOSB03929-NOTE_SOURCE = IT_ALV-SOURCE.
IT_ZTBOSB03929-NOTE_TYPE = IT_ALV-TYPE.
IT_ZTBOSB03929-NOTE_TEXT = IT_ALV-NOTE+(274).
APPEND IT_ZTBOSB03929.
T = IT_ALV-NOTE+(274).
SHIFT IT_ALV-NOTE LEFT DELETING LEADING T.
CLEAR:T,IT_ZTBOSB03929.
ENDDO.
ENDIF.
CLEAR:IT_ALV,IT_ZTBOSB03929,S,Y.
ENDLOOP.
INSERT ZTB_OSB03929 FROM TABLE IT_ZTBOSB03929 ACCEPTING DUPLICATE KEYS.
ENDFORM.
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/19561.html