Thursday 30 June 2016

External Subroutine with passing parameters

  • Defining Subroutine
                PERFORM <SUBROUTINE NAME> IN PROGRAM <program name>
                                                            USING <AV1> <AV2>
                                                            CHANGING <CHANGING1> <CHANGING2>
                                                             TABLES <TABLE1> <TABLE2>.
                    
                                              or

                PERFORM <SUBROUTINE NAME> (program name)
                                                            USING <AV1> <AV2>
                                                            CHANGING <CHANGING1> <CHANGING2>
                                                            TABLES <TABLE1> <TABLE2>.
Ex:



Steps

  • Go to transaction Code SE38.
  • Enter the program name start's with Y or Z<program name > and click on create button.
  • Enter the Title.
  • Select Attribute Type as Executable Program.
  • Click on save button.


   


  • Source Code:
types begin of ty_vbrp,
        vbeln type vbrp-vbeln,
        posnr type vbrp-posnr,
        matnr type vbrp-matnr,
        arktx type vbrp-arktx,
        netwr type vbrp-netwr,
       end of ty_vbrp.

data wa_vbrp type ty_vbrp,
       it_vbrp type table of ty_vbrp.

parameters p_vbeln type vbrp-vbeln.

perform fetch_data  IN PROGRAM ZSUB_INT_PASS_PARM
                 using p_vbeln changing it_vbrp.
perform display(ZSUB_INT_PASS_PARMtables it_vbrp using wa_vbrp .



  • Save -> Check -> Activate.
  • Click on Execute ( F8).


Input






Output




No comments:

Post a Comment