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

Looping Problem

Former Member
0 Likes
576

Hi All,

I am having internal tables as below,

DATA:BEGIN OF it_mkol OCCURS 0,

slabs LIKE mkol-slabs,

matnr LIKE mkol-matnr,

sinsm LIKE mkol-sinsm,

END OF it_mkol.

DATA:BEGIN OF it_mard OCCURS 0,

labst LIKE mard-labst,

matnr LIKE mard-matnr,

lgort LIKE mard-lgort,

insme LIKE mard-insme,

END OF it_mard.

DATA:BEGIN OF it_eord OCCURS 0,

lifnr LIKE eord-lifnr,

matnr like eord-matnr,

END OF it_eord.

DATA:BEGIN OF it_plpo OCCURS 0,

vgw03 LIKE plpo-vgw03,

matnr like plpo-matnr,

END OF it_plpo.

DATA: BEGIN OF it_stb OCCURS 0.

include structure STPOX.

Data: sinsm LIKE mkol-sinsm,

vgw03 LIKE plpo-vgw03,

labst LIKE mard-labst,

matnr LIKE mard-matnr,

insme LIKE mard-insme,

slabs LIKE mkol-slabs,

vname(20),

totprc TYPE i,

qistock TYPE i,

END OF it_stb.

I want to append the rows from the table it_mkol,it_mard,it_eord,it_plpo into it_stb.

Through which table I will have to loop, so that the rows will be appended correctly

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
524

Hi Manik,

You can work with this way.

Step 1: Loop table it_mard

step 2: Inside this loop read table it_mkol with key matnr = it_mard-matnr.

step 3: Read table it_eord with key matnr = it_mard-matnr.

step 4: Read table it_plpo with key matnr= it_mard-mantr..

step 5: append the data into the final internal table

step 6: clear the header of the table.

cheers,

Chidanand

3 REPLIES 3
Read only

Former Member
0 Likes
524

loop at it_mard.

read table it_mkol with key matnr = it_mard-matnr.

read table it_eord with key matnr = it_mard-matnr.

read table it_plpo with key matnr = it_mard-matnr.

<move the data to it_stb and append data>.

endloop.

Read only

Former Member
0 Likes
524

as i under sstood the link between all the inerenal tables is MATERIAL.

so loop the table which contailns more number of materials..as per my knowledge <b>MKOL contans more entries than MARD, EORD. because MKOL contains more key valeues than MARD,BORD.</b>

so loop the table MKOL

then read the records from MARD and BORD.

populate all the value form MARD and BORD, MKOL to the FINAL workarea

then APPEND .

Please Close this thread.. when u r problem is solved

Reward if Helpful

Regards

Naresh Reddy K

Read only

Former Member
0 Likes
525

Hi Manik,

You can work with this way.

Step 1: Loop table it_mard

step 2: Inside this loop read table it_mkol with key matnr = it_mard-matnr.

step 3: Read table it_eord with key matnr = it_mard-matnr.

step 4: Read table it_plpo with key matnr= it_mard-mantr..

step 5: append the data into the final internal table

step 6: clear the header of the table.

cheers,

Chidanand