Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP SCRIPT---perform statement in script.

Former Member
0 Likes
2,089

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?

7 REPLIES 7
Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
1,193

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

Read only

nablan_umar
Product and Topic Expert
Product and Topic Expert
0 Likes
1,193

I don't see it cause any problem passing multiple USING and CHANGING parameters from SAPSCRIPT.

Read only

Former Member
0 Likes
1,193

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

Read only

0 Likes
1,193

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?

Read only

0 Likes
1,193

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.

Read only

0 Likes
1,193

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

Read only

Former Member
0 Likes
1,193

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.