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

Coding help for looping the table control

Former Member
0 Likes
576

Hi friends,

Pls help me to post some example codes for looping the table control data items.

i.e., Details available in table control item in MIGO.

Ex:

LINE Material text Qty

1 INGOT 5.0

1 INGOT 2.5

1 INGOT 10.0

1 FURNACE OIL 180.0

Pls help me,How to loop this table control items , so that i want to sum the consolidated qty by material wise.

the fileds are cs_goitem-matnr and cs_goitem-qty.

FYI,

1) the cs_goitem is a structure of MIGO.(cant do it for looping)

2) cs_goitem is the parameter and goitem is a structure

3) we cant declare an internal table here.ex:

data: itab type standard table of goitem with header line.

data: begin of itab occurs 0.

data: itab like mchb occurs 0 with header line.

Post ur comments with sample codes.

thanks & reagrds

sankar.

Edited by: sankar babu on Jan 2, 2008 10:13 AM

Edited by: sankar babu on Jan 2, 2008 11:17 AM

5 REPLIES 5
Read only

arpit_shah
Contributor
0 Likes
526

use the COLLECT keyword.

or

check MCHB it is helpful to u.

Regards,

Arpit

Read only

0 Likes
526

Hi Arpit.S,

Could u pls explain it in detail??...with collect stmt...

Bcos...inside badi method,u cant declare a table with headers...So pls post with some good examples.

thanks & regards

sankar.

Read only

Former Member
0 Likes
526

hi as u used table control . fetch data from dat table control in internal table.

data: itab type standard table of cs_goitem with header line.

data : total like cs_goitem-matnr.

loop at itab.

at new itab-qty.

total = 0.

total = total + itab-qty.

endat.

  • * at this point u get total qty for that material.

endloop.

Edited by: yogesh kothavade on Jan 2, 2008 11:04 AM

Read only

0 Likes
526

HI Yogesh,

first,thanks for ur reply.

with ur code helps, the system saying error as cs_goitem is unknown.("data: itab type standard table of cs_goitem with header line").

Here cs_goitem is the parameter and its parameter type is goitem.

first,just tell me how to get the internal table of MIGO where the datas getting stored.

Pls advise.

Read only

Former Member
0 Likes
526

Got result.

regards

sankar.