Table Conversion (MOVE-CORRESPONDING-TABLE)

Hi,
I've run into a requirement which I'm not sure how to fulfil:
How to convert the data contents from one table format (Set of columns/objects) to other format (subset of columns), i.e. MOVE-CORRESPONDING-TABLE in standard ABAP?
In my scenario I have a table with 5 columns for internal logic (defined as ruleset variable) and I want to expose a table with only 2 columns as the function result.
My first shot was trying to define both tables with the same element objects (fields) and use a table operation expression (not sure if it actually works), but it leads to (plausible) error message "Multiple use of identical objects in context/temporary ruleset variable not allowed" (FDT_CORE 378).
What is the best/only way to achieve it?
Shai

You have an expression EXP1 with a specific result, let's say table T1 with structure S1 with Elements E1 to E4. Further, you have a function result T2, with S2 with E1 and E2 (all different technical IDs).
You create a rule like this: "Update values T2 after processing expression EXP1."
Such an option exists af of NW 731, SP4 or something.
In older releases your rules looks like this:
" Update values T1 after processing expression EXP1.
Update values T2 from T1."
A move does not look at IDs but for names, I think.

Similar Messages

  • Move-corresponding in table type Field-Symbols

    Hi,
        I have to use one statement in field-symbol similar to "move-corresponding" in normal internal table.Is it possible to use statement similar to "Move-corresponding in field-symbols".
    For Eg:
    Field-symbols <FA_IT> type standard table.
    data:begin of wa_ekk,
       f1 type i,
       f2 type werks_d,
       f4 type posnr,
       end of wa_ekk,
    it_ekk  like standard table of wa_ekk.
    begin of wa_final,
       f1 type i,
       f2 type werks_d,
       f3 type i,
       f4 type n,
    end of wa_final,
    it_final like standard table of wa_final.
    assign it_ekk to <fs_it>.
    Loop at <fs_it>.
    *???????-i dont know how to move the value to it_final
    *---I know I can use assign component statement
    *-to move each field  to the target field
    but for that we need to know the field name or index position of the structure-
    Endloop.
    My requirment is now i want to move the content of <fs_it> into it_final internal table.
    I know that In normal itab we can use "move-corresponding" to move the value from it_ekk to it_final.
    In the same way how to use it in field-symbol concept.
    Requirement:Real time Processing of Internal table
    1) Content of it_ekk:
    f1   f2       f4
    12  1000  0023
    23  2000  0037
    2)After ASSIGN statement:
    Content of <fs_it> is:
    f1   f2       f4
    12  1000  0023
    23  2000  0037
    3)Now I want to move the content of <fs_it> to it_final
    Output of It_final:
    F1   F2    F3    F4
    12  1000   ---    0023
    23  2000   ---    0037
    Regards,
    Vigneswaran S

    Andrey's code is going to work only if you are running it in a non-unicode system.
    See code below for a Unicode system using similar effect to "Move-Corresponding" statement.
    FIELD-SYMBOLS: <fs_ekk> LIKE wa_ekk,
                   <fs_final> LIKE wa_final.
    ASSIGN it_ekk TO <fs_it> .
    LOOP AT <fs_it> ASSIGNING <fs_ekk>.
      ASSIGN <fs_ekk> TO <fs_final> CASTING.
      CLEAR <fs_final>-f3.
      APPEND <fs_final> TO it_final.
    ENDLOOP.
    Hope this solves your problem and please don't forget to reward points.
    Cheers,
    Sougata.

  • Queyr about move-corresponding

    Hi guys,
    is move-corresponding capable of moving all entries of internal table w/o headerline to another internal table?
    or is it only capable of moving one entry?
    thanks a lot!

    Hi,
    To move values between the components of structures, use the statement :
    MOVE-CORRESPONDING <struct1> TO <struct2>.
    This statement moves the contents of the components of structure <struct1> to the components of <struct2> that have identical names. The other fields remain unchanged.
    When it is executed, it is broken down into a set of MOVE statements, one for each pair of fields with identical names, as follows:
    MOVE STRUCT1-<ci> TO STRUCT2-<ci>.
    Any necessary type conversions occur at this level. This process is different to that used when you assign a whole structure using the MOVE statement, where the conversion rules for structures apply.
    Example :
    DATA: BEGIN OF ADDRESS,
              FIRSTNAME(20) VALUE 'Fred',
              SURNAME(20) VALUE 'Flintstone',
              INITIALS(4) VALUE 'FF',
              STREET(20) VALUE 'Cave Avenue,
              NUMBER TYPE I VALUE '11'.
              POSTCODE TYPE N VALUE '98765'.
             CITY(20) VALUE 'Bedrock',
             END OF ADDRESS.
    DATA: BEGIN OF NAME,
               SURNAME(20),
               FIRSTNAME(20),
               INITIALS(4),
               TITLE(10) VALUE 'Mister',
              END OF NAME.
    MOVE-CORRESPONDING ADDRESS TO NAME.
    Yes all the values are moved to the corresponding fields.
    Hope this will help you.
    Plz reward if useful.
    Thanks,
    Dhanashri.

  • About the move corresponding

    hi,
           can anyone say about the diff... between the  move corresponding  and move statment..
    wat is the diff.. move corresponding and append stmt.. in which situation we need to use this....

    Hi
    Reward if help.
    MOVE-CORRESPONDING wa_tab1 to wa_tab2.************ End
    MOVE: wa_tab1-fld1 to wa_tab2-fld1,      wa_tab1-fld2 to wa_tab2-fld2,      wa_tab1-fld3 to wa_tab2-fld3,
    Assigning Values with MOVE
    To assign the value of a data object source to a variable destination, use the following statement:
    MOVE source TO destination.
    or the equivalent statement
    destination = source.
    The content of source remains unchanged, source does not therefore have to be a variable - it can also be a literal, a text symbol, or a constant. You must always specify decimal points with a period (.), regardless of the user’s personal settings.
    Multiple assignments
    f4 = f3 = f2 = f1.
    are also possible. ABAP processes them from right to left as follows:
    MOVE f1 TO f2.
    MOVE f2 TO f3.
    MOVE f3 TO f4.
    In the MOVE statement (or when you assign one value to another with the equal sign), it is not possible to specify the field names dynamically as the contents of other fields. If you need to do this, you must use field symbols .
    The source and target fields can be of different data types. The result of the value assignment depends on whether these data types are compatible and whether a type conversion can be performed. If there is no conversion rule between the data types in question, no assignment can be made.
    DATA: t(10)  TYPE c,
          number TYPE p DECIMALS 2,
          count  TYPE i.
    t = 1111.
    MOVE '5.75' TO number.
    count = number.
    Following these assignments, the fields t, number and count have the values ‘1111      ’, 5.75, and 6 respectively. When you assign the number literal 1111 to T, it is converted into a character field with length 10. When you assign number to count , the decimal number is rounded to an integer (as long as the program attribute Fixed pt. arithmetic has been set).
    Assigning Values Between Components of Structures
    The rules for value assignments between data objects also apply to structures. With the command
    DATA: struct1 TYPE structure,
          struct2 TYPE structure.
    struct1 = struct2.
    two structures of the same type can be assigned to one another without difficulty. Here, the entire source structure is seen as a unit and copied to the source structure. It is then possible to access the components individually again. If the structures in question are not compatible, see the conversion rules for structures.
    In practice, however, you will often only need to assign certain components of a structure to be certain components of another structure. ABAP has a special statement for this purpose:
    MOVE-CORRESPONDING sourcestruct TO destinationstruct.
    This statement assigns the contents of the components of structure sourcestruct to the components of the destinationstruct structure that have identical names.
    When it is executed, it is broken down into a set of MOVEstatements, one for each pair of fields with identical names, as follows:
    MOVE sourcestruct-comp1 TO destinationstruct-comp1.
    MOVE sourcestruct-comp2 TO destinationstruct-comp2.
    Any necessary type conversions are performed individually.
    DATA: BEGIN OF address,
            firstname(20) TYPE c VALUE 'Fred',
            surname(20) TYPE c VALUE 'Flintstone',
            initials(4) TYPE c VALUE 'FF',
            street(20) TYPE c VALUE 'Cave Avenue',
            number TYPE i VALUE '11',
            postcode(5) TYPE n VALUE '98765',
            city(20) TYPE c VALUE  'Bedrock',
          END OF address.
    DATA: BEGIN OF name,
            surname(20) TYPE c,
            firstname(20) TYPE c,
            initials(4) TYPE c,
            title(10) TYPE c VALUE 'Mister',
          END OF name.
    MOVE-CORRESPONDING address TO name.
    In this example, the values of name-surname, name-firstname and name-initials are set to 'Flintstone’, ‘Fred’, and 'FF'. name-title always has the value ‘Mister’.
    Append Structure->Append structures are used for enhancements that are not included in the standard. This includes special developments, country versions and adding customer fields to any tables or structures.
    An append structure is a structure that is assigned to exactly one table or structure. There can be more than one append structure for a table or structure.
    The following enhancements can be made to a table or structure TAB with an append structure:
    · Insert new fields in TAB,
    · Define foreign keys for fields of TAB that already exist,
    · Attach search helps to fields of TAB that already exist,
    These enhancements are part of the append structure, i.e. they must always be changed and transported with the append structure.
    Pls Reward if help.

  • Conditional MOVE-CORRESPONDING

    Hi, I need to write a piece of code to move records from one internal table to another table. I got to know about the MOVE-CORRESPONDING statement in ABAP. Now my question is: if I use the following, what will the system do:
    MOVE-CORRESPONDING ITAB1 TO ITAB2.
    Will all the contents of ITAB1 be moved to ITAB2? I want to add a condition to it. Is that possible?
    Thanks.

    Hi,
    Syntax:
    MOVE-CORRESPONDING <sourcestruct> TO <destinationstruct>.
    This statement assigns the contents of the components of structure <sourcestruct> to the components of the <destinationstruct> structure that have identical names.
    If you want to add a condition to, it is better using MOVE statement instead.
    Regards,
    Ferry Lianto

  • Move Corresponding Fields

    Hi
    I would like to move fields from a structure that has the following fields
    data Struc1 type table1.
    Fields:
    BUKRS
    WAERS
    MENGE....
    (similarly another 50 such fields)
    into another structure that has following fields,
    data Struc2 type table2.
    Fields:
    ZZ_WAERS
    ZZ_MENGE
    ZZ_BUKRS
    The data elements linked to the fields in both the structures would be the same. Move-Corresponding will not work as the field names do not match... also the order of the fields in both the structures do not match
    What is the easiest way to do this task other than moving each field one at a time?
    Can I apply any field symbols concept here... please let me know

    Hi Grame,
    if you want to create a generic solution, you can use RTTI Runtime Type Information to determine the datatype of the components in both structures. Then you could create assignments for equal types in source and target structure.
    This could work as long as you do not have more than one component of the same data type (data element) in the structures.
    Something like
    FIELD-SYMBOLS:
        <data1> TYPE ANY,
        <data2> TYPE ANY.
      DATA:
        lo_typedescr1 TYPE REF TO cl_abap_typedescr,
        lo_typedescr2 TYPE REF TO cl_abap_typedescr.
      DO.
        ASSIGN COMPONENT sy-index OF STRUCTURE itab1 TO <data1>.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          DO.
            ASSIGN COMPONENT sy-index OF STRUCTURE itab2 TO <data2>.
            IF sy-subrc NE 0.
              EXIT.
            ELSE.
              lo_typedescr1 = cl_abap_typedescr=>describe_by_data( <data1> ).
              lo_typedescr2 = cl_abap_typedescr=>describe_by_data( <data2> ).
              IF lo_typedescr1 =  lo_typedescr2.
                <data2> = <data1>.
              ENDIF.
            ENDDO.
          ENDIF.
        ENDDO.
    I have some doubts about performance if you do this for every table line. It will be better to do it once, keep the results in some kind of internal assignment table and use it in the loop. For this I don't write the code, thats your homework
    Regards,.
    Clemens

  • Problem with move-corresponding

    Hi,
    I have these codes below:
    TYPES: BEGIN OF t_employee1,
            carrid LIKE spfli-carrid,
            connid LIKE spfli-connid,
            countryfr LIKE spfli-countryfr,
          END OF t_employee1.
    DATA: i_employee TYPE STANDARD TABLE OF spfli WITH HEADER LINE,
          i_employee1 TYPE STANDARD TABLE OF t_employee1 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    SELECT-OPTIONS: s_carrid FOR spfli-carrid.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      SELECT * FROM spfli INTO TABLE i_employee
    WHERE carrid IN s_carrid.
        MOVE-CORRESPONDING i_employee TO i_employee1.
    But when i debug the program, carrid, connid and countryfr of i_employee do not move to i_employee1...
    is there somethig wrong with my codes???
    Thanks a lot!

    Change ur code as shown below:
    TYPES: BEGIN OF t_employee1,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    countryfr LIKE spfli-countryfr,
    END OF t_employee1.
    DATA: i_employee TYPE STANDARD TABLE OF spfli WITH HEADER LINE,
    i_employee1 TYPE STANDARD TABLE OF t_employee1 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    SELECT-OPTIONS: s_carrid FOR spfli-carrid.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
    SELECT * FROM spfli INTO TABLE i_employee
    WHERE carrid IN s_carrid.
    if sy-subrc = 0.
    loop at i_employee.
    MOVE-CORRESPONDING i_employee TO i_employee1.
    append i_employee1.
    endloop.

  • Statement not accesible  : "MOVE-CORRESPONDING ebkn TO *ebkn."

    hi guys,
    (system upgraded from 4.6 to 6.0 and made unicode compatible)
                    thr r two problems........
    1. "MOVE-CORRESPONDING ebkn TO *ebkn." is not accessible, is it something related to mirror image......... how to resolve this.
    2. Refresh it_tab - "Refresh and clear statements are not accesible" .
      These are present inside includes..... ( is it somewhere related to use of subroutines prior to the use of refresh or clear statement......)
    Those tables are defined prior to the statement Refresh or Clear.......

    Hi Mohd,
    please paste error message(s) in detail:
    source name(s)
    source line(1)
    full error message including message class, type and number
    If you get W messages (warnings), you may ignore them.
    Regards,
    Clemens

  • Syntax  of move corresponding

    hi
    Can anyone give me the syntax of move corresponding.
    I even want to know wat does this exactly do.
    Can I have some sample sof move corresponding.
    Its urgent.U'll get points.
    Thanking you
    Chandrika.

    hi,
    MOVE-CORRESPONDING
    Basic form
    MOVE-CORRESPONDING struc1 TO struc2.
    Effect
    Interprets struc1 and struc2 as structures. If, for example, struc1 and struc2 are tables, it executes the statement for their header lines.
    Searches for the sub-fields which occur both in struc1 and struc2 and then generates, for all relevant field pairs which correspond to the sub-fields ni, statements of the form
    MOVE struc1-ni TO struc2-ni.
    The other fields remain unchanged.
    With complex structures, the full names of the corresponding field pairs must be identical.
    Example
    DATA: BEGIN OF INT_TABLE OCCURS 10,
            WORD(10),
            NUMBER TYPE I,
            INDEX  LIKE SY-INDEX,
          END   OF INT_TABLE,
          BEGIN OF RECORD,
            NAME(10) VALUE 'not WORD',
            NUMBER TYPE I,
            INDEX(20),
          END   OF RECORD.
    MOVE-CORRESPONDING INT_TABLE TO RECORD.
    This MOVE-CORRESPONDING statement is equivalent to both the following statements:
    MOVE INT_TABLE-NUMBER TO RECORD-NUMBER.
    MOVE INT_TABLE-INDEX  TO RECORD-INDEX.
    Example
    TYPES: BEGIN OF ROW1_3,
             CO1 TYPE I,
             CO2 TYPE I,
             CO3 TYPE I,
           END   OF ROW1_3.
    TYPES: BEGIN OF ROW2_4,
             CO2 TYPE I,
             CO3 TYPE I,
             CO4 TYPE I,
           END   OF ROW2_4.
    TYPES: BEGIN OF MATRIX1,
             R1 TYPE ROW1_3,
             R2 TYPE ROW1_3,
             R3 TYPE ROW1_3,
           END OF   MATRIX1.
    TYPES: BEGIN OF MATRIX2,
             R2 TYPE ROW2_4,
             R3 TYPE ROW2_4,
             R4 TYPE ROW2_4,
           END OF   MATRIX2.
    DATA: ROW TYPE ROW1_3,
          M1  TYPE MATRIX1,
          M2  TYPE MATRIX2.
    ROW-CO1 = 1. ROW-CO2 = 2. ROW-CO3 = 3.
    MOVE: ROW TO M1-R1, ROW TO M1-R2, ROW TO M1-R3.
    MOVE-CORRESPONDING  M1 TO M2.
    The last MOVE-CORRESPONDING statement is equivalent to the statements:
    MOVE: M1-R2-CO2 TO M2-R2-CO2,
          M1-R2-CO3 TO M2-R2-CO3,
          M1-R3-CO2 TO M2-R3-CO2,
          M1-R3-CO3 TO M2-R3-CO3.
    Note
    The same runtime errors may occur as with MOVE.
    Note
    This statement assigns values based on pairs of fields with identical names. To avoid unwanted assignments, you should consider all fields of the source and target structures. If either is defined with reference to an ABAP Dictionary type (for example, a database table), remember that any subsequent extension to the type could cause coincidental pairs of identically-named fields, which could lead to incorrect program logic.
    Regards,
    Sourabh

  • Move Corresponding in AMDP Procedures

    Hi,
    Since Move Corresponding from internal table 1 to internal table 2 is not available in HANA SQL in AMDP, I can achieve the same using Selecting the respecting columns from the internal table 1 into internal table 2. Is there any other way through which we can achieve this?
    Regards,
    Ramesh

    Hi Ramesh,
    as alternative you could use the calculation engine function CE_PROJECTION to reach the same result. But I would not recommend to use the CE function because of the latest statement regarding the usage of CE functions in blog New SQLScript Features in SAP HANA 1.0 SPS9 (last paragraph). There it is (now!) recommended to use pure SQL instead of CE functions.
    Best regards,
    Florian

  • QM15 - MOVE-CORRESPONDING is not working

    Hi,
    I am executing a standard transaction QM15, in which workcenter (ARBPL) is not getting populated in the list output display.
    When I debugged the transaction, i found that there is a statement for moving ARBPL to the output table.
    MOVE-CORRESPONDING RQMQMEL TO OBJECT_TAB.
    After pressing F5 at this point, OBJECT_TAB remains the same.. its not getting appended with new value from RQMQMEL. Please help me out in understanding this. The Structure of RQMQMEL is same as OBJECT_TAB.
    Thanks,
    DhanaLakshmi M S

    Modify internal table has been written somewhere else in the program, depending on QMFE table. ARBPL was updated only in QMEL table.

  • Move vs move corresponding

    which is preferrable between move and move-corresponding  based on performance issues?

    the general performance recommendation is the following:
    Never use move-corresponding with buffered tables, the overhead can be similar as the buffered access itself.
    For database selects, the select itself is more expensive than the move corresponding. The decision come from the decision whether you want to use a fieldlist or a SELECT *. Fieldlists are recommended for very width tables, if the fieldlist reduces the width by a factor 2. Fieldlist must be used if your INTO structure is different from the table structure. In these 2 cases, you should use MOVE-CORRESPONDING.
    Siegfried

  • Move-corresponding , Append , modify, .........

    Hi..the following table is a program on internal table...
    Tables: MARA, MARD, MAKT.
    Select-options: S_MATNR, S_WERKS, S_LGORT
    FIELD NAME: MARA-MTART, MARA-MATNR, MARA-MBRSH, MAKT-MAKTX, MARD-WERKS, MARD-LGORT, MARD-LABST.
    Internal Tables: Standard Internal table for MARD, MARA, MAKT, OUTTAB with header line.
    Processing Flow:
    1. Select Material data into Internal table based on selection from MARD
    2. Select Material data into Internal table based on selection from MARA
    3. Select Material data into Internal table based on selection from MAKT
    4. Move-corresponding MARD to OUTTAB. Append OUTTAB.
    5. Loop at OUTTAB. Read Table MARA & MAKT and modify OUTTAB.
    6.  Write OUTTAB to Screen.
    I have doubt on Move-corresponding , modify....I have write the code as giving below,,,bt I am not getting proper ouput...data is not selecting from MATNR from selection screen.
    tables: MARA, MARD, MAKT.
    data: begin of i_mara occurs 0,
          MTART type MARA-MTART,  
          MATNR type MARA-MATNR,  
          MBRSH type MARA-MBRSH,  
               end of i_mara.
    data: begin of i_mard occurs 0,
          WERKS type MARD-WERKS,  
          LGORT type MARD-LGORT,  
          LABST type MARD-LABST,  
          end of i_mard.
    data: begin of i_makt occurs 0,
          MAKTX type MAKT-MAKTX,   
          end of i_makt.
    data: begin of wa,
          col1 type MARD-WERKS,
          col2 type MARD-LGORT,
          col3 type MARD-LABST,
          end of wa.
    data: i_outtab like table of wa with header line.
    select-options: S_MATNR for MARA-MATNR,  
                   S_WERKS for MARD-WERKS,  
                   S_LGORT for MARD-LGORT.  
    perform select_data_mard.   (I am not including the data inside this )
    perform select_data_mara.
    perform select_data_makt.
    perform fill_second-outtab.    ( I am including )
    FORM fill_second-outtab .
    loop at i_outtab.
    move-corresponding i_mard to i_outtab.
    append i_outtab.
    endloop.
    ENDFORM.                    " fill_second-outtab
    perform read_mara.
    perform read_makt.
    perform read_mard.
    clear i_outtab.
    wa-col1 = mara-MATNR.
    wa-col2 = mard-WERKS.
    wa-col3 = mard-LGORT.
    modify i_outtab from wa.
    loop at i_outtab into wa.
    write: / wa-col1, wa-col2, wa-col3.
    endloop.
    Thanks in advance.

    Thanks
    ok I am posting my complete code
    If my code is too complicated or wrong , then you can just go through the problem(which I have written at beginning)  and give some hints.
    Thanks
    tables: MARA, MARD, MAKT.
    *********************Data Declearation**************************
    *This is the internal table for mara .*
    data: begin of i_mara occurs 0,
          MTART type MARA-MTART,  
          MATNR type MARA-MATNR,  
          MBRSH type MARA-MBRSH, 
                end of i_mara.
    **This is the internal table MARD table.*
    data: begin of i_mard occurs 0,
          WERKS type MARD-WERKS,  
          LGORT type MARD-LGORT,  
          LABST type MARD-LABST,  
          end of i_mard.
    **This is the internal table for table MAKT.*
    data: begin of i_makt occurs 0,
          MAKTX type MAKT-MAKTX,  
          end of i_makt.
    **Declare outtabb**
    data: begin of wa,
          col1 type MARD-WERKS,
          col2 type MARD-LGORT,
          col3 type MARD-LABST,
          end of wa.
    data: i_outtab like table of wa with header line.
    *******************start of selection screen***********************
    select-options: S_MATNR for MARA-MATNR,  
                   S_WERKS for MARD-WERKS,  
                   S_LGORT for MARD-LGORT. 
    *****************end of selection screen***************************
    ***selecting data from databse*******
    *******************start of main program***************************
    start-of-selection.
    *selection from table MARD*
    perform select_data_mard.
    **select data from MARA*
    perform select_data_mara.
    **select data from MAKT*
    *perform select_data_makt.
    *move-corressponding outtab*
    perform fill_second-outtab.
    *read table mara.*
    perform read_mara.
    *read table makt.*
    perform read_makt.
    **read table mard.
    perform read_mard.
    clear i_outtab.
    wa-col1 = mara-MATNR.
    wa-col2 = mard-WERKS.
    wa-col3 = mard-LGORT.
    append wa to i_outtab.
    loop at i_mard into wa.
    write: / wa-col1, wa-col2, wa-col3.
    endloop.
    *********************end of main program******************
    *&      Form  select_data_mard
          text
    -->  p1        text
    <--  p2        text
    FORM select_data_mard .
    select WERKS LGORT LABST
    from MARD
    into table i_mard.
    ENDFORM.                    " select_data_mard
    *&      Form  select_data_mara
          text
    -->  p1        text
    <--  p2        text
    FORM select_data_mara .
    select MTART MATNR MBRSH
    from MARA
    into table i_mara.
    ENDFORM.                    " select_data_mara
    *&      Form  select_data_makt
          text
    -->  p1        text
    <--  p2        text
    FORM select_data_makt .
    select MAKTX
    from MAKT
    into table i_makt.
    ENDFORM.                    " select_data_makt
    *&      Form  fill_second-outtab
          text
    -->  p1        text
    <--  p2        text
    FORM fill_second-outtab .
    loop at i_outtab.
    move-corresponding i_mard to i_outtab.
    append i_outtab.
    endloop.
    ENDFORM.                    " fill_second-outtab
    *&      Form  read_mara
          text
    -->  p1        text
    <--  p2        text
    FORM read_mara .
    read table i_mara with key
    matnr = mara-matnr.
    ENDFORM.                    " read_mara
    *&      Form  read_makt
          text
    -->  p1        text
    <--  p2        text
    FORM read_makt .
    read table i_makt with key
    MAKTX = makt-maktx.
    ENDFORM.                    " read_mard
    *&      Form  read_mard
          text
    -->  p1        text
    <--  p2        text
    FORM read_mard .
    read table i_mard with key
    werks = MARD-WERKS
    lgort = mard-lgort.
    ENDFORM.                    " read_mard

  • Move corresponding query

    hi all,
    i have 2 internal tables.
    I moving data from internal table 1 to imnternal table 2.
    My problems is that the two internal tables have same fields
    data: begin of itab occurs 0,
       matnr like mara-matnr,
       maktx like makt-maktx,
    end of itab.
    data: begin of itab1 occurs 0,
    maktx like makt-maktx,
       matnr like mara-matnr,
    end of itab1.
    I have data in itab and trying to move to itab2.
    loop at itab.
    move-corresponding itab to itab1.
    append itab1.
    endloop.
    I am not getting any values ,i guess the field in itab1 should be in the same order.
    I have itab1 as i declared is there any way that i can from itab to itab1.
    iam not from programming background and i knew that there was something like move corresponding fields --
    pls let me know
    thanks

    hi preeti,
    one important sugestion.
    never use move corresponding. it will result in very low performance.
    so alwys declare the 2nd itab in the same order itself.
    data: begin of itab occurs 0,
    matnr like mara-matnr,
    maktx like makt-maktx,
    end of itab.
    data: begin of itab1 occurs 0,
    <b>matnr like mara-matnr,</b>
    maktx like makt-maktx,
    end of itab1.
    <b>thn do this.
    if itab[] is not initial.
    itab1[] = itab[].
    else.
    write "no data in itab".
    endif.
    </b>
    but what u wrote in ur question correct.
    chk ur itab has data. as i did in my code.
    rgds
    anver
    if helped mark points

  • Move corresponding Concept

    Helo Experts,
    Plz tell what is the problem in my code.Data is not coming in internal talbe it_error, even on the correct condition
    loop at record.
    if record-BUKRS_001 = 'XYZ' and record-EKORG_002 ne '2000' .
    if sy-subrc eq 0.
    MOVE-CORRESPONDING record TO it_error.
    APPEND record TO it_error.
          endif.
          endif.
    endloop.
    Ravi

    Hi,
    if u r using move corresponding then both the internaal tables sould ahve same stucture...
    here is small eg just go through the code ...
    data: begin of itab occurs 0,
      name(20) type c,
      comp(20) type c,
      city(20) type c,
      END OF ITAB.
    data: begin of itab1 occurs 0,
      name(20) type c,
      city(20) type c,
      END OF ITAB1.
    itab1-name = 'Rajat11'.
    itab1-city = 'Delhi2222'.
    append itab1.
    itab1-name = 'Rajat22'.
    itab1-city = 'Delhi1'.
    append itab1.
    itab1-name = 'Rajat33'.
    itab1-city = 'Delhi2'.
    append itab1.
    loop at itab1 .
    move-corresponding itab1 to itab.
    append itab.
    endloop.
    loop at itab.
    write:/ itab-name.
    write:/ itab-city.
    write:/ itab-comp.
    endloop.
    i hope u will get solution..
    Thanks & Regards
    Ashu Singh

Maybe you are looking for