Moving a value to a component of a field symbol

Hi,
I have a problem with a piece of code comparable to this one:
FIELD-SYMBOLS:
  <structure_A> TYPE ANY,
  <structure_B> TYPE ANY,
  <component_name> TYPE ANY.
<component_name> = 'WHATEVER'.
" <structure_A>-<component_name> = <structure_B>-<component_name>.
The intention is to copy a value from a component of one structure to the same component of another structure. The crux is that the structures are defined dynamically and the component's name is known during runtime only.
Assume that the example is well-defined, i. e. all field symbols are initiated with suitable values.
--Florian

hi Florian,
when the structure is only known during run time, you have to ASSIGN each field separately, something like this:
FIELD-SYMBOLS : <field_A> TYPE ANY,
<field_B> TYPE ANY.
ASSIGN COMPONENT 'WHATEVER' OF structure <structure_A> TO <field_A>.
ASSIGN COMPONENT 'WHATEVER' OF structure <structure_B> TO <field_B>.
<field_B> = <field_A>.
you have to repeat the above for each single field you want to copy its value
hope this helps
ec

Similar Messages

  • Assign a value to a component of a field-symbol

    Hi,
    I'm struggling with field-symbols, hope someone can help me with this:
    I have two field-symbols:
    - <row> which for example can have structure E1P0002 assigned to it;
    - <row_it> which for example can have stucture P0002 assigned to it.
    Certain components of <row> should be assigned to components of <row_it>. The names of the components differ however. For instance: component STRAS_40 of <row> should be assigned to component STRAS of <row_it>, NAME2_40 of <row> should be assigned to NAME2 of <row_it>, etc.
    Depending on the structures assigned to the field-symbols, these fields are not always available.
    Any ideas how this can be solved?
    Thanks,
    Patrick

    Hi do as follows,
              <row_wa> is the structure of type P0002
    and <row_it> is a field symbol of table type
    and another field symbol <fs> type any.
    if <row>-STRAS_40 is not initial.
    assign component  STRAS of  structure <row_wa> to <fs>.
    <fs> = <row>-STRAS_40 .
    endif.
    if <row>- NAME2_40 is not initial.
    assign component  NAME2 of  structure <row_wa> to <fs>.
    <fs> = <row>-NAME2_40 .
    endif.
    append  <row_wa> to <row_it>.
    Hope this explanation of mine helps you,
    Murthy.

  • Move a variable to a component of a field-symbol structure ???

    I have a field symbol <fs_struc> that's typed as a structure from the dictionary.
    I want to move a variable to a particular component of this structure, and I've put the name of his component in another field symbol <fs_comp>.
    1) Why doesn't the following syntax work?
    ASSIGN variable TO <fs_struc>-<fs_comp>
    (Note that there's a hyphen between <fs_struc> and <fs_comp>)
    2) What is the correct syntax to do this ?
    Thanks.

    Hi David,
    1) If you've assigned <fs_comp> to a field in a structure, then you have the memory address of the component within the structure.  This is why the syntax does not work, because <fs_comp> contains the reference already to the structure (eg. <fs_comp> =  structure-field, while <fs_field>-<fs_comp> =  structure-structure-field).  You can instead use:
    ASSIGN variable TO <fs_comp>, if <fs_comp> was already assigned to a field of a structure.
    2) If your scenario is that you don't know the field of the structure you want to assign in advance, you can try something like the following.  Snippet just shows how you can dynamically assign a field of a structure to another field symbol.
    data: ls_kna1 type kna1.
    data: lv_comp_name(5) type c value 'NAME1'.
    data: o_data type ref to data.
    field-symbols: <fs_data> type kna1.
    field-symbols: <fs_comp> type any.
    ls_kna1-name1 = 'Testing'.
    CREATE DATA o_data TYPE (lv_comp_name).
          ASSIGN o_data->* TO <fs_comp>.
    assign ls_kna1 to <fs_data>.
    ASSIGN COMPONENT lv_comp_name OF STRUCTURE <fs_data> TO <fs_comp>.
    write: <fs_comp>

  • ASSIGN Component ... (field symbol stuff)

    Hi,
    I want to validate certain fields (KNA1, BUKRS, KOART, FNAME) which are
    entered by the user in the transaction XK01.  They are being captured in a structure, lets say X_LFA1.
    To validate this fields I am being asked to use field symbols using component assign.
    Can someone tell me how do I do this ?

    Tushar,
    Its still not clear to me what exactly you are trying to do.
    Is it like you just want to see if those fields exist in the table or not? If yes, you can do like this.
    parameter : p_field -- field entered by the user
    data : wa_ztable like ztable.
    field-symbols : <fs_any> type any.
    Assign component p_field of structure wa_ztable to <fs_any>.
    if sy-subrc = 0.
    Success.
    endif.
    Regards,
    Ravi

  • Error in Moving values to field symbols. - CX_SY_CONVERSION_NO_NUMBER

    Hi Friends,
    I have asigned the component 'ICON' to the field symbol . While i am adding the value to the field symbol it is going for Dump.
    Erro Message :
    Unable to interpret "@08\QGreen Light; Go; Okay@ " as a number.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_CONVERSION_NO_NUMBER', was not
         caught and
        therefore caused a runtime error.
        The reason for the exception is:
        The program attempted to interpret the value "@08\QGreen Light; Go; Okay@ " as
         a number, but
        since the value contravenes the rules for correct number formats,
        this was not possible.
    Code :
      ASSIGN COMPONENT 'ICON' OF STRUCTURE <line> TO <fs_icon>.
      add wa_result-icon to <fs_icon>.
    Please find the information and i waiting for your valuable anwers.
    Thanks,
    Shankara Narayan

    HI,
    What do you mean by adding the value?
    Do you want to move the value of wa_result-icon to the field-symbols <fs_icon>.
    use move statement or use '=' operator.
    ADD will try to do an addition.
    You cannot add character fields. It will surely give a dump.
    Do as follows:-
    Move wa_result-icon to <fs_icon>.
    Regards,
    Ankur Parab

  • Problem with field-symbol values not updating

    H i ,
          I have following piece of code :
    Assigning Dynamic Table to Field Symbol
        ASSIGN ist_dyn_table->* TO <gs_dyn_table>.
    *   Creating Structure for dynamic table
        CREATE DATA gs_dyn_line LIKE LINE OF <gs_dyn_table>.
    *   Creating line type for the Dynamic Values
        ASSIGN gs_dyn_line->* TO <gs_line>.
    *   Populating values in the dynamic table
        LOOP AT ist_pwcl_main INTO wa_pwcl_main.
          ASSIGN COMPONENT gc_fld_werks OF STRUCTURE <gs_line> TO <gs_field>.
       1   IF sy-subrc EQ 0.
       2        <gs_field> = wa_pwcl_main-werks.
       3      ENDIF.
       5  IF <gs_field> IS ASSIGNED.
       6     <gs_field> = wa_pwcl_main-vbeln.
          ENDIF.
      7 IF <gs_field> IS ASSIGNED.
      8  <gs_field> =  wa_pwcl_main-posnr.
          ENDIF.
       IF <gs_field> IS ASSIGNED.
            <gs_field> = wa_pwcl_main-quant.
          ENDIF.
    on debugging  at line 2 <gs_filed> contains the value of werks .
    but at line 6 <gs_field> contains value of vbeln as 0 and at 8 of posnr as 0 .
    What can be the problem ? Other values are getting assigned properly .
    Plz help ...
    Regards .

    Hi,
    Assigning Dynamic Table to Field Symbol
        ASSIGN ist_dyn_table->* TO <gs_dyn_table>.
      Creating Structure for dynamic table
        CREATE DATA gs_dyn_line LIKE LINE OF <gs_dyn_table>.
      Creating line type for the Dynamic Values
        ASSIGN gs_dyn_line->* TO <gs_line>.
      Populating values in the dynamic table
        LOOP AT ist_pwcl_main INTO wa_pwcl_main.
          ASSIGN COMPONENT gc_fld_werks OF STRUCTURE <gs_line> TO <gs_field>.
       1   IF sy-subrc EQ 0.
       2        <gs_field> = wa_pwcl_main-werks.
       3      ENDIF.
       5  IF <gs_field> IS ASSIGNED.
       6     <gs_field> = wa_pwcl_main-vbeln.
          ENDIF.
      7 IF <gs_field> IS ASSIGNED.
      8  <gs_field> =  wa_pwcl_main-posnr.
          ENDIF.
       IF <gs_field> IS ASSIGNED.
            <gs_field> = wa_pwcl_main-quant.
          ENDIF.
    Based on your coding above, <gs_field> has been assigned with data type 'WERKS' (i'd assume component gc_fld_werks found from structure <gs_line> is a plant typed), which is a CHAR(4) data type.
    Meaning, if <gs_field> is assigned with Plant type value, e.g. <gs_field> = '1000', field symbol <gs_field> will contain 4 character only.
    At line 6, if wa_pwcl_main-vbeln = '0000201000', <gs_field> is only capturing '0000' only. This is also happened to line 8.
    However, it looks like that <gs_field> is getting over-write if ASSIGNED statement returns SY-SUBRC = 0.
    Hope this helps.
    Regards,
    Patrick

  • How to check the length of a field symbol value

    hi all,
    i have a problem with string function, i have assined  table fields to  a field symbol in a loop i want check the length of the assigned fields symbol value  in every loop . i have written like ,,,,,len = strlen( <fs>). then i am getting the length of the field label what i ahve assigned to fiels symbol not the field value lenght ,
    please advise me on this,
    thanks,
    sre

    I think you're on the right track.  This should work:
    data: len type i.
    data: begin of itab OCCURS 1,
            a type string value '1',
            b type string value '12',
            c type string value '123',
          end of itab.
    FIELD-SYMBOLS: <fs> type ANY.
    do 3 times.
      assign component sy-index of STRUCTURE itab to <fs>.
      len = strlen( <fs> ).
    enddo.

  • Passing field symbol value to a variable

    Hi All,
    I have a value in Field Symbol declared as   <FS-STATUS> TYPE STANDARD TABLE.
    I want to use the value  <fs-status> -low  in  a case statement.
    For this i think i have to pass the <fs-status> -low  into a variable and then use in case statement.
    Can anyone explain how to pass values in field symbol to variable? Or if this is not possible is there any other solution.
    Thanks in advance.

    Hi ,
    I have give some code sample ; just check ..
    DATA: BEGIN OF line,
             col1(1) TYPE c,
             col2(1) TYPE c VALUE 'X',
           END OF line.
    FIELD-SYMBOLS <fs> LIKE line.
    ASSIGN line TO <fs>.
    MOVE <fs>-col2 TO <fs>-col1.
    WRITE: <fs>-col1, <fs>-col2.
    Or u can check this link :
         http://www.erpgenie.com/abaptips/content/view/401/62/

  • Can i use one JSF component's value for other component in the same page.

    Can i use one JSF component's value for other component in the same page.
    For example
    I have a <h:selectBooleanCheckbox id="myChk"> in my jsf page, i want to access its value for another component like:
    <h:commandButton disabled="#{myChk.checked}" action="myAction" value="myValue" />
    ** "myChk.checked" >> I am just asuming "checked" property is available...

    Bind the checkbox to a UIInput myChk property. Then you can reference this property from the page, e.g.
    <h:selectBooleanCheckbox binding="#{myBean.myChk}" onchange="submit();" />
    <h:commandButton disabled="#{myBean.myChk.value}" action="myAction" value="myValue" />

  • How to pass a value to a component

    In the following file I want to click on a button and send a value to a component. I want that value to change for different buttons but I cannot use the instance name to send that information and I also cannot use a method of tIe class. I tried
    instructorView.myVar= e.currentTarget.data 
    and
    instructorView.test()
    but both fail. How do I access the properties and methods for this component from the function named click()?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*" layout="vertical"  applicationComplete="init()">
        <mx:Script>
            <![CDATA[
        private var myData:Array=["first","second", "third"];
        private function init():void{
            for(var i:int=0;i<3;i++){
                var button:Button=new Button;
                button.data=myData[i];
                mainMenu.addChild(button);
                button.addEventListener(MouseEvent.CLICK, click);
        public function click(e:Event):void {
            trace("selected data="+e.currentTarget.data)
            viewStack.selectedChild=instructor 
            //instructorView.myVar= e.currentTarget.data            
            //instructorView.test()           
            ]]>
        </mx:Script>
           <mx:Panel  layout="vertical" width="300" height="300"  >        
           <mx:ViewStack   id="viewStack" >
                <mx:VBox id="mainMenu" label="Login" >
                </mx:VBox>
                <mx:VBox id="instructor" label="Instructor" >
                    <local:InstructorView  id="instructorView" />
                </mx:VBox>
            </mx:ViewStack >
             <mx:HBox>
                 <mx:Button label="Main Menu" click="viewStack.selectedChild=mainMenu;"/>
             </mx:HBox>         
        </mx:Panel>
    </mx:Application>
    InstructorView.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"  creationComplete="init()" width="100%" height="100%">
    <mx:Script>
        <![CDATA[
    [Bindable] public var myVar:String=""
    public function init():void{
        trace("init"+myVar)
    public function test():void{
        trace("test="+myVar)
        ]]>
    </mx:Script>
    </mx:Canvas>

    I guess you are getting a null object reference error. This has nothing to do with our instructor view code. It is the creationpolicy of the view stack. The component is not created when you assign values.
    This is a link to livedocs page on creation policy.
    http://livedocs.adobe.com/flex/3/html/help.html?content=layoutperformance_05.html
    To solve your problem, either you can set creationPolicy="all" for viewstack or wait for the component to be instantiated completely

  • Reg : Pass One Component's value to other component's value

    Hi all,
    I have the following code . Here I want to Pass :Pass One Component's value to other component's value
    <af:image binding="#{backingBeanScope.backing_OText.i1}"
    id="i1"
    source="#{(SkinBean.skinFamily == 'MSIE_D2I3')?'/images/d2i3Logo.gif':'/images/UDR_logo.jpg'}"
    shortDesc="Hello World"/>
    <af:spacer width="100" height="10"
    binding="#{backingBeanScope.backing_OText.s1}"
    id="s1"/>
    <af:outputText
    binding="#{backingBeanScope.backing_OText.ot1}"
    id="ot1"
    inlineStyle=" font-weight:normal; font-size:32pt; font-family:Georgia, 'Times New Roman', times, Serif;"
    value = *"Here I want to pass the value as 'Hello World' from The Image Component's ShortDesc"*
    Please give me the solution .
    Thanks inAdvance .

    since you already have the backing bean, you can try to set the value property to
    #{backingBeanScope.backing_OText.i1.shortDesc}regards,
    ~Krithika

  • Need to bind value attributes of Component controller with value attributes

    Hi,
    I am developing a Java Web Dynpro application which is importing RFC Model.

    Hi Kaushik,
    It is very simple to enter values in webdynpro and to update the ztable through RFC
    All you hav to do is
    1. Create the ztable , RFC to import data into that table,
    2. Create the model in webdynpro with that RFC
    3. First map the ModelInputElements to the component controller(say zid, zname) (you can have your own value attribute in component controller say id , name )
    4. Map the attributes to the view where the input field is there
    5. Now write the code as follows,
    Zxxx in = new Zxxx();
    wdContext.nodeZxx_InputElement.bind(in);
    in.setZid(wdcontext.currentContextElement().getId()); // getId component controllers attribute and getZid is model' s mapped attributre
    in.setZname(wdcontext.currentContextElement().getName()); // getName component controllers attribute and getZname is model's mapped attributre
    /* u need not have to map that model attrobute to component attribute for that */
    try
    in.execute();
    Catch(Eception e)
    e.printStackTrace();
    Regards,
    Sam Charles J.

  • Read Z set type values of a component / equipment(object id)

    Hi Experts,
    I want to read the values of the attributes of a particular Z set type. I have the ibase component, object id, object family. How do I get values in the component details.
    Warm Regards,
    Abdullah Ismail

    Hi Experts,
    I want to read the values of the attributes of a particular Z set type. I have the ibase component, object id, object family. How do I get values in the component details.
    Warm Regards,
    Abdullah Ismail

  • Where can I find the moving average value of Project stock

    Dear All
    All my company stock is project stock. For all my Goods Issues with 221 Q, system takes the moving average value for that consumption posting. Where this moving average value can be found?
    Other than MBBS, is there anything else?
    Thanks
    Edited by: srini v on Dec 12, 2009 12:48 PM

    Hi,
    Try MM60
    Regards,
    Pardeep Malik

  • How to access the value of a field of a field symbol.

    Hello All,
    i need to access the value of a field in a field symbol. But when i am trying to get the value like <FS>-POSNR, it's showing that that the <FS> has no structure.
    In my program, the field itself that i need to check should be dynamic. ie i'll get the field in a variable and i need to find the value of that field.
    Am pasting my code below, please tell me what needs to be done.
    here in my sample code i am moving the entry of the <FS> into a work area structure. But in my actual program, i gets the structure as a parameter. So is there any way i can declare a work area dynamically...
    FUNCTION z_39181_dyn_fs_60758.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(PARAMETER) TYPE  VBELN
    *"  TABLES
    *"      DATA_TAB
      BREAK-POINT.
      FIELD-SYMBOLS <fs> TYPE ANY.
      FIELD-SYMBOLS <fs1> TYPE ANY.
      FIELD-SYMBOLS <fstab> TYPE ANY TABLE.
      DATA name(5) VALUE 'POSNR'.
      FIELD-SYMBOLS <f> TYPE ANY.
      DATA: dref TYPE REF TO data,
            dref1 TYPE REF TO data,
            dref2 TYPE REF TO data.
      DATA: lv_lips TYPE string.
      DATA: lv_lipsfld TYPE string,
                lv_fld TYPE string,
                lw_lips TYPE lips.
                lv_lips = 'LIPS'.
                lv_fld = 'LW_lips-POSNR'.
      CREATE DATA dref1 TYPE (lv_lips).
      CREATE DATA dref TYPE STANDARD TABLE OF (lv_lips).
      CREATE DATA dref2 LIKE LINE OF data_tab.
      ASSIGN dref->* TO <fstab>.
      ASSIGN dref1->* TO <fs>.
    assign dref2->* to <fs
      <fstab> = data_tab[].
      LOOP AT <fstab> INTO <fs>.
        lw_lips = <fs>.
        WRITE lw_lips-vbeln.
        ASSIGN (lv_fld) TO <fs1>.
       write <fs>
      ENDLOOP.
    Helpful answers will be rewarded...

    Use syntax
    ASSIGN COMPONENT name OF STRUCTURE struc TO <fs>.

Maybe you are looking for