Cursor with dynamic SELECT

HI
I want to create a cursor with a dynamic select, in other words, in the code,when i OPEN the cursor i want to change its query.
How can i do?
PS I have the 8.1.7

Hi
Sorry my very bad english,
I would like to change the WHERE condition of my declared cursor, is there some method that allow me to pass a string in the quey condition?
How can i use REF CURSOR?

Similar Messages

  • Submit report with dynamic selections

    Hi All,
    I am trying to Submit a report with dynamic selections. I am using the option SUBMIT REPORT WITH FREE SELECTIONS.
    But the dynamic selections are not getting passed.
    Request you to kindly provide some inputs
    My code is
    DATA: trange TYPE rsds_trange,
          trange_line LIKE LINE OF trange,
          trange_frange_t_line LIKE LINE OF trange_line-frange_t,
          trange_frange_t_selopt_t_line LIKE LINE OF trange_frange_t_line-selopt_t,
          texpr TYPE rsds_texpr.
    trange_line-tablename = 'PA0002'.
    *trange_frange_t_line-tablename = 'PA0002'.
    trange_frange_t_line-fieldname = 'GBJHR'.
    trange_frange_t_selopt_t_line-sign   = 'I'.
    trange_frange_t_selopt_t_line-option = 'EQ'.
    trange_frange_t_selopt_t_line-low    = '1987'.
    trange_frange_t_selopt_t_line-high   = '1987'.
    APPEND trange_frange_t_selopt_t_line TO   trange_frange_t_line-selopt_t.
    APPEND trange_frange_t_line TO trange_line-frange_t.
    APPEND trange_line TO trange.
    CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
      EXPORTING
        field_ranges = trange
      IMPORTING
        expressions  = texpr.
    submit RPCADVQ0
    VIA SELECTION-SCREEN
                    WITH SELECTION-TABLE rspar_tab
                    WITH FREE SELECTIONS it_texpr
                    and returN.
    Kindly provide your inputs
    Regards
    Reshma

    Hi Reshma,
    Use the FM - RS_REFRESH_FROM_DYNAMICAL_SEL before FREE_SELECTIONS_RANGE_2_EX.
      data: trange  type rsds_trange,
              g_repid type sy-repid.
    g_repid = 'RPCADVQ0'.
      call function 'RS_REFRESH_FROM_DYNAMICAL_SEL'
        exporting
          curr_report        = g_repid
          mode_write_or_move = 'M'
        importing
          p_trange           = trange
        exceptions
          not_found          = 1
          wrong_type         = 2
          others             = 3.
      if sy-subrc eq 0.
    " Do the changes to the trange
    CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
    EXPORTING
    field_ranges = trange
    IMPORTING
    expressions = texpr.
    submit RPCADVQ0
    VIA SELECTION-SCREEN
    WITH SELECTION-TABLE rspar_tab
    WITH FREE SELECTIONS it_texpr
    and returN.
    endif.
    Cheers,
    Kothand

  • How to save a variant with dynamic selections parameters

    Anybody knows how to save a variant for an ABAP that uses a Logical database with Dynamic Selections?
    Have a look for example to the following:
    SE38 - DEMO_PROGRAM_GET - Execute - Shift F4 - Connection Number.
    How to save 0820 as Connection Number?
    Function Group SVAR seems good but FREE SELECTIONs are not easy to manage...

    Hello,
      I tried to save the variant of DEMO_PROGRAM_GET with dynamic selection field (Connection Number) filled. It gets saved without any problem. Just click 'SAVE' and enter the variant name and description.
    Thanks,
    Venu

  • FBL1N with dynamic selection WITHHOLDING TAX CODE is dropping rows

    Using FBL1N with dynamic selection field: WITHHOLDING TAX CODE and noticed that several vendors dropped off the report. Appears FBL1N's filter logic uses LFB1-QSSKZ and not LFBW-WT_WITHCD. Upon examination, I determined that the missing vendors didn't have a WTC assignment (column is BLANK) in table LFB1. Problem is I'm using transaction FK02's WITHHOLDING TAX ACCT tab to assign the WT codes but these rows are written to table LFBW (not LFB1). How is the LFB1-QSSKZ field populated? And why do some of the entries in LFB1-QSSKZ have values while others do not? Would ultimately like to populate the blank assignments with the correct WT code.

    Hi Steve,
    This is due to the limitation due to standard design.
    You can see that a vendor can be assigned to multiple WHT codes and can also have multiple WHT code for a single line item. Hence in FBL1N output it would not be possible to show the WHT code as there is no  one to one relationship.
    You can click on the line item and can then see the WHT information in WHT button. Or alternatively get the data in withholding tax information reports.
    Regards,
    SDNer

  • How to create a Type Object with Dynamic select query columns in a Function

    Hi Every One,
    I'm trying to figure out how to write a piplined function that executes a dynamic select query and construct a Type Object in order to assigned it to the pipe row.
    I have tried by
    SELECT a.DB_QUERY INTO actual_query FROM mytable a WHERE a.country_code = 'US';
    c :=DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(c,actual_query,DBMS_SQL.NATIVE);
    l_status := DBMS_SQL.EXECUTE(c);
    DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
    FOR j in 1..col_cnt LOOP
    DBMS_SQL.DEFINE_COLUMN(c,j,v_val,2000);
    END LOOP;
    FOR j in 1..col_cnt LOOP
    DBMS_SQL.COLUMN_VALUE(c,j,v_val);
    END LOOP;
    But got stuck, how to iterate the values and assign to a Type Object from the cursor. Can any one guide me how to do the process.
    Thanks,
    mallikj2

    Hi Justin,
    First of thanks for your reply, and coming to my requirement, I need to report the list of items which are there in the dynamic select statement what am getting from the DB. The select statement number of columns may vary in my example for different countries the select item columns count is different. For US its '15', for UK it may be 10 ...like so, and some of the column value might be a combination or calculation part of other table columns (The select query contains more than one table in the from clause).
    In order to execute the dynamic select statement and return the result i choose to write a function which will parse the cursor for dynamic query and then iterate the values and construct a Type Object and append it to the pipe row.
    Am relatively very new for these sort of things, welcome in case of any suggestions to make it simple (Instead of the function what i thought to work with) also a sample narrating the new procedure will be appreciated.
    Thanks in Advance,
    mallikj2.

  • Is it possible to make a search help with dynamic  selection table?

    Hi Experts,
    Is it possible to create search helps with dynamic seletion tables means
    i dont know the selection table names at the time of creation of search help.
    These tables will be determined at runtime.
    if yes, Please give an idea how to create and pass the table names at runtime.
    Thanks
    Yogesh Gupta

    Hi Yogesh,
    Create and fill your itab and show it with FM F4IF_INT_TABLE_VALUE_REQUEST
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = 'field to return from itab'
          dynpprog        = sy-repid
          dynpnr          = sy-dynnr
          dynprofield     = 'field on your screen to be filled'
          stepl           = sy-stepl
          window_title    = 'some text'
          value_org       = 'S'
        TABLES
          value_tab       = itab
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
    Darley

  • Issue with dynamic selection in SAP Query

    Hi,
    I have a doubt in SAP QUERY
    i used that for creating Customer Master Report
    2 fields i have added in dynamic selection from knvv table. if i try to excute based on the value in that 2 fields
    i'm not getting  output records based on that
    pls help me with the logic from where i can get the variables for that dynamic fileds.
    thanks in advancde.

    Hi Suhas,
    Actually in my report user will enter program name & variant name, based on this I need to find out the value for that variant & print that report. so for normal selection I can get the detail using FM: "RS_VARIANT_CONTENTS" but for dynamic selection (Free selection), I am not getting the detail using this FM.
    So I need any FM or Table Name which gives me the value for dynamic selection based on the report & variant.
    Thanks & Regards,
    Lalit Soni

  • Working with dynamic selection screen in LDB FMF

    Hi Guys,
    I am working with LDB FMF and I have a requirement where user need the selection field in initial screen which is already comming in dynamic selection option.
    Is it possible without changing the standerd LDB.
    Atul
    Edited by: Atul Dhariwal on Jun 16, 2009 6:27 AM

    Hi,
    my requirement is to list fields from dynamic selection to appear in the main selection screen.
    user doesn't want's to click on dynamic selection option and select the fields.
    I hope i am clear this time.
    Atul

  • Execution of report with dynamic selection in method

    Dear Experts,
    I need to execute report 'RCATS_APPROVE_ACTIVITIES' in background in the method after populating field-'Processing status'. Also there is a option of dynamic selections for this report in menu bar. In Dynamic selections, there is a field - 'CREATED BY' which also i want to populate before execution.
    Here I am able to populate field- 'Processing status' like code below:-
    DATA: rspar    TYPE STANDARD TABLE OF rsparams,
         wa_rspar TYPE rsparams.
    wa_rspar-selname = 'LDBSTAT'.
    wa_rspar-kind = 'S'.
    wa_rspar-option = 'EQ'.
    wa_rspar-sign = 'I'.
    wa_rspar-low = '10'.
    APPEND wa_rspar TO rspar.
    CLEAR wa_rspar.
    SUBMIT RCATS_APPROVE_ACTIVITIES
         USING SELECTION-SCREEN 1000
        WITH SELECTION-TABLE rspar
    But I am not able to populate the dynamic selection field- CREATED BY.
    Please suggest(if possible with code) how to resolve this.
    Regards
    Nitin

    Dear KArri,
    Thanks for the reply but this i am performing in the Method of BO and want to execute this method in my workflow. That is the reason, I have posted this in workflow forums.
    For this I have created a customised BO to use in CATS workflow.
    Regards
    Nitin

  • Program with Dynamic selection but no LDB is used

    Hello Friends,
    Can any one tell me the any standard program name, In which Dynamic selection (Free Selection) is used but LDB(Logical Data Base) is not used.
    Lalit Soni

    Not possoble with out LDB, it uses selection-screen dynamic selections for table <tabname> in ldb, one alternative is using the screen table to hide selection.
    E,.g
        loop at screen.
          if screen-group1 = 'FS1' .
            screen-active = 1.
            modify screen.
          endif.
        endloop.

  • How to deal with dynamic selection screen elements when macros are used?

    Hello experts,
    This is regarding the dynamic selection screen elements. Actually the requirement is to modify the existing standard report program RFUMSV00 by copying it into a Z report, adding a few selection screen elements and new fields in the output. I actually did everything required except for the one thing that is going out of my reach.
    There are a certain fields which are coming when they are not supposed to get displayed. I don't understand the code because of its obsoleteness. Neither can I debug it because it is just data declaration.
    This is the code where there is a fault. If I copy the entire code into a new Z report, I'm getting new fields like Entry Date, Document Type, Reference Transaction,  Reference key, Logical system.
      DEFINE selection_screen_line.
      selection-screen: begin of line.
      parameters &3 like &4 default 'X' modif id mc4.
      selection-screen: comment (30) &1 for field &3 modif id mc4.
      selection-screen: comment pos_low(10) text-019
                        for field &2 modif id mc4.  "neu
      parameters &2 like rfums_alv-variante modif id mc4.
      selection-screen:
          position pos_high.
      selection-screen: pushbutton (15) text-028
                        user-command &5 modif id mc4.
      selection-screen end of line.
    END-OF-DEFINITION.
    Kindly, suggest me the right solution.

    In the program attributes ( SE38 > RFUMSV00 > GOTO > Properties ), you will find a logical database BRF declared. The include DBBRFSEL is part of the selection screen of this logical database.
    The selection screen is actually the selection screen of this logical database.
    Under the Logical Database field, there is a Selection screen field where you can input which selection screen of the logical database to be used.
    But, this is just to change the selection screen that is displayed. To completely suppress it you need to remove logical database declaration from the properties of the program and call it inside your program through function module.
    You cannot just remove it from the declaration because many of its variables are used in the program.
    So call it using function module as the first step in INITIALIZATION section of the program.
    The syntax and function module to call it in your program can be found in the following thread :
    How to hide the selection screen of a Logical datebase?
    Regards,
    Ashish

  • How to use Field-symbol with dynamic select query

    Can anybody tell me, how to use field-symbols in the dynamic select query.

    FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
    1. ... typing
    2. ... STRUCTURE struc DEFAULT dobj
    The FIELD-SYMBOLS statement declares a field symbol <fs>. The name conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
    After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
    eg.
    FIELD-SYMBOLS <fs> TYPE ANY.
    DATA: BEGIN OF line,
            string1(10) VALUE '0123456789',
            string2(10) VALUE 'abcdefghij',
          END OF line.
    WRITE / line-string1+5.
    ASSIGN line-string1+5(*) TO <fs>.
    WRITE / <fs>.
    output:
    56789
    56789
    reward if helpful
    anju

  • CX_SY_DYNAMIC_OSQL_SEMANTICS error with dynamic SELECT statement

    Hello Gurus,
    We have a dynamic SELECT statement in our BW Update Rules where the the Selection Fields are populated at run-time and so are the look-up target and also the WHERE clause. The code basically looks like below:
              SELECT (lt_select_flds)
                FROM (lf_tab_name)
                INTO CORRESPONDING FIELDS OF TABLE <lt_data_tab>
                FOR ALL ENTRIES IN <lt_source_data>
                WHERE (lf_where).
    In this instance, we are selecting 5 fields from Customer Master Data and the WHERE condition for this instance of the run is as below:
    WHERE: DIVISION = <lt_source_data>-DIVISION AND DISTR_CHAN = <lt_source_data>-DISTR_CHAN AND SALESORG = <lt_source_data>-SALESORG AND CUST_SALES = <lt_source_data>-SOLD_TO AND OBJVERS = 'A'
    This code was working fine till we were in BW 3.5 and is causing issues after we moved to BW 7.31 recently. Ever since, when we execute our data load, we get the CX_SY_DYNAMIC_OSQL_SEMANTICS. THE ERROR TEXT SAYS 'Unable to interpret '<LT_SOURCE_data>-DOC_NUMBER'.
    Can you pleasesuggest what can we do to this code to get is working correctly ? What has changed in ABAP Objects that has been introduced from BI 7.0 that could be causing this issue?
    Would appreciate any help we can get here.
    Thanks
    Arvind

    Hi,
    Please try this.
    data: lv_where type string.
    concatenate 'vbeln' 'in' 'r_vbeln' into lv_where separated by space.
    select *from table into itab where (lv_where).
    Also please check this sample code.
    REPORT ZDYNAMIC_WHERE .
    TABLES: VBAK.
    DATA: CONDITION TYPE STRING.
    DATA: BEGIN OF ITAB OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    END OF ITAB.
    SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
    CONCATENATE 'VBELN' 'IN' 'S_VBELN.'
    INTO CONDITION SEPARATED BY SPACE.
    SELECT VBELN POSNR FROM VBAP INTO TABLE ITAB
    WHERE (CONDITION).
    LOOP AT ITAB.
    WRITE 'hello'.
    ENDLOOP.
    Regards,
    Ferry Lianto

  • OBPM4 - Variant with dynamic selection

    Hi Experts,
    I'm using the FBPM transaction (report SAPFPAYM). I have created the variant in OBPM4, in the variant I have insert the dynamic selection for Value Date.
    When I run the report  SAPFPAYM, the report does not work. If I delate this dynamic selection the report works correctly.
    Could you help me?
    Thanks in advance.
    Regards
    Giampaolo

    Hi Jyothi,
    I have inserted in the variant the dinamic variant selection "Value Date" or only a value date:
    When I run the report I have this message:
    "No Payment Media Created in Format FR_ETEBAC_VRT-ETR
    Message no. BFIBL02159
    Diagnosis
    No payment media were created for format FR_ETEBAC_VRT-ETR for payment group
    100"
    If I delate the value date or value date dinamic parameter, the report works correctly.
    Do you have any suggestion?
    Thans a lot
    Kind Regards
    Giampaolo

  • EPMDimensionOverride with Dynamic selection

    Hello,
    Using the EPMDimensionOverride, I want a variable selection of members.
    For this i use EPMCellRanges, and i select all members of Entity (Row Axis).
    But the problems are :
    1- when i have Empty cell, the formula is not working.
    2- When i change the Entity, i still get the same selection.
    Does anybody get the problem before ? Any solutions ?
    Thank you.
    Oussama

    Hello Oussama,
    Its working fine for me.. Please see the below image as reference..
    The scenario is selectable and the highlighted red arrow is the Dimension Override function.
    See the dimension override function here..
    Dynamic selection for Scenario..
    please share you report images, then we can find where exactly you are missing...
    Regards,
    Saida Reddy G

Maybe you are looking for

  • I am trying to move my iPhoto library

    I am trying to move my iPhoto library to a new hard drive. Should be simple, but I am getting the error message ' some date in iPhoto library can't be read or written' is there any way around this? J

  • Where can I get replacement base pads for my Macbook?

    The four rubber base pads from my MacBook Pro have fallen of, which means my laptop slides around on the desk all the time. Does anyone know where I can buy replacements? Thanks!

  • Is it possible to call a subscreen/modal dialog box from the global class

    Hi, Is it possible to call a subscreen or modal dialog box from the global class .. or is there any option to display a pop screen or subscreen in order to get the values from user which as to be implemented in the global class.. thanks and regards,

  • Third part Sales Question

    Hi, This is nothing related to configuration. Just want to understand that in a third party sales order, when the 3rd party vendor delivers goods to the customer, then after that how does the delivering plant location knows that the 3rd party vendor

  • Website does not recognize uploaded file as pdf

    A website is rejecting uploaded pdf files with the error message that it is not a pdf file. The site accepts the same files uploaded with IE from the same computer. It also accepts the file uploaded with Firefox from another running Windows 7 Profess