‎2007 Feb 20 6:16 AM
hi
one example pl. to show how to use PERFORM in form.
thanx
rocky
‎2007 Feb 20 6:20 AM
IN SAPSCRIPT FORM DO THIS.
/: PERFORM DATA_COLLECTION IN PROGRAM Z_PROGRAM
/: USING ®UH-VBLNR&
/: USING ®UH-LIFNR&
/: CHANGING &BAREA&
/: CHANGING &NAME&
/: CHANGING &NAME2&
/: CHANGING &NAME3&
<b>IN Z_PROGRAM DO THIS.</b>
FORM DATA_COLLECTION TABLES IN_TAB STRUCTURE itcsy
OUT_TAB STRUCTURE itcsy.
*your logic
ENDFORM.
‎2007 Feb 20 7:28 AM
hi
here i have 2 questions
why STRUCTURE ITCSY is used?? what is its importance??
second--- what is the type of in program i.e. whether it is executable or subroutine pool.
thanx
rocky
‎2007 Feb 20 6:21 AM
Hi,
Syntax in a form window:
/: 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.
‎2007 Feb 20 6:22 AM
Hi,
See some example below.
Definition in the SAPscript form:
/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM
/
/ &BARCODE&
Coding of the calling ABAP program:
REPORT QCJPERFO.
FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA: PAGNUM LIKE SY-TABIX, "page number
NEXTPAGE LIKE SY-TABIX. "number of next page
READ TABLE IN_PAR WITH KEY PAGE.
CHECK SY-SUBRC = 0.
PAGNUM = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY NEXTPAGE.
CHECK SY-SUBRC = 0.
NEXTPAGE = IN_PAR-VALUE.
READ TABLE OUT_PAR WITH KEY BARCODE.
CHECK SY-SUBRC = 0.
IF PAGNUM = 1.
OUT_PAR-VALUE = |. "First page
ELSE.
OUT_PAR-VALUE = ||. "Next page
ENDIF.
IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = L. "Flag: last page
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.
‎2007 Feb 20 9:54 AM
Hi,
PERFORM form IN PROGRAM prog.
Additions:
1. ... USING p1 p2 p3 ...
2. ... CHANGING p1 p2 p3 ...
3. ... TABLES itab1 itab2 ...
4. ... IF FOUND
In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See Passsing SY-REPID not allowed and Receiving SY-SUBRC not allowed.
However, here you can specify the names of both the subroutine and the program in which it occurs dynamically at runtime. If you do this, you should place the variables form and prog in parentheses. The names in form and prog must be entered in uppercase, otherwise a runtime error occurs. If you do not specify any additions (such as USING) you do not need to specify the program after IN PROGRAM. In this case, the system looks for the subroutine in the current program.
Example
DATA: RNAME(30) VALUE 'WRITE_STATISTIC', PNAME(8) VALUE 'ZYX_STAT'.
Here Form and Program name must be written in upper case.
PERFORM (RNAME) IN PROGRAM ZYX_STAT.
PERFORM WRITE_STATISTIC IN PROGRAM (PNAME).
PERFORM (RNAME) IN PROGRAM (PNAME).
All three PERFORM statements have the same effect, that is, they call the subroutine 'WRITE_STATISTIC', which is defined in the program 'ZYX_STAT'.
Regards,
Sruthi
‎2007 Feb 20 11:21 AM
hi
what is the type of program 'ZYX_STAT' in se38, is it executable or subroutine pool??????????????????????????????
‎2007 Feb 23 10:36 PM
Hi,
Perform program for sapscript is of type SUBROUTINE POOL.
Br,
Laxmi
‎2007 Feb 24 1:15 PM
Hi rocky robo
Calling ABAP subroutines
You can call an ABAP subroutine from SapScript using the PERFORM statment. You can use this to get data
without havning to cnahge the print program. In the examole below NAME is retreived from table SCUSTOM.
SapScript
/:DEFINE &CUST& = '00000021'.
/:PERFORM GET_NAME IN PROGRAM Z_BC460_EX4_HF
/: USING &CUST&
/: CHANGING &NAME&
/:ENDPERFORM.
Dear &NAME&
The ABAP routine
The ABAP routine could be defined as follows:
IMPORTANT: The structure itcsy must be used for the parameters.
REPORT Z_HENRIKF_SCRIPT_FORM .
TABLES scustom.
FORM get_name tables in_tab structure itcsy out_tab structure itcsy.
read table in_tab index 1.
select single * from scustom
where id = in_tab-value.
if sy-subrc = 0.
read table out_tab index 1.
move scustom-name to out_tab-value.
modify out_tab index sy-tabix.
else.
read table out_tab index 1.
move 'No name' to out_tab-value.
modify out_tab index sy-tabix.
endif.
You could also fill the ouput parameter table this way
READ TABLE out_par WITH KEY 'NAME1'.
out_par-value = l_name1.
MODIFY out_par INDEX sy-tabix.
ENDFORM.
Note that if you use more than one parameter you must use Using or Changing before every parameter !
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM
‎2007 Feb 26 7:18 AM
hi,
ITCSY STRUCTURE is a subroutine pool which is used in the SAP script form Editor for calling an internal or external program. If the requirement is totally differnt as the print program exits or that piece of requirement of code is not supported by print program or not present in the print program. then you can make use of this structure by writing it separately and call the same in the form editor using Perform as all of our friends suggested. ITCSY STRUCTURE hold two fields which you need to use in the program. they are fieldname and the fieldvalue.
bye
shamim.