cancel
Showing results for 
Search instead for 
Did you mean: 

Scripts

Former Member
0 Kudos

hhi.

what is the structure ITCSY in SCripts explain with exaple

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi,

In case of SAPSCRIPT modifications user can add a logic with out modifying PRINTPROGRAM, for that one we use FORM ROUTINES( SUBROUTINES).

using FORM ROUTINES user can add a logic with out modifying the

print program.

in subroutine we use strucutre ITCSY.

ITCSY is a structure based on this user can add a logic in form routines.

<b>this structure ITCSY contains field NAME and VALUE.</b>

here <b>NAME---> field name</b>

<b>VALUE----


> field value.</b>

<b>steps for creating subroutine</b>

<b>example for printing new field to the form without modifying print program.</b>

1) gotoSE38.
****2) Provide name for REPORT.

    REPORT zexample.
****3) provide declarations as per your needs.

    TABLES:  vbak,vbdka. " declare tables

***** maintain subroutine
4) FORM  zform TABLES input   STRUCTURE ITCSY
                                                            output STRUCTURE ITCSY.

DATA: v_ename like vbak-ernam,
          x(10) type N.

      LOOP AT input.
         CASE input-name.
                  WHEN 'vbdka-vbeln'.
                   X = input - value.
         ENDCASE.
     ENDLOOP.

****based on input value extracting employee data.

     select ernam from vbak into v_ename where vbeln = X.
     endselect.

****logic for print ouput
     output-name = 'ename'.
     output-value  = v_ename.
     append output.   

ENDFORM.

5) SAVE
6) ACTIVATE.

we call the subroutines in script editor by using PERFORM....ENDPERFORM control command.

<b>in script form editor.</b>
1) gotoSE71

2) provide form name : Zmedruk

3) select appropiate PAGE WINDOW--->select EDIT---->select the window required for adding a field---->seelct edit---> select ELEMENTS
  next goto EDITOR

4) **** syntax for calling the subroutine

/: PERFORM zform IN PROGRAM zexample
/: USING &vbdka-vbeln&
/: CHANGING &ename&
/: ENDPERFORM

/ employee name &ename&           "equallent write statement
here you use any paragraph format ('/'inted of this you use 'p' also).

5) press F3 

6) SAVE and ACTIVATE.

regards,

Ashokreddy

Message was edited by:

Ashok Reddy

Former Member
0 Kudos

Hi Pandu,

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

Aneesh.

Former Member
0 Kudos

HI..,

In Scripts,You can use the PERFORM command to call an ABAP subroutine (form) from any program.

While calling this PERFORM in the scripts you need to pass some variables as USING and CHANGING parameters..

<b>Here comes the use of ITCSY structure...</b>

<b>This structure contains two fields -


field name and field value .</b>

<b>An internal table of type ITCSY in the called program receives these fields and their values...</b>

You can use such calls to subroutines for carrying out calculations, for obtaining data from the database that is needed at display or print time, for formatting data, and so on.

Here is the syntax and an Example !

In scripts u write as....

/: 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:

<b>FORM <form> TABLES IN_TAB STRUCTURE <u>ITCSY</u>

OUT_TAB STRUCTURE <u>ITCSY</u>.

...

ENDFORM.</b>

The values of the SAPscript symbols passed with /: <i>USING... are now stored in the internal table IN_TAB .</i> 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 <i>OUT_TAB contains names and values of the CHANGING parameters in the PERFORM statement. </i>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.

Please do remember to close the thread when ur problem is solved ! reward all helpful answers !!

regards,

sai ramesh