on 02-15-2007 5:23 AM
hi
how to carte subroutine and call to form with out using table , plz give me simple example program.
Hi ,
you can use following code as reference.
In print pgm:
FORM SUM TABLES IN_PAR STRUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA : VAR_MON_CHA LIKE ITCSY-VALUE.
DATA : VAR_TOT_NETWR LIKE ITCSY-VALUE.
DATA: INT LIKE V_MON_CHA.
READ TABLE IN_PAR WITH KEY 'V_TOT_NETWR'.
CHECK SY-SUBRC = 0.
VAR_TOT_NETWR = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY 'V_MON_CHA'.
CHECK SY-SUBRC = 0.
VAR_MON_CHA = IN_PAR-VALUE.
REPLACE ',' WITH ' ' INTO VAR_MON_CHA.
REPLACE ',' WITH ' ' INTO VAR_TOT_NETWR.
CONDENSE : VAR_MON_CHA NO-GAPS ,
VAR_TOT_NETWR NO-GAPS .
VAR_MON_CHA = VAR_TOT_NETWR + VAR_MON_CHA.
CONDENSE VAR_MON_CHA.
INT = VAR_MON_CHA.
*CONDENSE INT.
OUT_PAR-VALUE = INT.
CONDENSE OUT_PAR-VALUE.
OUT_PAR-NAME = 'V_MON_CHA1'.
MODIFY OUT_PAR INDEX 1.
ENDFORM. " SUM
And in script:
LINE/*PERFORM SUM IN PROGRAM ZSDUTSFTI_INVPRINT
LINE/*USING &V_TOT_NETWR&
LINE/*USING &V_MON_CHA&
LINE/*CHANGING &V_MON_CHA1&
LINE/*ENDPERFORM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Syntax in a form window:
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM
The ABAP subroutine called via the command line stated above must be defined in the ABAP report prog as follows:
FORM
<b>/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM</b>
/
/ &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.
Regards
Sudheer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi There,
Insert something like this in your form
/:DEFINE &FIELD& = 'ABC'.
/:PERFORM get_deposit_slip IN PROGRAM Z_MY_PROGRAM
/: USING &FEBKO-EMKEY&
/: CHANGING &W_FIELD&
/:ENDPERFORM.
Create a program with form routines simular to this,
FORM get_deposit_slip TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
DATA: h_emkey LIKE febko-emkey.
READ TABLE in_tab WITH KEY 'FEBKO-EMKEY'.
h_emkey = in_tab-value.
Insert code using your fields
To update changing fields update out_tab
READ TABLE out_tab WITH KEY 'W_FIELD'.
CONCATENATE 'SAP-' wa_bsis-belnr h_suff+h_page(1) INTO out_tab-value.
MODIFY out_tab INDEX sy-tabix.
ENDFORM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jaya,
In script, you need to write as
Perform <Name> from <Program name> with some parameters... changing parameter.
In driver program you need to call this.
Form <form name> with the parameters...
Check links.
http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/803279454211d189710000e8322d00/frameset.htm
http://www.sap-basis-abap.com/abap/how-to-call-a-subroutine-form-sapscripts.htm
http://www.iconet-ltd.co.uk/how_to_entry.php?id=21&keyword=
Regards,
Priyanka.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.