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

Report pgm

Former Member
0 Likes
622

&----


*

*& Report ZPRACTISE1 *

*& *

&----


*& *

*& *

&----


REPORT ZPRACTISE1 .

tables : mara,makt.

data : begin of it_mara occurs 0,

matnr like mara-matnr,

meins like mara-meins,

end of it_mara.

data : begin of it_makt occurs 0,

matnr like makt-matnr,

maktx like makt-maktx,

end of it_makt.

data : begin of itab occurs 0,

matnr like mara-matnr,

meins like mara-meins,

maktx like makt-maktx,

end of itab.

selection-screen : begin of block b1 with frame title text-001.

select-options : s_matnr for mara-matnr.

selection-screen : end of block b1.

select * from mara into corresponding fields of table it_mara

where matnr in s_matnr.

*select * from makt into corresponding fields of table it_makt

  • where maktx = it_makt-maktx.

select * from makt into corresponding fields of table it_makt

for all entries in it_mara

where matnr = it_mara-matnr.

  • loop at it_mara.

  • move it_mara to itab.

    • append itab.

    • clear itab.

    • modify itab.

  • endloop.

loop at it_mara.

read table it_mara with key matnr = it_mara-matnr.

  • move it_makt to itab.

  • move it_mara to itab.

move it_mara-matnr to itab-matnr.

move it_mara-meins to itab-meins.

move it_makt-maktx to itab-maktx.

append itab.

  • refresh itab.

clear itab.

endloop.

loop at itab.

write : itab-matnr,

itab-meins,

itab-maktx.

endloop.

The above pgm i am not getting materialdescription in the o/p.please slove my problem

&----


*

*& Report ZPRACTISE1 *

*& *

&----


*& *

*& *

&----


REPORT ZPRACTISE1 .

tables : mara,makt.

data : begin of it_mara occurs 0,

matnr like mara-matnr,

meins like mara-meins,

end of it_mara.

data : begin of it_makt occurs 0,

matnr like makt-matnr,

maktx like makt-maktx,

end of it_makt.

data : begin of itab occurs 0,

matnr like mara-matnr,

meins like mara-meins,

maktx like makt-maktx,

end of itab.

selection-screen : begin of block b1 with frame title text-001.

select-options : s_matnr for mara-matnr.

selection-screen : end of block b1.

select * from mara into corresponding fields of table it_mara

where matnr in s_matnr.

*select * from makt into corresponding fields of table it_makt

  • where maktx = it_makt-maktx.

select * from makt into corresponding fields of table it_makt

for all entries in it_mara

where matnr = it_mara-matnr.

  • loop at it_mara.

  • move it_mara to itab.

    • append itab.

    • clear itab.

    • modify itab.

  • endloop.

loop at it_mara.

read table it_mara with key matnr = it_mara-matnr.

  • move it_makt to itab.

  • move it_mara to itab.

move it_mara-matnr to itab-matnr.

move it_mara-meins to itab-meins.

move it_makt-maktx to itab-maktx.

append itab.

  • refresh itab.

clear itab.

endloop.

loop at itab.

write : itab-matnr,

itab-meins,

itab-maktx.

endloop.

The above pgm i am not getting materialdescription in the o/p.please slove my problem

4 REPLIES 4
Read only

naimesh_patel
Active Contributor
0 Likes
556

Hello,

Change the bold part...

loop at it_mara.

<b>read table it_MAKT with key matnr = it_mara-matnr.</b>* move it_makt to itab.

  • move it_mara to itab.

move it_mara-matnr to itab-matnr.

move it_mara-meins to itab-meins.

move it_makt-maktx to itab-maktx.

append itab.

  • refresh itab.

clear itab.

endloop.

Regards,

Naimesh

Read only

0 Likes
556

loop at <b>it_mara</b>.

read table <b>it_mara</b> with key matnr = it_mara-matnr.

silly mistake...

loop at <b>it_mara</b>.

read table <b>it_makt</b>a with key matnr = it_mara-matnr.

Read only

Manohar2u
Active Contributor
0 Likes
556

Yes, you are reading from it_mara table rather form it_makt.

Change the read statement to

read table <b>it_makt</b> with key matnr = it_mara-matnr.

Regds

Manohar

Read only

Former Member
0 Likes
556

Hai Reddy

Check the following Code

<b>tables : mara,makt.

data : begin of it_mara occurs 0,

matnr like mara-matnr,

meins like mara-meins,

end of it_mara.

data : begin of it_makt occurs 0,

matnr like makt-matnr,

maktx like makt-maktx,

end of it_makt.

data : begin of itab occurs 0,

matnr like mara-matnr,

meins like mara-meins,

maktx like makt-maktx,

end of itab.

selection-screen : begin of block b1 with frame title text-001.

select-options : s_matnr for mara-matnr.

selection-screen : end of block b1.

clear it_mara.

refresh it_mara.

select matnr

meins

from mara

into table it_mara

up to 10 rows

where matnr in s_matnr.

if sy-subrc = 0.

sort it_mara by matnr.

endif.

if not it_mara[] is initial.

clear it_makt.

refresh it_makt.

select matnr

maktx

from makt

into table it_makt

for all entries in it_mara

where matnr = it_mara-matnr and

spras = sy-langu.

endif.

loop at it_mara.

read table it_makt with key matnr = it_mara-matnr.

move it_mara-matnr to itab-matnr.

move it_mara-meins to itab-meins.

move it_makt-maktx to itab-maktx.

append itab.

clear itab.

endloop.

loop at itab.

write 😕 itab-matnr,

itab-meins,

itab-maktx.

endloop.</b>

Regards

Sreeni