‎2010 Jan 05 11:39 AM
Scenario is:
Internal table 1 is having fields like name1 date amount1 amount2 amount3 amount4 amount5 and internal table 2 is having fields like name1 date amount now the internal table 2 data i need to pass to BAPI function module which will update database tabl.
first internal table is having data
for one employee we can have multiple amounts. so i need logic how to pass the main internal table data to itab2 and pass it to BAPI.
Thanks,
Kumar
‎2010 Jan 05 11:45 AM
‎2010 Jan 05 11:52 AM
if employe name is unique , but it will not bw in most of the cases
if you need to add amount1 , amount 2 amount 3 , if it is that way
loop at itab1 into wa_itab1
wa_ita2-name = wa_itab1-name
wa_itab1-date = wa_itab1-date.
wa_itab2-amount = wa_itab1-amount1 + wa_itab1-amount2 --- so on -- wa_itab1-amountn
append wa_itab to itab2.
clear wa_itab1 , wa_itab2.
endloop.
if you need to add amount of differnet rows , if it is that way..
take a tempary work area of type wa_itab1_temp
v_amount tye wrbtr.
loop at itab1 into wa_itab1
wa_itab1_temp1 = wa_itab1
wa_ita2-name = wa_itab1_temp1-name
wa_itab2-date = wa_itab1_temp1-date.
v_amount = wa_itab1-amount1 + wa_itab1-amount2 --- so on -- wa_itab1-amountn
at end of name
wa_itab2-amount = v_amount.
append wa_itab to itab2.
clear wa_itab1 , wa_itab2 wa_itab1_temp1.
endat.
endloop.
Please let me knwo if you need further info
Regards
Satish Boguda
‎2010 Jan 05 11:54 AM
read the internal table by loop
if sy-tabix = 1.
name1 = v_name1.
date = V-date.
amount1 = V_amt1.
append internal table2.
name1 = v_name1.
date = V-date.
amount2 = V_amt1.
append internal table2.
name1 = v_name1.
date = V-date.
amount3 = V_amt1.
append internal table2.
name1 = v_name1.
date = V-date.
amount4 = V_amt1.
append internal table2.
name1 = v_name1.
date = V-date.
amount5 = V_amt1.
append internal table2.
endif.
try this, i hope it'll help.
‎2010 Jan 21 5:57 AM