Application Development 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: 

sapscript

Former Member
0 Kudos

FORM GET_PACK TABLES IT_INPUT STRUCTURE ITCSY

IT_OUTPUT STRUCTURE ITCSY.

the question is wrf th the above statement, as in can u put just itab in both the places of IT_INPUT and IT_OUTPUT.

4 REPLIES 4

Former Member
0 Kudos

ITCSY structure is used to represent the tables that are passed form the SAPScript to a subroutine pool program. Check the following extract form SAPHElp...

Calling ABAP Subroutines: PERFORM

You can use the PERFORM command to call an ABAP subroutine (form) from any program, subject to the normal ABAP runtime authorization checking. 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.

PERFORM commands, like all control commands, are executed when a document is formatted for display or printing. Communication between a subroutine that you call and the document is by way of symbols whose values are set in the subroutine.

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.

Aslo check this link...

http://help.sap.com/saphelp_erp2005/helpdata/en/d1/802d91454211d189710000e8322d00/frameset.htm

Former Member
0 Kudos

if i understand you correctly,

can we put ITAB in both the places of IT_INPUT and IT_OUTPUT. if this is your question, then NO is my response.

here is the brief description ,why ?

IT_INPUT is the internal table to hold the NAME of the field and its VALUE coming from the SCRIPT.

and IT_OUTPUT is the internal table to hold the NAME of the variables and Its values(what we calculate in this FORM and populate to that fields).

IT_OUTPUT is the internal table fields and for those fields values we calcualte in this form and populate to that IT_OUTPUT.

check this link, to get more idea on FORM calling from SCRIPT.

so we cant use the same name for both the tables. use either ITAB and OTAB accordingly.

if this is right, we should not do that.

Regards

srikanth

Message was edited by: Srikanth Kidambi

Message was edited by: Srikanth Kidambi

Former Member
0 Kudos

Hi Anupama,

I think we can use a name other than it_input and it_output , i have tried the same and it is working

FORM vsum TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

Yes but we cannot have the same name for the incomming table and the outgoing table because they have to store differen vales , (in_tab )one stores the values that are being input from the form for the calculation purpose and other stores the values that have to be sent back to the form (out_tab)

Regards.

Please reward points if helpful.

Sunmit.

Message was edited by: sunmit bhandari

Former Member
0 Kudos

hi

good

go through this link which ll give you complete idea about the ITCSY,

PERFORM ZOVERDRACHT IN PROGRAM ZALGFUNC1

USING &KOMVD-KWERT& "amount

USING &KOMK-WAERK& "currency

CHANGING &OVER& "my total

ENDPERFORM

the ABAP called is:

FORM ZOVERDRACHT TABLES TAB_IN STRUCTURE ITCSY TAB_OUT STRUCTURE ITCSY.

data: h_bedrag like komvd-kwert,

c_bedrag(18),

c_over(18),

h_valuta like komk-waerk.

READ TABLE TAB_IN WITH KEY 'KOMVD-KWERT'.

if sy-subrc = 0.

c_bedrag = TAB_IN-VALUE.

else.

READ TABLE TAB_IN WITH KEY 'KOMVD-KBETR'.

if sy-subrc = 0.

c_bedrag = TAB_IN-VALUE.

endif.

endif.

READ TABLE TAB_IN WITH KEY 'KOMK-WAERK'.

if sy-subrc = 0.

h_valuta = TAB_IN-VALUE.

endif.

replace '.' with ' ' into c_bedrag.

replace ',' with '.' into c_bedrag.

condense c_bedrag no-gaps.

h_bedrag = c_bedrag.

if h_valuta = 'BEF'.

h_bedrag = h_bedrag / 100.

endif.

h_over = h_over + h_bedrag.

write h_over to c_over currency h_valuta.

tab_out-name = 'OVER'.

shift c_over by 4 places left.

tab_out-value = c_over.

APPEND TAB_OUT.

CLEAR TAB_OUT.

ENDFORM.

h_over is defined as a global variable (top of program, outside this form)

so it keeps its value:

DATA h_over like komvd-kwert.

To print it on top of the main page you can insert this at the top of window

MAIN:

IF &PAGE& > '1'.

,,,,,,,,,,,,Overdracht,,,,&OVER(I14)&

ENDIF

To print it at the bottom:

IF &NOVER& NE 'X'

,,,,,,,,,,,,Overdracht,,,,&OVER(I14)&

ENDIF

I set &NOVER& to 'X' after printing the end values (totals on the last page)

so it doesn't try to print my intermediary value any more:

DEFINE &NOVER& = 'X'

Here I also clear my intermediary value because if you print several

invoices at once there is the danger that the intermediary value 'carries

on' from one invoice to another

PERFORM ZCLEAR IN PROGRAM ZALGFUNC1

ENDPERFORM

and the ABAP in question is very simple:

FORM ZCLEAR TABLES TAB_IN STRUCTURE ITCSY TAB_OUT STRUCTURE ITCSY.

clear h_over.

ENDFORM.

THANKS

MRUTYUN^