Parameter & Select Option

Hi Experts,
I've defined one parameter for company code(BUKRS) &  one select option for valuation class (BWKEY) in my selection screen.
If I select any comp code in the parmeter, then in F4 help for valuation class should show only valuation class assigned to that comp code.
It can derived from table T001k .
Could anybody help in this issue?
Points for Sure.
Thanks,
Ponraj.s.

Hi,
Check the below code.
tables: t001k.
For Identification Number
DATA: BEGIN OF it_bwkey OCCURS 0,
        bwkey LIKE t001k-bwkey,
      END OF it_bwkey.
data: v_bukrs(4).
For Run date
DATA: BEGIN OF it_bukrs OCCURS 0,
        bukrs LIKE t001k-bukrs,
      END OF it_bukrs.
DATA it_ret LIKE ddshretval OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN: BEGIN OF BLOCK main WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS:    p_bukrs(4) TYPE c.
SELECT-OPTIONS s_bwkey FOR t001k-bwkey NO INTERVALS.
SELECTION-SCREEN END OF BLOCK main.
Validation Section
INITIALIZATION.
  SELECT DISTINCT bukrs FROM t001k INTO TABLE it_bukrs.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'BUKRS'
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      dynprofield     = 'P_BUKRS'
      value_org       = 'S'
    TABLES
      value_tab       = it_bukrs
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bwkey-low.
  TABLES: t130r.
  DATA: BEGIN OF dynpfields OCCURS 0. "Hilfsstruktur zum auslesen des
          INCLUDE STRUCTURE dynpread. "Feldwertes vom Dynpro bei >F4<
  DATA: END OF   dynpfields.
  DATA : sy_repid LIKE sy-repid,
         sy_dynnr LIKE sy-dynnr.
  CLEAR dynpfields.
  REFRESH dynpfields.
  dynpfields-fieldname = 'P_BUKRS'.
  APPEND dynpfields.
  Lesen des akt. Wertes von Dynpro
  sy_repid = sy-repid.
  sy_dynnr = sy-dynnr.
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname     = sy_repid
      dynumb     = sy_dynnr
    TABLES
      dynpfields = dynpfields
    EXCEPTIONS
      OTHERS     = 01.
  IF sy-subrc = 0.
    READ TABLE dynpfields WITH KEY fieldname = 'P_BUKRS'.
    IF sy-subrc = 0.
      v_bukrs = dynpfields-fieldvalue.
    ENDIF.
  ENDIF.
  SELECT bwkey FROM t001k
  INTO TABLE it_bwkey
  WHERE bukrs = v_bukrs.
  DELETE ADJACENT DUPLICATES FROM it_bwkey.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'BWKEY'
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      dynprofield     = 'S_BWKEY'
      value_org       = 'S'
    TABLES
      value_tab       = it_bwkey
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
Message was edited by:
        Velangini Showry Maria Kumar Bandanadham

Similar Messages

  • How to set the parameter selection *optional* for each subreport?

    Hi,
    I am using Crystal Reprots 11.
    I create 10 subreports, and each subreport contains a Parameters Field.
    The 10 subreports are put in 10 footer sections in increasing order, i.e. subreport1, subreport2, subreport3, ..., subreport10.
    When I use "Print Preview" to take a look at the whole report, CR prompts a "Edit Values" window for selecting parameter values for all 10 subreports.
    For example, if I only select parameter values for subreport1 and click "OK", 9 error messages on the "Edit Values" window come out above the selection list box of every other subreports (i.e. subreport2 ~ subreport10) showing that: 'The value is not valid'.
    Sometimes, I just want to review some specific subreports but not all.
    How should I do to set the parameter selection optional (not mandatory) for each subreport?
    Thank you in adavance.
    Edited by: Holdup on Feb 17, 2012 3:44 PM

    Hi,
    Here's how you can make the prompts optional (Assuming you're using CR 2008 or higher):
    1) Go into each subreport
    2) You should see the parameter in the Field Explorer. Right-click the name and select Edit > Look for an option called 'Optional Prompt'. Set it to true
    3) If you have a record selection in the subreport, then you need to modify the selection formula to something like this:
    if not(hasvalue({?Parameter_Name})) then True else = {?Parameter_Name}
    Hope this helps!
    -Abhilash

  • Lock in parameter/select-options field

    Hi,
    How can we block another user from executing report with the same value of parameter/select-option field entered on screen by user?
    for example:
    Report ZZZ, parameter field sales org = A, run by user 1.
    Another user, say B, attempts to run the report by entering the same sales org = A. In these second execution of the report, I need to display error message saying that user A is running the report then report cant be run by user B.
    Do i need to put lock object for these?
    thanks alots
    Alia

    No, there is no mechanism to restrict in that way.
      but you can create a Z-table with one column (vkorg)
    now make a little change in the report..
    1.check if any entry of vkorg is there in that z-table.
    if not proceed, else error msg.
    2.craete an entry of that vkog in that z-table.
    3.Normal processing of this report.
    4.at end delete that entry of vkorg from z-table.
    thus you can achieve mutual exclusion.
    cheers.
    Message was edited by: Anid

  • How to fill empty parameter (selection-option)

    Hi!
    On selection screen I have two parameters (s_egrid and s_empid). If user enter something in first (but not in second) one, second one should be filled from database.
    The problem is that I don't know how to fill the empty parameter.
    Let's say that i have an internal table i_zemployee with list of all necessary employee Id's (stored in field empid)
    if I Ioop like this
    loop at i_zemployee into wa_zemployee.
        insert wa_zemployee-empid into s_empid.
      endloop.
    ... I did something stupid but i hope that you understand what i need:
    s_emipd[1] = 'u1'.
    s_emipd[2] = 'u7'.
    s_emipd[3] = 'u9'.
    ... like array of user id's.
    and this s_empid I need in my next SELECT statement like
    SELECT * FROM ...
        WHERE empid in s_empid.
    if someone knows the solution thanks in advance!
    T.

    HI try something like this...
    tables: mara, makt.
    data: begin of itab occurs 0,
    matnr like mara-matnr,
    end of itab.
    data : begin of btab occurs 0,
    maktx like makt-maktx,
    end of btab.
    ata mak like makt-maktx.
    DATA : return like ddshretval occurs 0 with header line.
      data: begin of dynpfields occurs 3.
              include structure dynpread.
      data: end of dynpfields.
    select-options: p_matnr for mara-matnr.
    select matnr from mara into table itab where matnr IN p_matnr.
    loop at itab.
    write: / itab-matnr.
    endloop.
    Initialization.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
    REFRESH ITAB.
    SELECT matnr FROM mara INTO TABLE ITAB.
    call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    retfield = 'MATNR '
    dynprofield = 'P_MATNR '
    dynpprog = sy-REPID
    dynpnr = sy-dynnr
    value_org = 'S'
    TABLES
    value_tab = ITAB
    return_tab = return.
    select single maktx from makt into  mak where matnr = return-fieldval.
    p_matnr = return-fieldval.
    refresh return.
    clear return.
    move 'P_MAKTX' to dynpfields-fieldname.
    move mak to dynpfields-fieldvalue.
    append dynpfields.
    CALL FUNCTION 'DYNP_VALUES_UPDATE'
      EXPORTING
        dyname                     = 'SY-REPID'
        dynumb                     = '1000'
      tables
        dynpfields                 = dynpfields
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    refresh return.
    clear return.
    validate according to ur requirement.
    Regards
    Syed A

  • Select-option/Parameter & Primary Key

    Dear Abaper,
        It this compulsory to have a Table fields define in Parameter/Select-option of Selection screen should be  Primary key of respective tables??
    and
      If we used two different tables having common fields and if common field of Table1  is primary key and Table2  is not a primary key can we used that common field in Parameter/Select-option of selection screen?
    Thanks & regards
    Mahendra

    Hi,
    Its not necessary to have fields in parameters/select options to be primary key. It just takes the datatype irrespective of the primary key.
    I have written a small example for you:
    PARAMETERS: a(18) type c,
                b type matnr, "data element
                c type mara-matnr. "table-fieldname
    These all are one and the same thing. a/b/c will have char 18 data type and length.
    Regards
    Purnand

  • Select option as parameter in FM.

    Ho to pass select options as a parameters in function module.

    There are ways to do it...
    In the Function module using the Table parameter you can do it.
    Have a table parameter to hold the select option , Don't type refer to any DDIC structure or field.
    In the implementation of the function module you can do some thing like this,.
    "example you want to pass matnr select option
    data: r_selopt type range of matnr.
    data: wa_opt like line of r_selopt.
    r_selopt = table_param[].
    in the call function side you pass the select option directly to the table parameter directly.
    call function 'ZTEST_FUNCTION_SLECTOPTION'
    tables
    table_param = s_matnr.

  • Import Parameter as Select Option for a FM in ECC 6.0

    Hi All,
    Can someone help me get the import parameter of a function module to be of the type select-options( the way it is used in reports) in ECC 6.0.
    Thanks for all your help in advance.
    Divya

    What I do is as following....
    I create two parameters...One for <b>START</b> and the other for <b>END</b>....Then, inside my FM I create a RANGE...
      DATA: BEGIN OF r_datum OCCURS 1,
            sign(1),
            option(2),
            low  TYPE vekp-vhilm,
            high TYPE vekp-vhilm,
            END OF r_datum.
    Passing the START to low and END to high....
    P.S: Don't forget to assign points to useful answers.
    Greetings,
    Blag.
    Message was edited by:
            Alvaro Tejada Galindo

  • Set Parameter id is not working in case of select-options

    Hi,
    i am using the below code to get the SWIA first field fill with some data which i am getting by logic written..but its not getting filled since in tcode the first input box is select-options not a parameter..if it would have been a parameter than my logic would have worked finest. so kindly suggest what to do now in case of select-options.
    form user_command  using p_ucomm    type sy-ucomm
                             p_selfield type slis_selfield.
      data : wi type sww_wiid .
      clear : wi .
      read table it_final into wa_final index p_selfield-tabindex.
      if sy-subrc = 0.
        check ( wa_final-wi_id is not initial ).
        wi = wa_final-wi_id .
        case p_ucomm.
          when '&IC1'.
            set parameter id 'WID' field wi.
            call transaction 'SWIA'and skip first screen.
        endcase.
      endif.
    endform.
    Regards,
    HiM

    ThanQ..i got you totally..thanks to remind
    Regards,
    HiM

  • 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

  • Passing Select-options as parameter to function module

    I need to pass a select-option as a parameter to a function module. Is this possible?
    There is an option of passing all the values of the select-option to an internal table, passing that internal table as parameter to the function module, and then adding it manually again to a select-option in the function module.
    But is there any direct way to do this?

    Hi,
    I have a similar problem: I have RFC function module to which I want to pass select options. Therefore I defined table parameters as follows:
    IT_RUNID     TYPE     EFG_TAB_RANGES
    IT_PERNR      TYPE     EFG_TAB_RANGES
    IT_REINR     TYPE     EFG_TAB_RANGES
    I can successfully pass my values to the module, but if I try to check these parameters
    using
    CHECK IT_TRIPS-RUNID IN IT_RUNID.
        CHECK IT_TRIPS-PERNR IN IT_PERNR.
        CHECK IT_TRIPS-REINR IN IT_REINR.
    the check always fails, I guess because there are leading zeros in the ranges. Is there a way to solve this problem?
    Thanks and regards,
    Martin

  • Select options and parameter

    We have a parameter and select option in Selection Screen, by using the parameter and select option in the select query, with out passing the any values to the Parameter and SO, how we will get the records?

    hi check this..
    if the parameter is empty if will not work in the select statement..you can get the values for the select options with empty structures..
    check this..
    tables:mara .
    data: begin of itab occurs 0,
    matnr like mara-matnr,
    end of itab .
    parameters:p_matnr like mara-matnr.
    select matnr  from mara into table itab
    where matnr  = p_matnr.
    loop at itab.
    write:/ itab-matnr.
    endloop.
    it will not fetch data..
    for select-options
    tables:mara .
    data: begin of itab occurs 0,
    matnr like mara-matnr,
    end of itab .
    select-options:s_matnr for mara-matnr.
    select matnr  from mara into table itab
    where matnr  in s_matnr.
    loop at itab.
    write:/ itab-matnr.
    endloop.
    it will fetch data..
    regards,
    venkat

  • Select option and parameter.

    I have select options and parameters in my selection screen. While extracting the data I am using both the select option and a parameter in where condition.  But that select statement is not returning any data. Could any body tell me what might be the reason.
    Thanks,
    bsv.

    Hi,
      See this example code it works.
    tables spfli.
    parameters p_carrid type spfli-carrid obligatory.
    select-options s_connid for spfli-connid.
    data itab type table of spfli with header line.
    select *
       from spfli into table itab
    where carrid eq p_carrid
       and connid in s_connid.
    loop at itab.
      write: / itab-carrid,
               itab-connid.
    endloop.
    Note : Dont leave blank for parameters because it take as space and when you select from table it is unsuccessful.
    Plzz Reward if it is useful,
    Mahi.

  • Select options to Function Module parameter

    Hello,
    I have a select options parameter in my report and then I have a function module that have to select into a database table using this SO.
    How can I pass the SO to the FM?
    The code must be something like that:
    REPORT ZXXXX.
    SELECT-OPTIONS:  so_werks FOR marc-werks.
    CALL FUNCTION 'ZFUNCTION'
    FUNCTION ZFUNCTION
    SELECT matnr FROM marc INTO TABLE it
    WHERE werks IN so_werks
    The select options must be a TABLES parameter? I have to create a structure type for that SO?

    Hi,
    In FM interface you can use
    structure EFG_RANGES ( In Tables Parameter ) . This structure is same as select options.
    Or in Importing parameters use EFG_TAB_RANGES . This is an internal table type .
    In both ways you can pass your select option to FM diretcly.
    Check the following link as well
    https://forums.sdn.sap.com/click.jspa?searchID=11071891&messageID=4908310
    Regards,
    Raj.

  • HOW  TO PASS SELECT-OPTIONS PARAMETER TO A FUNCTION MODULE.

    Hi friends.
    HOW DO U PASS A SELECT-OPTIONS PARAMTER TO A FUNCTION MODULE AS ITS IMPORT PARAMETER(IN MY CASE rfc fM) .
    Really urgent!!!
    thanks to one and all

    Hi,
    If you are passing a single value, its better you take it from s_option-low or s_option-high (select options).
    Else if you are passing values to the FM in a loop for all select option values, then better you declare an internal table with type <b>WSELKUNNR</b>.
    get low & high fields from each row & pass them.
    It will make you clear when you check out your select options in debug mode by entering different combinations of inputs.

  • Change from Parameter to Select-options.

    Hi All,
    Requirement is to change the existing program.
    One of my requirement is to change parameter(P_VKORG) to Select-options(S_VKORG).
    I mean  earlier we have only one Slaes Organization, now we have got to use multiple Sales organizations. For this requirement I have used select-options insted of Parmeters.
    But the code has:
    a)PERFORMS using Parameters( P_VKORG). This inturn is used in the select statement of the FORM-ENDFORM.
    b)READ statement also has P_VKORG in where condition.
    How should these be replaced with Select-options(S_VKORG)?
    What would be the effect if I directly replace them with S_VKORG.
    Kalyani T

    you cannot just directly replace with S_VKORG.
    select option is a structure with 4 fields, sign, option, low and high, hence it has to be dealt accordingly.
    a. performs has to be changed to 'tables S_VKORG'
    eg. perform get_data tables s_vkorg.
    b. read statement has to be modified to deal with multiple values. best option will be to select for data in s_vkorg, and save in an internal table.
    for eg, if select option was for vkorg,
    select vkorg from tvko into t_tvko where vkorg in s_vkorg.
    now t_tvko has list of possible vkorgs - regardless of we had a range or ne or gt or CP or whatever we had in select option.
    now modify the read table to do for entries in T_TVKO.
    c. in the select statement which is used in forms, wherever you see ' = P_vkorg'  , replace with IN S_VKORG.

Maybe you are looking for

  • Exit code 6: Premiere Pro CS6 [was: Error re]

    I need to reinstall Premiere Pro CS6, but I keep getting error messages: Exit Code: 6 Please see specific errors below for troubleshooting. For example,  ERROR: DF024 ... -------------------------------------- Summary --------------------------------

  • Can anybody help about the conditions in CRM business transaction??

    Hi experts, I'm fresh on CRM and have several questions regarding the conditions in CRM business transactions. Can you please help?Thanks in advance. In prciing procedure,we can determin which condition should be involved in item level,    then,how a

  • Ejb client stacktrace

    I'm new to ejb's so bare with me.... We have a number of stateful session beans deployed using weblogic6.1. I'm trying to figure out how to correctly propogate exceptions between the ejb and the client. My ejb throws custom exceptions of type X that

  • 8900 Not Connecting to Desktop Manager in Boot Camp

    Hi all I have a problem in Boot Camp (XP Pro) on my new MacBook Pro. My 8900 shows up perfectly in device manager and I can also browse the media card. When I run Desktop Manager 4.7, it cannot pick up the BlackBerry and it shows as Disconnected. I h

  • Windown update failure for 2008 R2 sp1

    I have a server which exhibit strange behaviour for window update. While it can detect required updates from MS, but most of them (except a few, i.e. KB3037581) failed to install. Inspection of windowupdate.log give the following error for failed upd