Dynamic SQL for selection-option???

Hi,
I am trying to select a table from the parameters (range ) , but every time i run it give me a dump witn error in  where ...(itab)
First i declare :
data : cond(72) TYPE C,
         itab LIKE TABLE OF cond .
select-options: p_auart  FOR vbak-auart ,
                      p_vkorg FOR vbak-vkorg.
--->
If not p_auart is initial.
    cond = 'auart IN p_auart' .
APPEND cond To itab.
endif.
the i do select:
Select * from vbak where (itab).
---> I give a dum in where clause....
So could you please help me out of this
Thanks

Hi Friend,
Make the following corrections.Your code will work fine.
By the statement- 'itab LIKE TABLE OF cond .' you meant to create a table of the type 'COND' which should be a structure.
So, here lies the problem.In your case COND is a char type variable and you are trying to mimic the table 'itab' from it.
As a rule of thumb,a table should mimic a std., table or a structure.
So remove the following lines:
data : cond(72) TYPE C,
itab LIKE TABLE OF cond .
Include the following lines:
type: begin og itab_record,
        cond(72) TYPE C,
        end of itab_record."Declaration of structure itab_record.
data: itab type standard table of itab_record initial size 0 with header line."Declaration of the table itab which mimics the       structure itab_record.
Modify these two statements,
cond = 'auart IN p_auart' .
APPEND cond To itab.
to
itab_record-cond = 'auart IN p_auart' .
append itab_record.
Other lines are exact,make these changes,execute it and seek my assistance if necessary.
Regards,
Lakshmanan

Similar Messages

  • Dynamic variant for select option High value

    Hi ,
    Please help me in creating dynamic variable for a select option date field high value.
    II tried the following method:
    1. Enter the values in the selection screen
    2. Save the variant using the SAVE button
    3. In the next screen for the date variable select the 'Selection variable' checkbox (L) and click on the button 'Selection variable' in the toolbar.
    4. Now you will see this variable in the next screen with 3 types of buttons. Click on the middle button (i.e. D - Dynamic date calculation).
    5. Click on the down arrow button and select the option 'Current Date'.
    5. Save the variant.
    But it is saving the date value in Field LOW of select option( From value).
    I need it in TO field( High value).
    Please help.
    regards,
    Sheeba

    Hi Sheeba
        we can do it other way .. Select the same steps as you have done but after the assigning the value current date to low ..click on the selection option push button at the application bar and choose the 'less than or equal to' option to your select option value and try the same ....
    I guess this would throw you same results as that of the value in the high value button
    Cheers,
    Jacks.

  • Dynamic F4 for Select Options

    Hi,
    I have two Select-Options for Kunnr and Bukrs.
    My requirement is that,
    when I select a particualar Kunnr in the Select Option the Corresponding Bukrs must appear in the F4 for the S_BUKRS.
    Can someone help please.
    Thanks,
    Supriya Manik.

    You might have to code a search help exit to achieve this purpose.
    In the KUNNR search help, have the exit export the selected value to parameter ID KUN.
    Then, from the BUKRS search help, read this value and pass it to the KUNNR field in the F4.
    You can find more info on search help exits at:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ee52446011d189700000e8322d00/frameset.htm
    Hope this helps.
    Sudha

  • Dynamic Values for Select Option

    Hi, 
      My requirement is that i have to set
      yesterday for the low range of select option
      and today for the high range.
      I tried the selection variables and found that
      only low range can be specified in the
      selection variable.
    Thanks,
    Siva

    Hi,
    You mean default display variant.
    Then try this.
    data w_variant TYPE disvariant.
    PARAMETERS P_LAYOUT LIKE DISVARIANT-VARIANT.
    INITIALIZATION.
    *Get Default display variant
    PERFORM F100_DISPLAY_DEFAULT_VARIANTS.
    FORM f100_display_default_variants.
      w_variant-report   = sy-repid.
      w_variant-handle   = c_handle.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save        = 'A'
           CHANGING
                cs_variant    = w_variant
           EXCEPTIONS
                wrong_input   = 1
                not_found     = 2
                program_error = 3
                OTHERS        = 4.
      IF sy-subrc EQ 0.
        p_layout = w_variant-variant.
      ENDIF.
    ENDFORM.

  • Dynamic sql for select statement

    Hi,
    Please help me with the below code:
    It is updating null if the select statment returns one values. If it fetches multiple values then it throughs the below error msg when running the program.
    Please let me know how to modify the below code. Or let me know is there anyother way to write this code.
    Logic for development:
    * View name should be passed as dynamic.
    CREATE OR REPLACE
    PROCEDURE "PKEP_LOAD_SO_EU" (p_var1 IN VARCHAR2)
    IS
    lv_sql VARCHAR2 (4000);
    lv_name VARCHAR2 (20);
    BEGIN
    lv_sql :=
    ' SELECT DISTINCT LEVEL2
    FROM BIIO_SALES_OB_IMPORT_'|| p_var1;
    EXECUTE IMMEDIATE lv_sql
    INTO lv_name;
    BEGIN
    UPDATE BIIO_SALES_OB_IMPORT_NA2 --table name for updation
    SET SOB_1 = NULL,
    SOB_DATE_1 = NULL
    WHERE level2 = lv_name; -- validation ( eg. Select distinct level2 from biio_sales_ob_import_'||p_var1)
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line (SQLERRM);
    NULL;
    END;
    END;
    BEGIN
    PKEP_LOAD_SO_EU ('NA1');
    end;
    Error report:
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at "DEMANTRA.PKEP_LOAD_SO_EU", line 11
    ORA-06512: at line 2
    01422. 00000 - "exact fetch returns more than requested number of rows"
    *Cause:    The number specified in exact fetch is less than the rows returned.
    *Action:   Rewrite the query or change number of rows requested
    Thanks.
    Padma

    Padu wrote:
    Please let me know whether is anyother way to write this code as im a beginner for SQl.You dont need to have a seperate SELECT statement. Just a single UPDATE will do the job for you.
    create or replace procedure pkep_load_so_eu
       p_var1 in varchar2
    as
    begin
       lSql := ' update biio_sales_ob_import_na2               ' ||
               '    set sob_1      = null                    ' ||
            '      , sob_date_1 = null                    ' ||
            '  where level2 in (                         ' ||
            '                    select level2               ' ||
            '                      from biio_sales_ob_import_'       || p_var1 ||
       execute immediate lSql;
    end;

  • Should I use dynamic SQL for simple updates?

    Please tell me, out of the two options given below, which option should i use to update columns in a table and why?
    what will be the performance difference between the two approaches?
    Please note: The options given below is just for an example
    procedure proc1(var1 varchar2)
    is
    begin
    update tab1 set col1 = var1;
    commit;
    end;
    procedure proc1(var1 varchar2)
    is
    sqlstr varchar2(1000);
    begin
    sqlstr := 'update tab1 set col1 = :v1';
    execute immediate sqlstr using var1;
    commit;
    end;
    Thanks
    Arun

    Arun G Nath wrote:.
    Should I use dynamic SQL for simple updates? No way, not a chance.
    Performance is not the issue (as long as you are using bind variables).
    But with dynamic SQL, you loose compile time checking; you do not know until runtime if the SQL is valid.
    You also loose the dependency between proc1 and tab1, which can be found only if you search user_source.
    (And in either case, you probably want to remove the commit)
    Regards
    Peter

  • Can i assign a collective srch help for select option in list display

    can i assign a collective srch help for select option in list display

    Hi,
    Yes ,u can assign a collective search help for select-option in list display.
    Eg:
    Define your select option like this
    SELECT-OPTIONS: s_vbeln FOR likp-vbeln MATCHCODE OBJECT vmva.
    Regards,
    Shiva.

  • How to set default values in initialization event for select option

    Abapers,
    I have 3 GL account like 0024831231,0024831238,0024831245.
    Please help me how to set default values in select-options ( s_hkont ) in INTIALIZATION event
    Thanks

    Select option is table <Structure> with fields, low, high, sign & option
    you need to append the value into the select option, with appropriate value in low or
    example:
    S_HKONT-low  = <value>
    S_HKONT-SIGN = 'I'
    S_hkont-OPTION = 'EQ'
    append s_hkont.
    Default value for select-option also can be added directly in select-option statement.
    Regards,
    Mahesh

  • Input Negative values in selection screen  for select-options field

    I am not able enter negative values for
    SELECT-OPTIONS V_ERFMG FOR MSEG-ERFMG.
    It says negative values are not allowed but I need to check for negative values. Kindly provide me solution.

    You can't put the negative values here...because the Domain which is attached to MSEG-ERFMG has not the "Sign" checkbox on.
    Try with this code:
    tables:wbrp.
    SELECT-OPTIONS V_ERFMG FOR WBRP-menge.
    Regards,
    Naimesh Patel

  • How to get calender in f4 help for select options in module pool (URGENT)

    Hi All,
    how to get calender in f4 help for select options in module pool
    Please help .
    Thanx in advance,
    amruta

    Hi Amruta,
    First of all, you can not create select-options directly in module pool.
    For creating <b>select-option is dialog prog</b> follow these steps:
    1. create your selection screen model as subscreen by:
    SELECTION-SCREEN BEGIN OF SCREEN 2000 AS SUBSCREEN.
    PARAMETRS: P_MATNR LIKE MARA-MATNR.
    SELECT-OPTIONS: S_BISMAT FOR MARA-BISMAT.
    SELECTION-SCREEN END OF SCREEN 2000.
    2. create a screen ( example 100 ) in your module-pool dedicated for selection-screen. on this screen layout sketch a sub-screen name like subscree_2000.
    3. write this bit of code in PBO and PAI of the screen 100;
    CALL SUBSCREEN SUBSCREEN_2000.
    4. include this code in PBO:
    INCLUDING SY-REPID '2000'
    6. write user_command of PAI, call screen which is going to executable after selection-screen.
    5. create a transcation for this dialog module pool with screen 100.
    6. execute this transaction and you can see it's behaving like cool with select-options.
    After that in [bprocee on value-request]</b>, use F4_DATE for both from and to option field.
    Hope it will solve the problem.
    Regards
    Krishnendu

  • How to assign search help using ovs for select options for ALV in web dynpr

    how to assign search help using ovs for select options for ALV in web dynpro

    Hi,
    refer http://wiki.sdn.sap.com/wiki/display/WDABAP/InputhelpofObjectValueSelectioninWDABAP
    http://www.****************/Tutorials/WebDynproABAP/OVS/page1.htm
    and http://wiki.sdn.sap.com/wiki/display/Snippets/WebDynproAbap-OVSsearch+help
    Thanks,
    Chandra

  • F4 help for select options based on parameter value

    hi all,
    I need a help to create an F4 help for select options for object id based on parameter value of object type, I mean once an object type is given the f4 help should contain object id's only of that type for each option.
    Regard's,
    Girija
    Moderator Message : Duplicate post locked. Continue with [f4 help for select options based on parameter value |f4 help for select options based on parameter value;.
    Edited by: Vinod Kumar on May 17, 2011 1:36 PM

    hi all,
    I need a help to create an F4 help for select options for object id based on parameter value of object type, I mean once an object type is given the f4 help should contain object id's only of that type for each option.
    Regard's,
    Girija
    Moderator Message : Duplicate post locked. Continue with [f4 help for select options based on parameter value |f4 help for select options based on parameter value;.
    Edited by: Vinod Kumar on May 17, 2011 1:36 PM

  • How to add OBLIGATORY for SELECT-OPTIONS

    Hi experts,
    I can use OBLIGATORY for PARAMETERS
    PARAMETERS :s_WMno  TYPE LINK-LGNUM DEFAULT 'SCA' OBLIGATORY.
    I want to add OBLIGATORY for SELECT-OPTIONS. How to do this?
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME .
        SELECT-OPTIONS:  s_matnr FOR mara-matnr .
    SELECTION-SCREEN END OF BLOCK b1.
    Many thanks.

    Hi,
    TABLES spfli.
    SELECT-OPTIONS : carrid FOR spfli-carrid OBLIGATORY. " This makes only Low field Obligatory
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-name = 'CARRID-HIGH'. " To make High field also obligatory
          screen-required = 1.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    Cheerz
    Ram

  • How to do validations for select-options

    Hi gurus,
    can you suggest me
    how to do validations for select-options
    Thanks&ragards,
    Kals.

    HI,
    TABLES: BKPF.
    TYPES: BEGIN OF TY_BKPF,
           BUKRS TYPE BUKRS,   "COMPANY CODE
           GJAHR TYPE GJAHR,   "FISCAL YEAR
           MONAT TYPE MONAT,   "FISCAL PERIOD
    DATA: T_BKPF TYPE TABLE OF TY_BKPF,
          W_BKPF TYPE TY_BKPF.
    SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_CODE   FOR BKPF-BUKRS,
                    S_YEAR   FOR BKPF-GJAHR,
                    S_PERIOD FOR BKPF-MONAT.
    SELECTION-SCREEN: END OF BLOCK B1.
                        AT SELECTION-SCREEN                           *
    IF S_CODE IS INITIAL OR S_YEAR IS INITIAL OR S_PERIOD IS INITIAL.
      MESSAGE E000(0) WITH 'ENTER VLAUES'.
    ENDIF.
    SELECT SINGLE * FROM BKPF WHERE BUKRS IN S_CODE.
      IF SY-SUBRC <> 0.
      MESSAGE E000(0) WITH 'ENTER VALID VALUES'.
      ENDIF.
    reward if useful
    thanks and regards

  • Standard Match Code for Selection Options with Example

    Hi Guys,
                 Can anybody tell me Standard Match Code or Search help for Selection Options.
             ex: MBEW-MATNR , MBEW-BWKEY and MBEW-BWTAR. can anybody tell how to keep Search Help or Match Code for the Above Fields in ECC 6.0 with Example
              Very Urgent.
    Thanks,
    Gopi.

    Well Gopi.. as per your requirement no need to use collective search help.
    I guess you have three fields in selection-screen,out 3 fields you have two fields contains search help.
    Create your user defined search help BWTAR ..
    Check the below links for creation search help :
    http://help.sap.com/saphelp_46c/helpdata/EN/cf/21ee2b446011d189700000e8322d00/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
    Hope you got it.
    Thanks
    Seshu

Maybe you are looking for

  • Safari not recognizing known filetypes

    http://bitzofbrinenhanced.blogspot.com/ Here's a site I tried listening to that featured enhanced podcasts. But they display as text files in Safari. If I right/ctrl click to save the file to disk it gets a .txt appended to it! The file is .m4b and I

  • Blank second page and export error in Crystal 10 Web Report Viewer

    We have a customer that is having 2 issues viewing an .rpt file in the Crystal 10 Web Report Viewer.  When they view a report that is 12 pages, the first page appears OK.  When they click Next to go to the Next page, the page shows as blank.  The sec

  • Acrobat Pro 11.0.08: Why are all of my PDF files (hundreds) now images?

    Search, editing, OCR does not work.  I have v-11 at home and it works fine. Burko77

  • App Store crashing iOS 6

    I have an iPod touch 4th generation (old I know) with iOS 6 and whenever you look at details of an app the store just crashes and this happens continuously. Does anyone else have this problem? Also will apple release iOS 6.1 shortly to rectify flaws?

  • "Row modification counter" in T-code db02

    Hi experts, In Transaction code DB02, when you enter the name of a table in Detailed analysis, you can see some indicators like Reserved (KB), Data size (KB), Total rows, Row modification counter... Do you know what does the indicator "Row modificati