‎2008 May 06 11:48 AM
‎2008 May 06 11:51 AM
Hi Ashutosh,
Refer to the following link:
http://sapdev.co.uk/sapscript/sapscript_executeabap.htm
Hope this helps.
Reward if helpful.
Regards,
Sipra
‎2008 May 06 12:32 PM
Hi,
Please find below the code snippet for your reference
Code Snippet
In Script (SE71), you can include the perform in the given way
/: DEFINE &G_NAME1& = ' '
/: DEFINE &G_STCEG& = ' '
/: DEFINE &G_ADRNR& = ' '
/: PERFORM GET_COMPANY_DETAILS IN PROGRAM Y_REQ_DATE_GI_LAYOUT
/: USING &MSEG-BUKRS&
/: CHANGING &G_NAME1&
/: CHANGING &G_STCEG&
/: CHANGING &G_ADRNR&
/: ENDPERFORM
L3 &G_NAME1&
/: IF &G_STCEG& NE ' '.
L2 ABN NUMBER : &G_STCEG&
/: ENDIF
In program Y_REQ_DATE_GI_LAYOUT (SE38) you can write the subroutine corresponding to the above Perform (This is called driver program for the script)
&----
*& Form GET_COMPANY_DETAILS
&----
Get the company code description and ABN value
----
--> TBL_INPUT
<-- TBL_OUTPUT
----
FORM get_company_details TABLES tbl_input STRUCTURE itcsy
tbl_output STRUCTURE itcsy.
DATA:
l_name1 TYPE ad_name1,
l_bukrs TYPE bukrs,
l_adrnr TYPE adrnr,
l_stceg TYPE stceg,
l_region TYPE regio,
l_land1 TYPE land1.
CLEAR tbl_input.
Get the company code*
READ TABLE tbl_input WITH KEY 'MSEG-BUKRS'.
l_bukrs = tbl_input-value.
Get the ADRNR And STCEG valueS from T001*
SELECT SINGLE adrnr stceg land1
INTO (l_adrnr, l_stceg, l_land1)
FROM t001
WHERE bukrs = l_bukrs.
Get the company code description*
SELECT SINGLE name1 region
INTO (l_name1, l_region)
FROM adrc
WHERE addrnumber = l_adrnr.
IF sy-subrc EQ 0.
LOOP AT tbl_output.
CASE tbl_output-name.
WHEN 'G_NAME1'.
MOVE l_name1 TO tbl_output-value.
MODIFY tbl_output.
WHEN 'G_STCEG'.
MOVE l_stceg TO tbl_output-value.
MODIFY tbl_output.
WHEN 'G_ADRNR'.
MOVE l_adrnr TO tbl_output-value.
MODIFY tbl_output.
WHEN 'G_REGION'.
MOVE l_region TO tbl_output-value.
MODIFY tbl_output.
ENDCASE.
ENDLOOP.
ENDIF.
ENDFORM. "get_company_details
The Perform in the script will call this report while execution.
Hope this helps you.
Regards,
Farheen.
‎2008 May 06 12:41 PM
Hi Ashutosh,
Someone has given your answer in essay mode.
I think you have learn how to use Performs in scripts.
Any way if you persist any problem please revert we experts are here to answer you.
Anyhow thanks for the patience of Fatima who has given your answer in short.
dont forget to reward her.
thanks
abdul.
‎2008 May 06 12:45 PM
Hi,
Refer the following links:
http://help.sap.com/saphelp_46c/helpdata/EN/d1/803279454211d189710000e8322d00/content.htm
http://www.sap-basis-abap.com/abap/how-to-call-a-subroutine-form-sapscripts.htm
Regards,
Kiran Sure