<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Move data dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734502#M1300523</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the structure are different and some field names are same..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

loop at structure.

move-corresponding fields of structure to Itab.

append itab.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if both the structure are same..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
itab[] = structure[].
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 May 2009 11:28:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-27T11:28:18Z</dc:date>
    <item>
      <title>Move data dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734498#M1300519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi. I have a function module that is passing data in a structure with many fields. What I want to do is move data from 1 of the structure fields into a new field based on which field a user enters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, if the user keys in field "DESCRIPTION" I want to move the field called "DESCRIPTION" from the structure. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can easily find what the user enters, the problem is moving the field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could do a massive IF or CASE statement, but is there any way I can simply say "MOVE &amp;lt;structure&amp;gt;-&amp;lt;user field&amp;gt; to &amp;lt;new field&amp;gt;"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreaciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dave.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 11:21:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734498#M1300519</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-27T11:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Move data dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734499#M1300520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use MOVE- CORRESPONDING.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 11:23:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734499#M1300520</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-27T11:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Move data dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734500#M1300521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can make use of ASSIGN COMPONENT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 11:25:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734500#M1300521</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-27T11:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Move data dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734501#M1300522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use a Move-Corresponding to move the corresponding fileds from one structure to another, else you will have to use a field symbol of type any and assign the values to that field symbol. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;S.Dakshna Nagarnatam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 11:27:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734501#M1300522</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-27T11:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Move data dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734502#M1300523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the structure are different and some field names are same..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

loop at structure.

move-corresponding fields of structure to Itab.

append itab.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if both the structure are same..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
itab[] = structure[].
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 11:28:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734502#M1300523</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-27T11:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Move data dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734503#M1300524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
"USER_FIELD stores field name i.e. DESCRIPTION
"STRUCT is the structure you are passing to FM
"&amp;lt;NEW_FIELD&amp;gt; is your target field

"assuming above you can do this in the following way
field-symbols &amp;lt;comp&amp;gt; type any.

assign component USER_FIELD of structure STRUCT to &amp;lt;comp&amp;gt;.
if sy-subrc = 0.
   move &amp;lt;comp&amp;gt; to &amp;lt;new_field&amp;gt;.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 11:30:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734503#M1300524</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-05-27T11:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Move data dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734504#M1300525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;will it help...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZTEST_SOURAV33
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  ztest_sourav33.


TYPES:
BEGIN OF x_struc1,
  af1 TYPE c LENGTH 10,
  af2 TYPE p LENGTH 2 DECIMALS 3,
  af3 TYPE i,
END OF x_struc1,
BEGIN OF x_struc2,
  bf1 TYPE c LENGTH 5,
  af1 TYPE c LENGTH 10,
  bf2 TYPE n,
  af2 TYPE p LENGTH 2 DECIMALS 3,
  bf3 TYPE c LENGTH 5,
  af3 TYPE i,
END OF x_struc2.

DATA: work_area1 TYPE x_struc1,
      work_area2 TYPE x_struc2.

work_area1-af1 = 'TEST123456'.
work_area1-af2 = '0.865'.
work_area1-af3 = 14.

PARAMETERS: field TYPE c LENGTH 3. " AF1, or AF2 or AF3


AT SELECTION-SCREEN.

  IF field = 'AF1' OR
     field = 'AF2' OR
     field = 'AF3'.

  ELSE.
    MESSAGE e001(00) WITH 'Enter AF1, AF2 or AF3'.
  ENDIF.

START-OF-SELECTION.

  FIELD-SYMBOLS: &amp;lt;f1&amp;gt; TYPE ANY,
                 &amp;lt;f2&amp;gt; TYPE ANY.
  DATA temp TYPE string.

  CONCATENATE 'WORK_AREA1-' field INTO temp.

  ASSIGN (temp) TO &amp;lt;f1&amp;gt;.
  IF sy-subrc = 0.

    CONCATENATE 'WORK_AREA2-' field INTO temp.
    ASSIGN (temp) TO &amp;lt;f2&amp;gt;.
    IF sy-subrc = 0.
      &amp;lt;f2&amp;gt; = &amp;lt;f1&amp;gt;.
     write: temp, '=', &amp;lt;f2&amp;gt;.
    ENDIF.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 12:18:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734504#M1300525</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-27T12:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Move data dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734505#M1300526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I was able to do it with the assigning to field symbol type any.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 12:39:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/move-data-dynamically/m-p/5734505#M1300526</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-27T12:39:21Z</dc:date>
    </item>
  </channel>
</rss>

