Application Development 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: 

solution 1

Former Member
0 Kudos
199

Guy's

i have asked these question in forum before,and

found soultion which i found to be temporary fix.kindly

find the issue below.

Scenario1

Table 😆 t_sdmat

fields 😆 matnr werks labst3 mvgr1 mvgr2

value 😆 53621 c01 cv

53621

Table 😆 t_lmw

fields 😆 matnr werks labst3

value 😆 53621 2001 20

53621 2002 30

final output required

Table 😆 t_sdmat

fields 😆 matnr werks labst3 mvgr1 mvgr2

value 😆 53621 2001 20 co1 cv

53621 2002 30

Sceanrio2

Table 😆 t_sdmat

fields 😆 matnr werks labst3 mvgr1 mvgr2

value 😆 53621 co1 cv

Table 😆 t_lmw

fields 😆 matnr werks labst3

value 😆 53621 2001 20

53621 2002 30

final output required

Table 😆 t_sdmat

fields 😆 matnr werks labst3 mvgr1 mvgr2

value 😆 53621 2001 20 c01 cv

53621 2002 30 c01 cv

i have tried following two option

but that didn't worked for both the scearion

<b><u>option1</u></b>

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.

<fs>-matnr = <fs_lmw>-matnr.

<fs>-werks = <fs_lmw>-werks.

<fs>-labst3 = <fs_lmw>-labst3.

DELETE t_lmw INDEX w_tabix.

ENDIF.

ENDLOOP.

delete t_sdmat where werks is initial.

<b><u>option2</u></b>

loop at t_lmw.

clear: t_sdmat.

read table t_sdmat with key matnr = t_lmw-matnr.

if sy-subrc eq 0.

w_tabix = sy-tabix.

t_sdmat-matnr = t_lmw-matnr.

t_sdmat-werks = t_lmw-werks.

t_sdmat-labst3 = t_lmw-labst3.

collect t_sdmat.

endif.

endloop.

delete t_sdmat where werks is initial.

4 REPLIES 4

Former Member
0 Kudos
164

Hi,

Confirm the following data. As I am clear the internal table values.

Scenario1

-


Table 😆 t_sdmat

fields 😆

matnr werks labst3 mvgr1 mvgr2

53621 c01 cv

53621

Final output

Table 😆 t_sdmat

matnr werks labst3 mvgr1 mvgr2

53621 2001 20 co1 cv

53621 2002 30

Scenario2

-


Table 😆 t_sdmat

matnr werks labst3 mvgr1 mvgr2

53621 co1 cv

Final output

Table 😆 t_sdmat

matnr werks labst3 mvgr1 mvgr2

53621 2001 20 c01 cv

53621 2002 30 c01 cv

Thanks,

Naren

Message was edited by: Narendran Muthukumaran

Former Member
0 Kudos
164

Hi,

Try the following code. I think this might work if the material number is unique in the internal table t_sdmat.

Create an internal table t_temp with the structure similar to t_sdmat.

loop at t_lmw.

v_tabix = sy-tabix.

read table t_sdmat index v_tabix.

if sy-subrc = 0.

move-corresponding t_sdmat to t_temp.

move-corresponding t_lmw to t_temp.

append t_temp.

else.

read table t_sdmat with key matnr = t_lmw-matnr.

if sy-subrc = 0.

move-corresponding t_sdmat to t_temp.

move-corresponding t_lmw to t_temp.

append t_temp.

endif.

endif.

endloop.

Thanks,

Naren

Message was edited by: Narendran Muthukumaran

Former Member
0 Kudos
164

Sceanrio2

Table 😆 t_sdmat

fields 😆 matnr werks labst3 mvgr1 mvgr2

value 😆 53621 co1 cv

Table 😆 t_lmw

fields 😆 matnr werks labst3

value 😆 53621 2001 20

53621 2002 30

final output required

Table 😆 t_sdmat

fields 😆 matnr werks labst3 mvgr1 mvgr2

value 😆 53621 2001 20 c01 cv

53621 2002 30 c01 cv

Solution --

Loop at t_sdmat.

clear t_lmw.

loop at t_lmw where matnr = t_sdmat-matnr.

move t_lmw-werks to t_sdmat-werks.

move t_lmw-labst3 to t_sdmat-labst3.

modify t_sdmat.

endloop.

endloop.

Former Member
0 Kudos
164

Scenario1

-


Table 😆 t_sdmat

fields 😆

matnr werks labst3 mvgr1 mvgr2

53621 c01 cv

53621

Final output

Table 😆 t_sdmat

matnr werks labst3 mvgr1 mvgr2

53621 2001 20 co1 cv

53621 2002 30

Solution --

loop at t_sdmat.

loop at t_lmw where matnr = t_sdmat-matnr.

move t_lmw-werks to t_sdmat-werks.

move t_lmw-labst3 to t_sdmat-labst3.

modify t_sdmat.

delete t_lmw.

exit.

endloop.

endloop.