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

scripts

Former Member
0 Likes
827

how to call subroutines in scripts

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
808

Hello,

Check this.


PERFORM <form> IN PROGRAM <prog> 
/: USING &INVAR1& 
/: USING &INVAR2& 
...... 
/: CHANGING &OUTVAR1& 
/: CHANGING &OUTVAR2& 
...... 
/: ENDPERFORM 
INVAR1 
and INVAR2 are variable symbols and may be of any of the four SAPscript symbol 
types. 
OUTVAR1 
and OUTVAR2 are local text symbols and must therefore be character strings. 
The ABAP subroutine called via the command line stated above must be defined in the ABAP 
report prog as follows: 
FORM <form> TABLES IN_TAB STRUCTURE ITCSY 
OUT_TAB STRUCTURE ITCSY. 
... 
ENDFORM. 
The values of the SAPscript symbols passed with /: USING... are now stored in the internal 
table IN_TAB . Note that the system passes the values as character string to the subroutine, 
since the field Feld VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR 80). See 
the example below on how to access the variables. 
The internal table OUT_TAB contains names and values of the CHANGING parameters in the 
PERFORM statement. These parameters are local text symbols, that is, character fields


chk this sample code of driver program:
REPORT ZVKKSCRIPTS1 .
data: v_mat like mara-matnr,
var1 like makt-maktx.
form subroutine tables itab structure itcsy
otab structure itcsy.
read table itab with key name = 'IT_VBAP-MATNR'.
if sy-subrc = 0.
v_mat = itab-value.
select single maktx from makt into var1
where matnr = v_mat and
spras = sy-langu.
if sy-subrc = 0.
read table otab with key name = 'VAR1'.
if sy-subrc = 0.
otab-value = var1.
modify otab index sy-tabix.
endif.
endif.
endif.
endform. 

Vasanth

4 REPLIES 4
Read only

Former Member
0 Likes
809

Hello,

Check this.


PERFORM <form> IN PROGRAM <prog> 
/: USING &INVAR1& 
/: USING &INVAR2& 
...... 
/: CHANGING &OUTVAR1& 
/: CHANGING &OUTVAR2& 
...... 
/: ENDPERFORM 
INVAR1 
and INVAR2 are variable symbols and may be of any of the four SAPscript symbol 
types. 
OUTVAR1 
and OUTVAR2 are local text symbols and must therefore be character strings. 
The ABAP subroutine called via the command line stated above must be defined in the ABAP 
report prog as follows: 
FORM <form> TABLES IN_TAB STRUCTURE ITCSY 
OUT_TAB STRUCTURE ITCSY. 
... 
ENDFORM. 
The values of the SAPscript symbols passed with /: USING... are now stored in the internal 
table IN_TAB . Note that the system passes the values as character string to the subroutine, 
since the field Feld VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR 80). See 
the example below on how to access the variables. 
The internal table OUT_TAB contains names and values of the CHANGING parameters in the 
PERFORM statement. These parameters are local text symbols, that is, character fields


chk this sample code of driver program:
REPORT ZVKKSCRIPTS1 .
data: v_mat like mara-matnr,
var1 like makt-maktx.
form subroutine tables itab structure itcsy
otab structure itcsy.
read table itab with key name = 'IT_VBAP-MATNR'.
if sy-subrc = 0.
v_mat = itab-value.
select single maktx from makt into var1
where matnr = v_mat and
spras = sy-langu.
if sy-subrc = 0.
read table otab with key name = 'VAR1'.
if sy-subrc = 0.
otab-value = var1.
modify otab index sy-tabix.
endif.
endif.
endif.
endform. 

Vasanth

Read only

Former Member
0 Likes
808

Hi,

perfrorm <formname> in program <program name>

using <i1>

changing<i2>

in zprogram u have to write the form ...............

form <form name> tables <intab> structure itcsy

<outtab> structure itcsy.

endform.

regards,

ram.

Read only

Former Member
Read only

Former Member
0 Likes
808

hi

to all thanks for responding to my question

regards

suresh.