Calling form-routines

Hello ABAP gutus,
i am using 10 form-routines to get some data, in all subroutines code is  same, but i am  passing different internal tables to all form-routines  with USING, CHANGING parameters.
for example
perform get_header1 using itab changing jtab.
perform get_header2 using itab1 changing jtab1.
FORM get_header1  USING    P_ITAB
                  CHANGING P_JTAB.
   CALL METHOD cl_salv_table=>factory
    IMPORTING
      r_salv_table = r_alvtab
    CHANGING
      t_table      = itab[].
  CALL METHOD r_alvtab->get_columns
    RECEIVING
      value = r_col.
  CALL METHOD r_col->get
    RECEIVING
      value = r_cols.
  loop at r_cols into wa_col.
    ref_col = wa_col-r_column.
    CALL METHOD ref_col->get_medium_text
      RECEIVING
        value = lv_text.
    jtab-header = lv_text.
    APPEND jtab.
    endloop.
endform.
FORM get_header2  USING    P_ITAB
                  CHANGING P_JTAB.
   CALL METHOD cl_salv_table=>factory
    IMPORTING
      r_salv_table = r_alvtab
    CHANGING
      t_table      = itab1[].
  CALL METHOD r_alvtab->get_columns
    RECEIVING
      value = r_col.
  CALL METHOD r_col->get
    RECEIVING
      value = r_cols.
  loop at r_cols into wa_col.
    ref_col = wa_col-r_column.
    CALL METHOD ref_col->get_medium_text
      RECEIVING
        value = lv_text.
    jtab1-header = lv_text.
    APPEND jtab1.
    endloop.
endform.
as above i used 10 form-routines.but i passed different internal tables.after these subrotines  i am using those internal table in function modules.
now my client wants me to maintain one form-routine instead of 10 form-routines.
Is it possible that? please tell me . its urgent
Regards
Mahesh

Hello Naredran.
see the below code
perform get_header1 using it changing it1.
perform get_header1 using itab changing it2.
*&      Form  get_header1
      text
     -->P_IT  text
     <--P_IT1  text
FORM get_header1  USING    P_IT
                  CHANGING P_IT1.
    FIELD-SYMBOLS : <FS>.
CALL METHOD cl_salv_table=>factory
    IMPORTING
      r_salv_table   = r_alvtab
    CHANGING
      t_table        = p_it.
  CALL METHOD r_alvtab->get_columns
    receiving
      value  = r_col
                   CALL METHOD r_col->get
                     receiving
                       value  = r_cols
  loop at r_cols into wa_col.
    ref_col = wa_col-r_column.
CALL METHOD ref_col->get_medium_text
   receiving
     value  = lv_text.
  assign IT1 to <FS>.    
  <FS> = lv_text.
  append it1.
  endloop.
ENDFORM.                    " get_header1
bellow error is coming while use the code which you said.
A USING reference parameter should not be used. Instead, define the
parameter as a USING-VALUE(...) or CHANGING parameter.
please let me know waht is wrong .

Similar Messages

  • Form Routine calling itself

    I would like to know what the perfomance issues if any the following code would cause:
    select single matnr
                           from mean
                           into lv_matnr
                          where ean11 = lv_ean11
                            and eantp = 'UC'.      "#EC *
                  if sy-subrc = 0.                 " If Same UPC existed / assigned to material then generate next UPC number
                     perform GET_NEXT_NUMBER.  " Get Next number in the same number range
                  else.
                     V_UPC = lv_upc_chk.
                  endif.
    The issue is that this code is in the form routine GET_NEXT_NUMBER and if the select to MEAN is successful it calls itself.  If this happens many times wouldn't this have a negative effect on performance?

    >
    Joseph Ritzik wrote:
    > I would like to know what the perfomance issues if any the following code would cause:
    >
    > select single matnr
    >                        from mean
    >                        into lv_matnr
    >                       where ean11 = lv_ean11
    >                         and eantp = 'UC'.      "#EC *
    >               if sy-subrc = 0.                 " If Same UPC existed / assigned to material then generate next UPC number
    >                  perform GET_NEXT_NUMBER.  " Get Next number in the same number range
    >               else.
    >                  V_UPC = lv_upc_chk.
    >               endif.
    >
    > The issue is that this code is in the form routine GET_NEXT_NUMBER and if the select to MEAN is successful it calls itself.  If this happens many times wouldn't this have a negative effect on performance?
    Unless you change lv_ean11 - This will be endless loop. Forget about performance but think about getting out from the routine.
    if the value is changed then that is ok if it serves the purpose. This is a recursive call and cannot be eliminated if required.

  • Error-handling in form routines to be called from maintenance  view

    hello,
    i have created a table maint. dialog. Under 'enviroment->modification->events' you can create form-routines for your own coding.
    I have the maint.event '01 - Before saving the data in the database'. Here i do some checks if entered values in some fields are okay or not etc.....
    When the users enters 'wrong' data i do a "message e000 with 'text' " So i got a error-message and the user is not able to save the data before changing it.
    BUT: i get the right error-message in the status-line, but i got an EMPTY screen, all the fields disapear. I have to go back with enter or the red cancel button. But then i 'fall back' to the selection screen of the maint. view. Thats not very user-friendly.
    Any ideas ?

    hi,
    think you have place your module not correct:
    try that: (without event)
    PROCESS AFTER INPUT.
      LOOP AT EXTRACT.
        FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
        CHAIN.
          FIELD Y789.
          FIELD Y012.
          MODULE LISTE_UPDATE_LISTE.
        ENDCHAIN.
    *begin of insertation
        CHAIN.
          FIELD Y123.
          FIELD Y456.
          module check_field  ON CHAIN-input.
        ENDCHAIN.
    *end of insertation
      ENDLOOP.
    Andreas

  • Error 420 "Can't call builtin routines remotely" while compiling a proc

    I get the message above when I try to compile a Forms procedure with a call to specific functions in the DBMS_UTILITY package. I am using Forms 10.1.2.2.0 and 10g DB (10.2.0.4.0). I want to trace the PL/SQL path that my Forms application is taking and be able to report the line number of the failure when an exception is thrown. I am able to call some routines within the DBMS_UTILITY package, but not any of them that have "pragma interface (C, format_error_stack);" in the code. These include format_call_stack, format_error_stack, and format_error_backtrace; all of which I would like to use. I've tried creating my own DB package function to act as a wrapper; this allows me to compile the form, but the call to the function form my exception handler returns null. These are really useful functions, but I do need to be able to access the functionality from within Forms. Does anyone have a solution/workaround for this problem. Note, this is similar to the question in Link:[ http://forums.oracle.com/forums/thread.jspa?messageID=504922��]
    Thanks JK.

    Nope, that does not work. See my first post above. I've tried using a wrapper, and whilst this allows my forms procedure to compile and my form to run, the wrapper procedure is returning null. Here's some code that may help to explain where I'm at. In the form, I've got -
    DECLARE
        l_bt VARCHAR2(2000); -- BackTrace
    BEGIN
        JEK_Raise_Exception; -- This is a DB procedure
    EXCEPTION
       WHEN OTHERS THEN
          l_bt := KEYOWNER.Backtrace.generate_backtrace;
          message('l_bt = '||l_bt); pause;
    END;-- Then a DB procedure that just generates an exception
    CREATE OR REPLACE PROCEDURE JEK_Raise_Exception IS
    BEGIN
       RAISE too_many_rows;
    END;-- and the function from my Backtrace Package to return the backtrace data.
       FUNCTION generate_backtrace
           RETURN VARCHAR2
       IS
          l_bt      VARCHAR2(2000);
       BEGIN
           l_bt := DBMS_UTILITY.format_error_backtrace;
           RETURN l_bt;  -- In my testing so far this has been NULL!!!
       END;

  • Perform a form routine within a sap script form

    Hi!
    How can I
    perform a form routine within a sap script form.
    Regards
    sas

    OK,
    many thanks for your kindly reply.
    But basically there is a matter which I don't understand.
    Which way is the better way to loop at internal table:
    Solution1:
    FORM xxx.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
       DEVICE                           = 'PRINTER'
       FORM                             = 'ZSD_PACKING_LIST'
       LANGUAGE                     =  SY-LANGU   .
    LOOP AT gt_versand_plan INTO gw_versand_plan.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'SHELEM'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'MAIN' .
    ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'.
    ENDFORM.
    Solution 2:
    Having the LOOP within the  sapscript form -> 'ZSD_PACKING_LIST'
    Regards
    sas

  • Call a routine in a dynamic action.

    Hi Experts,
    i want to write a routine in which i can give the error msg while saving the infotype 0002 incase the given condition is not fulfilled.
    Can you tell me where i can write this routine and how to call it in a dynamic action.
    i hav written other types of dynamic actions before but never called any routine before
    Plz give me the detailed info regarding writing a routine.
    regards
    TS

    Hello TS,
    You can do that using F in Indicator for step but iam not sure whether it will return an error message. We have user exits for this which might solve your issue. We have userexit PBAS0001 and in this EXIT_SAPFP50M_002 Function module, we need to write the code which ever you want to do.
    For Calling FORM in Dynamic actions.
    P - Check conditions
    I - Maintain infotype record
    W - Set default values when creating a new record
    V - Reference to another step
    F - Call routine
    M - Send mail
    Say you have a program ZTEST. In this you need to write the form that needs to be called in dynamic action and say for ex:form_test.
    You can fill only structure RP50D values, because these values you can get it back to dynamic action. ypu can check for examples in dynamic actions it self which have 'F' indicator step.
    Regards,
    Kiran I

  • Get current FORM-Routine Name

    Hi,
    during runtime i want to know the current form-routine-name to write it in a variable and put it in an itab. The background-idea is to print out all procedures that have been executed after running the program.
    Any hints, suggestions how to get this done?
    Thanks in advance
    Gunther

    Hi, Gunther,
    The only way to do this is to read the ABAP Call Stack in an internal table.
    Code:
    TYPES: BEGIN OF t_s_abap_callstack,
             mainprogram LIKE sy-repid,
             include LIKE sy-repid,
             line TYPE i,
             eventtype LIKE abdbg-leventtype,
             event LIKE abdbg-levent,
             flag_system,
           END OF t_s_abap_callstack.
    variable for ABAP callstack
    DATA: g_callstack TYPE STANDARD TABLE OF t_s_abap_callstack,
          g_callstack_wa TYPE t_s_abap_callstack.
    call 'ABAP_CALLSTACK' id 'DEPTH' field 99
                            id 'CALLSTACK' field g_callstack.
    g_callstack now contains the program and routine names called, in sequence. 
    Pls be careful in using this C Call; in particular, usage in a Productive environment should only be envisaged with the utmost caution.
    Philippe

  • Passing internal table to FORM routine

    Hi friends,
    how do i do the following:
    i have an internal table with data and i want the internal table to be passed in a FORM routine, as i need to do some operations on the data within the table, so what i need is how to do the FORM test_itab USING ... statement.
    thanks for your help,
    points will be awarded instantly!
    clemens

    Hi,
    Below will give you a detailed over view of how to achive the following.
    If you specify the addition TABLES, each table parameter t1 t2 ... for the subroutine called that is defined with the addition TABLES to the FORM statement must be assigned an internal table itab as the actual parameter. The assignment of the actual parameters to the formal parameters takes place using their positions in the lists t1 t2 ... and itab1 itab2 ... .
    You can only specify standard tables for itab. Transfer takes place by means of a reference. If a specified table itab has a header line, this is also transferred; otherwise, the header line in the corresponding table parameter t is blank when it is called.
    Note
    Use of table parameters in the interface for subroutines is obsolete but a large number of subroutines have not yet been converted to appropriately typed USING or CHANGING parameters, so that they must still be supplied with data by the TABLES addition to the PERFORM statement.
    Example
    Static call of the internal subroutine select_sflight transferring a table parameter.
    PARAMETERS: p_carr TYPE sflight-carrid,
                p_conn TYPE sflight-connid.
    DATA sflight_tab TYPE STANDARD TABLE OF sflight.
    PERFORM select_sflight TABLES sflight_tab
                           USING  p_carr p_conn.
    FORM select_sflight TABLES flight_tab LIKE sflight_tab
                        USING  f_carr TYPE sflight-carrid
                               f_conn TYPE sflight-connid.
      SELECT *
             FROM sflight
             INTO TABLE flight_tab
             WHERE carrid = f_carr AND
                   connid = f_conn.
    ENDFORM.
    Thanks,
    Samantak
    Rewards points for useful answers.

  • Form routine problem

    what is the exact use of the form routine assigned in nace?
    eg:
    o/p type                                     script drv prog   form routine  formname
    NEU        (Purchase order)     SAPFM06P     ENTRY_NEU     MEDRUCK
    if i create any modifications in the form routine using itcsy then will i have to write all the code within this form routine?
    eg:
    perform <form routine name> in program zprog1.
    using
    changing
    endperform.
    i have searched sdn but cudnt find a suitable answer. pls explain with an example.

    Hi,
    The routine mentioned in the Nace will have the logic to Get the data required to ptint on the form and also it call the Form using the function modules lije Open_Form Start_form Write_form. If it is a smartform it calls the Smart form generated FM.
    Ex NACE--> ENTRY_NEU
    Driver Program in NACE is ZSAPFM06P
    This prgram contains the form  ENTRY_NEU
    Form ENTRY_NEU.
    *get the data
    *Call the form
    Endform.
    I hope it is clear.

  • Urgent: Selection-screen within Form routines

    Hi Experts,
        Within Form routines can i declare selection-screen statements. If no how should i declare my objects on selection screen within form routines bcoz when i declared with selection screen statements within form routines iam getting the error as "Within FORM routines and function modules, the SELECTION-SCREEN statement is not allowed".          
    Regards.
    AADI.

    Hi Aditya,
    U cannot use the Selection-screen in Forms and Function Modules.
    Try to use it in an include program and call it from ur program.
    Reward if Helpful,
    Jagadish.

  • Form routine

    Hi All!
    In the NACE trans, when we configure for the output types for particular forms we have a entry for form routine.What is this exactly shall i give my print program name in this or some other options are there like 'entry'
    Please clarify me on this.
    Regards
    Praneeth
    Message was edited by: Praneeth kumar

    hI PRANEETH
    yOU HAVE MENTION THE PROGRAM I,E THE DRIVER PROGRAM WHICH CALL YOUR FORM.
    THE MENTION THE FORM ROUTINE I.E THE SUB-ROUTINE WHICH IS ACTUALLY CALLED FIRST IN YOUR PRINT PROGRAM AND THEN YUO FROM NAME
    KINLDLY REPLY IF YOU HAVE ANY DOUBT
    <b>FOR EXAMPLE CHECK OUT THIS PROGRAM RVADIN01 FOR INVOICE IN WHICH ENTRY WILL THE SUB-ROUTINE.</b>
    <b>THIS ENTRY WILL GIVEN IN THE NACE</b>
    REGARDS
    KISHORE
    REWARD IF HELPFUL
    Message was edited by: Harikishore Sreenivasulu

  • PO Output - Form routine

    Hi,
    where can i find the code which is written against form routine 3
    This is maintained in transaction OMFS for PO changes
    This routine no 3 calls for text from table t166t. I wanted change in this logic.
    Thanks,
    Sourabh

    Closed

  • Form routine for sales order adobe forms

    Hi Friends,
    I have a requirement to create z adobe forms for sales order for customized output type.
    When i checked, there is no form routine designed for calling the adobe forms.
    So, i am planning to copy the standard print program which is available for script and smartforms and creating a z form routine to include the function modules for calling the adobe form.
    Can any one please let me know whether have you worked in any of the same kind of situations and my apporach is ok or anything else can be done.
    Thanks & Regards,
    Prabu

    Hello,
    Plz check your caller program for the same and just find out the output type. for that purpose use the Tcode: NACE for finding the output type than proceed accordingly.
    Regards,
    Akg

  • FORM ROUTINE in Output Types

    Hi group,
      there is a requirement in which after the generation of accounting document(after saving VF01), we need to immediately reverse some of the lines in the accounting document by using F-02.  We have thought of using the Output Type Program to write our code as that was the only genuine place we could find to write our enhancement ( searched for user-exits after accounting doc is generated but cudn't find any). In the program , we shall write the BDC for aor reversal process. Now, when we SAVE VF01, this program(RLB_INVOICE, output type RD00) gets triggered. I thought instead of  writing something in the standard program( or even a Z version of it ), we wud write our code in a new program & then assign this program in NACE. I tried with some dummy program(zxxxxx), but there is an error log which says 'Processing Routine Entry does not exist for program zxxxxx).
    what is the significance of this FORM Routine 'ENTRY' in the output type???  wat is the solution for my problem??
    hope i am clear enough
    ur valuable inputs awaited...
    Thanks & Regards,
    Bikash Agarwal

    Hi
    The routine ENTRY is the start form called by the progam runs the print (RSNAST00 for example), that routine has to be defined in the program is assigned to output type.
    See the program RLB_INVOICE, here you can find the form ENTRY.
    So the program manages the print for the output type RD00 run a comand like this:
    PERFORM ENTRY IN PROGRAM RLB_INVOICE USING .......
    I don't think there's an exit after accounting document is created, there are some BTE (trx FIBF) are triggered just before it is generated, for example in BTE 1030: here you can know all accounting number and data (but the document isn't stored in database yet).
    I don't know if it's a good idea to insert the code in the routine of the print: remember all the process of saving of account document are running in update tusk, so while the output is been printing you can't be sure the accounting document is really stored in database.
    Max

  • What is the significance of Form routines while cretaing the out put types.

    Hi All
    while creating the output types in NACE what the significance of Form routines. What exactly in will do.
    please clarify in detail
    Arjun

    The FORM routines are important in configuration, because this is how the form print program will be called.  Usually the internal code is something like this.
    perform <routine> in program <print_program> using xscreen rcode.
    So in your print program, you need an ENTRY routine, so that the caller can call this routine.  The ENTRY will be the beginning of the program and call other FORMs which print the document.
    Regards,
    Rich Heilman

Maybe you are looking for