Wednesday 15 June 2016

Include



  • Include programs allow us to manage complex programs in an orderly way.
  • These are sub-programs which contains a set of re-usable statements .
  • These programs can not be executed directly.
  • These include programs must be embedded inside a main program for execution.
  • These programs does not contain parameter interface, that is no importing and exporting parameters.
  • Syntax :
              INCLUDE  Z or Y<Include name>.

Ex:


Steps

  • Go to Transaction Code SE38.

  • Enter the include name , Starts with Y or Z<include name> and click on create button.


  • Enter the Title and Select the Attribute type as INCLUDE program  and Click on save.

  • Save it in either Local package or Package.
  • Source Code
TYPES BEGIN OF TY_VBRK,
        VBELN TYPE VBRK-VBELN,
        VKORG TYPE VBRK-VKORG,
        NETWR TYPE VBRK-NETWR,
       END OF TY_VBRK.


DATA WA_VBRK TYPE TY_VBRK,
      IT_VBRK TYPE TABLE OF TY_VBRK.


SELECT-OPTIONS S_VBELN FOR WA_VBRK-VBELN.


  • Save -> Check -> Activate.
  • Click on Execute.


Note : Include  programs can not be executed directly. Include programs must be embedded inside a main program for execution.

  • To create executable program . Go to Transaction code SE38.
  • Enter the program name , starts with Y or Z<program name > and click on create.

  • Enter the Title and select Attribute type as Executable program  and click on save.
  •  Save -> Check -> Activate .
  • Execute.

Note : Nested include's are possible.

  • Double click on ZTSD_INCLUDE1.








  • Create one more include.




  • Click on Yes.


  • Click on Save.

  • Save it either Package or Local Package.


  • Source Code

SELECT VBELN VKORG NETWR FROM VBRK INTO TABLE IT_VBRK WHERE VBELN IN
S_VBELN.


  • Save->Check->Activate.

  • Click on Back Button.

  • Save ->Check->Activate.


  • Click on Back Button.


  • Create one more include for display output.
  • Double click on ZTSD_DISPLAY include and click on YES.


  • Click on Yes.

  • Click on Save Button.

  • Source Code
LOOP AT IT_VBRK INTO WA_VBRK.

  WRITE / WA_VBRK-VBELN WA_VBRK-VKORG WA_VBRK-NETWR.

ENDLOOP.


  • Save -> Check ->Activate.

  • Click on Back button.


  • Save -> Check -> Activate.

  • Execute.

Input



Output



                    more information............


No comments:

Post a Comment