<?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 Why my include Program is not working? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211581#M1982874</link>
    <description>&lt;P&gt;I am new to Include Programs. I have added them in my main program. The code of main program and Include programs is shown below. I have used Global Structures (zabap_vbrk) and Table Type (zabap_tb_vbrp):&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;REPORT z_abap_practice_1.

INCLUDE ZABAP_INCLUDE_TOP.

PERFORM get_data.

CALL FUNCTION 'ZABAP_DEMO_FM'
 EXPORTING
    im_vbeln = p_vbeln
 IMPORTING
   EX_VBRK = st_vbrk
   EX_IT_VBRP = it_vbrp
 EXCEPTIONS
   INVALID_DOCUMENT       = 1
   INVALID_CUSTOMER       = 2
   OTHERS                 = 3
          .
IF sy-subrc &amp;lt;&amp;gt; 0.
* Implement suitable error handling here
  IF sy-subrc Eq 1.
  MESSAGE 'Invalid Document' TYPE 'E'.
  ENDIF.
ENDIF.



WRITE : / 'Billing Document : ',25 st_vbrk-vbeln,
        / 'Billing Date : ',25 st_vbrk-fkdat,
        / 'Net Value ; ',25 st_vbrk-netwr LEFT-JUSTIFIED,
        / 'Payer : ',25 st_vbrk-kunrg.

SKIP.

WRITE : / 'Item',
       15 'Material No.',
       30 'Description',
       55 'Quantity',
       67 'UoM',
       75 'Tax Amount'.

LOOP AT it_vbrp INTO wa_vbrp.

  WRITE : / wa_vbrp-posnr,
          15 wa_vbrp-matnr,
          30 wa_vbrp-arktx,
          55 wa_vbrp-fkimg LEFT-JUSTIFIED,
          67 wa_vbrp-vrkme,
          75 wa_vbrp-mwsbp LEFT-JUSTIFIED.
ENDLOOP.

INCLUDE zabap_include_sub.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;  Include           ZABAP_INCLUDE_TOP
*&amp;amp;---------------------------------------------------------------------*

DATA : st_vbrk TYPE zabap_vbrk,
       it_vbrp TYPE zabap_tb_vbrp,
       wa_vbrp LIKE LINE OF it_vbrp,
       it_makt TYPE STANDARD TABLE OF makt.

PARAMETERS p_vbeln TYPE vbeln_vf.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;*----------------------------------------------------------------------*
***INCLUDE ZABAP_INCLUDE_SUB.
*----------------------------------------------------------------------*
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  GET_DATA
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM get_data.
SELECT * FROM makt INTO TABLE it_makt WHERE matnr EQ p_matnr.
ENDFORM.                    " GET_DATA&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;FUNCTION ZABAP_DEMO_FM.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(IM_VBELN) TYPE  VBELN_VF
*"  EXPORTING
*"     REFERENCE(EX_VBRK) TYPE  ZABAP_VBRK
*"     REFERENCE(EX_IT_VBRP) TYPE  ZABAP_TB_VBRP
*"  EXCEPTIONS
*"      INVALID_DOCUMENT
*"      INVALID_CUSTOMER
*"----------------------------------------------------------------------
*Fetch Billing Document Header Data.
  SELECT SINGLE
              vbeln
              fkdat
              netwr
              kunrg
                   FROM vbrk
                   INTO EX_VBRK
                   WHERE vbeln EQ IM_VBELN.

  IF sy-subrc IS NOT INITIAL.
      RAISE INVALID_DOCUMENT.
  ENDIF.

*Fetch Billing Document Item Data.
  SELECT vbeln posnr fkimg vrkme matnr arktx mwsbp FROM vbrp
                                                   INTO TABLE EX_IT_VBRP
                                                   WHERE vbeln EQ IM_VBELN.




ENDFUNCTION.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;When I check ZABAP_INCLUDE_TOP for syntax error it gives following error :&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1817707-error1.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;Why this error is coming when program type is Include?&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2020 06:49:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2020-06-10T06:49:33Z</dc:date>
    <item>
      <title>Why my include Program is not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211581#M1982874</link>
      <description>&lt;P&gt;I am new to Include Programs. I have added them in my main program. The code of main program and Include programs is shown below. I have used Global Structures (zabap_vbrk) and Table Type (zabap_tb_vbrp):&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;REPORT z_abap_practice_1.

INCLUDE ZABAP_INCLUDE_TOP.

PERFORM get_data.

CALL FUNCTION 'ZABAP_DEMO_FM'
 EXPORTING
    im_vbeln = p_vbeln
 IMPORTING
   EX_VBRK = st_vbrk
   EX_IT_VBRP = it_vbrp
 EXCEPTIONS
   INVALID_DOCUMENT       = 1
   INVALID_CUSTOMER       = 2
   OTHERS                 = 3
          .
IF sy-subrc &amp;lt;&amp;gt; 0.
* Implement suitable error handling here
  IF sy-subrc Eq 1.
  MESSAGE 'Invalid Document' TYPE 'E'.
  ENDIF.
ENDIF.



WRITE : / 'Billing Document : ',25 st_vbrk-vbeln,
        / 'Billing Date : ',25 st_vbrk-fkdat,
        / 'Net Value ; ',25 st_vbrk-netwr LEFT-JUSTIFIED,
        / 'Payer : ',25 st_vbrk-kunrg.

SKIP.

WRITE : / 'Item',
       15 'Material No.',
       30 'Description',
       55 'Quantity',
       67 'UoM',
       75 'Tax Amount'.

LOOP AT it_vbrp INTO wa_vbrp.

  WRITE : / wa_vbrp-posnr,
          15 wa_vbrp-matnr,
          30 wa_vbrp-arktx,
          55 wa_vbrp-fkimg LEFT-JUSTIFIED,
          67 wa_vbrp-vrkme,
          75 wa_vbrp-mwsbp LEFT-JUSTIFIED.
ENDLOOP.

INCLUDE zabap_include_sub.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;  Include           ZABAP_INCLUDE_TOP
*&amp;amp;---------------------------------------------------------------------*

DATA : st_vbrk TYPE zabap_vbrk,
       it_vbrp TYPE zabap_tb_vbrp,
       wa_vbrp LIKE LINE OF it_vbrp,
       it_makt TYPE STANDARD TABLE OF makt.

PARAMETERS p_vbeln TYPE vbeln_vf.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;*----------------------------------------------------------------------*
***INCLUDE ZABAP_INCLUDE_SUB.
*----------------------------------------------------------------------*
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  GET_DATA
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM get_data.
SELECT * FROM makt INTO TABLE it_makt WHERE matnr EQ p_matnr.
ENDFORM.                    " GET_DATA&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;FUNCTION ZABAP_DEMO_FM.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(IM_VBELN) TYPE  VBELN_VF
*"  EXPORTING
*"     REFERENCE(EX_VBRK) TYPE  ZABAP_VBRK
*"     REFERENCE(EX_IT_VBRP) TYPE  ZABAP_TB_VBRP
*"  EXCEPTIONS
*"      INVALID_DOCUMENT
*"      INVALID_CUSTOMER
*"----------------------------------------------------------------------
*Fetch Billing Document Header Data.
  SELECT SINGLE
              vbeln
              fkdat
              netwr
              kunrg
                   FROM vbrk
                   INTO EX_VBRK
                   WHERE vbeln EQ IM_VBELN.

  IF sy-subrc IS NOT INITIAL.
      RAISE INVALID_DOCUMENT.
  ENDIF.

*Fetch Billing Document Item Data.
  SELECT vbeln posnr fkimg vrkme matnr arktx mwsbp FROM vbrp
                                                   INTO TABLE EX_IT_VBRP
                                                   WHERE vbeln EQ IM_VBELN.




ENDFUNCTION.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;When I check ZABAP_INCLUDE_TOP for syntax error it gives following error :&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1817707-error1.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;Why this error is coming when program type is Include?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 06:49:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211581#M1982874</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-06-10T06:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why my include Program is not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211582#M1982875</link>
      <description>&lt;P&gt;hello, &lt;/P&gt;&lt;P&gt;Try activating the main program on SE80, doing a right click on the report z_abap_practice_1. &lt;/P&gt;&lt;P&gt;One advice for better code readability, put all your includes at the top of your report. &lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Deenesh&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 07:14:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211582#M1982875</guid>
      <dc:creator>r010101010</dc:creator>
      <dc:date>2020-06-10T07:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why my include Program is not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211583#M1982876</link>
      <description>&lt;P&gt;Do not make syntax check only for include - activate all reports with include and then system can check the syntax - it must know the whole report code you write it in that way (no classes, no Subroutine Pool ).&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 07:24:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211583#M1982876</guid>
      <dc:creator>MarekTurczynski</dc:creator>
      <dc:date>2020-06-10T07:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why my include Program is not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211584#M1982877</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;The sequence of include you have to put together.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT z_abap_practice_1.

INCLUDE ZABAP_INCLUDE_TOP.
INCLUDE zabap_include_sub.

PERFORM get_data.
....
....

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Secondly,&lt;/P&gt;&lt;P&gt;You need to activate all together.  Using SE80, and right click on the your report name at left panel z_abap_practice_1.  --  and activate&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 08:09:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211584#M1982877</guid>
      <dc:creator>venkateswaran_k</dc:creator>
      <dc:date>2020-06-10T08:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why my include Program is not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211585#M1982878</link>
      <description>&lt;OL&gt;
&lt;LI&gt;A syntax check on an include doesnt work, if the context of the programm is not known.&lt;BR /&gt;The syntax check has to be performed on e.g. an executable report that uses the include. In your case this would be your REPORT z_abap_practice_1.&lt;/LI&gt;&lt;LI&gt;You try to use "PERFORM get_data" in your main report before the INCLUDE zabap_include_sub is defined where the get_data form is stored. Includes need to be included where they are required. In your case, the include has to be included at least before the first form is called. And since your Include only contains a form, you would include it at the top after REPORT and other INCLUDEs. The order of the included INCLUDES depends on whether one include might have to access e.g. data or forms from other Includes. In your case, it would suffice to do it like Venkat already mentionend:&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT z_abap_practice_1.
INCLUDE ZABAP_INCLUDE_TOP.
INCLUDE zabap_include_sub. " this includes 'FORM get_data.' 
                           " it has to be declared before the 'PERFORM get_data.' is called !

PERFORM get_data.
" ...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2020 08:32:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211585#M1982878</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-06-10T08:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why my include Program is not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211586#M1982879</link>
      <description>&lt;P&gt;I tried to activate through SE80 but it gives error that following statement is not accessible.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PERFORM get_data.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jun 2020 08:28:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211586#M1982879</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-06-11T08:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why my include Program is not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211587#M1982880</link>
      <description>&lt;P&gt;I tried to activate through SE80 but it gives error that following statement is not accessible.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PERFORM get_data.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jun 2020 08:32:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211587#M1982880</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-06-11T08:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why my include Program is not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211588#M1982881</link>
      <description>&lt;SPAN class="mention-scrubbed"&gt;harbindersingh&lt;/SPAN&gt;, as mentionend in my answer as well as in Venkat's, did you move the "INCLUDE ZABAP_INCLUDE_SUB." statement from the bottom of your report to the top of the report after the "INCLUDE ZABAP_INCLUDE_TOP." statement and before the "PERFORM GET_DATA." statement?</description>
      <pubDate>Thu, 11 Jun 2020 11:52:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211588#M1982881</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-06-11T11:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why my include Program is not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211589#M1982882</link>
      <description>&lt;P&gt;Yes I did but still error is coming.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT z_abap_practice_1.

INCLUDE ZABAP_INCLUDE_TOP.
INCLUDE ZABAP_INCLUDE_SUB.

PERFORM get_data.

CALL FUNCTION 'ZABAP_DEMO_FM'
 EXPORTING
    im_vbeln = p_vbeln
 IMPORTING
   EX_VBRK = st_vbrk
   EX_IT_VBRP = it_vbrp
 EXCEPTIONS
   INVALID_DOCUMENT       = 1
   INVALID_CUSTOMER       = 2
   OTHERS                 = 3
          .
IF sy-subrc &amp;lt;&amp;gt; 0.
* Implement suitable error handling here
  IF sy-subrc Eq 1.
  MESSAGE 'Invalid Document' TYPE 'E'.
  ENDIF.
ENDIF.



WRITE : / 'Billing Document : ',25 st_vbrk-vbeln,
        / 'Billing Date : ',25 st_vbrk-fkdat,
        / 'Net Value ; ',25 st_vbrk-netwr LEFT-JUSTIFIED,
        / 'Payer : ',25 st_vbrk-kunrg.

SKIP.

WRITE : / 'Item',
       15 'Material No.',
       30 'Description',
       55 'Quantity',
       67 'UoM',
       75 'Tax Amount'.

LOOP AT it_vbrp INTO wa_vbrp.

  WRITE : / wa_vbrp-posnr,
          15 wa_vbrp-matnr,
          30 wa_vbrp-arktx,
          55 wa_vbrp-fkimg LEFT-JUSTIFIED,
          67 wa_vbrp-vrkme,
          75 wa_vbrp-mwsbp LEFT-JUSTIFIED.
ENDLOOP.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It is giving syntax error that the PERFORM statement is not accessible. &lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 07:44:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211589#M1982882</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-06-12T07:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why my include Program is not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211590#M1982883</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/users/1000936/harbindersingh.html"&gt;H S&lt;/A&gt;, it seems there is more coding missing. Where is p_matnr defined? If I include p_matnr along with p_vbeln in the Top-Include, all you have to do, is set the right report event.&lt;/P&gt;&lt;P&gt;Please have a look into event blocks and especially reporting events:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenevent_blocks.htm"&gt;https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenevent_blocks.htm&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenabap_processing_blocks.htm"&gt;https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenabap_processing_blocks.htm&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;So in conclusion, use the event START-OF-SELECTION to run your report after the selection screen:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT z_abap_practice_1.

INCLUDE zabap_include_top.  " contains parameters, therefore report starts with a selection screen
INCLUDE zabap_include_sub.

START-OF-SELECTION. " necessary event to start the process when the report is executed from the selection screen

  PERFORM get_data.
  " ...
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Jun 2020 08:53:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-my-include-program-is-not-working/m-p/12211590#M1982883</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-06-12T08:53:47Z</dc:date>
    </item>
  </channel>
</rss>

