Calling function in to procedure

how can i call a function in a procedure?
i m calculating average in function and i want to display that avg in dbms output of
procedure.how can i do that?

u want to claculate the avg value for entire records
create a function with in parameter.
and call that function in procedure.in this case u have to use cursor
and call that function in loop.
regards

Similar Messages

  • Problem calling function inside a procedure

    I have a procedure that simply calls a function, but I'm not sure how to declare it.
    When I run my script oracle returns an error:
    CREATE OR REPLACE PROCEDURE pr_entrada_close(
         var_id_entrada int)
    AS
    BEGIN
         fn_criaJobAnalise(var_id_entrada);
    END;
    ERROR at line 5: PL/SQL: Statement ignored3. AS
    4. BEGIN
    5.      fn_criaJobAnalise(var_id_entrada);
    6. END;

    As far as I know, that structure worked in at least 8.0 and possibly earlier. I actually saw something similar in production code on that version of Oracle. The actual function took several parameters, and using those paramters did a series of statements along the lines of:
    BEGIN
       SELECT 1 INTO l_var
       FROM table1
       WHERE <predicates>
    EXCEPTION
       WHEN NO_DATA_FOUND THEN
          RAISE APPLICATION_ERROR (-20001, 'Error');
       WHEN TOO_MANY_ROWS THEN
          RAISE APPLICATION_ERROR (-20002, 'Error');
    END;
    BEGIN
       SELECT 1 INTO l_var
       FROM table2
       WHERE <predicates>
    EXCEPTION
       WHEN NO_DATA_FOUND THEN
          RAISE APPLICATION_ERROR (-20003, 'Error');
       WHEN TOO_MANY_ROWS THEN
          RAISE APPLICATION_ERROR (-20004, 'Error');
    END;
    -- About 4 or 5 more tables checked
    RETURN 1;and the caller looked kind of like:
    DECLARE
       NO_ROWS_TABLE1 EXCEPTION;
       DUP_ROWS_TABLE1 EXCEPTION;
       NO_ROWS_TABLE2 EXCEPTION;
       DUP_ROWS_TABLE2 EXCEPTION;
       PRAGMA EXCEPTION_INIT (NO_ROWS_TABLE1, -20001);
       PRAGMA EXCEPTION_INIT (DUP_ROWS_TABLE1, -20002);
       PRAGMA EXCEPTION_INIT (NO_ROWS_TABLE2, -20003);
       PRAGMA EXCEPTION_INIT (DUP_ROWS_TABLE2, -20004);
       l_v NUMBER;
    BEGIN
       BEGIN
          l_v := test_tables(<parameters>);
       EXCEPTION
          WHEN NO_ROWS_TABLE1 THEN
             <do something about it>
          WHEN DUP_ROWS_TABLE1 THEN
             <do something about it>
          WHEN NO_ROWS_TABLE2 THEN
             <do something about it>
          WHEN DUP_ROWS_TABLE2 THEN
             <do something about it>
       END;
       <Continue normal processing>
    END;and, yes, <Continue normal processing> occasionally failed for mysterious reasons when more than one of the checks would have failed had the function got to them, and l_v was never ever used.
    This was one of the clevererbits of code in that app.
    John

  • Calling Function in Stored Procedure

    Hi all,
    I've created table below,
    CREATE TABLE TEST
      ID                  NUMBER(3)    NOT NULL,
      selectcode          VARCHAR2(10),
      value_use           VARCHAR2(10),
      bin_no              NUMBER(10),
      markup              VARCHAR2(40),
      descr               VARCHAR2(100),
      value_imp           VARCHAR2(90)
    create sequence idseq;
    insert into test values (idseq.nextval,'rel','C1',1,'master','test1');
    insert into test values (idseq.nextval,'rel','C1',1,'masterdir','test2');
    insert into test values (idseq.nextval,'rel','C1',2,'master','test3');
    insert into test values (idseq.nextval,'rel','C2',2,'masterdir','test4');
    insert into test values (idseq.nextval,'rel','C2',2,'master','test5');
    insert into test values (idseq.nextval,'rel1','C2',1,'master','test6');
    insert into test values (idseq.nextval,'rel1','C2',1,'masterdir','test7');
    select * from test;
    ID     SELECTCODE     VALUE_USE      BIN_NO     MARKUP                  DESCR
    1         rel                C1              1     master                  test1
    2         rel                C1              1     masterdir          test2
    3         rel            C1              2     master                  test3
    4         rel                C2            2     masterdir          test4
    5         rel                C2              2     master                  test5
    6         rel1        C2              1     master                   test6
    7         rel1           C2              1     masterdir            test6There is an existing function called valcon which returns data for value_imp based on value_use and markup in the table.
    SQL>select valcon ('C1','master',' ','VALUE',' ') output from dual;
    OUTPUT
    Value In County
    I created a stored procedure, to insert values to this table using this function.. But I'm not sure how to pass the value inside the function..
    CREATE OR REPLACE PROCEDURE test_sp
      ( in_selectcode    IN varchar2,
        in_valueuse      IN varchar2
    AS
    cursor val_cur is
        select *
        from test
        where ....;
    TYPE val_typ IS TABLE OF val_cur%ROWTYPE;
    val_arr  val_typ;
    begin
    open cursor..
    fetch cursor into val_arr;
    FOR ..
      LOOP
         insert into test (id, selectcode, value_use, selectval,value_imp)
         select  id_seq.nextval, in_selectcode, 'C1',  Nvl2(Trim(in_selectcode),'Y','N'),
         valcon ('val_arr.value_use','val_arr.markup',' ','VALUE',' ')
         from dual;
    end loop;
    close cursor;
    end;
    end test_sp
    / Since i'm using an array, can you please tell me how I can pass 'val_arr.value_use' as a string in the function? I researched a lot to find this, but I couldnt find how I can do this.
    Thank you

    I've used an update query to update test.bin_no in a sequence for the same selectcode and value_use. But I'm trying to see if I can do this within the insert query so I dont have to duplicate the work with one insert and one update.
    The procedure below works with update query:
    CREATE TABLE TEST
      ID                  NUMBER(3)    NOT NULL,
      selectcode          VARCHAR2(10),
      value_use           VARCHAR2(10),
      bin_no              NUMBER(10),
      markup              VARCHAR2(40),
      descr               VARCHAR2(100),
      value_imp           VARCHAR2(90)
    create sequence idseq;
    insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel','C1',1,'Y');
    insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel','C1',1,'Y');
    insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel','C1',2,'Y');
    insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel','C2',2,'Y');
    insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel','C2',2,'Y');
    insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel1','C2',1,'Y');
    insert into test (id,selectcode,value_use,bin_no,value_imp) values (idseq.nextval,'rel1','C2',1,'Y');
    select * from test;
    ID     SELECTCODE     VALUE_USE      BIN_NO     VALUE_IMP     
    1         rel                C1              1     Y           
    2         rel                C1              2     Y         
    3         rel            C1              2     Y          
    4         rel                C2            2     Y  
    5         rel                C2              2     Y                
    6         rel1        C2              1     Y            
    7         rel1           C2              1     Y      
    CREATE OR REPLACE PROCEDURE test_sp (in_selectcode   IN VARCHAR2,
                                         in_valueuse     IN VARCHAR2
                                        ) AS
      msg   VARCHAR2 (4000);
    BEGIN
      INSERT INTO test (id, selectcode, value_use, bin_no, selectval, value_imp
        SELECT   id_seq.NEXTVAL,
                 in_selectcode,
                 'C1',
                 bin_no,
                 NVL2 (TRIM (in_selectcode), 'Y', 'N'),
                 valcon (value_use, markup, ' ', 'VALUE', ' ')
        FROM     kn_job
        WHERE    scode= in_selectcode;
         update test t
         set t.bin_no = (select t1.r from
                  (select rowid, ROW_NUMBER() OVER(PARTITION BY in_selectcode, in_valueuse ORDER BY id asc) r from test) t1
                  where t.rowid=t1.rowid);
    end test_sp
    select * from test;
    ID     SELECTCODE     VALUE_USE      BIN_NO     VALUE_IMP     
    1         rel                C1              1     Y           
    2         rel                C1              2     Y         
    3         rel            C1              3     Y          
    4         rel                C2            1     Y  
    5         rel                C2              2     Y                
    6         rel1        C2              1     Y            
    7         rel1           C2              2     Y       But is it possible to do this without an update query? Updating bin_no in a sequence for selectcode,value_use?
    Thanks

  • Need to call funtion in stored procedure to run one customized report

    Hi,
    I need to call one function in stored procedure for our customized report. Can anyone please help me in calling the function in stored procedure and provide the syntax for the same.
    Thanks,
    Kalpana.

    Either open an existing report. You'l see so many examples.
    or
    http://www.google.co.in/#hl=en&source=hp&biw=1024&bih=586&q=call+function+in+stored+procedure+sql&aq=1&aqi=g2g-m2&aql=&oq=Call+function+in+stored&gs_rfai=&fp=dbefe777997d3915

  • How can I call a function from a procedure

    I have a function named: f_calc_value which return the variable v_result. This function is part of a package.
    How can I call this function from a new procedure I am creating?
    Thanks

    or refer this theread....calling function from procedure

  • Call a PL/SQL procedure or function from applet

    Could anyone please let me know how I could call a PL/SQL procedure
    or function from a JDBC method from applet with Internet Explorer?

    It depends from where you are calling your PLSQL routine. If it is SQL*Plus then you can use & (ampersand) with the variable to be input at run time.
    If you are executing the PLSQL routine from another application (some front end application) then it's not possible. Because when a procedure is executing at server side, the front end application does not have control, and the control is only transfered back to front end application when the PLSQL routine either completes successfully or throws an exception.
    In either case, you can not go back to the PLSQL routine.
    In this case, what you can do is, write code in your front end application to get that variable value from user and then pass that value to PLSQL routine.

  • Calling a Function inside a procedure

    Can you call a function inside a procedure?...if so....how?

    Not all built-in functions can be used directly in an assignment.
    SQL> CREATE PROCEDURE p (p_val IN VARCHAR2) AS
      2  l_v VARCHAR2(10);
      3  BEGIN
      4     l_v := DECODE(p_val,'YES','TRUE','FALSE');
      5  END;
      6  /
    Warning: Procedure created with compilation errors.
    SQL> show error
    Errors for PROCEDURE P:
    LINE/COL ERROR
    4/4      PL/SQL: Statement ignored
    4/11     PLS-00204: function or pseudo-column 'DECODE' may be used inside
             a SQL statement onlyTTFN
    John

  • Calling function in procedure...A tricky one

    hi guys,
    Here is a tricky thing ...
    There is actually a Whole book which has Risk and XYZ portfolio books and other books as well.
    The below procedure actually select the risk books based on FLAG =N else it will select all the books.
    Now i need to modify this....
    Here is a thing .....instead of selecting all the books it should select XYZ portfolio list.
    Actually there is function in a package called PKG.TEST_func, This function lists all the books
    Now all i need to do is call this function in the procedure in the else part and pass the parameter for XYZ portfolio books.
    HOW DO I DO THIS????
    create or replace procedure TEST
    flg in varchar2 ,
         cur_out out sys_refcursor
    as
    begin
    if upper(flg) = 'N' then
         open cur_out for
              select distinct Book
              from bookmgr.VW_book@bookmgr_dbln
              where RISK_REP_FLG = 'N'
    ORDER BY book;
    Else
    open cur_out for
    select distinct Book
    from bookmgr.VW_book@bookmgr_dbln;
    end if;
    end test;
    Please let me know if u have any questions....
    Thank you so much in Advance....I m kinda of newbe to this world. I appriciate you help..
    thanks
    -sunny

    It will be something like ...
    Else
        cur_out :=PKG.TEST_func('XYZ portfolio list') ;
    end if;Of course,m it is your system, so only you know the actually value of the parameter.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • How can i call my function from a procedure?

    My function is:
    create or replace FUNCTION test(pAttributeName IN NUMBER)
    RETURN VARCHAR2 IS
    ret VARCHAR2(100) := NULL;
    VAR n1 NUMBER
    BEGIN
    SELECT Klartext INTO ret FROM piclist WHERE ATTRIBUTNAME = 'voltage_level' and PICLIST_ID =pAttributeName;
    RETURN ret;
    Insert into BM_ATTRIB(ID_ERFASSUNG,ID_ATTRIBNAME,ATTRIB_CHA,BM_ATTRIB_ID) VALUES(1,1,ret,1);
    exception
    when no_data_found then
    ret := 'AAA'   ------- you can return any default value,if you like
    --return ret;
    return NULL;
    when others then
    dbms_output.put_line('Exception:'||sqlerrm);
    End;
    I want to call it from a procedure!
    Please help!
    Nicole

    if the function is in the same package as the procedure then merely specify the function name and parameters:
    retcode := functionname(param1..paramn);
    If in another package then:
    retcode := packagename.functionname(param1..paramn);
    If the function is in another schema then you need to grant execute rights to the package/function to the schema trying to run the function:
    grant execute on packagename/functionname to otherschema;
    you need to be the package/function schema owner to do the above grant.

  • Calling User Functions in ODI Procedure

    Hi All,
    Can anyone pass me the syntax in which i can call a ODI User Function in ODI Procedure?
    Thanks,
    Ritika

    Hi,
    just use
    function("parameter_char", parameter_number)
    Does it help you?
    Cezar Santos
    (www.odiexperts.com)

  • Calling function from procedure

    Hi,
    I have a function validate_address which returns 'Y' or 'N' to say if the address is valid or not.
    I need to call this function from a procedure - saying 'select records where the function returns 'N' (as part of the where clause)'
    Could you help me with how to achieve this, please. Thanks,
    Message was edited by:
    user6773

    Create Or Replace Procedure procedure0001 As
      vAddress          Varchar2(200) := '1 Tech Drive, Silicon Valley, CA 94109';
      vFlag             Varchar2(5);
    Begin
      vFlag := validate_address(vAddress);
      If vFlag = 'N' Then
      End If;
    End;
    or
    Create Or Replace Procedure procedure0001 As
      vAddress          Varchar2(200) := '1 Tech Drive, Silicon Valley, CA 94109';
      vFlag             Varchar2(5);
    Begin
      Select validate_address(vAddress)
        Into vFlag
        From Dual
       Where validate_address(vAddress) = 'N'
    End;
    /

  • Call Oracle function from Stored Procedure

    Hi,
    I have function Which returning one number. I want to use that number in a procedure. How to call the Oracle Function from the Procedure
    Create procedure
    AS
    Begin
    Check number;
    Select Function1 into check from dual;
    It is giving error.
    Can anyone provide me example for this.
    Thanks in advance

    Put the Check Number; before begin
    SQL> create or replace procedure abc as
      2 begin
    3 val number;
      4  select abcd into val from dual;
      5  dbms_output.put_line(val);
      6  end;
      7  /
    Warning: Procedure created with compilation errors.
    Elapsed: 00:00:00.00
    SQL> show error
    Errors for PROCEDURE ABC:
    LINE/COL ERROR
    3/5      PLS-00103: Encountered the symbol "NUMBER" when expecting one of
             the following:
             := . ( @ % ;
             The symbol ":=" was substituted for "NUMBER" to continue.
    SQL> create or replace procedure abc as
      2 val number;
    3 begin
      4  select abcd into val from dual;
      5  dbms_output.put_line(val);
      6  end;
      7  /
    Procedure created.
    Elapsed: 00:00:00.00
    SQL> exec abc;
    100.22
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL>

  • How to use CALL FUNCTION '/1BCDWB/SF00000014' in smartform urgent

    hiiiiiiiii
    Iam doing classical report n i want my output to be printed in smartform.
    So my output is in IT_FINAL table.In smartform in Form Interface Table column i had declare :::
    Parameter Name: IT_FINAL
    Type Assignment:LIKE
    Associated Type:ZSD_FINAL ( Its a structure of IT_FINAL)
    And in SE38..iam using...............
    data: FM_NAME1 type RS38L_FNAM.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    FORMNAME = 'ZCSF_SDPRSR03_PR'
    importing
    FM_NAME = FM_NAME1.
    CALL FUNCTION FM_NAME1
    EXPORTING
    IT_FINAL = IT_FINAL.
    So while running its giving dump..
    I DONT KNOW HOW TO USE THE ABOVE FUNCTION MODULE.
    CALL FUNCTION '/1BCDWB/SF00000014'
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Please suggest me with example if possible......URGENT.
    (Rewards if solved)
    Regards.

    Hi
    see the below doc and do accordingly
    How to create a New smartfrom, it is having step by step procedure
    http://sap.niraj.tripod.com/id67.html
    step by step good ex link is....
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    Here is the procedure
    1. Create a new smartforms
    Transaction code SMARTFORMS
    Create new smartforms call ZSMART
    2. Define looping process for internal table
    Pages and windows
    First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
    Here, you can specify your title and page numbering
    &SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
    Main windows -> TABLE -> DATA
    In the Loop section, tick Internal table and fill in
    ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
    3. Define table in smartforms
    Global settings :
    Form interface
    Variable name Type assignment Reference type
    ITAB1 TYPE Table Structure
    Global definitions
    Variable name Type assignment Reference type
    ITAB2 TYPE Table Structure
    4. To display the data in the form
    Make used of the Table Painter and declare the Line Type in Tabstrips Table
    e.g. HD_GEN for printing header details,
    IT_GEN for printing data details.
    You have to specify the Line Type in your Text elements in the Tabstrips Output options.
    Tick the New Line and specify the Line Type for outputting the data.
    Declare your output fields in Text elements
    Tabstrips - Output Options
    For different fonts use this Style : IDWTCERTSTYLE
    For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
    5. Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    <b>call function 'SSF_FUNCTION_MODULE_NAME'</b>
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    <b>call function FM_NAME</b>
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Smartform
    you can check this link here you can see the steps and you can do it the same by looking at it..
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    SMARTFORMS STEPS.
    1. In Tcode se11 Create a structure(struct) same like the Internal table that you are going to use in your report.
    2. Create Table type(t_struct) of stracture in se11.
    3. In your program declare Internal table(Itab) type table of structure(struct).
    4. Define work area(wa) like line of internal table.
    5. Open Tcode Smartforms
    6. In form Global setting , forminterface Import parameter define Internal table(Itab) like table type of stracture(t_struct).
    7. In form Global setting , Global definitions , in Global data define Work area(wa) like type stracture(struct).
    8. In form pages and window, create Page node by default Page1 is available.
    9. In page node you can create numbers of secondary window. But in form there is only one Main window.
    10. By right click on page you can create windows or Go to Edit, Node, Create.
    11. After creating the window right click on window create table for displaying the data that you are passing through internal table.
    12. In the table Data parameter, loop internal internal table (Itab) into work area(wa).
    13. In table there are three areas Header, Main Area, Footer.
    14. Right click on the Main area create table line by default line type1 is there select it.
    15. Divide line into cells according to your need then for each cell create Text node.
    16. In text node general attribute. Write down fields of your work area(wa) or write any thing you want to display.
    17. Save form and activate it.
    18. Then go to Environment, function module name, there you get the name of function module copy it.
    19. In your program call the function module that you have copied from your form.
    20. In your program in exporting parameter of function pass the internal table(itab).
    SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms.
    SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can
    configure forms with data from an SAP System for the relevant business processes.
    To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form. When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module.
    You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output.
    You can check individual nodes as well as the entire form and find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.
    SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as background graphics. You use background graphics to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, you can suppress the background graphic, if desired.
    SAP Smart Forms also support postage optimizing.
    Also read SAP Note No. 168368 - Smart Forms: New form tool in Release 4.6C
    What Transaction to start SAP Smart Forms?
    Execute transaction SMARTFORMS to start SAP Smart Forms.
    Key Benefits of SAP Smart Forms:
    SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time.
    You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics.
    To make changes, use Drag & Drop, Copy & Paste, and select different attributes.
    These actions do not include writing of coding lines or using a Script language.
    Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic. So you do not need a group of function modules to print a form, but only one.
    For Web publishing, the system provides a generated XML output of the processed form.
    Smart Forms provides a data stream called XML for Smart Forms (XSF) to allow the use of 3rd party printing tools. XSF passes form content from R/3 to an external product without passing any layout information about the Smart Form.
    SmartForms System Fields
    Within a form you can use the field string SFSY with its system fields. During form processing the system replaces these fields with the corresponding values. The field values come from the SAP System or are results of the processing.
    System fields of Smart Forms
    &SFSY-DATE&
    Displays the date. You determine the display format in the user master record.
    &SFSY-TIME&
    Displays the time of day in the form HH:MM:SS.
    &SFSY-PAGE&
    Inserts the number of the current print page into the text. You determine the format of the page number (for example, Arabic, numeric) in the page node.
    &SFSY-FORMPAGES&
    Displays the total number of pages for the currently processed form. This allows you to include texts such as'Page x of y' into your output.
    &SFSY-JOBPAGES&
    Contains the total page number of all forms in the currently processed print request.
    &SFSY-WINDOWNAME&
    Contains the name of the current window (string in the Window field)
    &SFSY-PAGENAME&
    Contains the name of the current page (string in the Page field)
    &SFSY-PAGEBREAK&
    Is set to 'X' after a page break (either automatic [Page 7] or command-controlled [Page 46])
    &SFSY-MAINEND&
    Is set as soon as processing of the main window on the current page ends
    &SFSY-EXCEPTION&
    Contains the name of the raised exception. You must trigger your own exceptions, which you defined in the form interface, using the user_exception macro (syntax: user_exception <exception name >).
    Example Forms Available in Standard SAP R/3
    SF_EXAMPLE_01
    Simple example; invoice with table output of flight booking for one customer
    SF_EXAMPLE_02
    Similar to SF_EXAMPLE_01 but with subtotals
    SF_EXAMPLE_03
    Similar to SF_EXAMPLE_02, whereby several customers are selected in the application program; the form is called for each customer and all form outputs are included in an output request
    Advantages of SAP Smart Forms
    SAP Smart Forms have the following advantages:
    1. The adaption of forms is supported to a large extent by graphic tools for layout and logic, so that no programming knowledge is necessary (at least 90% of all adjustments). Therefore, power user forms can also make configurations for your business processes with data from an SAP system. Consultants are only required in special cases.
    2. Displaying table structures (dynamic framing of texts)
    3. Output of background graphics, for form design in particular the use of templates which were scanned.
    4. Colored output of texts
    5. User-friendly and integrated Form Painter for the graphical design of forms
    6. Graphical Table Painter for drawing tables
    7. Reusing Font and paragraph formats in forms (Smart Styles)
    8. Data interface in XML format (XML for Smart Forms, in short XSF)
    9. Form translation is supported by standard translation tools
    10. Flexible reuse of text modules
    11. HTML output of forms (Basis release 6.10)
    12. Interactive Web forms with input fields, pushbuttons, radio buttons, etc. (Basis-Release 6.10)
    Regards
    Anji

  • Call to Oracle stored procedure that returns ref cursor doesn't work

    I'm trying to use an OData service operation with Entity Framework to call an Oracle stored procedure that takes an number as an input parameter and returns a ref cursor. The client is javascript so I'm using the rest console to test my endpoints. I have been able to successful call a regular Oracle stored procedure that takes a number parameter but doesn't return anything so I think I have the different component interactions correct. When I try calling the proc that has an ref cursor for the output I get the following an error "Invalid number or type of parameters". Here are my specifics:
    App.config
    <oracle.dataaccess.client>
    <settings>
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursor.P_RESULTS" value="implicitRefCursor bindinfo='mode=Output'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.0" value="implicitRefCursor metadata='ColumnName=WINDFARM_ID;BaseColumnName=WINDFARM_ID;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Number;ProviderType=Int32'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.1" value="implicitRefCursor metadata='ColumnName=STARTTIME;BaseColumnName=STARTTIME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.2" value="implicitRefCursor metadata='ColumnName=ENDTIME;BaseColumnName=ENDTIME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.3" value="implicitRefCursor metadata='ColumnName=TURBINE_NUMBER;BaseColumnName=TURBINE_NUMBER;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.4" value="implicitRefCursor metadata='ColumnName=NOTES;BaseColumnName=NOTES;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.5" value="implicitRefCursor metadata='ColumnName=TECHNICIAN_NAME;BaseColumnName=TECHNICIAN_NAME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYID.RefCursor.P_RESULTS" value="implicitRefCursor bindinfo='mode=Output'" />
    </settings>
    OData Service Operation:
    public class OracleODataService : DataService<OracleEntities>
    // This method is called only once to initialize service-wide policies.
    public static void InitializeService(DataServiceConfiguration config)
    // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
    // Examples:
    config.SetEntitySetAccessRule("*", EntitySetRights.All);
    config.SetServiceOperationAccessRule("GetWorkOrdersByWindfarmId", ServiceOperationRights.All);
    config.SetServiceOperationAccessRule("CreateWorkOrder", ServiceOperationRights.All);
    config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
    [WebGet]
    public IQueryable<GetWorkOrdersByWindfarmId_Result> GetWorkOrdersByWindfarmId(int WindfarmId)
    return this.CurrentDataSource.GetWorkOrdersByWindfarmId(WindfarmId).AsQueryable();
    [WebGet]
    public void CreateWorkOrder(int WindfarmId)
    this.CurrentDataSource.CreateWorkOrder(WindfarmId);
    Here is the stored procedure:
    procedure GetWorkOrdersByWindFarmId(WINDFARMID IN NUMBER,
    P_RESULTS OUT REF_CUR) is
    begin
    OPEN P_RESULTS FOR
    select WINDFARM_ID,
    STARTTIME,
    ENDTIME,
    TURBINE_NUMBER,
    NOTES,
    TECHNICIAN_NAME
    from WORKORDERS
    where WINDFARM_ID = WINDFARMID;
    end GetWorkOrdersByWindFarmId;
    I defined a function import for the stored procedure using the directions I found online by creating a new complex type. I don't know if I should be defining the input parameter, WindfarmId, in my app.config? If I should what would that format look like? I also don't know if I'm invoking the stored procedure correctly in my service operation? I'm testing everything through the rest console because the client consuming this information is written in javascript and expecting a json format. Any help is appreciated!
    Edited by: 1001323 on Apr 20, 2013 8:04 AM
    Edited by: jennyh on Apr 22, 2013 9:00 AM

    Making the change you suggested still resulted in the same Oracle.DataAccess.Client.OracleException {"ORA-06550: line 1, column 8:\nPLS-00306: wrong number or types of arguments in call to 'GETWORKORDERSBYWINDFARMID'\nORA-06550: line 1, column 8:\nPL/SQL: Statement ignored"}     System.Exception {Oracle.DataAccess.Client.OracleException}
    I keep thinking it has to do with my oracle.dataaccess.client settings in App.Config because I don't actually put the WindfarmId and an input parameter. I tried a few different ways to do this but can't find the correct format.

  • CALL FUNCTIONS

    HI ALL
    WHERE CAN I FIND ALL THE FUNCTION MODULES USED IN ABAP AND I ALSO NEED EXPLANATIONS ....CAN ANYONE HELP
    WITH REGARDS
    VIJAY

    Hi,
    You can use the table TFDIR  to see all the fun modules in ABAP.
    see the doc  and links for further details
    Function Modules;
    Check this matter.
    Function Modules are Glopbal ABAP programs created by SAP for reusable purpose.they have IMPORT,EXPORT and TABLE parameters, and EXCEPTIONS to through when error occurs.
    You can create them from TCode SE37.
    Go through the following doc:
    Function modules are cross-program, reusable procedures that are organized into function groups, and whose functions are implemented between the statements FUNCTION and ENDFUNCTION. Function modules and their interfaces are created in the Function Builder.
    Function Module Interfaces
    The parameter interface of a function module is defined in the Function Builder. It includes the definition of interface parameters and the specification of exceptions that can be triggered by a function module. The Function Builder automatically generates comment lines below the FUNCTION statement in the source code of the function module, which represent the interface of the function module with the following syntax:
    Syntax
    ... [IMPORTING parameters]
    [EXPORTING parameters]
    [CHANGING parameters]
    [TABLES table_parameters]
    [{RAISING|EXCEPTIONS} exc1 exc2 ...]
    The syntax and semantics of IMPORTING, EXPORTING, CHANGING, RAISING, and EXCEPTIONS mainly correspond to the definition of method interfaces with [CLASS-]METHODS. The additional option of defining table parameters using TABLES is obsolete.
    Interface parameters
    The interface parameters are defined on the relevant tab pages in the Function Builder.
    IMPORTING parameters are input parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input parameter. The content of the actual parameter is passed to the input parameter when the call is made. The content of an input parameter for which 'pass by reference' is defined cannot be changed in the function module.
    EXPORTING parameters are output parameters. When the function module is called, a suitable actual parameter can be specified for every output parameter. The content of an output parameter that is defined for 'pass by value' is transferred to the actual parameter if the function module is completed without errors. An output parameter that is defined for pass by reference is not initialized when the function module is called.
    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.
    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
    reward if useful
    regards,
    Anji

Maybe you are looking for