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

solution

Former Member
0 Likes
876

Guy's i need solution for

following problem, i have two internal table t_sdmat

and t_lmw

Table:->t_sdmat

fields:->matnr werks labst3

value:-> 53621

53621

Table:->t_lmw

fields:->matnr werks labst3

value:-> 53621 2001 20

53621 2002 30

final output requried

Table:->t_sdmat

fields:->matnr werks labst3

value:-> 53621 2001 20

53621 2002 30

1 ACCEPTED SOLUTION
Read only

guillaume-hrc
Active Contributor
0 Likes
842

Hi,

Something like that should solve the problem:

DATA: w_tabix  TYPE sy-tabix.
FIELD-SYMBOLS: <fs>      LIKE lINE OF t_sdmat,
               <fs_lmw>  LIKE LINE OF t_lmw.

LOOP AT t_sdmat ASSIGNING <fs>.
  READ TABLE t_lmw ASSIGNING <fs_lmw> WITH KEY matnr = <fs>-matnr.
  IF sy-subrc = 0.
    w_tabix = sy-tabix.
    MOVE-CORRESPONDING <fs_lmw> TO <fs>.
  
    DELETE t_lmw INDEX w_tabix.
  ENDIF.
ENDLOOP.

Best regards,

Guillaume

8 REPLIES 8
Read only

Former Member
0 Likes
841

loop at t_sdmat.

loop at t_lmw where matnr = t_sdmat-matnr.

write : / t_lmw-matnr, t_lmw-werks, t_lmw-labst3.

endloop.

endloop.

Surely, if you wish to save it in t_sdmat table than you can initialise the particular values in t_sdmat and modify the table.

Regards

Anurag

Message was edited by: Anurag Bankley

Message was edited by: Anurag Bankley

Read only

suresh_datti
Active Contributor
0 Likes
841

if its just that try

t_sdmat[] = t_lmw[].

~Suresh

Read only

guillaume-hrc
Active Contributor
0 Likes
843

Hi,

Something like that should solve the problem:

DATA: w_tabix  TYPE sy-tabix.
FIELD-SYMBOLS: <fs>      LIKE lINE OF t_sdmat,
               <fs_lmw>  LIKE LINE OF t_lmw.

LOOP AT t_sdmat ASSIGNING <fs>.
  READ TABLE t_lmw ASSIGNING <fs_lmw> WITH KEY matnr = <fs>-matnr.
  IF sy-subrc = 0.
    w_tabix = sy-tabix.
    MOVE-CORRESPONDING <fs_lmw> TO <fs>.
  
    DELETE t_lmw INDEX w_tabix.
  ENDIF.
ENDLOOP.

Best regards,

Guillaume

Read only

0 Likes
841

Hi Guillaume

You got the point,that what i was looking for

Read only

Former Member
0 Likes
841

Refresh t_sdmat.

t_sdmat[] = t_lmw[].

Regards,

Ravi

Read only

Former Member
0 Likes
841

Hi,

simple

<b>append lines of t_lmw to t_sdmat.</b>

Regards

vijay

Read only

Former Member
0 Likes
841

Check if the below code helps you.


*** Assumption Final Output should exist basing on 
***   materials from t_sdmat
delete adjacent duplicates from: t_sdmat.
loop at t_lmw.
     clear: t_sdmat.
     read table t_sdmat with key matnr = t_lmw-matnr.
     if sy-subrc eq 0.
        move-corresponding t_lmw to t_sdmat.
        collect t_sdmat.
     endif.
endloop.
delete t_sdmat where werks is initial.

Read only

Former Member
0 Likes
841

Hi Sanju

The solution sample code could be like this:---

refresh t_sdmat.

t_sdmat[] = t_lmw[].

regards,

varun sanghi