PERFORM <SUBROUTINE NAME> USING <AV1> <AV2>
CHANGING <CHANGING1> <CHANGING2>
TABLES <TABLE1> <TABLE2>.
FORM <SUBROUTINE NAME > USING <FV1> <FV2>
CHANGING <CHANGING1> <CHANGING2>
TABLES <TABLE1> <TABLE2>.
ENDFORM.
- In the above syntax <av1> and <av2> are actual parameters and <fv1> <fv2> are formal parameters.
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.
- Either save it in Package or Local Package.
- 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 USING P_VBELN CHANGING IT_VBRP.
PERFORM DISPLAY TABLES IT_VBRP USING WA_VBRP .
*&---------------------------------------------------------------------*
*& Form FETCH_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_VBELN text
* <--P_IT_VBRP text
*----------------------------------------------------------------------*
form FETCH_DATA using p_p_vbeln
changing p_it_vbrp TYPE ANY TABLE.
SELECT VBELN POSNR MATNR ARKTX FROM VBRP INTO TABLE p_it_vbrp
WHERE VBELN = p_p_vbeln.
endform. " FETCH_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_IT_VBRP text
* -->P_WA_VBRP text
*----------------------------------------------------------------------*
form DISPLAY tables p_it_vbrp TYPE STANDARD TABLE
"Insert correct name for <...>
using p_wa_vbrp like wa_vbrp.
WRITE : / p_wa_vbrp-vbeln , p_wa_vbrp-posnr , p_wa_vbrp-matnr ,
p_wa_vbrp-arktx , p_wa_vbrp-netwr.
ENDLOOP.
endform. " DISPLAY
No comments:
Post a Comment