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

Similar Messages

  • How to use offset for select-option parameter ?

    Hi experts
    could anybody please let me know how to use offset for select-option parameter. i can able to use offset for table fields, variabiles and all , but don't know how to use for parameters.
    following is my code
    SELECT-OPTIONS: s_prctr  FOR vbsegs-prctr OBLIGATORY.
    here "prctr"  length is 10.
    i'm using two tables  1. vbsegd-bupla
                                    2. vbsegs-prctr
    here prctr+6(4) = bupla.
    "Bupla" length is 4
    SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
                                                                 WHERE belnr = it_vbkpf-belnr
                                                                   AND gjahr = it_vbkpf-gjahr
                                                                   AND bukrs = it_vbkpf-bukrs
                                                                   AND bupla IN s_prctr.  
    the above statement is not working as prctr and bupla lenths are different. here i want to use offset.
    SELECT belnr gjahr bukrs prctr sgtxt buzei FROM vbsegs INTO CORRESPONDING FIELDS OF TABLE it_vbsegs FOR ALL ENTRIES IN it_vbkpf
                                                                WHERE belnr = it_vbkpf-belnr
                                                                  AND gjahr = it_vbkpf-gjahr
                                                                  AND bukrs = it_vbkpf-bukrs
                                                                  AND prctr IN s_prctr.
    this is working as prctr and s_prctr lengths are equal.
    could anybody please help me out in this.
    Thanks in advance.
    regards
    satish

    Below code will work for you.
    SELECT-OPTIONS: s_prctr  FOR vbsegs-prctr OBLIGATORY.
    RANGES: s_bupla FOR vbsegd-bupla.
    s_bupla[] = s_prctr[].
    DELETE ADJACENT DUPLICATES FROM s_bupla.
    SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
                                                                  WHERE belnr = it_vbkpf-belnr
                                                                    AND gjahr = it_vbkpf-gjahr
                                                                    AND bukrs = it_vbkpf-bukrs
                                                                    AND bupla IN s_bupla.

  • Passing select option parameter to a procedure

    Hello, i need to know pass a select option parameter to a procedure. I tried the following
    For eg if i have a select option called so_belnr & i call the procedure using the following
    PERFORM VALIDATE_DOCUMENT TABLES SO_BELNR USING GJAHR BUKRS  , i still cannot use the
    select option paramter in the called procedure.
    Pls help.

    Hi,
    in topinclude...
    data: lr_belnr type RNG_BELNR.
    at start-of-sel.....
    move so to range..
    refresh: lr_belnr.
    lr_belnr[] = so_belnr[].
    PERFORM VALIDATE_DOCUMENT TABLES lr_belnr USING GJAHR BUKRS .
    in form:
    ...   tables lr_belnr like structure of RNG_BELNR.
    reason(my definietion): perfom doesn´t know if the select-options is availible.....
    bestreg
    Robert

  • Select-option parameter passed to function module

    hi,
    I have passed the select-option parameter as a table to my function module,
    suppose i have passed it as date(it contains field date-high and date-low)
    In my function module while i am looping the table and selecting the data according to date_low,it is going to select only the data according to date_low.
    since the table contains only one row.
    loop at date.
    select the data according to date_low.
    date_low = date_low +1.
    modify date_low.
    endloop.
    how can i select all the data from date_low and date_high?

    Hi,
    there is issue  design of ur FM .
    You have to put 2 table parametrs or 2 import paremeters in the FM ,after that with in the Function module fill the internal table of type ranges (say itab).
    After filling the ranges internal table, this can be used in ur select stament just as select option ( select ...where podat in itab)
    revrt back if any issues.
    regards,
    Naveen

  • Propagate Properties option for Primary Keys?

    Hi,
    I have a physical model Oracle Database 11g created. I would like to change Using Index option from one value to another for most of primary keys in the model. Is there a way to do it? Additionally I would like to assign all primary key indexes to one tablespace.
    Now, I have to:
    1. Double click on one of the primary keys.
    2. Change Using Index option on General tab.
    3. Go to Using Index tab and select proper tablespace.
    All these steps have to be repeated for each primary key.
    Is there a way to do it once and propagate the change for all? There is similar option on indexes but I don't see it for primary keys.
    Arek

    Hi Arek,
    unfortunately there is no "Propagate Properties" functionality for primary keys.
    Philip

  • How to improve performance of select query when primary key is not referred

    Hi,
    There is a select query where we are unable to refrence primary key of the tables:
    Since, the the below code is refrensing to vgbel and vgpos fields instead of vbeln and posnr..... the performance is very  slow.
    select vbeln posnr into (wa-vbeln1, wa-posnr1)             
           from lips                                            
           where ( pstyv ne 'ZBAT'    
               and pstyv ne 'ZNLN' )  
               and vgbel = i_vbap-vbeln                         
               and vgpos = i_vbap-posnr.                        
    endselect.                                                 
    Please le t me know if you have some tips..

    hi,
    I hope you are using the select statement inside a loop ...endloop get that outside to improve the performance ..
    if not i_vbap[] is initial.
    select vbeln posnr into table it_lips
    from lips
    for all entries in  i_vbap
    where ( pstyv ne 'ZBAT'
    and pstyv ne 'ZNLN' )
    and vgbel = i_vbap-vbeln
    and vgpos = i_vbap-posnr.
    endif.

  • 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.

  • How to pass value to select-option parameter using SET PARAMETER Command

    Hi,
        Am passing values to selection-screen fields in report RV13A004 ( used in VK11, VK12 and VK13). using below statement but material number is select-option in this report. am able to pass  MATERIAL FROM using SET PARAMETER ID, can i know how to pass values MATERIAL TO range in select-options fields using SET PARAMETER Command ??
    Passing values to parameter id
    set parameter id 'VKS' field kschl.
    set parameter id 'VKO' field vkorg.
    set parameter id 'VTW' field vtweg.
    set parameter id 'KDA' field erdat.
    set parameter id 'MAT' field matnr_from.
    Change condition price.
    call transaction 'VK12' and skip first screen.
    Thanks in advance.
    Regards,
    Balamurugan.

    Hi,
    instead of using set parameters and dden call transaction use this..........
    submit RV13A004  WITH SELECTION-TABLE rspar
    Effect
    If you specify this addition, parameters and selection criteria on the selection screen are supplied from an internal table rspar. You must specify an internal table with the row type RSPARAMS for rspar. The structured data type RSPARAMS is defined in the ABAP Dictionary and has the following components, all of which are data type CHAR:
    SELNAME (length 8),
    KIND (length 1),
    SIGN (length 1),
    OPTION (length 2),
    LOW (length 45),
    HIGH (length 45).
    To supply parameters and selection criteria for the selection screen with specific values, the lines in the internal table rspar must contain the following values:
    SELNAME must contain the name of a parameter or selection criterion for the selection screen in block capitals
    KIND must contain the type of selection screen component (P for parameters, S for selection criteria)
    SIGN, OPTION, LOW, and HIGH must contain the values specified for the selection table columns that have the same names as the selection criteria; in the case of parameters, the value must be specified in LOW and all other components are ignored.
    If the name of a selection criterion is repeated in rspar, this defines a selection table containing several lines and passes it on to the selection criterion. If parameter names occur several times, the last value is passed on to the parameter.
    The contents of the parameters or selection tables for the current program can be entered in the table by the function module RS_REFRESH_FROM_SELECTOPTIONS.
    Notes
    In contrast to selection tables, the data types of the components LOW and HIGH in table rspar are always of type CHAR and are converted to the type of the parameter or selection criterion during transfer, if necessary.
    When entering values, you must ensure that these are entered in the internal format of the ABAP values, and not in the output format of the screen display.
    Cheers
    Will.

  • Select option/Parameter

    Hi Folks,
    I have declared two variables vendor and PO Doc Type along with the other fields in the selection screen  and was not able to understand the way it behaves.
    vendor and potype are declared as select-option no intervals.
    In that way the select statement is selecting the data even if we leave the fields blank in the selection screen.
    But,
    When I declare the vendor as select option no intervals and potype as parameter
    and leave the fields as blank it is not selecting the data.If I gve some value to POtype then it is working fine.
    So,does it mean that if we declare a variable as parameter,is it a must to given some value in the selection screen?
    Kindly let me know.
    K.Kiran.

    Hi Kiran,
    If you declare the selection screen variable as parameter and using this in the WHERE clause of query then it should have some value.
    This is not the case with select option.
    Why is it like this.
    PARAMETER in WHERE clause - The select statement treat it as a single field so you need to fill it.
    SELECT-OPTION - It is treated as the no. of fields, so nothing is filled in this ...that means select ALL
    Hope it is clear.
    Regards,
    Atish

  • Populating select-option, parameter simultaneously

    Hi All,
    I have a select option and a parameter on the selection screen. The parameter is disabled for input and enabled for output. The F4 for the the select option has a numeric value and a corresponding text (comes from a standard function module). When I select a value from F4, the numeric value should go to the select-option and the text should go to the input disabled parameter.
    At the moment, I am having to press an enter after choosing F4, for the text to reflect in the parameter field. I need both of them displayed at the same time, without having to press an enter.
    Please guide me about how I could achieve this.
    Thanks and Regards,
    Vidya.

    use this code in your F4 Help of Select Option after F4 Help Function Module .
    DATA SCR_FIELDS  LIKE DYNPREAD   OCCURS 0 WITH HEADER LINE.
    SCR_FIELDS-FIELDNAME =  ur parameter Name.
    SCR_FIELDS-FIELDVALUE =  ur parameter value(ur Text Field)
    APPEND SCR_FIELDS.
    CALL FUNCTION 'DYNP_VALUES_UPDATE'
        EXPORTING
          DYNAME               = PROG_name
          DYNUMB               = SY-DYNNR
        TABLES
          DYNPFIELDS           = SCR_FIELDS
        EXCEPTIONS
          INVALID_ABAPWORKAREA = 1
          INVALID_DYNPROFIELD  = 2
          INVALID_DYNPRONAME   = 3
          INVALID_DYNPRONUMMER = 4
          INVALID_REQUEST      = 5
          NO_FIELDDESCRIPTION  = 6
          UNDEFIND_ERROR       = 7
          OTHERS               = 8.
    So you need not have to press Enter
    Regards,
    Alpesh
    Edited by: Alpesh on Mar 14, 2009 11:44 AM

  • Select statement for primary keys

    Hi
    What is the syntax to select a statement from a table with only primary keys. there are 4 primary keys i have to select all the 4 primary keys is there any syntax difference???

    Hi,
    do u want those primary keys in the internal table or else will u have a where condition based on those all the primary key fields
    if u use all the four primary keys u can write like this remember one thing first u write the field just like in the table created order it is not mandatory to do like that but it increases the performance of the so query
    select single * from ztable into table t_tab where (mention all the four primary keys here ) it increases the performance we are using this single because u r giving all the primary keys in the select query so obvously one record will be there so it increases the query performance..
    if wont give those primary keys then write like this select * from ztable into table t_tab.
    as normal as ordinary
    i hope u got cleared
    plzz reward if it is helpful..
    plzz dont forget to reward...

  • ODI Selective Reverse throws Primary Key Violation error

    Hi John,
    Hope you are doing good.
    The version of ODI  is 10.1.3.4.5
    I was trying to reverse an MS SQL table using selective reverse and its throwing the below error
    com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'PK_COL'. Cannot insert duplicate key in object 'dbo.SNP_COL'.
    Also the error says - Technology or Driver does not support Reverse engineering
    I reversed the same table yesterday and it went fine. But today i wanted to reverse an another table from the same database but its giving an error. I tried deleting the Model itself and tried reversing the both tables and now its not reversing the first on either.
    Please suggest.
    Thanks,
    Sravan

    dear
    you have performed more than once the same reverse engineering.
    If the problem is a doubling in snp * repository, you could delete rows via plsql this process and try again
    tell me if this is not working or if

  • How to use a select option parameter?

    hi
    i have created a selection screen in this way
    select-option car_no for equi-equnr.
    now i want to move all the values that i have selected in car_no range into an itab?
    i used the debugger and so that i have low and high i can i move all the values into an itab
    thanks.

    Hi,
    If you want to move the values of your select-options into an internal table, LOOP the select options and move the values into your internal table.
    sample code:-
    select-options car_no for equi-equnr.
    loop at car_no.
    wa_itab-equnr = car_no-low.
    append wa_itab to itab.
    endloop.
    But here you have to take care of few things.
    Firstly the values which are excluded. There are 4 fields in selection options - Option, sign, Low and High. When sign is 'I' you can move it into your internal table. When it is 'E' you should not select that particular entry.
    Secondly, do you have any high values. If there are high values available then you have to take all the values beteween low and high an move them into your internal table. One thing can be done in this case - while declaring the select option you can add "NO INTERVALS " so there would be only low value available unless user goes into EXTENSION option and selects ranges option.
    If you wante to move them into ranges internal table, then you can declare ranges and move it into that table.
    smaple code:-
    DATA: r_equnr TYPE RANGE OF equi-equnr,  
              wa_r_equnr LIKE LINE OF r_equnr.
    r_equnr[] = car_no[]
    Can you give more clarification about your requirement, so that a better solution can be provided.
    Edited by: Krishna Adabala on Nov 27, 2008 9:50 AM

  • Select query with primary key on RESB taking too long

    Hello All,
    The below Select query is taking about 1 Hour to run on production. I have done some analysis and the correct index is being selected.
    The query is :
    IF it_aufnr[] IS NOT INITIAL.                             
        SELECT rsnum
               rspos
               matnr
               werks
            lgort
               shkzg
               aufnr
               bdmng
               enmng                      
               FROM  resb INTO  TABLE it_rsnum FOR ALL ENTRIES IN it_aufnr
               WHERE rsnum EQ it_aufnr-rsnum
               AND   xloek NE 'X'
               AND   postp NE 'X'
               AND   resb~bdmng GE resb~enmng.
      ENDIF.
    Database Table RESB: 40,000,000 Records (40 Million)
    Internal Table   it_aufnr:  20,000 Entries
    Entries selected from RESB: 150,000.
    Any ideas on how I could improve the performance ?
    Thanks,
    Shruthi

    >     SELECT rsnum
    >            rspos
    >            matnr
    >            werks
    >         lgort
    >            shkzg
    >            aufnr
    >            bdmng
    >            enmng                      
    >            FROM  resb INTO  TABLE it_rsnum FOR ALL ENTRIES IN it_aufnr
    >            WHERE rsnum EQ it_aufnr-rsnum
    >            AND   xloek NE 'X'
    >            AND   postp NE 'X'
    >            AND   resbbdmng GE resbenmng.
    >   ENDIF.
    >
    > Database Table RESB: 40,000,000 Records (40 Million)
    > Internal Table   it_aufnr:  20,000 Entries
    > Entries selected from RESB: 150,000.
    >
    Hi,
    the problem is the big for all entries table.
    Your 20.000 records FAE will be split into SEVERAL sql statements depending on the size of the table.
    Where do you get the it_auftrn from?
    If it's another transparent table try to JOIN this table to your big table.
    SELECT rsnum
                rspos
                matnr
                werks
            lgort
                shkzg
                aufnr
                bdmng
                enmng                      
                FROM  resb JOIN tab_auftrn  on  resbrsnum = tab_auftrnauftrn
                AND   xloek NE 'X'
                AND   postp NE 'X'
                AND   resbbdmng GE resbenmng.
    Make sure that your WHERE filter and the JOIN keys on both tables are supported by indexes.
    150.000 records about of 40 Mio. can definitly be serviced by an appropriate index:
    i.e. Index fields (check your PK or secondary indexes):
    rsnum
    enmng                      
    aufnr
    bye
    yk

  • 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.

Maybe you are looking for