Assigning values to a range dynamically

Hello All,
I want to assign the values to a range dynamically.
For example in the following piece of code, I cannot directly assign wa-kunnr to
r_kunnr-low.
LOOP AT ITAB INTO WA.
r_kunnr-sign = 'I'.
r_kunnr-option = 'EQ'.
r_kunnr-low = wa-kunnr.
APPEND r_kunnr.
ENDLOOP.
Can this be done dynamically? If I use following code I am getting a short dump.
lv_fnam = 'wa-kunnr'.
LOOP AT ITAB INTO WA.
r_kunnr-sign = 'I'.
r_kunnr-option = 'EQ'.
r_kunnr-low = ( lv_fnam ).
APPEND r_kunnr.
ENDLOOP.
Could anyone please suggest how to do this?
Regards
Indrajit

Hi Indrajit,
this is working perfectly for me ...i did not get any error
REPORT  ychatest.
TABLES : kna1.
DATA : wa TYPE kna1,
       lv_fnam(10).
FIELD-SYMBOLS : <fs> TYPE ANY.
SELECT-OPTIONS : s_kunnr FOR kna1-kunnr.
INITIALIZATION.
  wa-kunnr = '100'.
  lv_fnam = 'WA-KUNNR'.
  ASSIGN (lv_fnam) TO <fs>.
  s_kunnr-sign = 'I'.
  s_kunnr-option = 'BT'.
  s_kunnr-low = <fs>.
  APPEND s_kunnr.

Similar Messages

  • Assigning value to a range dynamically

    Hello All,
    I want to assign the values to a range dynamically.
    For example in the following piece of code, I cannot directly assign wa-kunnr to
    r_kunnr-low.
    LOOP AT ITAB INTO WA.
    r_kunnr-sign    = 'I'.
    r_kunnr-option = 'EQ'.
    r_kunnr-low     = wa-kunnr.
    APPEND r_kunnr.
    ENDLOOP.
    Can this be done dynamically? If I use following code I am getting a short dump.
    lv_fnam = 'wa-kunnr'.
    LOOP AT ITAB INTO WA.
    r_kunnr-sign    = 'I'.
    r_kunnr-option = 'EQ'.
    r_kunnr-low     = ( lv_fnam ).
    APPEND r_kunnr.
    ENDLOOP.
    Could anyone please suggest how to do this?
    Regards
    Indrajit

    Hi,
    Try giving it capital letters
    lv_fnam = <b>'WA-KUNNR'</b>.
    LOOP AT ITAB INTO WA.
    r_kunnr-sign = 'I'.
    r_kunnr-option = 'EQ'.
    r_kunnr-low = ( lv_fnam ).
    APPEND r_kunnr.
    ENDLOOP.
    Thanks
    Naren

  • ASSIGN VALUE TO XML ATTRIBUTE DYNAMICALLY

    how can we create and asign value to an XML attribute dynamically?

    Hi Harshit,
    In this case you should use append xml instead of assign in the assignment action block.
    Assigfn values to local variables from sql query say "Local.Shift", "Local.Quantity" and "Local.Total" then append it to your output as:
    <root  Shift="#Local.Shift#" Qty="#Local.Quantity#" Total="#Local.Total#" />
    Append it to parent of <root /> element.
    Regards,
    Swaroop

  • Assign values to bapi structure dynamically

    Hi,
    I have to use the BAPI, BAPI_MATERIAL_SAVEDATA to extend the material to different plant specific views. I have to use the structure BAPI_MARC and other structures in order to do this. But the values to be passed to the structure BAPI_MARC are not fixed. These values will be maintained in a custom table against the structure name and field name for a particular plant.
    In the program I have to extract the structure name and field name for a corresponding plant from custom table and fill the corresponding value in BAPI structure BAPI_MARC.
    Now, internal table in the program is having these details.
    How can I fill the bapi structure BAPI_MARC based on this information.
    For example, if in custom table, value 0001 is maintained against the field PUR_GROUP, I have to fill the field PUR_GROUP in strcutre BAPI_MARC with 0001.
    Hope I am clear in explaining the problem. Please let me know how to aciheve this?
    Best Regards,
    Kumar.

    Hi,
    I have tried to implement that in a sample program first. Please have a look at the code below.
    DATA: BEGIN OF line,
            col1 TYPE i,
            col2 TYPE i,
            col3 TYPE i,
          END OF line.
    DATA comp(4) TYPE c VALUE 'COL3'.
    FIELD-SYMBOLS: <f1> TYPE ANY, <f3> TYPE ANY.
    ASSIGN line TO <f1>.
    ASSIGN COMPONENT comp OF STRUCTURE <f1> TO <f3>.
    IF <f3> IS ASSIGNED.
    ENDIF.
    I checked in the debugging mode and the value of <f3> in debugging mode is 0, but not line-col3.
    Best Regards,
    Kumar

  • Dynamically assign value to a column in ALV LIST Display

    Hi all,
    How can I dynamically assign value to a column in ALV LIST Display without using classes and methods?
    Thanks,
    Ridhima

    Hi Vikranth,
    I am displaying one ALV list say with columns A and B.
    I have value in A but not in B. Now at runtime user selects one row, clicks on push button in application toolbar, then i have to display value in column B in the already displayed list.
    I searched and came to know it can be done with oops concept. but i am not using classes and methods.
    so how can i do this?
    Thanks,
    Ridhima.

  • How to assign values to Dynamic VO.

    Hi All,
    I have created a Dynamic VO and i have created 2 attributes(name and age) for it.
    Can i create this dynamic VO in Process form request of one of the CO class?
    Please let me know how to assign values to it......and display it and the page.?
    Thanks,
    Sowmya.

    Mukul
    I am trying to achieve something like below:
    Creating a Dynamic VO in my extended controller's ProcessRequest() method and attaching it to a MessageChoiceBean. In ProcessFormRequest() method based on some condition i have to change my Dynaic VO's whereClauseParam and re-execute it so that it will show some different set of values. Below is the code which i used. But after re-executing it my LOV is still showing old set of values. I have posted a query regd. the same but dint get much help. Kindly let me know, if you have any comments. Also Please find the link to my earlier post.
    Link: Re: Re-executed dynamic VO not showing new values
    * CODE *
    ProcessRequest()
    ViewObject vo = (ViewObject)am.createViewObjectFromQueryStmt("dummyVO","SELECT MEANING AS VALUE FROM HR_LOOKUPS WHERE LOOKUP_TYPE = :1");
    vo.setMaxFetchSize(-1);
    vo.setWhereClauseParam(0,"input1");
    vo.executeQuery();
    OAMessageChoiceBean mesBean=(OAMessageChoiceBean)webBean.findIndexedChild(webBean,"DemoChoiceItem");
    mesBean.setPickListCacheEnabled(false);
    mesBean.setPickListViewObjectDefinitionName("dummyVO ");
    mesBean.setPickListViewUsageName("dummyVO ");
    mesBean.setListDisplayAttribute("VALUE");
    mesBean.setListValueAttribute("VALUE");
    ProcessFormRequest()
    If the event is fired
    S.O.P(....);
    ViewObject vo1 = (ViewObject)am.findViewObject("dummyVO");
    vo1.clearCache();
    vo1.reset();
    vo1.setWhereClause(null);
    vo1.setWhereClauseParams(null);
    vo1.setWhereClauseParam(0,"input2");
    vo1.executeQuery();
    S.O.P(....);
    Thanks

  • How to assign attribute values to a range of BPs ????

    Hi All,
         While assigning attribute values to business partners we can specify at the most one business partner at a time.
    My requirement is to assign attribute values to a range of business partners at a time.
    Is there any customization setting where I can do this OR
    do I write a report for this ?
    Regards,
    Ashish

    Hi Ravi,
          Thanks for replying !!!!
    But, CRMD_MKT_TOOLS doesnt seem to solve my problem.
    I have a range of BPs (e.g 8000101 to 8000199).
    And I have a list of attribute sets with values as follows:-
    Attribute Set            Values
    Age group                1 - 10, 11 - 20, ....
    Reading habits          Business, sports, news.....
    Profession                Doctor , Engineer .......
    and so on..
    Now in transaction CRMD_PROF_BP, I can choose a single BP (e.g. 8000101) and assign it an attribute set(e.g. Profession) and value (Doctor).
    But, my requirement is to specify an entire range of BPs(8000101 to 8000150) and assign attribute set and values to that entire range.
    Now how do I achieve this ???????
    (target groups would be created only after attributes have been assigned)
    Regards,
    Ashish

  • Assign values dynamically to radio button

    I am creating an online test. I will need to display answer choices from the table. I created radio buttons for these answer choices and I could put the labels dynamically by using      
    Set_Radio_Button_Property('block_name.radio_group_name', 'radio_button1',LABEL,cursor_name.field_name);
    Now I have problem to set radio button values dynamically. Should I use when_radio_changed event?
    Any help would be appreciated.

    I really appreciate your help.
    My intention is to display the test on the screen.
    That means I need to display all questions and answer
    choices for each one dynamically. Based on the answer
    choice type (radio button or checkbox or drop down
    etc) I will need to assign the values to them and
    display on the screen. So far I could display
    questions and answer choices on the screen and set
    the label property for each radio button.
    Do you know what is the syntax to assign value to
    each radio button? First I will need to store user's
    answers in a table. For that I need to know what
    answer they selected. I wasn't sure how to do that.
    ThanksAs I said, the values cannot be assigned dynamically. Thus you will store the answers in code (perhaps in an array?) and your radio buttons will be 1,2,3,4 etc.
    In WHEN-RADIO-CHANGED you can retrieve the value from the array using the radio button value. Then store that value.
    e.g. Your screen shows
    What is the sound of one hand clapping?
    o Blue
    o Yes
    o 12
    These labels will be set dynamically, but the values for the radio buttons will be 1,2,3. If they pick "Yes", your radio button will be 2. You then get the value you really want from answer_array(2), where you put it when you retrieved the question details. Then you insert that into your users_answers table.

  • Can I create "Dimension value range" dynamically  from data?

    Hi,
    Can I create "Dimension value range" dynamically  from data?
    Regards

    You need to have a Database Link between two servers. Then you could do execute that statement without any problem. Try to create a database link with the help of
    CREATE DATABASE LINK command. Refer Document for further details

  • How can i dynamically assign values to the tld file

    How can i dynamically assign values to the tld file

    In the tld you write for the tag handler mention the following sub tags in the attribute
    <attribute>
    <name>xyz</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    import the packagejavax.servlet.jsp.tagext.DynammicAttributes;
    add the method
    public void setDynamicAttribute(String rui, String localname, Object value) throws JspException
    <Your Required task>
    Its better if you SimpleTagSupport class to be extended.

  • Assigning values dynamically to drop down

    Hi,
    I have drop down for which i have to assign values dynamically, I am getting values as a form of Array list.

    Hi Venki,
    Say your ArrayList is al . Create a value attribute under the root node. Say test. Bind this test to the DropdownByKey UI element. You can populate test attribute like this.
    IWDAttributeInfo attributeInfo =
    wdContext.getNodeInfo().getAttribute(IPrivate<viewname>View.IContextElement.TEST);
    ISimpleTypeModifiable valuesType =
    attributeInfo.getModifiableSimpleType();
    IModifiableSimpleValueSet VS=
    valuesType.getSVServices().getModifiableSimpleValueSet();
           for (int i = 0; i < al.size(); i++) {
              VS.put(al.get(i),""+al.get(i));
    Regards
    Siva

  • Assigning values to 2 fields using sql statement

    db11g , apex 4.0 and firefox 24 ,
    hi all ,
    i am trying to follow this tutorial to assign values to 2 items on a page using sql statement ,
    and i am using the same sql statement the tutorial uses
    select d.loc location, count(e.empno) num_employees from dept d, emp e where d.deptno = e.deptno(+) and d.deptno = :P3_DEPTNO group by d.loc -- btw , what does the "+" sign mean?
    after the e.deptno in the where condition .
    but i am facing this error
    1 error has occurred
    Wrong number of columns selected in the SQL query. See Help of attribute for details.
    and it does not work with two columns in the select statement under any conditions , i tried to remove the group function and the group clause ,
    it does not work unless i use only one column in the select statement ??
    thanks

    Pars
    And how exactly is this rewrite of the sql statement resolving the OP's issue.
    You are still using more than 1 column which will still result in the error message:
    Wrong number of columns selected in the SQL query.
    As mentioned in my earlier post APEX 4.0 (the version the OP is using) does not handle a sql statement with multiple columns for the dynamic action Set Value.
    Which means the fastest  and simplest solution is splitting up the dynamic action in multiple Set Value actions.
    Using this plugin or upgrade to a newer apex version would also be a possibility.
    Nicolette

  • Pass value to a field dynamically..

    Hi Experts,
    Can any one solve this issue?.
    I want to pass value to different fields dynamically..
    Egu2026
    I have work are having fields
    lwa_table-var1,
    lwa_table-var2,
    lwa_table-var3,
    lwa_table-var4,
    u2026.. up to lwa_table-var100.
    My logic is I have to pass l_tot value .. based on the last letter like below.
    if l_tot value is 1 we have pass to lwa_table-var1
    if l_tot value is 2 we have pass to lwa_table-var2
    if l_tot value is 3 we have pass to lwa_table-var3
    if l_tot value is 100 we have pass to lwa_table-var100.
    <removed_by_moderator>
    Thanks in advance.
    Regards,
    Kumar.
    Edited by: Julius Bussche on Aug 12, 2009 8:41 AM

    Hi Friend,
    U can do Following.....
    data:  text(12) type c.
    data : num type n.
    data: int type i.
    data: begin of wa_test,
          var1,
          var2,
          var3,
          var4,
          end of wa_test.
    FIELD-SYMBOLS <fs_wa> TYPE ANY.
    do 4 times.
      int = int + 1.
      num = int.
      CONCATENATE 'wa_test-' 'var' num into text.
      ASSIGN (text) to <fs_wa>.
    <fs_wa> = num.
      UNASSIGN <fs_wa>.
    enddo.
      write : wa_test-var1 , wa_test-var2 , wa_test-var3 ,wa_test-var4 .
    ouput will be :     1 2 3 4.
    Lets take Your Scenario----
    >>>>>>>>>>>>>>>>>
    Data: begin of lwa_table,
    Var1,
    Var2,
    Var3,
    u2026..
    u2026u2026
    Var100,
    End of lwa_table.
    Data: l_tot type i.
    u2022     For example l_tot = 36.
    u2022     Then u want to pass the same to lwa_table36.
    For this do followingu2026..
    Now Define-->>>
    data: text(13) type c.
    data : num type n.
    FIELD-SYMBOLS <fs_wa> TYPE ANY.
    *Now till now we done all the data definitions now u have to do following to pass it dynamically,
    l_tot = 36.
    Num  =  l_tot.
    CONCATENATE lwa_table-' 'var' num into text.
    ASSIGN (text) to <fs_wa>.
    <fs_wa> = num.
    UNASSIGN <fs_wa>.
    Write : lwa_table-var36.
    Output will be 36.
    Hope this resolves ur issue,
    Regards,
    Akash Rana
    Edited by: AKASH RANA on Aug 12, 2009 8:53 AM

  • How to assign values to a work area which is a Field Symbol?

    Hello Experts!
    I really need your help! this is the problem:
    I need to assign values to fields into a work area which is a field symbol. The values come from a flat file I uploaded and as I can't know the length I had to build the structure dynamically ( That's why I'm using FS). Each field comes from the file separated by ';', I tried using the SPLIT sentence:
    "SPLIT text AT ';' INTO TABLE <dyn_table>." but the values are assigned vertically into the same field instead of horizontally into each field of the table(field-symbol table).
    I know the name of the field dynamically
    (a TEXT + number) and I know I can't do this
    <dyn_wa>-TEXT1 or field_name = 'TEXT1' <dyn_wa>-(field_name).... ohhh I'm blocked, I don't seem to find the answer, please help!
    Thanks in advance!!
    Frinee

    Now that you have a table with the values, you can move them to the work area.
    data: begin of wa,
          fld1(20) type c,
          fld2(20) type c,
          fld3(20) type c,
    *     and so on
          end of wa.
    data: istr type table of string with header line.
    field-symbols: <fs>.
    split text at ';' into table istr.
    loop at istr.
    assign component sy-tabix of structure wa to <fs>.
    if sy-subrc <> 0.
    exit.
    endif.
    <fs> = istr.
    endloop.
    write:/ wa-fld1, wa-fld2, wa-fld3.
    Now, WA has the values in a horizontal fashion.
    Regards,
    Rich Heilman

  • Assigning part of a string dynamically to a component of a structure

    Hello,
    I want to take part of a string
    example: value = string+10(7)
    and assign this value to a structure. But I only have the fieldnames of the structure. I need something like the following
    Assign value TO COMPONENT (fieldname) of structure
    Thanks.
    Regards, Lars.

    do you have a set structure name you're dealing with or is that dynamic?
    If it's the first scenario and, say, you were dealing with mara and field matnr you could do this:
    data l_string.
    field-symbols <field> type any.
    l_string = in_string+10(18).
    assign l_string to <field> casting type matnr.
    (or assign l_string to <field> casting like mara-matnr).
    now <field> is a 'matnr' type field.
    If it's more complex please give some more info as I'm sure what you want can be done.

Maybe you are looking for