‎2006 Oct 05 5:37 AM
under what requirement shoukd the structure ITCSY be preferred
‎2006 Oct 05 5:39 AM
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 , you can call the subroutine in SAPScript as follows:
/: PERFORM ADD_INCOME IN PROGRAM ZNEGI
/: 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 ZNEGI, 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.
‎2006 Oct 05 5:39 AM
Hi uma,
ITCSY is used when calling routine
from sapscripts,
to fetch some data,
if that data is not available in the driver program.
1. while calling subroutines from sapscripts,
there is a special technique,
which has got its own limitations.
2.
FORM abc
TABLES
in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
ENDFORM.
3. The perform in se38 program should be of the
above format only.
4. We cannot pass internal tables.
5. Rather we need to pass
VARIABLE NAME
VARIABLE VALUE
(see the structure of itcsy in se11)
6. In this form, we have to read
the internal table in_tab
to capture the variable name and its value.
7. Similary, to return the values,
we have to put one record (for each variable)
in out_tab.
regards,
amit m.
‎2006 Oct 05 5:39 AM
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 , you can call the subroutine in SAPScript as follows:
/: PERFORM ADD_INCOME IN PROGRAM ZNEGI
/: 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 ZNEGI, 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.
‎2006 Oct 05 5:42 AM
Like ITCPO used for accessing FORMS from SAP script ITCSY can also be passed for passing Long text to SAP SCRIPT.
Hope this clarifes
~thomas.
‎2006 Oct 05 5:53 AM
Hello,
When u are using standard print program u cannot change the print program for ur purpose.So to overcome this we have define different program consisting of routines and use them in script.
Syntax goes like this:
In Script form:
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM
In ROutines program
FORM <form> TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
...
ENDFORM.
Check and let me know u face any problem.
Regards
‎2007 May 08 7:57 AM
Hi Ravi,
what should be the programme type after defining subroutine in driver programme.
I am trying to call routine in script,but the value is not returing in script and when i trying to debugg my programm it's not going through this routine which i defined in my programme.
This is the code:
/: PERFORM POP_ADD IN PROGRAM 'YPAYER'
/: USING &PAYR-ZNEM1&
/: CHANGING &Z_VBLNR&
/: ENDPERFORM
/E ELE
p1 &z_vblnr&
Driver Programm
&----
*& Report YPAYER *
*& Description: Print programme to display the payer infomation.
&----
*& Created by: Mohit Khandelwal Date: 9/04/2007
*& *
&----
REPORT YPAYER .
TABLES: PAYR.
--
data: z_itab like payr occurs 0 with header line.
*data: z_tline like standard table of tline with header line.
-----end of declaration--
data: words type spell.
--
selection-screen:begin of block b1 with frame title t1.
select-options: zbukr for z_itab-zbukr.
select-options: vblnr for z_itab-vblnr.
select-options: hbkid for z_itab-hbkid.
select-options: gjahr for z_itab-gjahr.
selection-screen: end of block b1.
---end-of-screen--
--
start-of-selection.
select single znme1 znme2 znme3 znme4 vblnr rwbtr from payr into
corresponding
fields of z_itab where zbukr in zbukr
and vblnr in vblnr
and hbkid in hbkid
and gjahr in gjahr.
end-of-selection.
*write: z_itab-vblnr.
----
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = z_itab-rwbtr
CURRENCY = 'INR'
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = words.
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZSD_PAYER'
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'PROTECT'
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ELE'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES = Z_ITAB.
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'ENDPROTECT'
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ELE1'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'HEADER'
IMPORTING
PENDING_LINES = Z_TLINE.
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM PREVIOUS_INFO TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
data: z_name1 type payr-znme1.
read BILLNO line of inttab
READ TABLE IN_TAB WITH KEY 'z_itab-znme1'.
CHECK SY-SUBRC = 0.
Z_NAME1 = IN_TAB-VALUE.
select from vbrp and modify out_tab with new data
SELECT SINGLE * FROM PAYR
WHERE ZNME1 = Z_NAME1.
IF SY-SUBRC = 0.
READ TABLE OUT_TAB with key 'z_vblnr'.
MOVE PAYR-VBLNR TO OUT_TAB-VALUE.
MODIFY OUT_TAB INDEX SY-TABIX.
ELSE.
READ TABLE OUT_TAB INDEX 1.
MOVE 'no data' TO OUT_TAB-VALUE.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.
ENDFORM.
Plz do reply.
Mohit Khandelwal