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

help withe loop on tables

Former Member
0 Kudos
323

Hallow in my table itab I have employee (sobid employee number and names ex. 80 emp) in my loop(b_itab) I get all he employee that doing the course (their sobid just 3 emp) how can I use b_itab to write to other table (d_itab) to write all the employee that don’t doing the course .I need a general solution.

<b>Ex.i have a table with 80 emp and I doing a loop on this table and find 3 employee that doing course how can I do comparison in the 2 table that if the employee not in b_itab(emp doing course) write them in d_itab(oteer table).</b> .if u need more details please let me now.

regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
292
loop at itab1.
  read table itab2 with key course = itab1-course
    if sy-subrc ne 0.
        move-corresponding itab2 to it_final.
        append it_final
    endif.
endloop.
4 REPLIES 4
Read only

Former Member
0 Kudos
293
loop at itab1.
  read table itab2 with key course = itab1-course
    if sy-subrc ne 0.
        move-corresponding itab2 to it_final.
        append it_final
    endif.
endloop.
Read only

Former Member
0 Kudos
292

Loop at itab.

  • Specify the condition here if they are doing the course

if (Condition here)

append itab to b_itab.

else

append itb to d_tab.

endif.

endloop.

The other option will be:

loop at itab.

read table b_itab with key course = itab-course.

if sy-subrc NE 0.

append itab to d_itab.

endif.

endloop.

Can you try these options? If not, please give the structure of the internal table to know exactly you want to do.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Kudos
292

Hi Antonio ,

in the loop how do you determine if the employee is doing the course or not.

As per my understanding you must be having a condition , if the condition is true the employee is doing the course if not what you can do is append that employee to your other internal table.

Regards

Arun

Read only

jayanthi_jayaraman
Active Contributor
0 Kudos
292

Hi,

I don't know whether I understood your question correctly.Check whether this is the output you want.

Loop at itab.

if not itab-sobid is initial."Employee during course

move-corresponding itab to d_itab.

append d_itab.

else."Employee not during course

move-corresponding itab to b_itab.

append b_itab.

endif.

endloop.