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

Issue with include structure

raviram_jk
Explorer
0 Likes
1,249

Hello everyone,

I am beginner,

while am using with include structure , output wil be blank .

below the code which i mentioned in program.

pls help me out of these.

REPORT  ZINC.

*tables:mara.

TYPES BEGIN OF jk.

include structure mara.

  TYPES END OF jk.

  DATA: itab TYPE STANDARD TABLE OF jk,

      wa_mara TYPE jk.

SELECT matnr from MARA into TABLE itab." UP TO 10 rows.

*sort itab.

LOOP AT itab INTO wa_mara.

NEW-LINE.

  WRITE: wa_mara-matnr.

*  write:/ wa_mara-matkl.

*  wa-pstat = mara-pstat.

ENDLOOP.

But, If i use with mandt the output is getting correct.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,185

Hi Raviram,

     you need to specify the target of matr as matnr field in your internal table.

SELECT matnr from mara into corresponding fields of TABLE itab.

The above select statement should solve your problem.

Problem with your code: you are trying to copy matnr into mandt field of itab .

Thanks & Regards,

Tashi

6 REPLIES 6
Read only

pavanm592
Contributor
0 Likes
1,185

hi ravi,

Include structure will include all the fields of the database structure if u want only material number to be fetched use types as below.

types : begin of jk,

              matnr type mara-matnr,

               end of jk.

Regards,

Pavan

Read only

0 Likes
1,185

Thanks pavan,

That concept i know, instead of using this. include structure mara it wil include all the fields.

bt while am using mandt in select and with in loop . the output is getting,

Read only

0 Likes
1,185

actually in select query as per your structure

select * from mara into itab up to 20 rows.

or use can write like this

select matnr into corresponding fields of itab up to 20 rows.

Regards,

pavan

Read only

Former Member
0 Likes
1,186

Hi Raviram,

     you need to specify the target of matr as matnr field in your internal table.

SELECT matnr from mara into corresponding fields of TABLE itab.

The above select statement should solve your problem.

Problem with your code: you are trying to copy matnr into mandt field of itab .

Thanks & Regards,

Tashi

Read only

0 Likes
1,185

Thanks tashi,

If i use corresponding field of table the value is getting. but i cannot use into table in the above mentioned prgm.

Read only

0 Likes
1,185


Hi Raviram,

Yes, you need to use " into corresponding fields of TABLE" because you are trying to copy a single values to the table.

if you want to use "INTO TABLE" ........

then use SELECT * from mara into table itab.

or

create the structure with only matnr.

types : begin of jk,

              matnr type mara-matnr,

               end of jk.

and then your select statement.

Regards,

Tashi