‎2007 Nov 28 4:19 PM
hi guys.....i have a requirement as below
my output is as per the database
example:
doc: ' tax1 ' tax2 ' tax3..........'taxn
009 ' 1% ' 0 ' 0............'..
009 ' 0 ' 2% ' 0............'...
009 ' 0 ' 0 ' 3%.........'....
the same document number has three different taxes or even more
so the requirement is to print all the taxes in one row for given document number
example:
<b>docno: tax1 tax2 tax3..........taxn
009 1% 2% 3% ............n%</b>
thank you in advance
Vikram.
‎2007 Nov 28 4:36 PM
Hi Vikram,
do like this
data: wa1 like line of wa,
lv_lines type i,
cnt type i.
descibe table itab lines lv_lines.
loop at itab into wa.
cnt = cnt + 1.
if wa-doc = wa1-doc.
delete itab from wa.
modify itab from wa.
endif.
if cnt = lv_lines.
xit.
endif.
wa1 = wa.
endloop.Regards,
Satish
‎2007 Dec 04 10:12 PM
Create a table, copy of your itab, and then:
LOOP AT itab1.
ON CHANGE OF itab1-doc.
* // This restart the cycle
l_counter = 0.
ENDON.
l_counter = l_counter + 1.
CONCATENATE 'TAX' l_counter INTO l_field.
ASSIGN COMPONENT l_field OF STRUCTURE itab1 TO <field1>.
IF sy-subrc NE 0.
* // Lines of DOC finished or components finished.
APPEND wa TO itab2.
CONTINUE.
ENDIF.
ASSIGN COMPONENT l_field OF STRUCTURE wa TO <field2>.
IF sy-subrc NE 0.
APPEND wa TO itab2.
CONTINUE.
ENDIF.
IF <field1> IS NOT INITIAL.
<field2> = <field1>.
ENDIF.
ENDLOOP.
Hope this helps.
R.