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

moving data to final internal table by using read statement

Former Member
0 Likes
907

Hi all,

Types: BEGIN OF TY_MARA,

MATNR TYPE MATNR, " Material Number

END OF TY_MARA,

BEGIN OF TY_MAPL,

MATNR TYPE MATNR, " Material

PLNTY TYPE PLNTY, " Task List Type

END OF TY_MAPL,

BEGIN OF TY_PLKO,

PLNTY TYPE PLNTY, " Task List Type

VERWE TYPE PLN_VERWE, " Task list usage

END OF TY_PLK.

types: BEGIN OF TY_FINAL,

MATNR TYPE MATNAR, " MATERIAL NO.

VERWE TYPE PLN_VERWE, " Task list usage

END OF TY_FINAL.

DATA: I_MARA TYPE STANDARD TABLE OF TY_MARA ,

I_MAPL TYPE STANDARD TABLE OF TY_MAPL ,

I_PLKO TYPE STANDARD TABLE OF TY_PLKO ,

I_FINAL TYPE STANDARD TABLE OF TY_FINAL ,

WA_MARA TYPE TY_MARA,

WA_MAPL TYPE TY_MAPL,

WA_PLKO TYPE TY_PLKO,

WA_FINAL TYPE TY_FINAL.

SELECT-OPTIONS: S_MATNR FOR mara-MATNR.

SELECT MATNR

FROM MARA INTO TABLE I_MARA

WHERE MTART IN S_MTART.

SELECT MATNR

PLNTY FROM MAPL INTO TABLE I_MAPL FOR ALL ENTRIES IN I_MARA

WHERE MATNR = I_MARA-MATNR.

SELECT PLNTY

VERWE

FROM PLKO INTO TABLE I_PLKO FOR ALL ENTRIES IN I_MAPL

WHERE PLNTY = I_MAPL-PLNTY.

now i want to move MATNR and VERWE field to the final internal table i_final.the problem there is no MATNR field in I_PLKO internal table.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
732

Hi Mythily,

Try this.

Loop at i_mara into wa_mara.

move wa_mara-matnr to wa_final-matnr.

Read table i_mapl into wa-mapl with key matnr = wa_mara-matnr.

if sy-subrc = 0.

Read table i_plko into wa_plko with key plnty = wa_mapl-plnty.

if sy-subrc = 0

move wa_plko-VERWE to wa_final-VERWE.

endif.

endif.

append wa_final to i_final

endloop.

Regards,

Vijay

4 REPLIES 4
Read only

former_member404244
Active Contributor
0 Likes
732

HI,

Try like this.

Loop at I_PLKO.

read table I_MAPL with key PLNTY = I_PLKO-PLNTY.

if sy-subrc eq 0.

read table I_MARA with key matnr = I_MAPL-MATNR.

if sy-subrc eq 0.

Move : I_MARA-MATNR to I_final-matnr,

I_PLKO-VERME to I_final-Verme.

append i_final.

endif.

endif.

endloop.

Regards,

Nagaraj

Read only

Former Member
0 Likes
732

Hi,

Try this.


loop at i_mapl into wa_mapl.

read table i_plko into wa_plko with key matnr = wa_mapl-plnty.
   *now wa_mapl has the the verme value for that particulat plnty.

  * now assign all the values to the final work area and append into the internal table.

Hope it helps.

Regards,

Dhasarathy.

Read only

Former Member
0 Likes
733

Hi Mythily,

Try this.

Loop at i_mara into wa_mara.

move wa_mara-matnr to wa_final-matnr.

Read table i_mapl into wa-mapl with key matnr = wa_mara-matnr.

if sy-subrc = 0.

Read table i_plko into wa_plko with key plnty = wa_mapl-plnty.

if sy-subrc = 0

move wa_plko-VERWE to wa_final-VERWE.

endif.

endif.

append wa_final to i_final

endloop.

Regards,

Vijay

Read only

kanishakgupta1
Contributor
0 Likes
732

write this code

loop at i_mapl

read table i_plko with key plnty = i_mapl-plnty.

if sy-subrc eq 0.

move i_plko-verve to i_final-plko.

endif.

read table i_mara with key matnr = i_mapl-matnr.

if sy-subrc eq 0.

move i_mara-matnr to i_final-matnr.

endif.

endloop.