<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Read Source Codes in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-source-codes/m-p/6772411#M1463377</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: V_PNAME TYPE PNAME,
      V_INCL TYPE INCLUDENR,
      V_REPID TYPE SY-REPID,
      ITAB TYPE TABLE OF STRING,
      WA TYPE STRING.

PARAMETERS: P_FNAME LIKE TFDIR-FUNCNAME.

SELECT SINGLE PNAME INCLUDE
  INTO (V_PNAME,V_INCL)
  FROM TFDIR
  WHERE FUNCNAME = P_FNAME.

IF SY-SUBRC = 0.
  CONCATENATE V_PNAME 'U' V_INCL INTO V_REPID.
  V_REPID = V_REPID+3.
ENDIF.

TRY.
    READ REPORT V_REPID INTO ITAB.
  CATCH CX_SY_READ_SRC_LINE_TOO_LONG .
ENDTRY.

IF SY-SUBRC = 0.
  WRITE: 'Report is read. Hurray !!!'.

  LOOP AT ITAB INTO WA.

    WRITE / WA.

  ENDLOOP.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why did i concatenate 'U' to the variable V_REPID &amp;amp; remove the first 3 characters (which were 'SAP') before using READ REPORT ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. For using READ REPORT on include programs SAP says:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;To use the READ REPORT statement for programs that are organized in framework programs and Include programs when created in the ABAP Workbench, you need to know exactly how the programs are structured as well as their names. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The names of the framework programs for class pools and function group do not match the names of the global class and function group (see CLASS-POOL and FUNCTION-POOL statements). &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. On how the include programs are arranged in a function group read this : [http://help.sap.com/abapdocu_70/en/ABAPFUNCTION-POOL.htm|http://help.sap.com/abapdocu_70/en/ABAPFUNCTION-POOL.htm]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Mar 2010 03:59:59 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2010-03-30T03:59:59Z</dc:date>
    <item>
      <title>Read Source Codes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-source-codes/m-p/6772408#M1463374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as we know, to read a program''s source, we use the statement READ REPORT .....&lt;/P&gt;&lt;P&gt;now my question is, how about on function modules?&lt;/P&gt;&lt;P&gt;how do i read a function module's source code?  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Mar 2010 03:20:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-source-codes/m-p/6772408#M1463374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-30T03:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Read Source Codes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-source-codes/m-p/6772409#M1463375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Every function module has attached to a include in the function group, try to read that include source code, if you need to get the source of a function module. Its just a idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Mar 2010 03:40:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-source-codes/m-p/6772409#M1463375</guid>
      <dc:creator>praveen_hannu</dc:creator>
      <dc:date>2010-03-30T03:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Read Source Codes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-source-codes/m-p/6772410#M1463376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi praveen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;nice idea, would you know if all function module include programs start with L all the time? even customized FMs?&lt;/P&gt;&lt;P&gt;and will no other types of programs uses L as the beginning letter?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Mar 2010 03:46:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-source-codes/m-p/6772410#M1463376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-30T03:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Read Source Codes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-source-codes/m-p/6772411#M1463377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: V_PNAME TYPE PNAME,
      V_INCL TYPE INCLUDENR,
      V_REPID TYPE SY-REPID,
      ITAB TYPE TABLE OF STRING,
      WA TYPE STRING.

PARAMETERS: P_FNAME LIKE TFDIR-FUNCNAME.

SELECT SINGLE PNAME INCLUDE
  INTO (V_PNAME,V_INCL)
  FROM TFDIR
  WHERE FUNCNAME = P_FNAME.

IF SY-SUBRC = 0.
  CONCATENATE V_PNAME 'U' V_INCL INTO V_REPID.
  V_REPID = V_REPID+3.
ENDIF.

TRY.
    READ REPORT V_REPID INTO ITAB.
  CATCH CX_SY_READ_SRC_LINE_TOO_LONG .
ENDTRY.

IF SY-SUBRC = 0.
  WRITE: 'Report is read. Hurray !!!'.

  LOOP AT ITAB INTO WA.

    WRITE / WA.

  ENDLOOP.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why did i concatenate 'U' to the variable V_REPID &amp;amp; remove the first 3 characters (which were 'SAP') before using READ REPORT ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. For using READ REPORT on include programs SAP says:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;To use the READ REPORT statement for programs that are organized in framework programs and Include programs when created in the ABAP Workbench, you need to know exactly how the programs are structured as well as their names. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The names of the framework programs for class pools and function group do not match the names of the global class and function group (see CLASS-POOL and FUNCTION-POOL statements). &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. On how the include programs are arranged in a function group read this : [http://help.sap.com/abapdocu_70/en/ABAPFUNCTION-POOL.htm|http://help.sap.com/abapdocu_70/en/ABAPFUNCTION-POOL.htm]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Mar 2010 03:59:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-source-codes/m-p/6772411#M1463377</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-03-30T03:59:59Z</dc:date>
    </item>
  </channel>
</rss>

