‎2004 Oct 04 9:20 PM
Hi team,
can we have any sap sapcript perform statement like this
perform sub_some_routine in zprogram using variable1 changing variable2 changing variable3 changing variable4.
till now i have used only one variable for using and changing..
is there anyway to pass more than one variable to a subroutine in a program or to a subroutine pool from SAP SCRIPT?
‎2004 Oct 04 9:23 PM
Hi Puppala
I do not know in SAPScript context but normally, the syntax is like this for more than one variable:
PERFORM my_form IN PROGRAM zprogram
USING ip_par1 ip_par2 ...
CHANGING ep_par1 ep_par2 ... .
*--Serdar
‎2004 Oct 04 9:40 PM
I don't see it cause any problem passing multiple USING and CHANGING parameters from SAPSCRIPT.
‎2004 Oct 05 5:42 AM
Hi,
You got it right. To pass multiple variables to your program, you need to issue multiple changing/using statements. However, if you intend to pass data back and forth, your subroutine in the program must be of the format <b>FORM <name of routine> TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.</b>
These tables are used as an interface between your sapscript form and your program subroutine.
Regards
‎2004 Oct 05 9:31 AM
Hi,
u guys have not answered my query ..
i am asking u guys if u have ever worked on that syntax.
standard SAP provides syntax with only two varibales..
let me check it and i will try to find it out.. in the mean time can any one give a try to it?
‎2004 Oct 05 10:00 AM
Hi Abaper 007,
The syntax in Sapscript is somewhat different from "normal" abap. Following your example it should be:
/: perform sub_some_routine in zprogram
/: using variable1
/: changing variable2
/: changing variable3
/: changing variable4.
Regards,
John.
‎2004 Oct 05 2:01 PM
Hi abaper 007,
This is exactly what I meant when I said that "You got it right. To pass multiple variables to your program, you need to issue multiple changing/using statements". You had the syntax right. I believe that Michael Bauer's response is quite comprehensive but if you are asking the question in some other context, please explain it a bit more.
Regards
‎2004 Oct 05 1:13 PM
Hi,
here is an example. how to call it from
sapscript and how to react within the report:
/: DEFINE &PARAM1& = &SPACE&
/: DEFINE &PARAM2& = &SPACE&
/: DEFINE &PARAM3& = &SPACE&
/: DEFINE &PARAM4& = &SPACE&
/: DEFINE &PARAM5& = &SPACE&
/: DEFINE &PARAM6& = &SPACE&
/: DEFINE &PARAM7& = &SPACE&
/: DEFINE &PARAM8& = &SPACE&
/: DEFINE &SATZA& = 'Z'
/*
/: PERFORM GET_OBJEKT IN PROGRAM ZMFMCAL2
/: USING &AM07M-KONTIERUNG&
/: USING &MSEG-MBLNR&
/: USING &SATZA&
/: CHANGING &PARAM1&
/: CHANGING &PARAM2&
/: CHANGING &PARAM3&
/: CHANGING &PARAM4&
/: CHANGING &PARAM5&
/: CHANGING &PARAM6&
/: CHANGING &PARAM7&
/: CHANGING &PARAM8&
*:--- ABAP-CODE in ZMFMCAL2
FORM GET_OBJEKT TABLES T_INPUT STRUCTURE ITCSY
T_OUTPUT STRUCTURE ITCSY.
read table t_input index 1.
if sy-subrc = 0.
*:--- reading &AM07M-KONTIERUNG&
*:--- In t_input-value You will find the value of the 1. variable.
move t_input-value to ls_xxxx.
endif.
read table t_input index 2.
if sy-subrc = 0.
...
...
and so on
If You want to change a Value do the similar but with the output-table .
read table t_output index 1 (for the first variable)
move 'xxxx' to t_output-value.
modify t_output index 1.
Thats it!
hope i could help You
BR
Michael
ENDFORM.