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: 

displaying contents of program in classical list

Former Member
0 Kudos
87

hi abappers,

can anybody explain to me about how to display the lines of a particular program to be displayed in a classical list and also plz tell me how the same thing can be done using objects too. i need to enter the name of the program and the lines of the programs has to displayed in the classical list.

can anybody hlp me plz?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
68

Hi narendiran,

1. Very simple.

Just as u want !

2. just copy paste in new program

REPORT abc.

TYPES: BEGIN OF t_type,

line(72),

END OF t_type.

PARAMETERS : program LIKE sy-repid .

data : begin of t occurs 0,

line(72) type c,

end of t.

*----


READ REPORT program INTO t.

*----


LOOP AT t.

WRITE 😕 t-line.

ENDLOOP.

regards,

amit m.

5 REPLIES 5

Former Member
0 Kudos
69

Hi narendiran,

1. Very simple.

Just as u want !

2. just copy paste in new program

REPORT abc.

TYPES: BEGIN OF t_type,

line(72),

END OF t_type.

PARAMETERS : program LIKE sy-repid .

data : begin of t occurs 0,

line(72) type c,

end of t.

*----


READ REPORT program INTO t.

*----


LOOP AT t.

WRITE 😕 t-line.

ENDLOOP.

regards,

amit m.

0 Kudos
68

hi amit

thanks for the info but why the length of the field is 72 is there a special reason to define so, plz tell me.

0 Kudos
68

(already replied to your new post)

Hi narendiran,

1. The reason is,

that SAP ABAP Editor

allows 72 characters per line.

(however, it also allows

over riding this limit)

2. But all SAP Standard programs,

follow this rule of 72 lines.

3. Hence, 72 in the field size,

We can take more, no problem !

like this :

REPORT abc.

TYPES: BEGIN OF t_type,

line(100),

END OF t_type.

PARAMETERS : program LIKE sy-repid .

data : begin of t occurs 0,

line(72) type c,

end of t.

*----


READ REPORT program INTO t.

*----


LOOP AT t.

WRITE 😕 t-line.

ENDLOOP.

regards,

amit m.

0 Kudos
68

Hi Narendra,

The length of the field can be anything say 100 or even 200. It is advisable to keep the length of the field to be equal or more than the total lines of the program, whose contents you want to display.

For testing purpose, you just copy this code and run it :

REPORT ZKUN_GETLINESOFPRG .

PARAMETERS : program LIKE sy-repid .

data : begin of t occurs 0,

line(200),

end of t.

*----


<b>READ REPORT program INTO t.</b>

if sy-subrc <> 0.

message i006(zmsg_kunal).

else.

*----


LOOP AT t.

WRITE 😕 t-line.

ENDLOOP.

endif.

Thanks and Regards,

Kunal.

(if you feel the query is solved do reward the points).

former_member188685
Active Contributor
0 Kudos
68

Hi,

You need to use READ REPORT ,

<b>READ REPORT prog INTO itab.</b>

now loop at itab

write the program lines to report display.

Regards

Vjay