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

itab-c

Former Member
0 Likes
442

hi guys

here i m writing my coding for Questions-c , check it . is this right?

b) Get the maximum lead time for the components: For all records in it_child, get it_marc-wzeit matching on matnr and werks in it_marc and it_child and get the maximum wzeit for all matnr in it_child.

c) Populate this maximum wzeit as it_marc-ztlt matching on matnr and werks in it_bom (step 7a above) and it_marc. Now add it_marc-zlt and it_marc-ztlt for this matnr and werks and populate it_marc-wzeit. Also, set it_marc-upd = “X”.

and my coding is

c]--

data : total4 type bseg-wrbtr.

loop at it_marc where

it_bom-matnr = it_marc-matnr and

it_bom-werks = it_marc-werks.

if sy-subre = 0.

move it_marc-ztlt = it_child-wzeit.

modify it_marc.

total4 = it_marc-zlt + it_marc-ztlt.

it_marc - wzeit = total4.

modify it_marc.

endloop.

thanxs

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
394

Again, I don't know your full requirement, but....If we are talking about "C" and you are looping IT_BOM around the given code, then try this.



Loop at it_bom.

loop at it_marc
    where matnr = it_bom-matnr
      and werks = it_bom-werks.
it_marc-wzeit = it_marc-zlt + it_marc-ztlt.
modify it_marc.
endloop.

Endloop.

I think I'm still a little confused about your requirement.

Regards,

Rich Heilman

Read only

0 Likes
394

Rich´s sample could be improved by using field-symbols:

 
field-symbols: <wa_marc> like line of it_marc.
loop at it_marc
  assigning <wa_marc> 
  where 
    matnr = it_bom-matnr     and
    werks = it_bom-werks.
  <wa_marc>-wzeit = <wa_marc>-zlt + <wa_marc>-ztlt.
endloop.