Formal keys, formal Parameters

Q. What are formal Keys and Formal Parameters?

Formal parameter
the parameter defined in the method heading
Actual parameter
the parameter that is passed when a method is called

Similar Messages

  • How to define this FORMAL parameters for a std. SAP itab?

    Hello Experts,
    Am writing a custom PERFORM in a standard SAP include-RVCOMFZZ by using modification assistant, like below,
    RVCOMFZZ:
    PERFORM my_routine IN PROGRAM my_report USING com_vbapvb.
    (here com_vbapvb is a TABLES parameter  with STRUCTURE of vbapvb in the std. sap FM).
    my_report:
    FORM my_routine USING here_I_want_to_know_the_data_object
    ENDFORM.
    Here pls. let me know How to define the FORMAL parameters of my_routine? I tried with different options, but did not worked out. Preferable let me know in OOPS concepts (not using TABLES)
    Thank you

    Hi,
    here is example how to write you structure content  regardless what com_vbap has field list.
    PERFORM my_routine IN PROGRAM my_report USING com_vbapvb.
    FORM my_routine USING here_I_want_to_know_the_data_object.
      field-SYMBOLS: <field> type any.
      do 100 times.
        assign COMPONENT sy-index of structure ls_VBAPVB to <field>.
        if sy-subrc = 0.
          write:/ <field>.
          else.
          exit.
        endif.
      enddo.
    ENDFORM.
    Bye Jan

  • Declaration of subroutine formal parameters in ecc 6.0

    In extended syntax check of my program, how can i declare formal parameters ?
    the warning is
    Program:  ZADI_V_R_869_870_STATUS  Row:    751
    Parameter "P_LV_UNSHIPPED_QTY" is untyped.
    Static type checks and optimizations,
    therefore, cannot take place.
    If a type cannot be declared, use the type ANY.
    ANY. use the type ANY. use the type ANY.
    use the type ANY.
    Internal Message Code: MESSAGE GUX
    (The message can be hidden with "#EC *)
    The formal parameters in the code is nto delcared with type ...
    So how to declare here in ecc 6.0 ?
    FORM logic_4_ord_status
                      USING   p_lv_canc_date
                              p_lv_shipped_date
                              p_lv_order_qty
                              p_lv_delivery
                              p_lv_open_qty
                              p_lv_neworderqty
                              p_lv_pickedqty
                              p_lv_j_3acada
                              p_lv_j_3arqda
                              p_lv_cancelled1
                              p_lv_zzactcnt
                              p_lv_zzstatus
                              p_lv_cancelled2
                              p_lv_unshipped_qty
                     CHANGING p_wa_870_output_rec TYPE t_870_output_rec.
    My declaration is  
    DATA: lv_order_qty     TYPE wmeng,
            lv_cancelled1    TYPE wmeng,
            lv_cancelled2    TYPE wmeng,
            lv_delivery      TYPE lfimg,
            lv_open_qty      TYPE lfimg,
            lv_neworderqty   TYPE lfimg,
            lv_pickedqty     TYPE lfimg,
            lv_unshipped_qty TYPE lfimg,
            lv_canc_date(8)  TYPE c,
            lv_shipped_date  TYPE erdat .
      DATA: lv_j_3acada      TYPE j_3acada,
            lv_j_3arqda      TYPE j_3arqda.
    Please suugest me that TYPE any is sufficient
    for all
    p_lv_shipped_date
                              p_lv_order_qty TYPE any
                              p_lv_delivery TYPE any
                              p_lv_open_qty TYPE any
                              p_lv_neworderqty TYPE any
                              p_lv_pickedqty TYPE any
                              p_lv_j_3acada TYPE any
                              p_lv_j_3arqda TYPE any
                              p_lv_cancelled1 TYPE any
                              p_lv_zzactcnt TYPE any
                              p_lv_zzstatus TYPE any
                              p_lv_cancelled2 TYPE any
                              p_lv_unshipped_qty TYPE any

    Using "#EC UOM_IN_MES) at the end of formal parameter is of no use !!!
    I got aroung 275 Warnings in extended syntax check as I am using the below set so many times
    WRITE p_lv_order_qty     TO p_wa_870_output_rec-order_qty    DECIMALS 0.
        WRITE p_lv_neworderqty   TO p_wa_870_output_rec-new_ord_qty  DECIMALS 0.
        WRITE p_lv_cancelled1    TO p_wa_870_output_rec-cancel_1_qty DECIMALS 0.
        WRITE p_lv_cancelled2    TO p_wa_870_output_rec-cancel_2_qty DECIMALS 0.
        WRITE p_lv_open_qty      TO p_wa_870_output_rec-open_qty     DECIMALS 0.
        WRITE p_lv_delivery      TO p_wa_870_output_rec-deliv_qty    DECIMALS 0.
        WRITE p_lv_pickedqty     TO p_wa_870_output_rec-pick_qty     DECIMALS 0.
        WRITE p_lv_unshipped_qty TO p_wa_870_output_rec-unship_qty   DECIMALS 0.
    for each line do I need to give like below ? :"
    WRITE p_lv_order_qty     TO p_wa_870_output_rec-order_qty    DECIMALS 0. "#EC UOM_IN_MES)
    My coding :
    ===========================================================================
    FORM logic_4_ord_status
                      USING   p_lv_canc_date
                              p_lv_shipped_date   TYPE erdat
                              p_lv_order_qty      TYPE wmeng
                              p_lv_delivery       TYPE lfimg
                              p_lv_open_qty       TYPE lfimg
                              p_lv_neworderqty    TYPE lfimg
                              p_lv_pickedqty      TYPE lfimg
                              p_lv_j_3acada
                              p_lv_j_3arqda
                              p_lv_cancelled1     TYPE wmeng
                              p_lv_zzactcnt
                              p_lv_zzstatus
                              p_lv_cancelled2     TYPE wmeng
                              p_lv_unshipped_qty  TYPE lfimg
                     CHANGING p_wa_870_output_rec TYPE t_870_output_rec.
    *---Pass the values to output internal table.
        p_wa_870_output_rec-shp_ord_date   = p_lv_j_3acada.
        WRITE p_lv_order_qty     TO p_wa_870_output_rec-order_qty    DECIMALS 0. "#EC UOM_IN_MES)
        WRITE p_lv_neworderqty   TO p_wa_870_output_rec-new_ord_qty  DECIMALS 0.
        WRITE p_lv_cancelled1    TO p_wa_870_output_rec-cancel_1_qty DECIMALS 0.
        WRITE p_lv_cancelled2    TO p_wa_870_output_rec-cancel_2_qty DECIMALS 0.
        WRITE p_lv_open_qty      TO p_wa_870_output_rec-open_qty     DECIMALS 0.
        WRITE p_lv_delivery      TO p_wa_870_output_rec-deliv_qty    DECIMALS 0.
        WRITE p_lv_pickedqty     TO p_wa_870_output_rec-pick_qty     DECIMALS 0.
        WRITE p_lv_unshipped_qty TO p_wa_870_output_rec-unship_qty   DECIMALS 0.
    Could you please advice/help me in resisting these warnings...

  • Default is it a true formal parameters?

    Hi All
    Does any onoe know
    what 's the difference between Deptree or Ideptree?
    and which part of a databse tigger determine the number of times the tigger body executes?
    and Default is it a true formal parameters?
    please help,
    Hilaire

    DEPTREE
    This view, created by utldtree.sql, contains information on the object dependency tree. For user SYS, this view displays shared cursors (and only shared cursors) that depend on the object. For all other users, it displays objects other than shared cursors. Other users can access SYS.DEPTREE for information on shared cursors.
    Column Datatype NULL Description
    NESTED_LEVEL
    NUMBER
    Nesting level in the dependency tree
    TYPE
    VARCHAR2(15)
    Object type
    OWNER
    VARCHAR2(30)
    Object owner
    NAME
    VARCHAR2(1002)
    Object name
    SEQ#
    NUMBER
    Sequence number in the dependency tree. Used for ordering queries.
    See Also: "IDEPTREE"
    Joel P�rez

  • FM accepts no formal parameters of type "u"

    Hi,
    I get a strange error when calling an function module. Below you can see the (generated) data definition, my call, my function header and the errormessage i get. Any help would be appreciated.
    TYPES:
      BEGIN OF DATA_PACKAGE_STRUCTURE.
         INCLUDE STRUCTURE /BIC/CS8ZBP_ALL.
    TYPES:
         RECNO   LIKE sy-tabix,
      END OF DATA_PACKAGE_STRUCTURE.
    DATA:
      DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
           WITH HEADER LINE
           WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    * Get validation results & fill error table
    CALL FUNCTION 'ZBW_BP_VALIDATE_DPAK'      
       EXPORTING                               
         i_dpid     = datapackid               
         i_src      = _val_source              
         i_tgt      = _val_target              
         i_srctp    = _val_source_type         
       CHANGING                                
         c_t_data   = data_package             
         c_t_result = _lt_result.              
    *"*"Lokale interface:
    *"  IMPORTING
    *"     REFERENCE(I_REQUEST) TYPE REF TO  IF_RSBK_REQUEST_ADMINTAB_VIEW
    *"       OPTIONAL
    *"     REFERENCE(I_DPID) TYPE  RSDATAPID OPTIONAL
    *"     REFERENCE(I_SRC) TYPE  RSBKSRCNM OPTIONAL
    *"     REFERENCE(I_TGT) TYPE  RSBKTGTNM OPTIONAL
    *"     REFERENCE(I_SRCTP) TYPE  RSBKSRCTP OPTIONAL
    *"  CHANGING
    *"     REFERENCE(C_T_DATA) TYPE  ANY TABLE
    *"     REFERENCE(C_T_RESULT) TYPE  ZBW_T_BPVAL_ERROR
    *"  EXCEPTIONS
    *"      UNKNOWN_SOURCETYPE
    *"      NO_SOURCE_DEFINED
    *"      NO_SOURCETYPE_SUPPLIED
    You attempted to pass the field "DATA_PACKAGE" to the formal parameter
    "C_T_DATA"
    but the formal parameter "C_T_DATA" can accept only fields of
    type "h". The field "C_T_DATA" has the type "u".

    Hi,
    You should change:
    REFERENCE(C_T_DATA) TYPE  ANY TABLE
    by:
    REFERENCE(C_T_DATA) TYPE  STANDARD TABLE
    Best regards,
    Leandro Mengue

  • Issue with formal parameters

    Hi,
    The Sample Procedure is been displayed Below:--
    i_userId is an input (number) parameter to the Stored Procedure (SP)..
    This same parameter is used for filtering Data (can be found almost bottom , i had marked as "ISSUE FOUND" there.).
    i'm been using the SP without TO_NUMBER (i_userId) in my database 11g which works fine.
    When the same Script is been imported to another 11g Database.. the query fetches NOTHING..... And it Works only when i had given TO_NUMBER (i_userId)........
    Why is its So?........
    Is this issue occur due to any installation problem, or Database creation problem.............
    CREATE OR REPLACE PROCEDURE ADM_MENUSUBLEVEL_GET (i_userId IN NUMBER,
    i_parent IN NUMBER,
    o_menuCur OUT SYS_REFCURSOR,
    o_Return OUT NUMBER) IS
    array_tab array_tbl := array_tbl();
    BEGIN
    The Query below Fetches the lower most child node and returns its parent based on
    hierachy
    WITH MAINDATA AS
    (SELECT LAG(purity, (LVL - 1), 0) OVER (ORDER BY rn) Val, unique_id, menu_id, parent_id, remarks, is_active, lvl
    FROM (SELECT ROWNUM rn, DECODE (lvl, 1, menu_id, NULL) purity, unique_id,
    menu_id, parent_id, remarks, is_active, lvl
    FROM (SELECT 'A' unique_id, menu_id, parent_id, remarks, is_active, lEVEL lvl
    FROM adm_menuconfig t
    START WITH menu_id IN (SELECT adm.menu_id
    FROM adm_users adu,
    adm_user_auth_role adur,
    adm_rolemenumapping adr,
    adm_menuconfig adm
    WHERE adu.user_id = adur.user_id
    AND adur.role_id = adr.role_id
    AND adm.menu_id = adr.menu_id
    AND (NVL (adr.menu_add, 0) > 1 OR
    NVL (adr.menu_modify, 0) > 1 OR
    NVL (adr.menu_cancel, 0) > 1 OR
    NVL (adr.menu_view, 0) > 1 OR
    NVL (adr.menu_print, 0) > 1 OR
    NVL (adr.menu_re_print, 0) > 1 OR
    NVL (adr.menu_delete, 0) > 1 OR
    NVL (adr.menu_process, 0) > 1 OR
    NVL (adr.menu_approve, 0) > 1 OR
    NVL (adr.menu_pre_dated_entry, 0) > 1 OR
    NVL (adr.menu_import, 0) > 1 OR
    NVL (menu_export, 0) > 1 OR
    NVL (adr.menu_validation, 0) > 1)
    AND adur.is_active = 1
    AND adu.user_id = to_number(i_userId)) ------------------ ISSUE FOUND
    CONNECT BY menu_id = PRIOR parent_id)))
    SELECT parentid BULK COLLECT INTO array_tab/*Parent_Tab*/ -- Plsql Type
    FROM (SELECT parentid, (SELECT lvl
    FROM MAINDATA md
    WHERE md.parent_id = parentid
    AND ROWNUM = 1) lvl
    FROM (SELECT DISTINCT parent_id parentid
    FROM adm_menuconfig t
    START WITH menu_id IN
    (SELECT menu_id
    FROM MAINDATA
    WHERE lvl = 1)
    CONNECT BY menu_id = PRIOR parent_id)
    WHERE parentid IS NOT NULL)
    ORDER BY lvl;
    EXCEPTION
    WHEN OTHERS THEN
    o_Return := 1;
    END ADM_MENUSUBLEVEL_GET;
    Regards
    Nims

    user12265791 wrote:
    i'm been using the SP without TO_NUMBER (i_userId) in my database 11g which works fine.
    When the same Script is been imported to another 11g Database.. the query fetches NOTHING..... And it Works only when i had given TO_NUMBER (i_userId)........
    Why is its So?........
    Is this issue occur due to any installation problem, or Database creation problem.............Check the datatypes involved on the machine where it is not working. Its possible an implicit datatype conversion is taking place and is producing different results (leading spaces, for instance, in a string) than the TO_NUMBER

  • How to define FORMAL parameters for TABLES in OOPS?

    Hello Experts,
    Below is the custom code, would like to put in a user-exit
    PERFORM my_routine
    IN PROGRAM my_report
    TABLES standard_sap_vbap_tab
    USING standard_sap_variable
    CHAGING standard_sap_variable
    Pls. let me know How to write the FORM in perspective of data objects defination in OOPS for the above routine.
    FORM here_pl_let_me_know_how_to_define_the_data_objects
    ENDFORM.
    Thank you
    Moderator message: please search for available information/documentation before asking.
    Edited by: Thomas Zloch on Nov 10, 2010 3:40 PM

    This is a very basic question. F1 help on statement form will do.

  • Parameters....formal and actual parameters...

    when we need parameters, the concept of formal and acutal perameters with simple examples...pl

    Hi Balaji..
    We need parameters for Modularization and reuse of the code..
    Suppose that your report have five internal tables and you have to consolidate(sum up) the records in the table. This way you will need the same logic 5 times..
    So, instead of coding 5 times, we create a subroutine with parameters.. We will give a parameter type table to this subroutine and call this subroutine 5 times, passing the name of our 5 tables..
    The formal parameters are the parameters  that you define in the subroutine declaration.. FORM f_test_subroutine TABLES t_itab STRUCTURE e_itab
    USING us_par1
    CHANIGN ch_par2.
    However, the actual parameters are the actual values passed to the subroutine while calling the subroutine..
    PERFORM f_test_subroutine TABLES t_mytab
    USING w_par1
    CHANGING w_par2..
    Thanks and Best Regards,
    Vikas Bittera.
    ***Points for useful answers ***

  • How to use/declare actual and formal paramters in ECC 6.0?

    Experts,
      I am new to ECC 6.0, and
    Please help me how to pass workarea in actual parameters ( I need to use USING/CHANGING or TABLES ?  please correct me ).
    And in FORM logic_4_ord_status,  how to declare work area and variables in formal parameters signature ???
    I have declared:
    TYPES : BEGIN OF ty_869_input_rec,
              rec_type(2)   TYPE c,
              cntrl_no(50)  TYPE c,
              rep_flag(1)   TYPE c,
              edi_tr_par(16) TYPE c,
              sap_cust_no(100) TYPE c,
              brd_idfr(4) TYPE c,
              canc_date(8) TYPE c,    " Promised to ship by date
              po_no(18) TYPE c,
              cust_cntrt_po_no(18) TYPE c,
              selection(2) TYPE c,
            END OF ty_869_input_rec.
    TYPES : BEGIN OF ty_870_output_rec,
              rec_type(2)       TYPE c,
              cntrl_no(50)      YPE c,
              rep_flag(1)       TYPE c,
              edi_tr_par(16)    TYPE c,
              sap_cust_no       TYPE vbeln_va,
              brd_idfr          TYPE vkorg,
              po_no             TYPE bstnk,
              cust_cntrt_po_no TYPE bstnk,
              selection(2)      TYPE c,
            END OF ty_870_output_rec.
    Internal table declarations.
    DATA : gt_869_input_rec TYPE TABLE OF ty_869_input_rec,
           gt_870_output_rec   TYPE TABLE OF ty_870_output_rec.
    Workarea declations.
    DATA : wa_869_input_rec   TYPE          ty_869_input_rec,
           wa_870_output_rec      TYPE          ty_870_output_rec.
      DATA :  lv_order_qty     TYPE wmeng,
              lv_cancelled1    TYPE wmeng,
              lv_cancelled2    TYPE wmeng,
            lv_delivery      TYPE lfimg,
              lv_open_qty      TYPE lfimg,
              lv_neworderqty   TYPE lfimg,
            lv_pickedqty     TYPE lfimg,
              lv_unshipped_qty TYPE lfimg.
         perform logic_4_ord_status
                             USING   wa_869_INPUT_REC
                                          lv_order_qty
                                          lv_delivery
                                          lv_open_qty
                                          lv_j_3acada
                                          lv_j_3arqda
                                          lv_cancelled1
                                          lv_zzactcnt
                                          lv_zzstatus
                             changing  wa_870_output_rec                        
    form logic_4_ord_status
                    using   p_wa_869_input_rec  type TY_869_input_rec
                                     p_lv_order_qty
                                     p_lv_delivery
                                     p_lv_open_qty
                                     p_lv_j_3acada
                                     p_lv_j_3arqda
                                     p_lv_cancelled1
                                     p_lv_zzactcnt
                                     p_lv_zzstatus
                    changing  p_wa_870_output_rec type TY_870_output_rec              
        IF  p_lv_delivery LE '0'
        AND p_lv_Open_Qty GT '0'
        AND ( p_wa_869_input_recu2013canc_date <> p_lv_j_3acada )
        AND ( p_lv_zzactcnt = 'F' OR  p_lv_zzactcnt = 0 ).
          p_wa_870_output_rec-shp_ord_status = 'RD' .
          p_wa_870_output_rec-order_qty      = p_lv_order_qty.
          p_wa_870_output_rec-open_qty       = p_lv_open_qty.
      FOR 1st 'SC'
        ELSEIF p_lv_delivery LE '0'
        AND    p_lv_Open_Qty GT '0'
        AND    ( p_lv_cancelled1 GT '0' )
        AND   ( p_lv_zzstatus = 'F'
             OR p_lv_zzactcnt = '0' ).
    I could not declare actual and formal parameters correctly .
    Kindly help me.
    I am getting error at p_wa_869_input_recu2013canc_date.
    Please validate me ...
    THANKS IN ADV.

    It depends on which BW environment has an RFC connection to the ECC environment you're activating the DataSource in. Typically, environments are paired, similar (but not always) like the depiction below:
    ECC Development <-> BW Development
    ECC QA <-> BW QA
    ECC Production <-> BW Production
    Best Practices suggest that a DataSource be activated and put on a transport in the ECC Development environment. Upon activation of the DataSource in ECC Development, replication of the DataSource in the BW Development environment can take place and Best Practices suggest putting the DataSource on a transport in BW. As the ECC transport is promoted throughout the ECC landscape, the BW transport is promoted throughout the BW landscape in order to keep them in sync.
    So, if the envrionment that you've just activated the DataSource has an RFC connection to your BW Production environment, you can replicate in BW Production and if that's your standard practice, then that's the way your should do it. It's typically, however, not considered a Best Practice to be able to create, update or delete in a production environment.

  • Calling a stored procedure with default parameters

    Dear all,
    I am trying to call a stored procedure that has not all the parameters compulsory, and indeed, there are some I am not interested in. Therefore, I would like to call the stored procedure initializing only some of the parameters but if I miss some of them, I have an SQLException thrown. Is there any way to do that?
    Thanks
    Marie

    Hi
    One way to do it is ---
    By using Default Parameters you can miss few parameters while calling a procedure.
    =================================================================
    As the example below shows, you can initialize IN parameters to default values. That way, you can pass different numbers of actual parameters to a subprogram, accepting or overriding the default values as you please.
    Moreover, you can add new formal parameters without having to change every call to the subprogram.
    PROCEDURE create_dept (
    new_dname VARCHAR2 DEFAULT 'TEMP',
    new_loc VARCHAR2 DEFAULT 'TEMP') IS
    BEGIN
    INSERT INTO dept
    VALUES (deptno_seq.NEXTVAL, new_dname, new_loc);
    END;
    If an actual parameter is not passed, the default value of its corresponding formal parameter is used.
    Consider the following calls to create_dept:
    create_dept;
    create_dept('MARKETING');
    create_dept('MARKETING', 'NEW YORK');
    The first call passes no actual parameters, so both default values are used.
    The second call passes one actual parameter, so the default value for new_loc is used.
    The third call passes two actual parameters, so neither default value is used.
    Usually, you can use positional notation to override the default values of formal parameters.
    However, you cannot skip a formal parameter by leaving out its actual parameter.
    For example, the following call incorrectly associates the actual parameter 'NEW YORK' with the formal parameter new_dname:
    create_dept('NEW YORK'); -- incorrect
    You cannot solve the problem by leaving a placeholder for the actual parameter.
    For example, the following call is illegal:
    create_dept(, 'NEW YORK'); -- illegal
    In such cases, you must use named notation, as follows:
    create_dept(new_loc => 'NEW YORK');
    ===============================================================
    For more details refer URL http://technet.oracle.com/doc/server.804/a58236/07_subs.htm#3651
    Hope this helps
    Regards
    Ashwini

  • Calling Stored Procedure with parameters from a C program

    Hello, I need to call a PL/SQL stored procedure from a C program.
    Something like this sample program provided by Oracle -
    main()
    int i;
    EXEC SQL BEGIN DECLARE SECTION;
    */* Define type for null-terminated strings. */*
    EXEC SQL TYPE asciz IS STRING(20);
    asciz  username[20];
    asciz  password[20];
    int    dept_no;    / which department to query */*
    char   emp_name[10][21];
    char   job[10][21];
    EXEC SQL VAR emp_name is STRING (21);
    EXEC SQL VAR job is STRING (21);
    float  salary[10];
    int    done_flag;
    int    array_size;
    int    num_ret;    / number of rows returned */*
    int    SQLCODE;
    EXEC SQL END DECLARE SECTION;
    */* Connect to Oracle. */*
    strcpy(username, "SCOTT");
    strcpy(password, "TIGER");
    EXEC SQL WHENEVER SQLERROR DO sqlerror();
    EXEC SQL CONNECT :username IDENTIFIED BY :password;
    printf("Enter department number: ");
    scanf("%d", &dept_no);
    fflush(stdin);
    */* Set the array size. */*
    array_size = 10;
    done_flag = 0;
    num_ret = 0;
    */* Array fetch loop - ends when NOT FOUND becomes true. */*
    EXEC SQL EXECUTE
    BEGIN personnel.get_employees
    *(:dept_no, :array_size, :num_ret, :done_flag,*
    *:emp_name, :job, :salary);*
    END;
    END-EXEC;
    The question is - how is the Stored procedure get_employees declared ? Or more specifically, how is the salary parameter declared in get_employees ? Any help is highly appreciated.

    Hope following will help
    NOTE: Not tested
    Calling a stored procedure
    This program connects to ORACLE using the SCOTT/TIGER
    account. The program declares several host arrays, then
    calls a PL/SQL stored procedure (GET_EMPLOYEES in the
    CALLDEMO package) that fills the table OUT parameters. The
    PL/SQL procedure returns up to ASIZE values.
    It keeps calling GET_EMPLOYEES, getting ASIZE arrays
    each time, and printing the values, until all rows have been
    retrieved. GET_EMPLOYEES sets the done_flag to indicate "no
    more data."
    #include <stdio.h>
    #include <string.h>
    EXEC SQL INCLUDE sqlca.h;
    typedef char asciz[20];
    typedef char vc2_arr[11];
    EXEC SQL BEGIN DECLARE SECTION;
    /* User-defined type for null-terminated strings */
    EXEC SQL TYPE asciz IS STRING(20) REFERENCE;
    /* User-defined type for a VARCHAR array element. */
    EXEC SQL TYPE vc2_arr IS VARCHAR2(11) REFERENCE;
    asciz username;
    asciz password;
    int dept_no; /* which department to query? */
    vc2_arr emp_name[10]; /* array of returned names */
    vc2_arr job[10];
    float salary[10];
    int done_flag;
    int array_size;
    int num_ret; /* number of rows returned */
    EXEC SQL END DECLARE SECTION;
    long SQLCODE;
    void print_rows(); /* produces program output */
    void sql_error(); /* handles unrecoverable errors */
    main()
    int i;
    char temp_buf[32];
    /* Connect to ORACLE. */
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    strcpy(username, "scott");
    strcpy(password, "tiger");
    EXEC SQL CONNECT :username IDENTIFIED BY :password;
    printf("\nConnected to ORACLE as user: %s\n\n", username);
    printf("Enter department number: ");
    gets(temp_buf);
    dept_no = atoi(temp_buf);/* Print column headers. */
    printf("\n\n");
    printf("%-10.10s%-10.10s%s\n", "Employee", "Job", "Salary");
    printf("%-10.10s%-10.10s%s\n", "--------", "---", "------");
    /* Set the array size. */
    array_size = 10;
    done_flag = 0;
    num_ret = 0;
    /* Array fetch loop.
    * The loop continues until the OUT parameter done_flag is set.
    * Pass in the department number, and the array size--
    * get names, jobs, and salaries back.
    for (;;)
    EXEC SQL EXECUTE
    BEGIN calldemo.get_employees
    (:dept_no, :array_size, :num_ret, :done_flag,
    :emp_name, :job, :salary);
    END;
    END-EXEC;
    print_rows(num_ret);
    if (done_flag)
    break;
    /* Disconnect from the database. */
    EXEC SQL COMMIT WORK RELEASE;
    exit(0);
    void
    print_rows(n)
    int n;
    int i;
    if (n == 0)
    printf("No rows retrieved.\n");
    return;
    for (i = 0; i < n; i++)
    printf("%10.10s%10.10s%6.2f\n",
    emp_name, job[i], salary[i]);
    /* Handle errors. Exit on any error. */
    void
    sql_error()
    char msg[512];
    int buf_len, msg_len;
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    buf_len = sizeof(msg);
    sqlglm(msg, &buf_len, &msg_len);
    printf("\nORACLE error detected:");
    printf("\n%.*s \n", msg_len, msg);
    EXEC SQL ROLLBACK WORK RELEASE;
    exit(1);
    Remember, the datatype of each actual parameter must be convertible to the datatype of its corresponding formal parameter. Also, before a stored procedure is exited, all OUT formal parameters must be assigned values. Otherwise, the values of corresponding actual parameters are indeterminate.
    SQLCHECK=SEMANTICS is required when using an anonymous PL/SQL block.

  • How to pass more number of parameters in procedure

    How can we send 1000 parametrs in a procedure?
    is there any other method to pass parameters without defning 1000 parametrs
    Any example really helpful

    I know it's a hint, but have you ever known it to be ignored? Can you provide a working example showing it being ignored?Well it is not hard to demonstrate it being ignored, but these restrictions, while not obvious, are relatively well documented.
    What does not appear to be documented is the behaviour when calling from 3GLs (or does this qualify as an external procedure call?) where I believe the hint is also ignored.
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2261
    "The use of NOCOPY increases the likelihood of parameter aliasing. For more information, see "Understanding Subprogram Parameter Aliasing".
    Remember, NOCOPY is a hint, not a directive. In the following cases, the PL/SQL compiler ignores the NOCOPY hint and uses the by-value parameter-passing method; no error is generated:
    1. The actual parameter is an element of an associative array. This restriction does not apply if the parameter is an entire associative array.
    2. The actual parameter is constrained, such as by scale or NOT NULL. This restriction does not apply to size-constrained character strings. This restriction does not extend to constrained elements or attributes of composite types.
    3. The actual and formal parameters are records, one or both records were declared using %ROWTYPE or %TYPE, and constraints on corresponding fields in the records differ.
    4. The actual and formal parameters are records, the actual parameter was declared (implicitly) as the index of a cursor FOR loop, and constraints on corresponding fields in the records differ.
    5. Passing the actual parameter requires an implicit datatype conversion.
    6. The subprogram is called through a database link or as an external procedure."
    For example, consider rule #2 above and compare output of first block (with unconstrained NUMBER datatype) with second (with constrained NUMBER datatype).
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> SET SERVEROUTPUT ON;
    SQL> <<anonymous_block>>
      2  DECLARE
      3     variable_name NUMBER := 0;
      4
      5     PROCEDURE procedure_name (
      6        parameter_name   IN OUT NOCOPY   NUMBER)
      7     IS
      8     BEGIN
      9        dbms_output.put_line ('#2 variable_name => ' || variable_name);
    10        parameter_name := parameter_name + 1;
    11        dbms_output.put_line ('#3 variable_name => ' || variable_name);
    12     END procedure_name;
    13  BEGIN
    14     dbms_output.put_line ('#1 variable_name => ' || variable_name);
    15     procedure_name (variable_name);
    16     dbms_output.put_line ('#4 variable_name => ' || variable_name);
    17  END anonymous_block;
    18  /
    #1 variable_name => 0
    #2 variable_name => 0
    #3 variable_name => 1
    #4 variable_name => 1
    PL/SQL procedure successfully completed.
    SQL> <<anonymous_block>>
      2  DECLARE
      3     variable_name NUMBER (10) := 0;
      4
      5     PROCEDURE procedure_name (
      6        parameter_name IN OUT NOCOPY NUMBER)
      7     IS
      8     BEGIN
      9        dbms_output.put_line ('#2 variable_name => ' || variable_name);
    10        parameter_name := parameter_name + 1;
    11        dbms_output.put_line ('#3 variable_name => ' || variable_name);
    12     END procedure_name;
    13  BEGIN
    14     dbms_output.put_line ('#1 variable_name => ' || variable_name);
    15     procedure_name (variable_name);
    16     dbms_output.put_line ('#4 variable_name => ' || variable_name);
    17  END anonymous_block;
    18  /
    #1 variable_name => 0
    #2 variable_name => 0
    #3 variable_name => 0
    #4 variable_name => 1
    PL/SQL procedure successfully completed.
    SQL>

  • PERFORM ENTRY_NEU IN PROGRAM parameters error

    Hi,
    Looking for the cause of this error please:
    "Short text: Too many parameters specified with PERFORM.
    The reason for the exception is:
    A PERFORM was used to call the routine "ENTRY_NEU" of the program
    "Z_PGM".
    This routine contains 2 formal parameters, but the current call
    contains 4 actual parameters."
    Sapscript:
    /: PERFORM ENTRY_NEU IN PROGRAM Z_PGM
    /: USING SPACE
    /: USING SPACE
    /: ENDPERFORM
    Z_PGM:
    form entry_neu using return_code us_screen.
    coding here...
    endform.
    Thks,
    William

    Hi William,
    The pasted code that you show for your form routine doesn't look good. Whenever you call a form routine from SAPscript, they must be of the following form (standardized interface):
    FORM <form> TABLES in_params  STRUCTURE ITCSY
                       out_params STRUCTURE ITCSY.
    * Coding
    ENDFORM.
    Structure ITCSY has two fields, representing the parameter name (NAME) and the corresponding parameter value (VALUE). You can find an explanation with more details in the [SAP help link pasted by Rob above|http://help.sap.com/saphelp_40b/helpdata/en/d1/803279454211d189710000e8322d00/content.htm] or you can also check the corresponding entry in the [wiki|http://wiki.sdn.sap.com/wiki/display/ABAP/SUBROUTINESANDTHEIRUSEIN+SAPSCRIPT].
    So please adjust your form routine ENTRY_NEU so that it's compliant with the required interface. One more comment though: Your call looks a bit odd, because ENTRY_NEU is often the default name within a print program for triggering the SAPscript output. This form routine is usually called by the standard SAP printing framework (i.e. configuration of output type). Thus the name of the form sounds a bit odd to me, but maybe in your case it's something different...
    Best wishes, harald

  • Subroutine parameters ..by default pass by value or pass by ref

    how parameters pass ?  value or ref
    if we use changing in both perform and form...will it become CALL BY REF?
    Message was edited by:
            balaji velpuri

    Hi,
    <u><b>The Parameter Interface</b></u>
    The USING and CHANGING additions in the FORM statement define the formal parameters of a subroutine. The sequence of the additions is fixed. Each addition can be followed by a list of any number of formal parameters. When you call a subroutine, you must fill all formal parameters with the values from the actual parameters. At the end of the subroutine, the formal parameters are passed back to the corresponding actual parameters.
    Within a subroutine, formal parameters behave like dynamic local data. You can use them in the same way as normal local data objects that you would declare with the DATA statement. They mask global data objects with the same name. The value of the parameters at the start of the subroutine is the value passed from the corresponding actual parameter.
    Subroutines can have the following formal parameters:
    <u><b>Parameters Passed by Reference</b></u>
    You list these parameters after USING or CHANGING without the VALUE addition:
    FORM <subr> USING ... <pi> [TYPE <t>|LIKE <f>] ...
    CHANGING ... <pi> [TYPE <t>|LIKE <f>] ...
    The formal parameter occupies no memory of its own. During a subroutine call, only the address of the actual parameter is transferred to the formal parameter. The subroutine works with the field from the calling program. If the value of the formal parameter changes, the contents of the actual parameter in the calling program also change.
    For calling by reference, USING and CHANGING are equivalent. For documentation purposes, you should use USING for input parameters which are not changed in the subroutine, and CHANGING for output parameters which are changed in the subroutine.
    To avoid the value of an actual parameter being changed automatically, you must pass it by value.
    <u><b>Input Parameters That Pass Values</b></u>
    You list these parameters after USING with the VALUE addition:
    FORM <subr> USING ... VALUE(<pi>) [TYPE <t>|LIKE <f>] ...
    The formal parameter occupies its own memory space. When you call the subroutine, the value of the actual parameter is passed to the formal parameter. If the value of the formal parameter changes, this has no effect on the actual parameter.
    <u><b>Output Parameters That Pass Values</b></u>
    You list these parameters after CHANGING with the VALUE addition:
    FORM <subr> CHANGING ... VALUE(<pi>) [TYPE <t>|LIKE <f>] ...
    The formal parameter occupies its own memory space. When you call the subroutine, the value of the actual parameter is passed to the formal parameter. If the subroutine concludes successfully, that is, when the ENDFORM statement occurs, or when the subroutine is terminated through a CHECK or EXIT statement, the current value of the formal parameter is copied into the actual parameter.
    If the subroutine terminates prematurely due to an error message, no value is passed. It only makes sense to terminate a subroutine through an error message in the PAI processing of a screen, that is, in a PAI module, in the AT SELECTION-SCREEN event, or after an interactive list event.
    <u><b>Specifying the Type of Formal Parameters</b></u>
    Formal parameters can have any valid ABAP data type. You can specify the type of a formal parameter, either generically or fully, using the TYPE or LIKE addition. If you specify a generic type, the type of the formal parameter is either partially specified or not specified at all. Any attributes that are not specified are inherited from the corresponding actual parameter when the subroutine is called. If you specify the type fully, all of the technical attributes of the formal parameter are defined with the subroutine definition.
    The following remarks about specifying the types of parameters also apply to the parameters of other procedures (function modules and methods). If you have specified the type of the formal parameters, the system checks that the
    corresponding actual parameters are compatible when the subroutine is called. For internal subroutines, the system checks this in the syntax check. For external subroutines, the check cannot occur until runtime. By specifying the type, you ensure that a subroutine always works with the correct data type. Generic formal parameters allow a large degree of freedom when you call subroutines, since you can pass data of any type. This restricts accordingly the options for processing data in the subroutine, since the operations must be valid for all data types. For example, assigning one data object to another may not even be possible for all data types. If you specify the types of subroutine parameters, you can perform a much wider range of operations, since only the data appropriate to those operations can be passed in the call. If you want to process structured data objects component by component in a subroutine, you must specify the type of the parameter.
    Regards,
    Bhaskar

  • Regarding changing parameters

    hi experts,
                     cud u plz send me your own  small coding which let me about the functionality of changing parameters.....thnx in advance....
    plz dnt copy and paste it from net.......

    Hi,
    CHANGING parameters are input and output parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input or output parameter. When the function module is called, the content of the actual parameter is passed to the input/output parameter, and when the function module is completed, the content of the input/output parameter is passed to the actual parameter. TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
    Exceptions
    The exception of a function module are defined on the Exceptions tab page in the Function Builder. Here you can select exception classes to define whether class-based exceptions are declared or non-class-based exception are defined. Class-based exceptions are represented in the above syntax by RAISING, and non-class-based exceptions are represented by EXCEPTIONS.
    The addition RAISING is used to declare class-based exceptions that can be propagated from the function module to the caller. Exceptions in the categories CX_STATIC_CHECK and CX_DYNAMIC_CHECK must be explicitly declared, otherwise a propagation can lead to an interface violation. A violation of the interface leads to the treatable exception CX_SY_NO_HANDLER. Exceptions of the category CX_NO_CHECK are implicitly always declared. The declaration of exceptions of the category CX_STATIC_CHECK is statically checked in the syntax check. For exceptions of the category CX_DYNAMIC_CHECK, the check is not performed until runtime. In a function module in which class-based exceptions are declared with the RAISING addition, the statement CATCH SYSTEM-EXCEPTIONS cannot be used. Instead, the relevant treatable exceptions should be handled in a TRY control structure.
    The addition EXCEPTIONS is used to define a list of non-class-based exceptions that can be triggered in the function module using the statements RAISE or MESSAGE RAISING. Exceptions defined in this way - as with formal parameters - are bound to the function module and cannot be propagated. If an exception of this type is triggered in a function module, and no return value has been assigned to it with the homonymous addition EXCEPTIONS of the CALL FUNCTION statement when the call was made, this leads to a runtime error.
    Note
    For new developments after release 6.10, SAP recommends that you work with class-based exceptions that are independent of the function module.
    RFC is a technology which is used to access a functions (Modules) from
    the remote systems.
    If a function module is set as remote enabled which can be access from
    the remote system via RFC.Eg: U can access the Remote enabled function modules in ur VB,Webdynpro,Java,Visual composer program.
    A function module can be set as remote enabled by SE37->Go to ur FM->click the option Button "remote enabled".
    But Normal function modules can not accessd from the remote system.
    Good Example for RFC enabled function module is : BAPI(Business Application Programming Interface)
    Note: All BAPIs are Remote enabled but not all remote enabled function modules are BAPI.
    CALLING A FUNCTION MODULE:
    1)In U ABAP Editor --> Click "Patter" ---> Selection Option Button "Call Function"
    --> Write the Corresponding FM name --> Hit Enter
    2)The appropriate import ,export Parameters will be displayed in ur editor
    3)Pass the Values Here.
    Also check these links.
    http://www.geocities.com/victorav15/sapr3/abapfun.html
    Check this link:
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    Check this link:
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    See the following links:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
    REPORT demo_mod_tech_example_2 .
    DATA: num TYPE i VALUE 5,
    fac TYPE i VALUE 0.
    PERFORM fact USING num CHANGING fac.
    WRITE: / 'Factorial of', num, 'is', fac. "#EC NOTEXT
    FORM fact
    USING value(f_num) TYPE i
    CHANGING f_fact TYPE i.
    f_fact = 1.
    WHILE f_num GE 1.
    f_fact = f_fact * f_num.
    f_num = f_num - 1.
    ENDWHILE.
    ENDFORM.
    Regards,
    Priyanka.

Maybe you are looking for

  • All-day events across multiple days

    Okay, this is a very specifc question about a very specific situaiton, but I am curious to know what is going on. When I have an all-day event scheduled for one day in iCal and I sync it with my phone (Motorola v551) it shows up as a nice little note

  • Making a trivia game.

    I was looking at making a sports trivia java game. I want to make it so it starts with 20 seconds and goes down and the faster you answer it the seconds left equals how many points you get. Does anyone have any left over code or a similar style of ga

  • How to call a C sort function to sort a Java Array.

    My name is David, I'm interning this summer doing some High Performance Computing work. I'm significantly out of my comfort zone here; I am primarily a network/network security geek, not a programming guy. I took one Java based class called problem s

  • (PS CS3) Selecting all text to change fill color?

    I have a graphic with text - the text was not inserted by Photoshop, and it's not selectable as text; it's just part of the graphic.  I'd like to change the color of the text. I can select each letter and individual block of punctuation, etc. by usin

  • Photoshop elements 8 unexpectedly quits all the time

    I am using a Mac.