How to use a function in select clause

hi gems...good evening...
I want to write a select clause from a function. The scenario is like below:
function parameters
CREATE OR REPLACE FUNCTION FUNCTION_DEMO(p_pid IN NUMBER,
p_bankerNum IN NUMBER,
p_banker_name IN VARCHAR2,
p_business_num IN NUMBER,
p_businesses IN table_typ_businesses)
return table_typ_bankers
as .......
global object and table types
CREATE OR REPLACE TYPE obj_typ_businesses AS OBJECT (businesses NUMBER);
CREATE OR REPLACE TYPE table_typ_businesses AS TABLE OF obj_typ_businesses;
CREATE OR REPLACE TYPE obj_typ_bankers AS OBJECT (banker_num NUMBER(10,0));
CREATE OR REPLACE TYPE table_typ_bankers IS TABLE OF obj_typ_bankers;
The select query
select * from
table(cast(FUNCTION_DEMO(1,
2,
'ALEX',
2,
table(cast(select businesses_id from reference_businesses) as table_typ_businesses) as table_typ_bankers)But it is giving error with Missing expression.
My function is compiled successfully. I just want to make the select query to view the output given by the function i.e the table type "table_typ_bankers".
Please help...thanks in advance..

Hi ,
You can check this and change your code by taking this as an example. I just noted down with simple one input and return as collection type
and how to use/call it in select statement.
SQL> CREATE OR REPLACE TYPE obj_typ_businesses AS OBJECT (businesses NUMBER)
  2  /
Type created.
SQL> CREATE OR REPLACE TYPE table_typ_businesses AS TABLE OF obj_typ_businesses
  2  /
Type created.
SQL> CREATE OR REPLACE TYPE obj_typ_bankers AS OBJECT (banker_num NUMBER(10,2))
  2  /
Type created.
SQL> CREATE OR REPLACE TYPE table_typ_bankers IS TABLE OF obj_typ_bankers
  2  /
Type created.
/* Now creating a demo function and just focusing on your one input as collection type  */
SQL> create or replace function f11 ( tab_rec  IN table_typ_businesses)
  2  return table_typ_bankers
  3  is
  4  t_val table_typ_bankers:= table_typ_bankers();
  5  begin
  6        dbms_output.put_line('tab_rec count -'||tab_rec.count);
  7
  8  for i in 1..tab_rec.count
  9              loop
10               dbms_output.put_line ('tab_rec value ('||i||')'||tab_rec(i).businesses);
11                       t_val.EXTEND;
12                    t_val(i) := obj_typ_bankers(tab_rec(i).businesses * 12.50);
13              end loop;
14              return t_val;
15  end;
16  /
Function created.
/* To run your function by a select statement */
SQL> SELECT * FROM TABLE(f11(table_typ_businesses(obj_typ_businesses(5),
  2                          obj_typ_businesses(12),
  3                                         obj_typ_businesses(18))
  4                                             ) )
  5  /
BANKER_NUM
      62.5
       150
       225
tab_rec count -3
tab_rec value (1)5
tab_rec value (2)12
tab_rec value (3)18Hope this will help you... :)
Thanks!
Ashutosh

Similar Messages

  • How to use case function in where clause

    Hi,
    Suppose a table DEMO has columns
    DEMO TABLE
    user_id
    user_name
    location
    In this table i have 15 users. but out of 15 users i want to use only 5 users for passing as user_name.
    then how to achieve the result
    1. when i pass the particular 5 user_name in where clause then i should get all the user_name and for other 10 users it will show only the passing user_name.
    how to use case function

    Do you mean this ?
    SQL> var name varchar2(10)
    SQL> exec :name := 'ALLEN'
    PL/SQL procedure successfully completed.
    SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
      2  else :name end = ename;
    ENAME
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    14 rows selected.
    SQL> exec :name := 'SMITH'
    PL/SQL procedure successfully completed.
    SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
      2  else :name end = ename;
    ENAME
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    14 rows selected.
    SQL> exec :name := 'BLAKE'
    PL/SQL procedure successfully completed.
    SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
      2  else :name end = ename;
    ENAME
    BLAKERgds.

  • How to use xpath function to select some particular  nodes

    Dear experts:
    does abap supports  xpath  to sellect particular  nodes  according some node value or condition, i know other  programe language  supports the function selectNode(xpath expression)  , does abap or have the api to support it?
    and i know there is a class support  the xpath but it's not work., the class this:cl_xslt_processor
    to clarify my point. i take a ex.
    the xml doc is follow:
    <?xml version="1.0" encoding="utf-8" ?>
    - <n0:MT_CRM_Req xmlns:n0="http://gome.com/CRM/CRM/Outbound" xmlns:prx="urn:sap.com:proxy:DC0:/1SAI/TAS05C79364B9D0DC5F6738:701:2010/02/19">
    <company name="hp">
    <dep name="gds">
    <empolyeeid>123</empolyeeid>
    </dep>
    <dep name="its">
    <empolyeeid>148</empolyeeid>
    </dep>
    </company>
    <company name="foxconn">
    <dep name="fih">
    <empolyeeid>569</empolyeeid>
    </dep>
    </company>
      </n0:MT_CRM_Req>
    i  want to  select the employee 's company name who empolyee id is 123
    i use the method  ,and the code is :
    l_xslt->set_expression(
    expression = '/n0:MT_CRM_Req/n0:company[n0:dep/n0:empolyeeid=123]'
    nsdeclarations = 'n0 http://gome.com/CRM/CRM/Outbound'
    l_xslt->run('').
    nodes = l_xslt->get_nodes( ).
    LEN = nodes->GET_LENGTH( ) .
    WRITE LEN.
    but no nodes return.
    is anybody knows what's wrong with it? or there is some other api to manipulate the xml dom.
    best regrds!

    Hello Kevin ,
    i think you can get those details , have a look at program BCCIIXMLT1, i think this program will give you some idea to handle * manage xml docs.
    along with that program ...you need to put filter
    *---creating filers.
      filter   = document->create_filter_name( name = 'Company' ).
      iterator = document->create_iterator_filtered( filter ).
      main_node =  document.
    *---processing document.
      perform print_node using main_node p_flag.
    let me know if you need anymore help.
    regards
    Prabhu

  • How can we use DECODE function in where clause.

    Hi Guys,
    I have to use DECODE function in where clause.
    like below
    select * from tab1,tab2
    where a.tab1 = b.tab2
    and decode(code, 'a','approved')
    in this manner its not accepting?
    Can any one help me on this or any other aproach?
    Thanks
    -LKR

    >
    I am looking for to decode the actual db value something in different for my report.
    like if A then Accepted
    elseif R then Rejected
    elseif D then Denied
    these conditions I have to check in where clause.
    >
    what are you trying to do?
    may be you are looking for
    select * from tab1,tab2
    where a.tab1 = b.tab2
    and
       (decode(:code, 'A','Accepted') = <table_column>
        or
        decode(:code, 'R','Rejected') = <table_column>
       or
        decode(:code, 'D','Denied') = <table_column>
       )

  • How to use complex function as condition in Oracle Rule Decision Table?

    How to use complex function as condition in Oracle Rule Decision Table?
    We want to compare an incoming date range with the date defined in the rules. This date comparison is based on the input date in the fact & the date as defined for each rule. Can this be done in a decision table?

    I see a couple of problems here.
    First, what you posted below is not a syntactically valid query. It seems to be part of a larger query, specifically, this looks to be only the GROUP BY clause of a query.
    Prabu ammaiappan wrote:
    Hi,
    I Have a group function in the Query. Below is the Query i have used it,
    GROUP BY S.FREIGHTCLASS,
    R.CONTAINERKEY,
    S.SKU,
    S.DESCR ||S.DESCRIPTION2,
    S.PVTYPE,
    RD.LOTTABLE06,
    R.WAREHOUSEREFERENCE,
    RD.TOLOC,
    R.ADDWHO,
    R.TYPE,
    S.CWFLAG,
    S.STDNETWGT,
    S.ORDERUOM,
    R.ADDDATE,
    C.DESCRIPTION,
    (CASE WHEN P.POKEY LIKE '%PUR%' THEN 'NULL' ELSE to_char(P.PODATE,'dd/mm/yyyy') END),
    NVL((CASE WHEN R.ADDWHO='BOOMI' THEN RDD.SUPPLIERNAME END),SS.COMPANY),
    RDD.BRAND,
    S.NAPA,
    RD.RECEIPTKEY,
    R.SUSR4,
    P.POKEY,
    RDD.SUSR1,
    r.STATUS, DECODE(RDD.SUSR2,' ',0,'',0,RDD.SUSR2),
    rd.SUSR3Second, the answer to your primary question, "How do I add a predicate with with a MAX() function to my where clause?" is that you don't. As you discovered, if you attempt to do so, you'll find it doesn't work. If you stop and think about how SQL is processed, it should make sense to you why the SQL is not valid.
    If you want to apply a filter condition such as:
    trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')you should do it in a HAVING clause, not a where clause:
    select ....
      from ....
    where ....
    group by ....
    having max(some_date) between this_date and that_date;Hope that helps,
    -Mark

  • How to use SQL functions in the queries

    hey guys i wanna know how to use SQL functions in the queries is it possible or not .

    Hi,
    Wat exactly that set values are?
    those from sql query?
    How to use count():
    The COUNT() function returns the number of rows that matches a specified criteria.
    SQL COUNT(column_name) Syntax
    The COUNT(column_name) function returns the number of values (NULL values will not be counted) of the specified column:
    SELECT COUNT(column_name) FROM table_name
    SQL COUNT(*) Syntax
    The COUNT(*) function returns the number of records in a table:
    SELECT COUNT(*) FROM table_name
    SQL COUNT(DISTINCT column_name) Syntax
    The COUNT(DISTINCT column_name) function returns the number of distinct values of the specified column:
    SELECT COUNT(DISTINCT column_name) FROM table_name
    The IN function helps reduce the need to use multiple OR conditions.
    The syntax for the IN function is:
    SELECT columns
    FROM tables
    WHERE column1 in (value1, value2, .... value_n);

  • How to use BAPI_MATERIAL_AVAILABILITY Function Module....

    Hi Experts,
    I want to know actual free available quantity (ATP Qty.) for mass materials,
    How to use BAPI_MATERIAL_AVAILABILITY function module ?
    I have select all material from MARA and inserted in itab.
    LOOP AT ITAB.
    CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
      EXPORTING
        PLANT                    =
        MATERIAL                 =
        UNIT                     =
      CHECK_RULE               =
      STGE_LOC                 =
      BATCH                    =
      CUSTOMER                 =
      DOC_NUMBER               =
      ITM_NUMBER               =
      WBS_ELEM                 =
      STOCK_IND                =
      DEC_FOR_ROUNDING         =
      DEC_FOR_ROUNDING_X       =
      READ_ATP_LOCK            =
      READ_ATP_LOCK_X          =
    IMPORTING
      ENDLEADTME               =
      AV_QTY_PLT               =
      DIALOGFLAG               =
      RETURN                   =
      TABLES
        WMDVSX                   =
        WMDVEX                   =
    I dont know how to use it.
    pl. guide us.
    Yusuf

    Hi,
           data:  iwmdvsx type table of bapiwmdvs with header line,
           iwmdvex type table of bapiwmdve with header line.
    parameters: p_matnr type mara-matnr,
                p_werks type marc-werks,
                p_meins type mara-meins.
    call function 'BAPI_MATERIAL_AVAILABILITY'
      exporting
        plant            = p_werks
        material         = p_matnr
        unit             = p_meins
      CHECK_RULE       =
      STGE_LOC         =
      BATCH            =
      CUSTOMER         =
      DOC_NUMBER       =
      ITM_NUMBER       =
      WBS_ELEM         =
      STOCK_IND        =
    IMPORTING
      ENDLEADTME       =
      AV_QTY_PLT       =
      DIALOGFLAG       =
      RETURN           =
      tables
        wmdvsx           = iwmdvsx
        wmdvex           = iwmdvex.
    check sy-subrc = 0.
    Text
    ATP information
    Functionality
    Using this function module, you can determine the receipt quantity still available for a particular material in a certain plant according to ATP logic (MRPII).
    The availability check is carried out on transferring the material number, the plant and the input table (WMDVSX). The scope of the check, that is, which stocks, receipts and issues are to be included in the check is defined by the combination of checking group (material master) and cheking rule. In the function module, the system uses the checking rule defined in Sales & Distribution (A). You can overrule this checking rule by using an interface or a user-exit (exit_saplw61v_001). A similar procedure is also valid for the plant parameters. The customer number in the user-exit means that the plant selection can be controlled via the customer. If no plant parameters are given via the interface, the system uses the parameter 'WRK' saved in the user's fixed values.
    The results of the availability check are recorded in the output table (WMDVEX). This table contains dates and available receipt quantities (ATP quantities). The results of the check depends on the following entries:
    If no date and no quantity is transferred, the system displays the ATP situation from today's date into the future as the result.
    If only a date and no quantity is transferred, the system displays the ATP situation from the corresponding date as the result.
    If both a date and a quantity are transferred, the system calculates the availability situation for the quantity specified.
    In the last two cases, the parameter 'DIALOGFLAG' is supplied. This can result in the following:
    ' ' (blank)   <=> quantity completely available
    'X'           <=> only partial quantity available or not available at
                      all
    'N'           <=> Material not included in the availability check
                      (Material not relevant to the availability check)
    The system also displays the end of the replenishment lead time (ENDLEADTME).
    regards

  • How to  use data function using characterstics variable for calculation on

    how to  use data function using characterstics variable for calculation on  attribute as key figure

    Hi Gayatri
    Did you not see my answer for CASE because CASE does indeed offer the use of the BETWEEN clause, but DECODE does not. Let me give you a little synopsis of DECODE.
    In its most simple form it takes 4 values and looks like this: DECODE(A, B, C, D)
    This essentially means, IF A = B THEN C ELSE D
    The trick to solving BETWEEN in a DECODE is to work out algoriths where A = B. Because we don't know how many values are between 00 and 99, although I could guess there were 100 we could of course have 100 parts in the DECODE but that would be awful. How about if we look at it another way and say this:
    IF PART_NUMBER < 'SDK00' THEN pay_amount
    ELSE IF PART_NUMBER > 'SDK99' THEN pay_AMOUNT
    ELSE pay_amount + 100
    This statement only had 2 hard coded values, but how to make DECODE work with less than? Easy, we use the LEAST function. The LEAST function takes 2 values and returns the one with the lowest value. So I use LEAST(PART_NUMBER, 'SDK00') then whenever the PART_NUMBER is lower than SDK00 it will be true. A similar situation exists for the opposite function GREATEST. Putting all of this together then, you can do this:
    DECODE(PART_NUMBER, GREATEST(PART_NUMBER, 'SDK00'), DECODE(PART_NUMBER, LEAST(PART_NUMBER, 'SDK99'), PAY_AMOUNT * 100, PAY_AMOUNT), PAY_AMOUNT)
    In English this can be read as follows:
    IF the PART_NUMBER is greater than or equal to SDK00 and the PART_NUMBER is less than or equal to SDK99 THEN PAY_AMOUNT x 100 ELSE 0
    Best wishes
    Michael

  • How to use this function call function 'REUSE_ALV_COMMENTARY_WRITE' in alv

    hi all
    thanks in advance
    how to use this function in alv programming
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    why use and what purpose use this function plz tell me details
    plz guide me
    thanks

    Hi
    see this exmaple code where i had inserted a LOGO by useing this FM
    *& Report  ZTEST_ALV_LOGO
    REPORT  ztest_alv_logo.
    TYPE-POOLS : slis.
    *ALV Formatting tables /structures
    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: gt_events   TYPE slis_t_event.
    DATA: gs_layout   TYPE slis_layout_alv.
    DATA: gt_page     TYPE slis_t_listheader.
    DATA: gs_page     TYPE slis_listheader.
    DATA: v_repid     LIKE sy-repid.
    *ALV Formatting work area
    DATA: w_fieldcat TYPE slis_fieldcat_alv.
    DATA: w_events   TYPE slis_alv_event.
    DATA: gt_bsid TYPE TABLE OF bsid WITH HEADER LINE.
    INITIALIZATION.
      PERFORM build_events.
      PERFORM build_page_header.
    START-OF-SELECTION.
    *perform build_comment.     "top_of_page - in initialization at present
      SELECT * FROM bsid INTO TABLE gt_bsid UP TO 10 ROWS.
    *perform populate_for_fm using '1' '3' 'BUKRS' '8' 'GT_BSID' 'Whee'.
    *USING = Row, Column, Field name, display length, table name, heading
    *OR
      PERFORM build_fieldcat.
      gs_layout-zebra = 'X'.
    *top of page event does not work without I_callback_program
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program                = v_repid
          i_structure_name                  = 'BSID'
       i_background_id                   = 'ALV_BACKGROUND'
          i_grid_title                      = 'This is the grid title'
      I_GRID_SETTINGS                   =
          is_layout                         = gs_layout
          it_fieldcat                       = gt_fieldcat[]
          it_events                         = gt_events[]
        TABLES
          t_outtab                          = gt_bsid.
    Form..............:  populate_for_fm
    Description.......:  Populates fields for function module used in ALV
    FORM populate_for_fm USING p_row
                               p_col
                               p_fieldname
                               p_len
                               p_table
                               p_desc.
      w_fieldcat-row_pos      = p_row.          "Row Position
      w_fieldcat-col_pos      = p_col.          "Column Position
      w_fieldcat-fieldname    = p_fieldname.    "Field name
      w_fieldcat-outputlen    = p_len.          "Column Lenth
      w_fieldcat-tabname      = p_table.        "Table name
      w_fieldcat-reptext_ddic = p_desc.         "Field Description
      w_fieldcat-input        = '1'.
      APPEND w_fieldcat TO gt_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " populate_for_fm
    *&      Form  build_events
    FORM build_events.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = gt_events.
      READ TABLE gt_events
                 WITH KEY name =  slis_ev_user_command
                 INTO ls_event.
      IF sy-subrc = 0.
        MOVE slis_ev_user_command TO ls_event-form.
        APPEND ls_event TO gt_events.
      ENDIF.
      READ TABLE gt_events
                 WITH KEY name =  slis_ev_top_of_page
                 INTO ls_event.
      IF sy-subrc = 0.
        MOVE slis_ev_top_of_page TO ls_event-form.
        APPEND ls_event TO gt_events.
      ENDIF.
    ENDFORM.                    " build_events
    *&      Form  USER_COMMAND
    When user command is called it uses 2 parameters. The itab
    passed to the ALV is in whatever order it currently is on screen.
    Therefore, you can read table itab index rs_selfield-tabindex to get
    all data from the table. You can also check r_ucomm and code
    accordingly.
    FORM user_command USING  r_ucomm     LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      READ TABLE gt_bsid INDEX rs_selfield-tabindex.
    error checking etc.
      SET PARAMETER ID 'KUN' FIELD gt_bsid-kunnr.
      CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    ENDFORM.                    "user_command
    *&      Form  top_of_page
    Your own company logo can go here if it has been saved (OAOR)
    If the logo is larger than the size of the headings in gt_page,
    the window will not show full logo and will have a scroll bar. Thus,
    it is a good idea to have a standard ALV header if you are going to
    use logos in your top of page.
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_page
          i_logo             = 'ENJOYSAP_LOGO'.
    ENDFORM.                    "top_of_page
    *&      Form  build_fieldcat
    *Many and varied fields are available here. Have a look at documentation
    *for FM REUSE_ALV_LIST_DISPLAY and REUSE_ALV_FIELDCATALOG_MERGE
    FORM build_fieldcat.
      w_fieldcat-fieldname  = 'BUDAT'.
      w_fieldcat-seltext_m  = 'Dte pst'.
      w_fieldcat-ddictxt(1) = 'M'.
      w_fieldcat-edit = 'x'.
    Can change the position of fields if you do not want them in order
    of the DDIC or itab
    w_fieldcat-row_pos = '1'.
    w_fieldcat-col_pos = '10'.
      APPEND w_fieldcat TO gt_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " build_fieldcat
    *&      Form  build_page_header
          gt_page is used in top of page (ALV subroutine - NOT event)
          *H = Header, S = Selection, A = Action
    FORM build_page_header.
    For Headers, Key is not printed and is irrelevant. Will not cause
    a syntax error, but is not used.
      gs_page-typ  = 'H'.
      gs_page-info = 'Header 1'.
      APPEND gs_page TO gt_page.
      gs_page-typ  = 'H'.
      gs_page-info = 'Header 2'.
      APPEND gs_page TO gt_page.
    For Selections, the Key is printed (bold). It can be anything up to 20
    bytes. It gets printed in order of code here, not by key value.
      gs_page-typ  = 'S'.
      gs_page-key  = 'And the winner is:'.
      gs_page-info = 'Selection 1'.
      APPEND gs_page TO gt_page.
      gs_page-typ  = 'S'.
      gs_page-key  = 'Runner up:'.
      gs_page-info = 'Selection 2'.
      APPEND gs_page TO gt_page.
    For Action, Key is also irrelevant.
      gs_page-typ  = 'A'.
      gs_page-info = 'Action goes here'.
      APPEND gs_page TO gt_page.
    ENDFORM.                    " build_page_header

  • How to use CASE stmt in Where clause

    Hi,
    How to use CASE stmt in WHERE clause?. I need the code. Please send me as early as possible..........

    Hi,
    1004977 wrote:
    Hi,
    How to use CASE stmt in WHERE clause?. There's no difference between how a CASE expression is used in a WHERE clause, and how it is used in any other clause. CASE ... END always returns a single scalar value, and it can be used almost anywere a single scalar expression (such as a column, a literal, a single-row function, a + operation, ...) can be used.
    CASE expressions aren't needed in WHERE clauses very much. The reason CASE expressions are so useful is that they allow you to do IF-THEN-ELSE logic anywhere in SQL. The WHERE clause already allows you to do IF-THEN-ELSE logic, usually in a more convenient way.
    I need the code.So do the peple who want t help you. Post a query where you'd like to use a CASE expression in the WHERE clause. Post CREATE TABLE and INSERT statements for any tables used unless they are commonly available, such as scott.emp). Also, post the results you want from that sample data, and explain how you get those resuts from that data.
    See the forum FAQ {message:id=9360002}
    Please send me as early as possible..........As mentioned bfore, that's rude. It's also self-defeating. Nobody will refuse to help you because you don't appear pushy enough, but some people will refuse to help you if you appear too pushy.

  • Oracle:how to use max() function in case expression

    how to use max() function in case expression, Please explain with any example

    Hope this helps and should be self explanatory
    with t as
    (select 1 col,100 col2 from dual union
    select 2 ,100 from dual union
    select 2 ,200 from dual union
    select 3,100  from dual union
    select 3,200  from dual  )
    select col, case when max(col2)=100 then 'with 100 range'
    when  max(col2)=200 then 'with 200 range' end  from t group by col

  • How to use the function module ....

    hi
    how to use the function module ssf_function_module_name in smartforms

    Hi..
    If you are using this Function module, you can get the generated function module name of smartform dynamically. It is good progrmaming practice to get the fucntion module name dynamically because there might be some problems if you are hard coding in program.
    This will return the name of the function module and then from the exporting parameters you can use the fucntion module name to pass parameters to Smartforms.
    Check this link.I am expalining here how to use this function module.
    https://wiki.sdn.sap.com/wiki/pages/pointstab/viewpageversion.action?pageId=36109&version=2
    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
    call function 'SSF_FUNCTION_MODULE_NAME'
    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.
    call function FM_NAME
    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.
    <b>Reward points if useful</b>
    Regards
    Ashu

  • How to use HexToRef function?

    How to use HexToRef function?

    Exactly HexToRef!
    please, try this:
    create or replace
    TYPE "TOBJECT" as object
    Guid RAW(16)
    create table t$tobject of tobject;
    insert into t$tobject values (TOBJECT(SYS_OP_GUID()));
    select HEXTOREF(REFTOHEX(REF(t))) from t$tobject t;
    Error report:
    SQL Error: ORA-24360: 'Type Descriptor Object' не задан для 'Object Bind/Define'
    24360. 00000 - "Type Descriptor Object not specified for Object Bind/Define"
    *Cause:    Type Descriptor Object is a mandatory parameter for Object Types
    Binds and Defines.
    *Action:   Please invoke the OCIBindObject() or OCIDefineObject() call
    with a valid Type Descriptor Object.

  • How to use reuse_alv_variant  functions

    helo experts can any one tell me how to use these function modules
    REUSE_ALV_VARIANT_DEFAULT_GET,
    REUSE_ALV_VARIANT_F4,
    REUSE_ALV_VARIANT_EXISTENCE,
    WHAT IS THE CS_VARIANTS PARAMETER IN THESE FUNCTION MDOULES.
    HOW TO USE THAT?

    REUSE_ALV_VARIANT_DEFAULT_GET
    Text
         Read default layout (description only, w/o field catalog)
    Functionality
         Provides the default variant for the list specified in the structure
         parameter CS_VARIANT of a program.
    REUSE_ALV_VARIANT_F4
    Text
         Display variant selection dialog box
    Functionality
         Possible entries help, if the variant is defined explicitly as an input
         field on a screen. The selection must be specified by at least partially
         filling the parameter structure IS_VARIANT.
    REUSE_ALV_VARIANT_EXISTENCE
    Text
         Checks whether a display variant exists
    <u>CS_VARIENTS holds the information about varients like:</u>
    ABAP Program Name
    Mgt. ID for repeated calls from the same program
    Logical group name
    User name for user-specific storage
    Layout
    Description for layout
    Dependent variant entry vector
    Functionality
         This function module checks the existence in the database of a display
         variant passed in the interface.

  • How to use 'SO_NEW_DOCUMENT_SEND_API1' function module

    Hello Experts,
    Please anybody tell me how to use 'SO_NEW_DOCUMENT_SEND_API1' function module

    hi,
    umesh see below code copy it and compile it and see how it works!!
    REPORT  ZSEND_SMS.
    parameters: sms_num type text20 obligatory.
    parameters: subject type SO_OBJ_DES default sy-sysid.
    parameters: sms_txt type text50 obligatory.
    data: receivers like somlreci1 occurs 0 with header line,
    objhead like solisti1 occurs 0 with header line,
    objtxt like solisti1 occurs 0 with header line,
    p_rec like receivers-receiver,
    p_type like receivers-rec_type.
    *users like ywf_ea_user_task occurs 0 with header line.
    data: count type i,
    p_email(50),
    doc_chng like sodocchgi1,
    objcont like solisti1 occurs 5 with header line,
    p_count(5).
    start-of-selection .
    clear receivers.
    refresh receivers.
    receivers-receiver+9 = 'SMS'.
    receivers-receiver+13 = sms_num.
    move 'K' to receivers-rec_type.
    append receivers.
    clear doc_chng.
    doc_chng-obj_descr = subject. "Subject zpravy
    doc_chng-obj_name = 'SMS'.
    doc_chng-doc_size = strlen( doc_chng-obj_descr ).
    refresh objtxt.
    objtxt = 'SMS message'. "message
    append objtxt.
    call function 'SO_NEW_DOCUMENT_SEND_API1'
    exporting
    document_type = 'RAW'
    document_data = doc_chng
    commit_work = 'X'
    tables
    object_header = objhead
    object_content = objtxt
    receivers = receivers
    exceptions
    too_many_receivers = 1
    document_not_sent = 2
    operation_no_authorization = 4
    others = 99.
    if sy-subrc ne 0.
    message e208(00) with 'Error'.
    endif.
    Hope magic Works!
    Regards,
    Purvesh.

Maybe you are looking for

  • Not Able to use Mail.app

    Hello to everyone. After been browsing this site and google for about 2 days I have decided to post this message and see if someone can help me fix the problem I am having. My mail.app has been not working for me ever since I got my new mac and migra

  • I get the following message: Mozilla Firefox plugin-container has stopped working properly. What do I do?

    the message:" Mozilla Firefox plugin-container has stopped working properly" appears regularly in my maintenance center. I am on Windows 7 and Firefox 3.6.17

  • EQ2 guide

    EQ2 guide The fiery peaks of EverQuest II’s Lavastorm zone have claimed the life of many unfortunate  adventurers.  Rivers of lava flow freely and hundreds of hostile goblins and lizards inhabit this  desolate place.  SOE has recently decided to reva

  • Rman and bcv bkp

    hi, I want to find out if rman and bcv bkp both triggered together will it lead to any problem.

  • Syncing iPhone - applications will not install message

    After some trouble with my two month old iPhone4S I did a Master reset after a full backup. Now when I want to restore the application most of them (not all) will not install on the phone. Doing them one by one looks good in iTunes but on the phone I