Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Logic required

Former Member
0 Likes
591

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

4 REPLIES 4
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
513

employee name will not be unique.

Read only

Former Member
0 Likes
513



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

Read only

Former Member
0 Likes
513

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.

Read only

Former Member
0 Likes
513

Thanx all i got the solution...