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

abap code help

Former Member
0 Likes
579

hi,

i have a following scenario

table1

mstat

1

2

3

4

5

6

7

table 2

matno vno pno mstat quan

m001 v001 p001 1 1

but for this particular record i want show other status also which are in table 1 how to do that

table 3 should be in this way

matno vno pno mstat quan

m001 v001 p001 1 1

m001 v001 p001 2 0

m001 v001 p001 3 0

m001 v001 p001 4 0

m001 v001 p001 5 0

m001 v001 p001 6 0

m001 v001 p001 7 0

can any one tell me how to do that

1 ACCEPTED SOLUTION
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
533

Hi Venkat,

Declare a 3rd internal table with all the fields .

Loop at 1st internal table.

read 2nd internal table with key mstat = it1-mstat.

if sy-subrc eq 0.

it3-quan = it2-quan.

else.

it3-quan = 0.

endif.

append it3 to it3_tab.

endloop.

*reward if this helps

regards,

Sandeep

4 REPLIES 4
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
534

Hi Venkat,

Declare a 3rd internal table with all the fields .

Loop at 1st internal table.

read 2nd internal table with key mstat = it1-mstat.

if sy-subrc eq 0.

it3-quan = it2-quan.

else.

it3-quan = 0.

endif.

append it3 to it3_tab.

endloop.

*reward if this helps

regards,

Sandeep

Read only

gopi_narendra
Active Contributor
0 Likes
533

now check this code, hope this is clear??


loop at table1.
  loop at table2.
    move tab2-matno   to is_final-matno.
    move tab2-vno     to is_final-vno.
    move tab2-pno     to is_final-pno.
    move table1-mstat to is_final-mstat.
    append is_final to it_final.
  endloop.
  clear : table1, table2, is_final.
endloop.

Regards

Gopi

Read only

Former Member
0 Likes
533

thanks for answering but i am not able to understand

table2 can have 100 materials i cant hard code

table1 is having only mstat

if i delare all fields in all internal table then how to write select statement

so can u please be more clear

Message was edited by:

venkat s

Message was edited by:

venkat s

Read only

Former Member
0 Likes
533

hi try this code,

declare 3rd internal table with all the fields,

loop at table2.

at new mstat.

flag = 1.

endat.

if flag = '1'.

move-corresponding table2 to table3.

append table3.

clear table3.

clear flag.

endif.

endloop.

if it helps reward points...