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: 

Function Module that it brings all the lines of a program code.

Former Member
0 Kudos

Hi everyone, please, i´am looking for a function module that it brings all the lines of a program code, this lines could be in an internal table. Do you know some FM ?.

5 REPLIES 5

suresh_datti
Active Contributor
0 Kudos

Hi Rafael,

You can use 'RS_DETERMINE_OBJECT_SOURCE'.

Regards,

Suresh Datti

Former Member
0 Kudos

Hi Rafael,

Did you try READ REPORT and READ TEXTPOOL options.

Cheers

VJ

former_member927251
Active Contributor
0 Kudos

Hi Rafael,

This is from ABAP Help.


READ - Read a program 


Basic form 
READ REPORT prog INTO itab. 



Addition: 
1. ... STATE state 2. ... MAXIMUM WIDTH INTO w 



Effect 
Reads the program prog from the database into the internal table itab. The line length of table itab should be at least 72 characters. 


The Return Code is set as follows: 


SY-SUBRC = 0: 
Program was read. 
SY-SUBRC = 4: 
Program could not be read because it does not exist. 
SY-SUBRC = 8: 
Program could not be read because it is a security-critical system program and therefore protected against read access. 


Example
TYPES: BEGIN OF T_TYPE, 
         LINE(72), 
       END OF T_TYPE. 
DATA: PROGRAM LIKE SY-REPID VALUE 'PROGNAME', 
      T TYPE STANDARD TABLE OF T_TYPE WITH 
             NON-UNIQUE DEFAULT KEY INITIAL SIZE 500. 

READ REPORT PROGRAM INTO T. 
IF SY-SUBRC <> 0. 
  ... 
ENDIF. 



Addition 
... STATE state 


Note 
This addition is intended for internal use. SAP reserves the right to make changes, which may be incompatible, at any time. 



Effect 
Programs can be saved in the library in their "active" or "inactive" form. This addition determines which state of the program 'prog' should be read. state may have the values A for active, or I for inactive. Inactive programs are only visible to the user currently working with them. All other users work with the active version of the program. 



In the ABAP Workbench, you can define a list of objects being edited by each user. These programs are saved in their inactive form until they are activated. If you omit the STATE addition, the system automatically reads the inactive form of these programs, and the active form of all other programs. 

Since this set of programs is only ever available at short notice within the ABAP Workbench, you can always be sure that other programs using the READ REPORT statement without the STATE addtion will always read "active" reports. 



Addition 2 
... MAXIMUM WIDTH INTO w 


Effect 
After the program has been read successfully from the library, w is filled with the length of the longest line of the source text, in characters. 



Exceptions 
Non-Catchable Exceptions 



Cause: state has another value than A or I. 
Runtime Error: INSERT_REPORT_ILLEGAL_STATE 

Cause: At least one line of the source text is longer than the lines of the internal table itab. 
Runtime Error: READ_REPORT_LINE_TOO_LONG 

<b>

Reward points if it helps.</b>

Regards,

Amit Mishra

Former Member
0 Kudos

Hi,

Check out the program 'RPR_ABAP_SOURCE_SCAN'.

and the FM: 'SCWB_GET_ABAP_CODE_OF_OBJECT'

rgds,

latheesh

0 Kudos

use

'RS_DETERMINE_OBJECT_SOURCE'

Plz reward points and close the therad

gunjan