2010 Mar 01 10:57 AM
HI All,
I developed Letter of credit report..Am struggling with one logic...
I have two tables For example X and Y..
X have 10 material numbers and Y have 8 material numbers.
I need output liike this.
X table Y table Output
12 12 500.00 12 500
13 12 700.00 12 700
14 12 100.00 12 100
15 13 300.00 13 300
16 14 400.00 14 400
15 -
16 -
I wrote like this but its not displaying the remaining X table Details which are not preent in Y table.
LOOP AT it_lc INTO wa_lc.
IF it_boe IS NOT INITIAL.
LOOP AT it_boe INTO wa_boe WHERE lc_docno EQ wa_lc-lc_docno.
MOVE: wa_lc-vendor_number TO wa_final-vendor_number,
wa_lc-vendor_name TO wa_final-vendor_name,
wa_lc-lc_docno TO wa_final-lc_docno,
MOVE wa_boe-boe_paid_amount TO wa_final-boe_paid_amount.
endif.
endloop.
Thanks and regards
Sai.
2010 Mar 01 11:42 AM
Hello Sai,
as per my understanding, your requirement is to print all the record from table X and the records from table Y with same doc. no.
Please try the below logic.
loop at TABLEX into WA_TABLEX.
"<field assignment to a new work area (WA_FINAL) from the TABLEX>
(MOVE: wa_lc-vendor_number TO wa_final-vendor_number,
wa_lc-vendor_name TO wa_final-vendor_name,
wa_lc-lc_docno TO wa_final-lc_docno,)
if not TABLEY[] is initiail.
loop at TABLEY into WA_TABLEY where <condition (docno = wa_tablec-docno)>.
"<field assignment to the new work area (WA_FINAL) from the TABLEY>
(MOVE wa_boe-boe_paid_amount TO wa_final-boe_paid_amount.)
append WA_FINAL to TABLE_FINAL.
endloop.
else.
append WA_FINAL to TABLE_FINAL.
endif.
endloop.
Hope this helps you.
Regards,
Sachinkumar Mehta
HI All,
I developed Letter of credit report..Am struggling with one logic...
I have two tables For example X and Y..
X have 10 material numbers and Y have 8 material numbers.
I need output liike this.
X table Y table Output
12 12 500.00 12 500
13 12 700.00 12 700
14 12 100.00 12 100
15 13 300.00 13 300
16 14 400.00 14 400
15 -
16 -
I wrote like this but its not displaying the remaining X table Details which are not preent in Y table.
LOOP AT it_lc INTO wa_lc.
IF it_boe IS NOT INITIAL.
LOOP AT it_boe INTO wa_boe WHERE lc_docno EQ wa_lc-lc_docno.
MOVE: wa_lc-vendor_number TO wa_final-vendor_number,
wa_lc-vendor_name TO wa_final-vendor_name,
wa_lc-lc_docno TO wa_final-lc_docno,
MOVE wa_boe-boe_paid_amount TO wa_final-boe_paid_amount.
endif.
endloop.
Thanks and regards
Sai.
2010 Mar 01 11:30 AM
Hi,
You have to do an append twice .. as the records which are not there in 'Y' table , the other records are there in 'X' table.
Loop at X table.
read Ytable..
if sy-subrc eq 0.
append ztable.
endif.
append ztable.
endloop.
Regards,
Nagaraj
2010 Mar 01 11:35 AM
Hi Nagraj,
If i put read staement it will fetch only first record..In Y table for each Material nUmber i have more than one amount value...
2010 Mar 01 11:38 AM
HI,
then use Loop statement instead of read ... the other logic will remain the same.
Regards,
nagaraj
2010 Mar 01 11:42 AM
Hello Sai,
as per my understanding, your requirement is to print all the record from table X and the records from table Y with same doc. no.
Please try the below logic.
loop at TABLEX into WA_TABLEX.
"<field assignment to a new work area (WA_FINAL) from the TABLEX>
(MOVE: wa_lc-vendor_number TO wa_final-vendor_number,
wa_lc-vendor_name TO wa_final-vendor_name,
wa_lc-lc_docno TO wa_final-lc_docno,)
if not TABLEY[] is initiail.
loop at TABLEY into WA_TABLEY where <condition (docno = wa_tablec-docno)>.
"<field assignment to the new work area (WA_FINAL) from the TABLEY>
(MOVE wa_boe-boe_paid_amount TO wa_final-boe_paid_amount.)
append WA_FINAL to TABLE_FINAL.
endloop.
else.
append WA_FINAL to TABLE_FINAL.
endif.
endloop.
Hope this helps you.
Regards,
Sachinkumar Mehta