Skip to Content
author's profile photo
Former Member

Calling subrouting in smart forms

Hi all,

I defined the subroutine in form routine of smart forms, but why not to call the subroutine in program line.

Anyone could tell me how to definite and how to call.

and i try the following way, but it is not good choice.

Perform xxxxxxxxxxx

in program xxxxx

using xxx

changing xxxx.

Thank you very much in advance,

Kevin

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    author's profile photo
    Former Member
    Oct 07, 2005 at 04:19 AM

    Hi Kevin.

    In Smartforms, you declare a form which you want to be called in Form Routines, and then you call that form in the Initialization tab.

    For eg. : In Initialization you say :

    Perform get_text using value_1 changing value_2.

    Then in form routines, you MUST have a form GET_TEXT :

    Form GET_TEXT using value_1 changing value_2.

    ...

    ENDFORM.

    Also, in Form routines, you cannot access global data. So you need to pass it explicitly via USING/CHANGING.

    Hope it is clear.

    Regards.

    Samant

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Kevin,

      I can do it on WAS 620 . I am sure it is possible on 46C as well . You can define local data also here and change global data . Whatever you can do in a noraml program you can do in a subroutine in Smartform.

      I am again not sure what exactly is your requirement to write a subroutine.

      Cheers

      I saw your problem is solved . Dont forget to reward if answers were helpful.

      Message was edited by: Sanjay Sinha

  • author's profile photo
    Former Member
    Oct 07, 2005 at 03:31 AM

    Consider the instance,

    If you want to do some proceesing like addition at the form level. You can use a subroutine called from the form.

    If you call the subroutine from the Program, you will not able to meet the scenario exists in the form.

    Regards,

    Baburaj

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 07, 2005 at 03:59 AM

    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.

    Example:

    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.

    You can use the above syntax for calling the Subroutine from a Form.

    Regards,

    Baburaj

    Add comment
    10|10000 characters needed characters exceeded