Data Transfer between two internal tables

Hi SDN,
If I have two internal tables itab_a and Itab_b and I want to copy a subset of itab_a to itab_b using a conditional statement, is it possible and how?
Second, what if I want to append the smaller internal table itab_b to itab_a, how would you do that.
My task is to take some of the rows from a into b, change one field and append back to a. So if a had 100 rows, now it would have 110.
Please help.
Thanks.
Saf.

If I have two internal tables itab_a and Itab_b and I want to copy a subset of itab_a to itab_b using a conditional statement, is it possible and how?
LOOP AT ITAB_A.
  IF ITAB_A-SOME_FIELD = SOME_VALUE.
     MOVE-CORRESPONDING ITAB_A TO ITAB_B.
     APPEND ITAB_B.
  ENDIF.
ENDLOOP.

Similar Messages

  • Error 33172 occurred at Read & Write data transfer between two or more PF2010 controller

    Hi,i need to do data transfer between two or more FP2010 controller.e.g. FP2010(A) & FP2010(B).
    FP2010(A) need to transfer the measurement (from its I/O module) to FP2010(B) to do the data analysis.These data transfer should be synchronous btw two controller to prevent data lost.
    From the vi used in the attachment,i encountered some problems at:
    (1) Error 33172 occurred while publishing the data.Can i create and publish data under different item name?
    (2) How to synchronies the read & write btw contorller?
    All controller are communicating with each other directly without the need of a host computer to link them together
    Is there any other method to do fast data transfer betwe
    en controller?

    Hi YongNei,
    You were succesful in omiting enough information to make it very difficult to answer!
    Please post your example.
    Please tell us what version of LV-RT you are using.
    Please define what you concider "fast data transfer".
    Have you concidered mapping the FP tags of FP2010(A) to FP2010(B) and vise versa?
    WHat exactly has to be syncronized?
    If you have something that is close to working, share that.
    Well, that as far as I can go with the info you have provided. Depending on the details, what you are asking could be anything from trivial to impossible with the currently available technology. I just can't say.
    It would probably be a good idea to start over with a fresh question (sorry) because not many people are going to know what a a "
    PF2010" is and I can not guarentee that I will be able to get back to you personally until next week-end.
    Trying to help you get an answer,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Cann't move data between two internal table in Unicode program

    Hello expert,
    I import a program from old sap system to new system, but syntax error occurred --- ' L_T_S776[] = T_DATA_RECORDS[]. ',
    it is said ' internal table L_T_S776 and T_DATA_RECORDS are not mutually convertible, in unicode program, two internal tables must have the same structure layout'.
    The coding is:
    DATA: L_T_S776 LIKE S776 OCCURS 0 WITH HEADER LINE.
    DATA: L_T_S777 LIKE S777 OCCURS 0 WITH HEADER LINE.
    FIELD-SYMBOLS: <F_S776> TYPE S776.
    FIELD-SYMBOLS: <F_S777> TYPE S777.
    IF NOT ZCL_USEREXIT=>IS_ACTIVE( PROJN = 11 EXITN = 34 ) IS INITIAL.
      CASE I_RMCP2-SCTYP.
        WHEN 'Z776'.
          L_T_S776[] = T_DATA_RECORDS[].
          LOOP AT L_T_S776 ASSIGNING <F_S776>.
            <F_S776>-ZZCUSER = SY-UNAME.
            <F_S776>-ZZCDATE = SY-DATUM.
            <F_S776>-ZZCTIME = SY-TIMLO.
          ENDLOOP.
         T_DATA_RECORDS[] = L_T_S776[].
        WHEN OTHERS.
      ENDCASE.
    internal table T_DATA_RECORDS is defined to like INDX.
    this program is in function module EXIT_SAPMMCP6_011, it is a user_exit.
    I also confuse the meaning of this part of coding, could anybody help me?
    reward if got useful reply, thank you.
    H.B

    Hi,
    The structure are different thats why you getting this error. But there must be some fields common to which you want to move data. So you change in that way.
    And there will be no impact whatsoever because of such change.
    Regards,
    Atish

  • Find the difference between two internal table

    how can i see the difference between two interal tables?
    The requirement is as follows
    1. We have a transparent table, which stores the employee data with EMP ID as key.
    2. We load the transp table data into a interal table (B).
    3. We get data from legecy system as file and it gets loaded into another internal table (A) (this also has the same EMP ID key and this will have latest addition/update to those emplyees).
    Now we need to seperate out these data into three interal table Inserted (I), Deleted (D) and Updated (U).
    We want to do followign things
    I = A - B
    D = B - A
    Both A and B will have around 40k records. Hence we are trying to avoid the looping.
    Please suggest the best option for us.
    Thank you in advance.
    Raghavendra

    >
    RAGHAV URAL wrote:
    > how can i see the difference between two interal tables?
    > The requirement is as follows
    >
    > 1. We have a transparent table, which stores the employee data with EMP ID as key.
    > 2. We load the transp table data into a interal table (B).
    > 3. We get data from legecy system as file and it gets loaded into another internal table (A) (this also has the same EMP ID key and this will have latest addition/update to those emplyees).
    >
    > Now we need to seperate out these data into three interal table Inserted (I), Deleted (D) and Updated (U).
    >
    > We want to do followign things
    > I = A - B
    > D = B - A
    >
    > Both A and B will have around 40k records. Hence we are trying to avoid the looping.
    >
    > Please suggest the best option for us.
    >
    > Thank you in advance.
    > Raghavendra
    Hi Raghavendra,
      Currently as of my knowledge, these operations are only possible through LOOPs. But LOOPign can be really fast here if you properly utilize the SORTING, READ with BINARY SEARCH and FIELD-SYMBOLS usage. I would say:-
    Steps for Insert:-
    SORT: A, B.
    LOOP AT A ASSIGNING <WA_A>.
      READ TABLE B WITH TABLE KEY key = <WA_A>-key BINARY SEARCH.
      IF SY-SUBRC NE 0.
        APPEND <WA_A> TO I.
      ENDIF.
    ENDLOOP.
    Steps for Delete:-
    SORT: A, B.
    LOOP AT B ASSIGNING <WA_B>.
      READ TABLE A WITH TABLE KEY key = <WA_B>-key BINARY SEARCH.
      IF SY-SUBRC NE 0.
        APPEND <WA_B> TO D.
      ENDIF.
    ENDLOOP.
    Regards,
    Ravi.

  • DIFFERENCE BETWEEN TWO INTERNAL TABLES,THESE TABLES HAVE SAME FILEDS

    TYPES: BEGIN  OF
    TY_AS_UP,
    WERKS  LIKE  
                      MARC-WERKS,
    MATNR LIKE  
                       MARC-MATNR,
    LGORT LIKE  
                      MARD-LGORT,
    LABST(13) TYPE C,             
    (MARD-LABST)
    END OF TY_AS_UP.
    TABLES:
    1) FLAT FILE DATA.:
    DATA: WA_FILEDATA 
                 TYPE TY_AS_UP,
    I_FILEDATA TYPE STANDARD TABLE OF TY_AS_UP INITIAL SIZE 0.
    2) SAP DATA (SELECT QUREY)
    DATA: WA_SAPDATA
                  TYPE TY_AS_UP,
    I_SAPDATA TYPE STANDARD TABLE OF TY_AS_UP INITIAL SIZE 0.
    NOTE:
    I brought data to above table(2) from two internal tables I_MARC and I_MARD .
    My requirement is to display difference between  tables  1) and 2) based on quantity field(MARD-LABST)..
    report layout:
          top-of-page
    plant  diff qty  distri.qty   sap  
    01       -20       30        50  
            end-of-page
              page no 1.
    Kindly help me,it is urgent

    hi micky,
         thanks for your solution.
    another problem:
    I could not understand below
    requirement, could you please
    explain me.
    8)     Format the report based on the display options specified in the selection screen.
    a)     Display option “EQUAL IN QTY” show report lines where the difference is between the distributor file quantity and the SAP quantity is 0.
    b)     Display option “DIFFERENCE IN QTY” show report lines where the difference between the distributor file quantity and the SAP quantity is not 0.
    c)     If both options are selected, show report lines where the difference is both 0 and not 0.
    d)     Display SKUs in the distributors file not found in SAP as “Missing SKUs”
    regards,
    saritha.

  • Compare multiple variable selections between two internal tables

    I am trying to work out the syntax for the following, however i am stumped on the 2nd part of the requirement....
    I have two internal tables.  and i need to compare the records.
    1st, line by line, which i can do, however the 2nd requirement, i need to check a range of data against the same table...
    here is an example of the tables:
    Internal Table1 has the following records.
    TL1
    TL2
    TL3
    TL4
    TL5
    TL6
    Internal table 2 has the following records...
    LDOC1     TL1
    LDOC1     TL2
    LDOC1     TL3
    LDOC1     TL7
    LDOC2     TL1
    LDOC2     TL5
    LDOC3     TL6
    LDOC3     TL7
    but for the 2nd requirement, i have to group the LDOC1 (2, 3)  and search for all TL* and report if they all exist, some exist or none exist within the 1st internal table.
    so for requirement 1, the answer would be yes (as i can do a read table using the TL*), however i am not sure how i can check "for all entries" for TL1, Tl2, TL3, TL7 and return that only some entries exist....  LDOC1 should return "some", LDOC2 should return "all" and LDOC3 should return "none".
    Hopefully that makes sense???
    Can someone give me a keyword to investigate as i am not sure the At new would work....  Unless i do an at new and then loop and maybe add the record to a "range" to then compare and log the result as it runs through each result...
    so if Itab1 = itab2 then variable = yes. else None.
    if variable = yes, and itab1 = itab2 then variable = yes.
    if variable = yes and itab1 <> itab2 then variable = some.
    would that work??  i am worried about performance too as there could be 1000's of records....
    and can i have an "at end" so at end, if variable = yes, then variable = all?
    i have written all the rest of the report to get all the data into these tables...  i am just a little baffled as to how i can validate and compare the multiple selection....  :o(

    Hi,
    It is really confusing :-).. But i have tried to figure out.. may be this could be useful for you.
    Internal Table1 has the following records.
    TL1
    TL2
    TL3
    TL4
    TL5
    Internal table 2 has the following records...
    LDOC1 TL1
    LDOC1 TL2
    LDOC1 TL3
    LDOC1 TL7
    LDOC2 TL1
    LDOC2 TL5
    LDOC3 TL6
    LDOC3 TL7
    itab3[] = itab2[]
    sort itab3 by field1.
    delete adjacent duplicates from itab3 comparing field1.
    itab3
    LDCO1 
    LDCO2
    LDCO3
    loop at itab3.
    clear: lv_flag, index, ind.
    loop at itab2 where field1 = itab3-field1.
    index = index + 1.
    read table itab1 with key field1 = itab2-field2.
    if sy-subrc NE 0.
    lv_flag = 'X'.
    ind = ind + 1.
    endif.
    endloop.
    if lv_flag = 'X'.
    if ind = index.
      lv_val = 'NONE'.
    elseif ind NE index.
      lv_val = 'SOME'.
    endif.
    else.
      lv_val = 'ALL'.
    endif.
    "here you can modify itab3 with lv_val in one field, so that you can figure out which is SOME, NONE, ALL
    endloop.
    Regards,
    senthil

  • Can we apply join between two internal tables?

    Itab has fields A,B,C.
    Data: begin of itab occurs 1,
             A  type I,
             B type I,
             C type I,
             End of itab.
    Jtab has fields A, I, J.
    Data: begin of itab occurs 1,
             A  type I,
             I type I,
             J type I,
             End of itab
    The common field between itab and jtab is u201CAu201D.
    Now I need to collect A,B,C,I, J in another internal table ktab.
    How should I be doing this.
    If I use a SELECT query with inner join between itab and jtab it says u201Citab is not a database tableu201D.
    How should I get the result  ktab with A B C I J fields?
    Please help, nay help will be highly appreciated?

    a®s wrote:
    >
    > sort itab_all by A
    > delete adjacent duplicates from itab_all comparing A.
    >
    >
    Do you have the above code in ?
    Here A is common field between both tables, first we are appending itab_1 & itab_2 into table itab_all then deleting the adjacent duplicates from itab_all. then we are reading itab_1 & itab_2 for possible matches and update the same values in itab_all
    so there will NOT be a chance of duplicates in itab_all

  • Excel data transfer into SAP internal table with GUI_UPLOAD

    hi all,
      i m using SRM4 system and i wanted to develop one report which will upload data from excel and convert it into IT.
    i know that many threads are posted on this topic.
    but my requirement is slight different. in the system only one function module is available that is "GUI_UPLOAD" and we want that user shd not save file as tab delimited before calling this fm. instead, program shd take care of all these things...
    please suggest something asap..
    helpful ans will be rewarded..
    thanks,
    jigs.

    Dear Jigs,
    Please go though the following lines of code:
    D A T A D E C L A R A T I O N *
    TABLES: ANEP,
    BKPF.
    TYPES: BEGIN OF TY_TABDATA,
    MANDT LIKE SY-MANDT, " Client
    ZSLNUM LIKE ZSHIFTDEPN-ZSLNUM, " Serial Number
    ZASSET LIKE ZSHIFTDEPN-ZASSET, " Original asset that was transferred
    ZYEAR LIKE ZSHIFTDEPN-ZYEAR, " Fiscal Year
    ZPERIOD LIKE ZSHIFTDEPN-ZPERIOD, " Fiscal Period
    ZSHIFT1 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 1
    ZSHIFT2 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 2
    ZSHIFT3 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 3
    END OF TY_TABDATA.
    Declaration of the Internal Table with Header Line comprising of the uploaded data.
    DATA: BEGIN OF IT_FILE_UPLOAD OCCURS 0.
    INCLUDE STRUCTURE ALSMEX_TABLINE. " Rows for Table with Excel Data
    DATA: END OF IT_FILE_UPLOAD.
    S E L E C T I O N - S C R E E N *
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME,
    BEGIN OF BLOCK B2 WITH FRAME.
    PARAMETERS: P_FNAME LIKE RLGRAP-FILENAME OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK B2,
    END OF BLOCK B1.
    E V E N T : AT S E L E C T I O N - S C R E E N *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
    PROGRAM_NAME = SYST-REPID
    DYNPRO_NUMBER = SYST-DYNNR
    FIELD_NAME = ' '
    STATIC = 'X'
    MASK = '.'
    CHANGING
    FILE_NAME = P_FNAME
    EXCEPTIONS
    MASK_TOO_LONG = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    E V E N T : S T A R T - O F - S E L E C T I O N *
    START-OF-SELECTION.
    Upload Excel file into Internal Table.
    PERFORM UPLOAD_EXCEL_FILE.
    Organize the uploaded data into another Internal Table.
    PERFORM ORGANIZE_UPLOADED_DATA.
    E V E N T : E N D - O F - S E L E C T I O N *
    END-OF-SELECTION.
    *& Form UPLOAD_EXCEL_FILE
    text
    --> p1 text
    <-- p2 text
    FORM UPLOAD_EXCEL_FILE .
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    FILENAME = P_FNAME
    I_BEGIN_COL = 1
    I_BEGIN_ROW = 3
    I_END_COL = 7
    I_END_ROW = 32000
    TABLES
    INTERN = IT_FILE_UPLOAD
    EXCEPTIONS
    INCONSISTENT_PARAMETERS = 1
    UPLOAD_OLE = 2
    OTHERS = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " UPLOAD_EXCEL_FILE
    *& Form ORGANIZE_UPLOADED_DATA
    text
    --> p1 text
    <-- p2 text
    FORM ORGANIZE_UPLOADED_DATA .
    SORT IT_FILE_UPLOAD BY ROW
    COL.
    LOOP AT IT_FILE_UPLOAD.
    CASE IT_FILE_UPLOAD-COL.
    WHEN 1.
    WA_TABDATA-ZSLNUM = IT_FILE_UPLOAD-VALUE.
    WHEN 2.
    WA_TABDATA-ZASSET = IT_FILE_UPLOAD-VALUE.
    WHEN 3.
    WA_TABDATA-ZYEAR = IT_FILE_UPLOAD-VALUE.
    WHEN 4.
    WA_TABDATA-ZPERIOD = IT_FILE_UPLOAD-VALUE.
    WHEN 5.
    WA_TABDATA-ZSHIFT1 = IT_FILE_UPLOAD-VALUE.
    WHEN 6.
    WA_TABDATA-ZSHIFT2 = IT_FILE_UPLOAD-VALUE.
    WHEN 7.
    WA_TABDATA-ZSHIFT3 = IT_FILE_UPLOAD-VALUE.
    ENDCASE.
    AT END OF ROW.
    WA_TABDATA-MANDT = SY-MANDT.
    APPEND WA_TABDATA TO IT_TABDATA.
    CLEAR: WA_TABDATA.
    ENDAT.
    ENDLOOP.
    ENDFORM. " ORGANIZE_UPLOADED_DATA
    In the subroutine --> ORGANIZE_UPLOADED_DATA, data are organized as per the structure declared above.
    Regards,
    Abir
    Don't forget to award points *

  • How to append records between two internal tables

    hi all,
    im trying to append from an internal table to another internal table with same structure. i tried the following but it overwrites previous contents of i_dest:
    move i_src to i_dest
    thanks,
    sid

    hey u try to move it record by record
    <b>itab2 = itab.
    append itab2.</b>
    This should work I guess
    just check the code below, if u want to move the whole itab into itab2 then use <b>itab2[] = itab.</b>
    <b>loop at it_pgm.
      read table itab with key obj_name = it_pgm-pgm_name.
      if sy-subrc = 0.
        itab_final-obj_name = itab-obj_name.
        itab_final-func_spec = itab-func_spec.
        itab_final-func_area = itab-func_area.
        itab_final-dev_class = itab-dev_class.
        append itab_final.
    else.
       itab_alt-pgm_name = it_pgm-pgm_name.
       append itab_alt.
      endif.</b>
    please reward points if found helpful

  • How to delete the matching records from two internal tables

    Hi ,
    I have two internal tables say A and B of the same type. If A has 10 records and B has 4 records , I want to delete the 4 records in B from A .
    loop at B into wa .
    delete A where key = wa - key .
    endloop.
    takes a long time if the table B is huge. how can I improve the performance.
    Thanks.
    Gayathri

    Hi Gayathri,
    You could try field-symbols. It reduces the data transfer from the internal table B to the work area.
    field-symbols <fs_itab_b> like line of B.
    loop at B assigning <fs_itab_b>.
      delete A where key = <fs_itab_b>?-key.
    endloop.
    Regards,
    <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=zwcc%2fwm4ups%3d">anand Mandalika</a>.

  • How to pass data between two internal sessions using ABAP memory?

    Hi,
    How to pass data between two internal sessions using ABAP memory?
    It would be fine if you could explain with an example.
    And also let me clear about the data passing between two main sessions and two external sessions with specific examples.
    Thanks.

    Hi ,
      check the example.
    Reading Data Objects from Memory
    To read data objects from ABAP memory into an ABAP program, use the following statement:
    Syntax
    IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.
    This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.
    In this statement, the system does not check whether the structure of the object in memory is compatible with the structure into which you are reading it. The data is transported bit by bit. If the structures are incompatible, the data in the target field may be incorrect.
    PROGRAM SAPMZTS1.
    DATA TEXT1(10) VALUE 'Exporting'.
    DATA ITAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.
    DO 5 TIMES.
      ITAB-BOOKID = 100 + SY-INDEX.
      APPEND ITAB.
    ENDDO.
    EXPORT TEXT1
           TEXT2 FROM 'Literal'
      TO MEMORY ID 'text'.
    EXPORT ITAB
      TO MEMORY ID 'table'.
    SUBMIT SAPMZTS2 AND RETURN.
    SUBMIT SAPMZTS3.
    The first part of this program is the same as the example in the section Saving Data Objects in Memory. In the example, the programs SAPMZTS1 and SAPMZTS2 are called using SUBMIT. You can create and maintain the programs called using the SUBMIT statement by double-clicking their names in the statement. For further information about the SUBMIT statement, refer to Calling Executable Programs (Reports)
    Example for SAPMZTS2:
    PROGRAM SAPMZTS2.
    DATA: TEXT1(10),
          TEXT3 LIKE TEXT1 VALUE 'Initial'.
    IMPORT TEXT3 FROM MEMORY ID 'text'.
    WRITE: / SY-SUBRC, TEXT3.
    IMPORT TEXT2 TO TEXT1 FROM MEMORY ID 'text'.
    WRITE: / SY-SUBRC, TEXT1.
    Example for SAPMZTS3:
    PROGRAM SAPMZTS3.
    DATA JTAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.
    IMPORT ITAB TO JTAB FROM MEMORY ID 'table'.
    LOOP AT JTAB.
      WRITE / JTAB-BOOKID.
    ENDLOOP.
    The output is displayed on two successive screens. It looks like this:
    and
    The program SAPMZTS2 attempts to read a data object TEXT3 from the data cluster "text", which does not exist. TEXT3 therefore remains unchanged. The existing data object TEXT2 is placed in TEXT1. In both cases, SY-SUBRC is 0, since the cluster "text" contains data.
    The program SAPMZTS3 reads the internal table ITAB from the cluster "table" into the internal table JTAB. Both tables have the same structure, namely that of the ABAP Dictionary table SBOOK.
    Pls. reward if useful.....

  • How to transfer data from a dynamic internal table

    Hi All
    I want to transfer data from a dynamic internal table<dyn_table>
    to a non dynamic internal table itab which should have the same structure as <dyn_table>.
    How can this be done?
    Regards,
    Harshit Rungta

    As stated earlier this can be done only through field symbols...
    You cannot create an non dynamic internal table with ANY structure...using DATA statement
    If the strucutre is defined well and good...you can create an non-dynamic internal table...
    If you do not know the structure then the internal table has to be dynamic...and to be generated using field symbols
    DATA: lv_ref TYPE REF TO data.
    FIELD-SYMBOLS: <fs_dyn_table> TYPE STANDARD TABLE.
    * You create a dynamic internal table...
    CREATE DATA lv_ref LIKE (your_dynamic_internal_table).
    ASSIGN lv_ref->* TO <fs_dyn_table>.
    Now...do the transfer.
    <fs_dyn_table> = "your_dynamic_internal_Table
    Hope it helps!

  • Can we get the data from two internal tables in ALV.

    hi friends i would like to display the data using two internal tables using alv grid.please guide me.

    Hi,
    ALV would be having a specific layout say :
    MATNR
    MAKTX
    QTY
    Now, if you have two internal tables, then do they have a different structure. If they have different structures, then what kind of ALV layout you expect. The ALV output should be as per the structure of 1st or 2nd internal table.
    If both internal table have same layout, then populate the data from 2nd internal table into 1st internal table and pass the 1st internal table ( it will have data of both internal tables) to ALV.
    Best regards,
    Prashant

  • Two internal tables data into one

    Hello Gurus,
    I have data in two internal tables. One table IT_A contains the fields -
    MATNR - SALES ORG - DCHANNEL - STATUS - DESCRIPTION
    The other table IT_B contains the fields -
    CUSTOMER - SALES ORG.
    I need to display the result of all the fields when the sales org of both the tables are equal. i.e IT_A-VKORG = IT_B-VTORG.
    MATNR - SALES ORG - DCHANNEL - STATUS - DESCRIPTION.
    Please help me out with the code to be written.
    Regards,
    Balu

    TABLES    : MVKE, CAUFVD, TVMST.
    TYPES     : BEGIN OF T_MVKE,
                MATNR TYPE MVKE-MATNR,
                VKORG TYPE MVKE-VKORG,
                VTWEG TYPE MVKE-VTWEG,
                VMSTA TYPE MVKE-VMSTA,
                VMSTB TYPE TVMST-VMSTB,
                END OF T_MVKE.
    DATA      : LT_MVKE TYPE STANDARD TABLE OF T_MVKE WITH HEADER LINE,
                LS_MVKE TYPE T_MVKE.
    DATA      : LT1_MVKE TYPE STANDARD TABLE OF T_MVKE WITH HEADER LINE,
                LS1_MVKE TYPE T_MVKE.
    DATA      : LT2_MVKE TYPE STANDARD TABLE OF T_MVKE WITH HEADER LINE,
                LS2_MVKE TYPE T_MVKE.
    TYPES     : BEGIN OF T_KNVP,
                KUNNR TYPE KNVP-KUNNR,
                VKORG TYPE KNVP-VKORG,
                END OF T_KNVP.
    DATA      : LT_KNVP TYPE STANDARD TABLE OF T_KNVP WITH HEADER       LINE,
                LS_KNVP TYPE T_KNVP.
    SELECT-OPTIONS S_MATNR FOR MVKE-MATNR.
    PARAMETER  : P_KUNNR TYPE KNVP-KUNNR .
    START-OF-SELECTION.
    SELECT MATNR VKORG VTWEG VMSTA FROM MVKE INTO TABLE LT_MVKE WHERE MATNR IN S_MATNR .
    IF SY-SUBRC = 0.
    APPEND LT_MVKE.
    ELSE.
    EXIT.
    ENDIF.
    SELECT DISTINCT KUNNR VKORG FROM KNVP INTO TABLE LT_KNVP WHERE KUNNR = P_KUNNR.
    IF SY-SUBRC = 0.
    APPEND LT_KNVP.
    ELSE.
    EXIT.
    ENDIF.
    LOOP AT LT_MVKE.
    LT1_MVKE-MATNR = LT_MVKE-MATNR.
    LT1_MVKE-VKORG = LT_MVKE-VKORG.
    LT1_MVKE-VTWEG = LT_MVKE-VTWEG.
    LT1_MVKE-VMSTA = LT_MVKE-VMSTA.
    SELECT SINGLE VMSTB FROM TVMST INTO LT1_MVKE-VMSTB WHERE VMSTA = LT_MVKE-VMSTA AND SPRAS = SYST-LANGU.
    APPEND LT1_MVKE.
    CLEAR LT1_MVKE.
    ENDLOOP.
    LOOP AT LT1_MVKE.
      IF NOT LT_KNVP[] is INITIAL.
      READ TABLE LT_KNVP WITH KEY VKORG = LT1_MVKE-VKORG BINARY SEARCH TRANSPORTING NO FIELDS.
       IF SY-SUBRC = 0.
       APPEND LT1_MVKE TO LT2_MVKE.
       ELSE.
       APPEND LT1_MVKE TO LT2_MVKE.
       MESSAGE S003.
       ENDIF.
      CLEAR LT1_MVKE.
      ELSE. "IF LT_KNVP[] IS INITIAL.
       APPEND LT1_MVKE TO LT2_MVKE.
    ENDIF.
    ENDLOOP.
    WRITE: /1 'MATERIAL NUMBER', 20 'SALES ORG', 35 'DISTRIBUTION CHANNEL', 65 'MATERIAL STATUS', 85 'STATUS DESCRIPTION'.
    LOOP AT LT2_MVKE.
    FORMAT HOTSPOT ON.
    WRITE: /1 LT2_MVKE-MATNR, 20 LT2_MVKE-VKORG, 35 LT2_MVKE-VTWEG, 65 LT2_MVKE-VMSTA, 85 LT2_MVKE-VMSTB.
    HIDE: LT2_MVKE-MATNR, LT2_MVKE-VKORG, LT2_MVKE-VTWEG, LT2_MVKE-VMSTA, LT2_MVKE-VMSTB.
    CLEAR LT2_MVKE.
    FORMAT HOTSPOT OFF.
    ENDLOOP.
    AT LINE-SELECTION.
      IF LT2_MVKE-VMSTA = ' '.
       MESSAGE E002.
    ELSE.
    SET PARAMETER ID 'MAT' FIELD LT2_MVKE-MATNR.
    CALL TRANSACTION 'CO09'.
    DATA WERKS(4) TYPE C VALUE '1200'.
    SET PARAMETER ID 'WRK' FIELD WERKS.
    DATA RULE(2) TYPE C VALUE 'ZB'.
    SET PARAMETER ID 'PRR' FIELD RULE.
    SET PARAMETER ID 'X' FIELD CAUFVD-PRMBD.
    ENDIF.
    Hello gurus,
    The above code is working fine when I give both Material and customer in the select options. But it is not doing anything when I enter only the material.
    Please help.
    Regards,
    Balu

  • Diference between DATA: and TYPES: on internal tables

    Hi people,
    Can somebody help me. I wanna know whats the diference between DATA: and TYPES: on internal tables
    and whitch has the best performance, here is a eg:
    DATA: BEGIN OF ti_sbook occurs 0,
              carrid   LIKE sbook-carrid,
              fldate   LIKE sbook-fldate,
              customid LIKE sbook-customid,
              loccuram LIKE sbook-loccuram,
           END OF ti_sbook.
    AND
    TYPES: BEGIN OF ti_sbook ,
              carrid   LIKE sbook-carrid,
              fldate   LIKE sbook-fldate,
              customid LIKE sbook-customid,
              loccuram LIKE sbook-loccuram,
           END OF ti_sbook.
    DATA: gw_sbook       TYPE  TABLE OF ti_sbook,
    gs_sbook       TYPE ti_sbook.
    witch of both types is better?
    thanks.

    Hi Marcelo,
    For compatibility matters is better to create internal tables with a work area separately. So yes it's better to use types. When you work with Object Oriented coding you will need to use internal tables defined with types. Also when defining tables with types is the new way of coding, the another coding is getting obsolete defined by SAP. That's why when working in ABAP with OO (Object Oriented) code you'll have to define tables with types and not the other way.
    Hope it helps.
    Regards,
    Gilberto Li

Maybe you are looking for

  • HP Pavilion dv6000 will not power up.

    I have had an HP Pavillion dv6000 for a few years, and suddenly, it will not power up at all.  I can not determine that anything at all happens when I press the power button.  What's weird is that when I connect the power, the AC LED (the one with th

  • HT1386 Help iphone won't connect - "device timed out" error AGAIN & AGAIN

    I recently updated my phone to IOS 7.02 and now when I try to connect to itunes I get a "device timed out" error.  Thinking it must just be my itunes out of date, I updated it too.  Again and again the " device timed out" error still happens.  What a

  • Is it harmful to my 2011 MacBook Pro to turn it sideways?

    When I'm lying down in bed, I usually turn my MacBook Pro sideways so I can see the screen comfortably. Is this harmful to my Mac in any way? Thanks!

  • How To: Itunes 10 for xp 64 bit

    File Extraction 1. Download the latest itunes x64 from apple.com 2. Locate the downloaded file, right click 3. Select 7-zip from the menu, and "extract to iTunes64Setup\" as it will extract to a contained folder 4. Open the extracted folder. If you s

  • Movie clip needs to change alpha of another movie clip

    In frame 3 of my Flash animation, I make a graph animate using a mask. At the end of that animation I want a button in frame 3 whose alpha is set to 0 to become visible so it can be clicked. So, within the movie clip of the graph, on the last frame I