cancel
Showing results for 
Search instead for 
Did you mean: 

ITCPO & ITCSY

Former Member
0 Kudos

What role does ITCPO & ITCSY plays in SAPSCRIPTS.

Rgrds.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

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.

Answers (3)

Answers (3)

former_member196280
Active Contributor
0 Kudos

Both are structures, you can pass " ITCPO" to your form in your print program.. you can see the parameters by viewing the structure... (Print-preview, no of pages wtc)

"ITCSY" is used mostly when driver program is not in your control. It is used to call sub-routine from your SAP script and pass back values to SAP script.

Regards,

SaiRam

Former Member
0 Kudos

Hi Chidambar,

ITCPO is basically for providing the output options i.e number of copies,the print should be immidiately taken or not,the spool request should be created or not,if it does how many days the request should be present in the spool etc.So basically all the custom made options for the print can be set thr ITCPO

ITCSY is a structure with two fields, fieldname and fieldvalue.When you have to change some data in sapscript

or say u have to fetch some data or calculate new data using the existing data in the sapscript, WITHOUT changing its driver program, This structure comes into picture.Using the perform statement you can pass values to the form routine which in turn sends the new data to the sapscript.

Reward points if useful.

Cheers,

Deepthee Kasal

Former Member
0 Kudos

Hi,

the structure ITCSY is used in relation with SAPScripts. You can call a Routine in any program in SAPScript.

For eg: if you have a subroutine named ADD_INCOME in a program ZSHAIL_BASIC, you can call the subroutine in SAPScript as follows:

/: PERFORM ADD_INCOME IN PROGRAM ZSHAIL_BASIC

/: USING &var1&

/: CHANGING &var2&

/: ENDPERFORM.

Here the input parameter to the subroutine is var1 and the value returned by the subroutine is var2.

In the program ZSHAIL_BASIC, you have to call the subroutine as

FORM ADD_INCOME TABLES IN_TAB STRUCTURE ITCSY OUT_TAB STRUCTURE ITCSY.

ENDFORM.

IN_TAB is a structure of type ITCSY,which has 2 components, NAME and value.

So in the program, var1(which is sent from SAPScript) , will be stored as IN_TAB-NAME and its value will be in IN_TAB-VALUE. You can utilise the IN_TAB-VALUE and after performing the required operations, the return value should be assigned to table OUT_TAB.

This value can thus be obtained in var2 specified in SAPScript.

Regards,

Omkar.