How to use select-options in the function module of import parameter ?

Hi ...
   I have created a BAPI and tested in SWO1 tcode , by giving the single value for an company code ( BUKRS ) , it executed properly .
Same thing is working after implementing in a program .
so now it is working for fetching a single company code details .
My requirement is : I want to use select-options in program as well as in function module IN IMPORT PARAMETER.
Program :
REPORT  ZTEST.
TABLES : T001 , ZBAPI_STR .
TYPES : BEGIN OF TY_ITEM  .
          INCLUDE STRUCTURE ZBAPI_STR .
TYPES : END OF TY_ITEM .
DATA :WA_ITEM TYPE TY_ITEM ,
      ITEM LIKE STANDARD TABLE OF WA_ITEM INITIAL SIZE 0 .
PARAMETER : BUKRS TYPE ZBAPI_STR-BUKRS.
call function 'ZBAPI_FMT001'
  exporting
    bukrs         =  BUKRS
IMPORTING
  RETURN        =
  tables
    itemtab       = ITEM
IF ITEM IS NOT INITIAL .
  LOOP AT ITEM INTO WA_ITEM .
    WRITE : / WA_ITEM-BUKRS , WA_ITEM-BUTXT , WA_ITEM-ORT01 , WA_ITEM-LAND1 .
  ENDLOOP.
ENDIF.
FUNCTION MODULE :
FUNCTION ZBAPI_FMT001.
""Local Interface:
*"  IMPORTING
*"     VALUE(BUKRS) TYPE  EFG_TAB_RANGES
*"  EXPORTING
*"     VALUE(RETURN) TYPE  BAPIRET2
*"  TABLES
*"      ITEMTAB STRUCTURE  ZBAPI_STR
SELECT BUKRS BUTXT ORT01 LAND1 FROM T001 INTO TABLE ITEMTAB WHERE BUKRS = BUKRS .
ENDFUNCTION.
Regards
Deepa.

I have given a similiar example which i did
Declare a
Table type:Z_TT_PONUM             
Short text  :  Select options  PO Number
in SE11 tcode with row type eg: Z_ST_PONUM
create a structure (this will be the row type)
Structure          Z_ST_PONUM            
Short text         Select Options Field PO number
Compenent  Compent type
SIGN       BAPISIGN      Inclusion/exclusion criterion SIGN for range tables
OPTION       BAPIOPTION      Selection operator OPTION for range tables
LOW       EBELN                      Purchasing Document Number
HIGH       EBELN                      Purchasing Document Number
In the function module import
give as
I_PO_NUM     TYPE     Z_TT_PONUM     opt  pass value Select options  PO Number
Hope this is exactly what you want to know.
So you create a structure simliar to mine but the low an high whould be your component
then a table type  and then include that in the BAPI.
Then pass your select-option value to this BAPI when you call this BAPI in the program

Similar Messages

  • How to pass select-option filed to Function Module Exporting Parameter

    Hi,
        How to pass select-option filed to Function Module Exporting Parameter.
    Thanks

    Hi,
    DATA: BEGIN OF ITAB5_WRK OCCURS 0,
            KUNNR     TYPE KNKK-KUNNR,  "CUSTOMER #
            SBGRP     TYPE KNKK-SBGRP,  "CREDIT REP
            KLIMK     TYPE KNKK-KLIMK,  "CREDIT LIMIT
            NAME1     TYPE KNA1-NAME1,  "CUSTOMER NAME
            SKFOR     TYPE KNKK-SKFOR,  "TOTAL A/R
            AMT1      TYPE KNKK-SKFOR,  "CURRENT
            AMT2      TYPE KNKK-SKFOR,                          "01-30
            AMT3      TYPE KNKK-SKFOR,                          "31-60
            AMT4      TYPE KNKK-SKFOR,                          "61-90
            AMT5      TYPE KNKK-SKFOR,                          "91-120
            AMT6      TYPE KNKK-SKFOR,                          "OVR 120
            BZIRK     TYPE KNVV-BZIRK,
          END OF ITAB5_WRK.
    SELECT-OPTIONS P_COMP     FOR  T001-BUKRS
      SELECT KUNNR SBGRP  FROM KNKK
             INTO TABLE ITAB5_WRK
             WHERE SBGRP IN P_REP
               AND KUNNR GE '0001000000'
               AND SKFOR NE 0.
      LOOP AT ITAB5_WRK.
        DELETE ADJACENT DUPLICATES FROM ITAB5_WRK COMPARING KUNNR.
      ENDLOOP.
      PERFORM GET_CREDIT_LIMITS.
    *=======================================================================
      IF P_DIST NE SPACE.
        LOOP AT ITAB5_WRK.
          SELECT SINGLE * FROM KNVV WHERE KUNNR EQ ITAB5_WRK-KUNNR
                                      AND VKORG EQ P_COMP
                                      AND VTWEG EQ '20'
                                      AND SPART EQ '10'
                                      AND BZIRK IN P_DIST.
          IF SY-SUBRC EQ 0.
            MOVE KNVV-BZIRK TO ITAB5_WRK-BZIRK.
            MODIFY ITAB5_WRK.
          ELSE.
            DELETE ITAB5_WRK.
          ENDIF.
        ENDLOOP.
      ENDIF.
    *==============================================================
      LOOP AT ITAB5_WRK.
        MOVE: 'F/S'            TO WRK-KKBER,
               ITAB5_WRK-KUNNR TO WRK-KUNNR.
        PERFORM AGING.
        ADD: W_SNFAE  TO ITAB5_WRK-AMT1,
             W_SFAE1  TO ITAB5_WRK-AMT2,
             W_SFAE2  TO ITAB5_WRK-AMT3,
             W_SFAE3  TO ITAB5_WRK-AMT4,
             W_SFAE4  TO ITAB5_WRK-AMT5,
             W_SFAE5  TO ITAB5_WRK-AMT6,
             W_SFAEL  TO ITAB5_WRK-SKFOR,
             W_SNFAE  TO ITAB5_WRK-SKFOR.
        MOVE: 'SPEC'            TO WRK-KKBER,
               ITAB5_WRK-KUNNR TO WRK-KUNNR.
        *PERFORM AGING.*
        ADD: W_SNFAE  TO ITAB5_WRK-AMT1,
             W_SFAE1  TO ITAB5_WRK-AMT2,
             W_SFAE2  TO ITAB5_WRK-AMT3,
             W_SFAE3  TO ITAB5_WRK-AMT4,
             W_SFAE4  TO ITAB5_WRK-AMT5,
             W_SFAE5  TO ITAB5_WRK-AMT6,
             W_SFAEL  TO ITAB5_WRK-SKFOR,
             W_SNFAE  TO ITAB5_WRK-SKFOR.
        MODIFY ITAB5_WRK.
      ENDLOOP.
    FORM AGING.
      *CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'* 
      EXPORTING
          BUKRS             = P_COMP           
          KKBER             = WRK-KKBER
          KUNNR             = WRK-KUNNR
          RASID             = 'FEND'
          KLIMP             = 'X'
        IMPORTING
          SFAE1             = W_SFAE1
          SFAE2             = W_SFAE2
          SFAE3             = W_SFAE3
          SFAE4             = W_SFAE4
          SFAE5             = W_SFAE5
          SFAE6             = W_SFAE6
          SFAEL             = W_SFAEL
          SNFA1             = W_SNFA1
          SNFA2             = W_SNFA2
          SNFA3             = W_SNFA3
          SNFA4             = W_SNFA4
          SNFA5             = W_SNFA5
          SNFA6             = W_SNFA6
          SNFAE             = W_SNFAE
        EXCEPTIONS
          NO-AGING_SCHEDULE = 1
          NO_TABLE_INPUT    = 2.
      CASE SY-SUBRC.
        WHEN 1.
          MESSAGE E999 WITH 'PLEASE ENTER AGING SCHEDULE'.
        WHEN 2.
          MESSAGE E999 WITH 'DO NOTHING ??'.
      ENDCASE.
    ENDFORM.                    "AGING
    Thanks

  • How to pass select option value to function module while using service call

    Hi,
    I have select-option in my WD application. To collect data based on user input im using service call. How to pass this select option values to my RFC.
    rgds
    sudhanshu

    Hi,
    Thank s for your reply. In fact im doing similar with following variation:
    i) collected range values using get_range* method.
    ii) separate low and high values as: 
    read table <field2> index 1 into wa_range.
    vert2_low = wa_range-low.
    vert2_high = wa_range-high.
    (Please note that in RFC I have taken two importing parameter as s_vert_lo and s_vert_hi)
    iii) Now setting these RFC attribute as:
    lo_el_importing->set_attribute(
        EXPORTING
          name =  `S_VERT_LO`
          value = vert2_low ).
    and
    lo_el_importing->set_attribute(
        EXPORTING
          name =  `S_VERT_HI`
          value = vert2_high ).
    iv) In RFC im having my query as :
    select <fld list> from BUT000 into table itab where vertical in r_vert.
    Here, r_vert is a range defined as:
    ranges r_vert for <fld refrence>
    r_vert-sign = 'I'.
    r_vert-option = 'BT'.
    r_vert-low = S_VERT_LO.
    r_vert-high = S_VERT_HI.
    append r_vert.
    Issue here is with ranges. if im passing both low and high values it is fine but if only low value being passed it is not giving me any record.
    Please suggest.
    Rgds
    Sudhanshu

  • Select options passed to function module

    Hey
    I would like to know how r the select-options of a program passed to the function module that is called internally in that program? I want to use this select-options in the function module to fetch frm the database tables?
    Shakr

    Hi,
    Use ranges in function modules. You can declare in import/export/ changing or tables parameters
    Example of ranges:
    ERDAT_RAN
    ERDAT_RAN
    SHP_R_ERZET
    RVBELN
    ERNAM_RAN
    Please see them in se11.
    Pass the select options in the report to these ranges or use below coding:
    DATA: wa_cmfre     LIKE     erdat_ran,
          wa_erdat     LIKE     erdat_ran,
          wa_erzet     LIKE     shp_r_erzet,
          wa_vbeln     LIKE     rvbeln,
          wa_ernam     LIKE     ernam_ran.
    SELECT-OPTIONS: s_erdat FOR vbak-erdat,                  s_erzet FOR vbak-erzet NO-EXTENSION,  
    s_cmfre FOR vbak-cmfre OBLIGATORY ,
    s_vbeln FOR vbak-vbeln NO-EXTENSION,         
    s_auart FOR vbak-auart OBLIGATORY,                           s_bsark FOR vbak-bsark.
      wa_cmfre-sign    = s_cmfre-sign.
      wa_cmfre-option  = s_cmfre-option.
      wa_cmfre-low     = s_cmfre-low.
      wa_cmfre-high    = s_cmfre-high.
      IF NOT s_erdat[] IS INITIAL.
        wa_erdat-sign   =  s_erdat-sign.
        wa_erdat-option =  s_erdat-option.
        wa_erdat-low    =  s_erdat-low.
        wa_erdat-high   =  s_erdat-high.
      ENDIF.
      IF NOT s_erzet[] IS INITIAL.
        wa_erzet-sign   =  s_erzet-sign.
        wa_erzet-option =  s_erzet-option.
        wa_erzet-low    =  s_erzet-low.
        wa_erzet-high   =  s_erzet-high.
      ENDIF.
      IF NOT s_vbeln[] IS INITIAL.
        wa_vbeln-sign   =  s_vbeln-sign.
        wa_vbeln-option =  s_vbeln-option.
        wa_vbeln-low    =  s_vbeln-low.
        wa_vbeln-high   =  s_vbeln-high.
      ENDIF.
      IF NOT s_ernam[] IS INITIAL.
        wa_ernam-sign   =  s_ernam-sign.
        wa_ernam-option =  s_ernam-option.
        wa_ernam-low    =  s_ernam-low.
        wa_ernam-high   =  s_ernam-high.
      ENDIF.
    you can pass these work areas to function module.
    Thanks,
    Shravan G.

  • How to pass select-option variable in function

    hi ,
    select-option : s_akont for KNB1-akont OBLIGATORY.
    i have to pass s_akont in function without using
    s_akont-low & s_akont-high.
    rightnow i am passing like s_akont but it is giving me a error :
    s_akont is followed by niether by an internal table nor by a value list.
    what should i write.
    regards
    raj

    Hello Raj
    I assume that you want to import your select-options into your function module(s). Since select-options are, by default, itabs with header lines you have to pass your select-options as following:
    CALL FUNCTION 'Z_...'
      TABLES
        it_selopt = s_akont[].
    The TABLES parameter it_selopt could be of type ANY or better of type <b>TABLE</b>.
    If you want to use generic select-option structure you can use <b>RSDSSELOPT</b> and the table type <b>TT_RSDSSELOPT</b>. In this case you would need to copy your select-options from s_akont to a generic type s_generic (of type RSDSSELOPT).
    Regards
      Uwe

  • How to use select options whitout ranges ie like parameter

    how to use select options whitout ranges ie like parameter and pls send me the code on that
    thanks
    raja.

    hi,
    SELECT-OPTIONS : s_kunnr for kna1-kunnr <b>no intervels.</b>
    eg: code
    <b>SELECT-OPTIONS : s_kunnr for kna1-kunnr <b>no intervels.</b></b>
    data: itab type table of kna1 with header line.
    select * from kna1 into table itab where kunnr IN s_kunnr.
    rgds
    Anver

  • How will use Select-Options in Read table Concept.

    Hi All,
                  How will use Select-Options in Read table. For  example,
          Select-Options : test for bseg-prctr.
           Select * from bseg into table ITAB.
    Read table ITAB with key prctr in test.
    Last line is showing error. If any way to read ITAB as conditions given per select options.
    Thankx Advance,,,

    HI,
    you cannot use " IN " with read statement , read statement is used as:
    READ TABLE it_collect  ASSIGNING <fs_collect>
                      WITH KEY   rbpl = <fs_wkdet>-arbpl
                                 ufnr = <fs_wkdet>-aufnr.
    anyways you can use  loop at statement before read to use  " into "  statement as:
    LOOP AT it_master INTO l_master
                                           WHERE werks       = l_werks
    hope it will help you
    regards
    rahul
    Edited by: RAHUL SHARMA on Dec 30, 2008 9:14 AM

  • How to get select-options type fields in module programming

    i need to get ranges type of fields ( like we use select-options in reports) in module prgrming..im only gettin single entry field (like we use in paramenters)...how to get it like this
    field1  ___  to  ___    ->
    field2  ___  to  ___    ->
    Thanx,
    Naveen Vishal

    Hi,
    report zrich_0006 .
    tables: mara.
    Custom Selection Screen 1010
    selection-screen begin of screen 1010 as subscreen.
    selection-screen begin of block b1 with frame title text-001.
    parameters: p_rad1 radiobutton group grp1 default 'X',
    p_rad2 radiobutton group grp1,
    p_rad3 radiobutton group grp1.
    select-options: s_matnr for mara-matnr,
    s_matkl for mara-matkl,
    s_mtart for mara-mtart.
    selection-screen end of block b1.
    selection-screen end of screen 1010.
    start-of-selection.
    call screen 100.
    *& Module STATUS_0100 OUTPUT
    module status_0100 output.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    endmodule.
    *& Module USER_COMMAND_0100 INPUT
    module user_command_0100 input.
    endmodule.
    Create Screen 100 with a subscreen area called "subscreen_1010"
    Screen Flow Logic follows
    *process before output.
    module status_0100.
    call subscreen subscreen_1010 including sy-repid '1010'.
    *process after input.
    call subscreen subscreen_1010 .
    module user_command_0100.

  • How do we trap exception inside the function module?

    How do we trap exception inside the function module?

    Use ABAP Help - CATCH, RAISE for starters. Or take a look at an existing function module, for example.

  • How to use "Select options" in Webdynpro Java ?

    HI experts ,
    I want know if can be implemented "select options" like the ones used in R3 - ABAP in a webdynpro Java.
    And in case of being possible, how to implemented using Adaptive RFC or BAPI with a R3 backend system?
    Our Portal is EP6.0 SP18 ,J2EE 6.40 .
    Thanks & Regards,
    Jianguo Chen

    Hi Jianguo,
    check these links:
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/5f/e5de3f68d48f15e10000000a155106/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/5f/e5de3f68d48f15e10000000a155106/frameset.htm</a>
    You may use 2 EVS to simulate your select option.
    Regards,
    Gianluca Barile

  • Passing SELECT-OPTIONS value to Function Module

    Hi,
    I need to pass select-options value to a function module.
    Code is like the following:
    SELECT-OPTIONS seltab FOR object-type.
    CALL FUNCTION 'Z_MY_FM'
          EXPORTING
            sel_tab         = seltab
         IMPORTING
            result_tab     = it_result
    I have found a similar problem in the SDN forum: How to pass select-options parameter to FM?
    However, that could not help me much in solving my problem.
    So far I have tried to created a structure in DDIC with the following components for the select-options:
    SIGN - BAPISIGN
    OPTION - BAPIOPTION
    LOW - ZBWOBJECTTYPE (my type)
    HIGH - ZBWOBJECTTYPE (my type)
    and subsequently a table type for this structure which is specified in the "Import" tab of my function module.
    Unfortunately, when I ran the program a runtime exception occured (CALL_FUNCTION_CONFLICT_TYPE).
    Could anyone please help me on this issue?
    Thanks in advance.
    Regards,
    Joon Meng

    Hello Joon,
    CALL FUNCTION 'Z_MY_FM'
          EXPORTING
            sel_tab         = seltab
         IMPORTING
            result_tab     = it_result
    You have defined SELTAB as a SELECT-OPTION.
    So when you pass only SELTAB, the header line is transferred to the FM. When you pass SELTAB[] the whole table(range) is passed.
    It is similar to the concept of an internal table with header line.
    Hope i am clear.
    Anyways how have you defined result_tab and sel_tab ?
    BR,
    Suhas

  • How to write select options with extension in module pool program

    hi,
    M having  the following fields through screen painter.
    1. sales offfice
    2.sales district
    3.customer no
    for those three fields no extension is not provided and no search help is there.
    i want write  seletion options to get extension in that module pool
    screen.
    plese send coding for me , please let me know how to get that
    select options with the above all three fields.
    Thanks & Regards
    Raji

    Check it
    In top include
    DATA: number(4) TYPE n VALUE '9005',
    PROCESS BEFORE OUTPUT.
      MODULE status_9001.
      CALL SUBSCREEN AREA1 INCLUDING SY-REPID number.
    PROCESS AFTER INPUT.
      MODULE user_command_9001.
      CALL SUBSCREEN AREA1.
    *&      Module  status_9001  OUTPUT
          text
    MODULE status_9001 OUTPUT.
      SELECTION-SCREEN BEGIN OF SCREEN 9005 AS SUBSCREEN.
      PARAMETER pa_bukrs TYPE t001-bukrs.
      select-options matnr for wa_matnr.
      SELECTION-SCREEN END OF SCREEN 9005.
    ENDMODULE.                 " status_9001  OUTPUT

  • How to pass a SELECT-OPTION to a FUNCTION-MODULE

    Hi forum:
              How can i pass a selection-option like an input parameter of a function-module?. Put one example in the answer, please.
              After pass this value i want to put this into an IN select condition.
       But for i only need know how to pass this value
    thnks
    Josué
    Thnks
    Josue Cruz

    Hi Rich.
       this is a little example of my code.
       DATA: wa_bukrs TYPE bkpf-bukrs,
                  wa_budat TYPE bkpf-budat,
                  wa_gjahr TYPE bkpf-gjahr.
       SELECT-OPTIONS: se_bukrs FOR wa_bukrs OBLIGATORY,
                    se_gjahr FOR wa_gjahr OBLIGATORY,
                    se_budat FOR wa_budat OBLIGATORY.
      HERE i can to put the call to the function.
    Thnks

  • How to pass select-options to the Adobe Form?

    Hello Experts,
    I am facing an issue on passing the SELECT-OPTIONS from driver program to Adobe Form .I created a structure which holds sign,Option,Low and High fields, assigned to the  table type and passed to the form,Its going dump can anyone resolve the issue.
    Regards,
    Girish Kumar vedurupaka.

    Hello simi ,
    Using se11 created a structure for select-options the created a table type for that structure. I pass that table type to the importing parameter in the form interface.
    in the Global data:
       IT-MARA TYPE TY_MARA.
    IN TYPES :
    TYPES :BEGIN OF ty_mara1,
             MARA TYPE MARA,
             ERSDA TYPE  ERSDA,
             ERNAM  TYPE ERNAM,
             LAEDA  TYPE LAEDA,
            END OF TY_MARA1.
      TYPES TY_MARA TYPE TABLE OF TY_MARA1.
    IN CODE  INITIALIZATION  I WRITE THE SELECT STATEMENT.
    SELECT MATNR ERSDA ERNAM FROM MARA INTO TABLE IT_MARA
    WHERE MATNR IN S_MATNR.
    in the driver program exported the S_MATNR to the the form.
    when i am executing the program and giving the range in S_MATNR values are not importing and and going to dump.  

  • Select Options to RFC function modules

    Hi all
    When we use a PERFORM in main program, we can simply use the select-options
    as for ex.,
    in so_matnr
    in so_bsart
    like that
    without passing any parameters.
    This way it will take all values given in 'Single values' in the multiple selection option of selection screen.
    We need not bother about so_matnr-low and so_matnr-high.
    When we use a function module to be executed in another R/3 server ,
    we have to pass values. In these values we can pass so_matnr-low and so_matnr-high only. If the user selects Single Vals instead of these,
    how to pass them?
    Regards
    Vijaya Chamundi

    Hi,
    so_matnr is stored as a table, with fields sign, option, low and high.
    Each time you add a single value, a line is added to the table.
    If you add 'single value'  1 in the selection screen, then a line is added to table so_matnr[] with fields sign='I', option='EQ' and low='00000..1' and high is empty.
    So, if you want to pass it as a parameter, you can pass it as a table:
    so_matnr[]
    In this way you are sure you have all the information you need.
    regards,
    Rolf

Maybe you are looking for

  • Subinventory LOV not getting populated in Mobile Field Service Pocket PC

    Hi, After installing Mobile Field Service Pocket PC on a Windows Emulator, and connecting to Oracle Database Lite webtogo, while trying to create a parts requirement the subinventory LOV is empty. The other fields like item and address are getting po

  • Adding field in standard SAP transaction output results.

    Hi, I have to add a new field in standard SAP transaction output results. Can any one tell me what are the ways (brief explanation) that I can do this? If using exists - then what kind of exists I have to use? And how to find out the possibility with

  • Problem to  Use C function in oracle

    Hi Friends, i m trying to use c funciton in oracle as per oralce documentation its working fine when i used the demo example but in demo example thr are only interger data type used i need to use the char data type from c and while calling that funct

  • Embedding an Application in webpage

    In my project I had to serve a windows/destop application (Example: Adobe Photoshop) on a web page. And the client shall use that and save the output in a location either on the server or his local system. Is there any way solve this problem..I know

  • Latest Safari Version: search field is now quite smaller

    I installed the most recent version of Safari last night. Now, for some reason, the search field in the top right corner is quite small. Because of this, the suggested Google keywords that appear in the drop down are now truncated. Does anyone know h