2008 Oct 20 12:51 PM
hi all,
i have an issue in my report,
i have a final internal table. fileds in the table are
bukrs belnr gjahr buzei sgtxt
0010 12345 2008 01 text
0010 12345 2008 02 -
now the problem is if the belnr is same thn in the final internal table the above sgtxt shoud come for second line item if the second line item is initial ,i shoud get the output as
bukrs belnr gjahr buzei sgtxt
0010 12345 2008 01 text
0010 12345 2008 02 text
please help me how to write code for this
2008 Oct 20 12:55 PM
Hi,
Use this :
Loop at itab.
if itab-sgtext is initial .
read table itab into wa with key bukrs = itab-bukrs
belnr = itab-bukrs
gjahr = itab-bukrs
buzei = itab-bukrs
sgtext <> space.
if sy-subrc eq 0.
itab-sgtext = wa-sgtext.
modify itab transporting sgtext.
endif.
endif.
endloop.
Hope this helps.
Rgds,
Sandeep
2008 Oct 20 12:58 PM
Hi,
u can do as follows...
DATA: ITAB_T LIKE LINE OF <ITAB>,
SGTXT_T TYPE <ITAB>-SGTXT.
SORT <ITAB> BY BELNR SGTXT
LOOP AT <ITAB>.
ITAB_T = <ITAB>.
AT NEW BELNR.
T_BELNR = <ITAB_T-SGTXT.
ENDAT.
IF <ITAB>-SGTXTR IS INITIAL.
ITAB_T-SGTXT = SGTXT_T.
ENDIF.
APPEND ITAB_T INTO <ITAB_FINAL>.
CLEAR: ITAB_T,
SGTXT_T.
ENDLOOP.
2008 Oct 20 1:05 PM
Hi,
Move this values to one more internal table.
Loop at 1 internal table.
read second internal table with belnr.
If check that text is initial.
second internal text = first internal table text.
endif.
Modify second internal table with text.
endloop..
Now 2 internal table will have all the rows with text