Search on this Website

Sunday, October 21, 2007

Sample ABAP Code - How to Call PERFORM from SAPSCRIPT

/: PERFORM BIN_LOCATION IN PROGRAM Z_SAPSCRIPT_PERFORMS
/: USING &RESBD-MATNR&

/: USING &CAUFVD-IWERK&

/: USING &RESBD-LGORT&

/: CHANGING &MARD-LGPBE&

/: ENDPERFORM



------------------------------------------------------------------------------------------------------------------

REPORT z_sapscript_performs.

*----------------------------------------------------------------------

* SUBROUTINES FOR CALLING FROM SAPSCRIPTS

*-----------------------------------------------------------------------

* AUTHOR: Sheila Titchener -

* DATE: September 2005

*

*-----------------------------------------------------------------------

FORM bin_location TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

*-----------------------------------------------------------------------

* get default bin location from MARD for this material/plant/storage *

* location

*-----------------------------------------------------------------------


DATA: l_matnr TYPE matnr, "material

l_werks TYPE werks, "plant

l_lgort TYPE lgort, "storage location

l_lgpbe TYPE lgpbe. "bin location


* Get first parameter in input table.

READ TABLE in_tab INDEX 1.

WRITE in_tab-value TO l_matnr .

* Get second parameter in input table

READ TABLE in_tab INDEX 2.

MOVE in_tab-value TO l_werks.

* Get third parameter in input table

READ TABLE in_tab INDEX 3.

MOVE in_tab-value TO l_lgort.

* read bin location

SELECT SINGLE lgpbe INTO l_lgpbe FROM mard

WHERE matnr = l_matnr

AND werks = l_werks

AND lgort = l_lgort.


IF l_LGPBE IS INITIAL.

l_LGPBE = 'NONE'.

ENDIF.


* read & update only parameter in output table

READ TABLE out_tab INDEX 1.

out_tab-value = l_lgpbe.

MODIFY out_tab INDEX 1.


ENDFORM.


Other Related Link :

Learn SAP Script Online and get Sap Script Code

No comments: