‎2008 Feb 19 7:35 AM
Hi all of You,
What is the use of ITCSY Structure ? i am having some knowledge is correct or not pls check it?
suppose i have completed the script program .every thing is fine and i missed to do sub total with out changing the code ,by using ITCSY structure we can rectify it ? or any other pls explain it what the purpose of ITCSY Structure.
‎2008 Feb 19 7:39 AM
Hi,
It is a structure, have 2 fields name and value and can be used to transfer data between script and program. Check the below code..
This example get the value of shipment document number based on billing document number
VBDPR-VBELN_VL is the billing document number.
In Script......
/: PERFORM GET_SHIPMENT_NO IN PROGRAM ZVADIN01
/: USING &VBDPR-VBELN_VL&
/: CHANGING &Z_TKNUM&.
/: ENDPERFORM
In program...
DATA: Z_TKNUM LIKE VTTP-TKNUM.
DATA: Z_TEMP_TKNUM LIKE VTTP-TKNUM
FORM GET_SHIPMENT_NO TABLES INTAB STRUCTURE ITCSY
OUTTAB STRUCTURE ITCSY.
READ TABLE INTAB WITH KEY NAME = 'VBDPR-VBELN_VL'.
IF SY-SUBRC = 0.
CLEAR Z_TEMP_TKNUM.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = INTAB-VALUE
IMPORTING
OUTPUT = Z_TEMP_TKNUM
EXCEPTIONS
OTHERS = 1.
CLEAR Z_TKNUM.
SELECT TKNUM INTO Z_TKNUM UP TO 1 ROWS
FROM VTTP
WHERE VBELN = Z_TEMP_TKNUM.
ENDSELECT.
IF SY-SUBRC = 0.
READ TABLE OUTTAB WITH KEY NAME = 'Z_TKNUM'.
IF SY-SUBRC = 0.
OUTTAB-NAME = 'Z_TKNUM'.
OUTTAB-VALUE = Z_TKNUM.
MODIFY OUTTAB INDEX SY-TABIX.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.
Rgds,
Bujjji
‎2008 Feb 19 7:41 AM
Hi Nagi,
Normally ITCSY structure is used SAP SCRIPTS.
Suppose you are standard Driver program for your form and still you wanted to do some calculations,then you dont need to touch your standard program and in your Forms you cant write select queries also.
for this purpose, calulations and queries will be performed outside the Script and still you can bring in those values into your form.
For this pupose only ITCSY structure is used.
Thanks.
Note: Reward Points if you find useful.
‎2008 Feb 20 5:08 AM
‎2008 Feb 19 7:42 AM
The structure ITCSY contains field name and field value.
The system does not execute the PERFORM command within
SAPscript replace modules, such as TEXT_SYMBOL_REPLACE or TEXT_INCLUDE_REPLACE.
The replace modules can only replace symbol values or
resolve include texts, but not interpret SAPscript control commands.
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.
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. See the example below
on how to
return the variables within the subroutine.
From within a SAPscript form, a subroutine GET_BARCODE in
the ABAP
program QCJPERFO is called. Then the simple barcode
contained there
('First page', 'Next page', 'Last page') is printed as
local variable
symbol.
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.
ITCPO - This structure contains the Output device.
REPORT ZPSAPSCRIPT.
TABLES : EKKO,
EKPO,
KNA1,
USR01,
MARA,
MAKT.
DATA : BEGIN OF ZOPTION.
INCLUDE STRUCTURE ITCPO.
DATA : END OF ZOPTION.
PARAMETERS: P_EBELN LIKE EKKO-EBELN,
P_EBELP LIKE EKPO-EBELP.
CLEAR EKPO.
SELECT SINGLE * FROM EKPO
WHERE EBELN = P_EBELN AND
EBELP = P_EBELP.
CLEAR KNA1.
SELECT SINGLE NAME1 FROM KNA1
INTO KNA1-NAME1
WHERE KUNNR = EKPO-KUNNR.
CLEAR MAKT.
SELECT SINGLE MAKTX FROM MAKT
INTO MAKT-MAKTX
WHERE MATNR = EKPO-MATNR AND
SPRAS = SY-LANGU.
CLEAR USR01.
SELECT SINGLE * FROM USR01 WHERE BNAME = SY-UNAME.
ZOPTION-TDDEST = USR01-SPLD. "Output device (printer)
ZOPTION-TDIMMED = 'X'. "Print immediately
ZOPTION-TDDELETE = 'X'. "Delete after printing
ZOPTION-TDPROGRAM = 'ZPQRPRNT'. "Program Name
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX = ' '
ARCHIVE_PARAMS = ' '
DEVICE = 'PRINTER'
DIALOG = ' '
FORM = 'Z_TESTSCRIPT'
LANGUAGE = SY-LANGU
OPTIONS = ZOPTION
IMPORTING
LANGUAGE = SY-LANGU
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'HEADER'
EXCEPTIONS
ELEMENT = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'MAIN'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'FOOTER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'FOOTER'
EXCEPTIONS
ELEMENT = 1.
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
OTHERS = 2.Regards