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

regarding ITCSY structure

former_member197425
Active Participant
0 Likes
808

Hi,

Can anyone please tell me how to use ITCSY structure in a Report

and Script.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
722

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.

3 REPLIES 3
Read only

Former Member
0 Likes
723

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.

Read only

i048168
Product and Topic Expert
Product and Topic Expert
0 Likes
722

Definition in the SAPscript form:

/: PERFORM GET_UNIT IN PROGRAM ZFORMPGM

/: USING &MATERIALNO&

/: CHANGING &UNIT&

/: ENDPERFORM

/

Coding of the calling ABAP program:

REPORT ZFORMPGM.

FORM GET_VALUEE TABLES IN_PAR STUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA: MATERIALNO LIKE MARA-MATNR,

UNIT LIKE MARA-MEINS.

READ TABLE IN_PAR WITH KEY 'MATERIALNO'.

CHECK SY-SUBRC = 0.

MATERIALNO = IN_PAR-VALUE.

READ TABLE OUT_PAR WITH KEY 'UNIT'.

CHECK SY-SUBRC = 0.

SELECT SINGLE MEINS INTO UNIT FROM MARA WHERE MATNR = MATERIALNO.

MODIFY OUT_PAR INDEX SY-TABIX.

ENDFORM.

Regards

Vadi

Read only

Former Member
0 Likes
722

hi,

abap program:

&----


*& Report ZVKKSCRIPTS1 *

*& *

&----


*& *

*& *

&----


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.

in the script:

use,

perform sub in program 'ZXX' using itab

changing otab.

thanks,

Keerthi

Edited by: keerthi kiran varanasi on Jan 31, 2008 9:51 AM