Combine internal tables

Hi,
I  have 2 internal tables
   itab1 which has fields  A  B
and itab2    which has fields    Name   Text.
A          B
1           1   
Name    Text
A           field1
B           field2
I need the final table itab3 as
A     text_A     B  text_B

hi
loop at itab1
append itab3
g_var = g_var +1.
  read table itab2 with index g_var.
    modify itab 3
endloop.
dats it.....
shiva

Similar Messages

  • Combining internal tables

    Dear experts,
       i need to put the below 4 internal table values into i_final internal table,
    SELECT warpl wstra plnnr plnal
        FROM mpos INTO CORRESPONDING FIELDS OF TABLE i_mpos
        WHERE warpl IN p_warpl.
    SELECT warpl abnum zaehl nplda terma stadt lrmdt
           offze offzo abrud abrna
           INTO   CORRESPONDING FIELDS OF TABLE i_mhis
           FROM   mhis
           FOR    ALL ENTRIES IN i_mpos
           where  warpl = i_mpos-warpl.
      SELECT plnnr plnal plnkn paket zaehl datuv strat
             INTO   CORRESPONDING FIELDS OF TABLE i_plwp
             FROM   plwp
             FOR    ALL ENTRIES IN i_mpos
             WHERE  plnnr = i_mpos-plnnr AND
                    plnal = i_mpos-plnal.
      SELECT plnnr plnkn ltxa1 arbei
               INTO   CORRESPONDING FIELDS OF TABLE i_plpo
               FROM   plpo
               FOR    ALL ENTRIES IN i_plwp
               WHERE  plnnr = i_plwp-plnnr AND
                      plnkn = i_plwp-plnkn.
       could any one pls send coding for the above
    thanks in advance
    karthik

    I cannot check fully because i dont have records for this combination. you can try this with your records.
    I hope it will work.
    REPORT  Z_TESTYUVA                              .
    Tables : MPOS,
             MHIS,
             PLWP,
             PLPO.
    *data  p_warpl LIKE mpos-warpl.
    Parameter : p_warpl LIKE mpos-warpl.
    DATA : i_mpos LIKE mpos Occurs 0 With Header Line,
           i_mhis LIKE mhis Occurs 0 With Header Line,
           i_plwp LIKE plwp Occurs 0 With Header Line,
           i_plpo LIKE plpo Occurs 0 With Header Line.
    DATA : Begin of it_final Occurs 0 ,
    warpl LIKE MPOS-warpl,
    wstra LIKE MPOS-wstra,
    plnnr LIKE MPOS-plnnr,
    plnal LIKE MPOS-plnal,
    abnum LIKE MHIS-abnum,
    zaehl LIKE MHIS-zaehl,
    nplda LIKE MHIS-nplda,
    terma LIKE MHIS-terma,
    stadt LIKE MHIS-stadt,
    lrmdt LIKE MHIS-lrmdt,
    offze LIKE MHIS-offze,
    offzo LIKE MHIS-offzo,
    abrud LIKE MHIS-abrud,
    abrna LIKE MHIS-abrna,
    plnkn LIKE PLWP-plnkn,
    paket LIKE PLWP-paket,
    datuv LIKE PLWP-datuv,
    strat LIKE PLWP-strat,
    ltxa1 LIKE PLPO-ltxa1,
    arbei LIKE PLPO-arbei,
    END OF it_final.
    SELECT warpl wstra plnnr plnal
    FROM mpos INTO CORRESPONDING FIELDS OF TABLE i_mpos
    WHERE warpl = p_warpl.
    SELECT warpl abnum zaehl nplda terma stadt lrmdt
    offze offzo abrud abrna
    INTO CORRESPONDING FIELDS OF TABLE i_mhis
    FROM mhis
    FOR ALL ENTRIES IN i_mpos
    where warpl = i_mpos-warpl.
    SELECT plnnr plnal plnkn paket zaehl datuv strat
    INTO CORRESPONDING FIELDS OF TABLE i_plwp
    FROM plwp
    FOR ALL ENTRIES IN i_mpos
    WHERE plnnr = i_mpos-plnnr AND
    plnal = i_mpos-plnal.
    SELECT plnnr plnkn ltxa1 arbei
    INTO CORRESPONDING FIELDS OF TABLE i_plpo
    FROM plpo
    FOR ALL ENTRIES IN i_plwp
    WHERE plnnr = i_plwp-plnnr AND
    plnkn = i_plwp-plnkn.
    loop at i_mpos.
       move-corresponding  i_mpos to it_final.
      LOOP AT i_mhis WHERE warpl = i_mpos-warpl.
           move-corresponding i_mhis to it_final.
           APPEND it_final.
           CLEAR it_final.
           ENDLOOP.
      LOOP AT i_plwp WHERE plnnr = i_mpos-plnnr AND
           plnal = i_mpos-plnal.
           move-corresponding i_plwp to it_final.
           MODIFY it_final TRANSPORTING plnnr plnal plnkn paket zaehl datuv strat  "You can try giving all to transporting
            WHERE plnnr = i_mpos-plnnr AND
            plnal = i_mpos-plnal.
      LOOP AT i_plpo WHERE plnnr = i_plwp-plnnr AND
            plnkn = i_plwp-plnkn.
           move-corresponding i_plpo to it_final.
           MODIFY it_final TRANSPORTING plnnr plnkn ltxa1 arbei         "You can try giving all to transporting
            WHERE plnnr = i_plwp-plnnr AND
            plnal = i_plwp-plnal.
           ENDLOOP.
           ENDLOOP.
      ENDLOOP.
    BY
    Yuvaram.
    Reward if useful

  • Combine 2 internal tables into a single internal table

    Hi
    I need to replace the following join statement by splitting it into 2 select statements and then combine them into a single internal table
    SELECT  vbak~waerk
    vbapvbeln vbapposnr vbapnetwr vbapbrgew
    vbap~erdat                         "IM152805
    INTO CORRESPONDING FIELDS OF TABLE l_t_orders
    FROM vbak INNER JOIN vbap ON vbakvbeln = vbapvbeln
    FOR ALL entries IN t_mchb
    WHERE vbap~vbeln = t_mchb-vbeln
    AND vbap~posnr = t_mchb-posnr.
    Need to replace the above with separate select statements and then combine the result into a single internal table...
    could anyone please help me...
    thanks in advance

    Hi,
    Check the code below,
    select vbeln waerk
    from vbak into table it_vbak for all entries in t_mchb  where vbeln = t_mchb-vbeln.
    select posnr
         netwr
         brgew
         erdat "IM152805
    INTO TABLE it_vbap
    for all entries in t_mchb
    where vbeln = t_mchb-vbeln
    and posnr = t_mchb-posnr.
    loop at it_vbap into wa_vbap.
    read table it_vbak into wa_vbak where vbeln = wa_vbap-vbeln.
    if sy-subrc = 0.
    l_t_orders-waerk = wa_vbak-waerk.
    l_t_orders-vbeln = wa_vbap-vbeln.
    l_t_orders-posnr = wa_vbap-posnr
    l_t_orders-netwr   = wa_vbap-netwr.
    l_t_orders-brgew   = wa_vbap-brgew.
    l_t_orders-erdat   = wa_vbap-erdat.
    append l_t_orders.
    endif.
    endloop.
    Reward if it is helpful.
    Regards,
    Bhanu

  • Combining Two Internal Tables??

    How do you combine two internal tables(not by append statement)...if any one knws please let me know..thanks in advance..

    Sort itab_vbap by vbeln posnr.
    sort itab_vbkd by vbeln posnr.
    Loop at itab_vbap into wa_vbap.
    read table itab_vbkd into wa_vbkd with key vbeln = wa_vbap-vbeln posnr = wa_vbap-posnr binary search.
    if sy-subrc = 0.
    move corresponding wa_vbap to wa_final.
    move corresponding wa_vbkd to wa_final.
    append wa_final to itab_final.
    endif.
    endloop.
    For move corresponding statement the name of the fields should match in both the work areas.
    I hope it helps.

  • Combination of three internal tables

    Hi there,
    Is it possible to join three internal tables into one final table?

    Hi,
      No its not possible.
    u have to loop . & based on the key u have to make one internal table  by combining the data of each line item .
    into one workarea.
    create a structure which include all the structure of the 3 tables and make a table of it.
    read 3 tables and append in the the final table
    sort the tables and use binary search to improve the performance.
    eg.
    type : begin of table4.
             include table1.      " table structure
             include table2.
             include table3.
           end of table4.
    data : table4_tab type table of table4,
           wa_tab4    type table4.
    sort : table2 by abc,
            table3 by xyz.
      loop at table1.
          read table table2 with key abc = table1-abc
          binary search.
          if sy-subrc =0.
            wa_tab4-table2 = table2.
          endif.
          read table table3 with key abc = table1-abc
          binary search.
          if sy-subrc =0.
            wa_tab4-table3 = table3.
          endif.
            wa_tab4-table1 = table1.
         append wa_tab4 into table4_tab.
         claer wa_tab4.
    endloop.
    Use this to optimise code & performance
    Reagrds
    Manoj B Gupta
    Message was edited by: Manoj Gupta

  • Combining two internal table

    Hi,
    Can any one tell how to combine two internal tables??

    hi,
    data it_tab  like table of wa_struct.
    data it_tab2 like table of wa_struct.
    it_tab-field1 = "a".
    append it_tab.
    it_tab2-field2 = "b".
    append it_tab2.
    move-correponding   it_tab to it_tab2.
    or
    data it_tab3 like table of wa_struct.
    loop at it_tab.
    it_tab3-field = it_tab -field.
    append it_tab3.
    endloop.
    loop at it_tab2.
    it_tab3-field = it_tab2-field.
    append it_tab3.
    endloop.
    regards,
    Siva
    REGARDS,
    Siva.

  • How to combine 2 internal tables ?

    how to combine 2 internal tables ? which statement is used to combine int tables ?

    Instead of using the normal loop-endloop approach for this kind of programming, use the variation of the append command. Care should be taken that the definition of both the internal tables should be identical.
    Not Recommended
                Loop at int_fligh1.
                 Append int_fligh1 to int_fligh2.
                Endloop.
    Recommended
                Append lines of int_fligh1 to int_fligh2.
    reward if helpful

  • Can't we pass custom defined internal table in SMARTFORM Interface

    Hi,
         I have a scenario, that my internal table from the program is is not dictionary type, but combination of some fields. Can't I directly pass this table to my smartform.
    Thank U 4 Ur time.
    Cheers,
    Sam

    hi,
    We can not pass the Internal tables to a Smartforms, you need to create the Structure and give the Structure in the Smartform, and declare the the internal table of that structure type and pass it
    Regards
    Sudheer

  • Search for a (sub)workarea in an internal table

    Hi all gurus,
    quite a simple question: I have an internal table made up of 100+ fields, and a workarea of the same type which is filled with some data.
    I'd like to know what's the best, effective way to search if there's a line in the internal table which is equal to the above cited workarea.
    I could compare specific fields:
    READ TABLE itab WITH KEY f1 = workarea-f1 f2 = workare-f2 ....
    IF sy-subrc = 0.
      OK.
    ELSE.
      KO
    ENDIF
    and so on. But it's quite terrible to write such a statement when there are a lot of fields!
    A refinement of the above request; I'd like to perform the above explained search EXCLUDING some specific fields from the comparizon, e.g. ,comparing fields from f3 to f98, ignoring f1, f2 and f99....
    Is there a simple way to obtain the desiderata? Please provide example as in documentation I've read about a COMPARING ALL FIELDS clause, but didn't understand how to use it w.r.t. the READ TABLE statement.
    Thanks!

    Hi,
    In my opinion, practically I don't see such a table that needs to combine hundreds of fields to be key fields.
    However, to meet your requirement, I guess there are several ways. But I just can think of one way that sounds a little bit workaround.
    Here is the pseudo code:
    data: itab_1 with fields from f1 to f99,
             itab_2 with fields from f3 to f98,
            wa_1 like line of itab_1,
            wa_2 like line of itab_2.   
    *there some time you fill data for your itab_1
    now assume itab_1 has been filled with data.
    now fill content for itab_2, which contain fields from f3 to f98 of itab_1
    loop at itab_1 into wa_1.
      move-corresponding fields of wa_1 to wa_2.
    append wa_2 to itab_2.
    endloop.
    clear wa_2.
    clear work area 2.
    suppose you have the work area you want to compare its content with the itab
    copy it to wa_2
    now wa_2 has value.
    *now use Read command to compare the needed data
    Read table itab_2 into wa_2 comparing all fields.
    if sy-subrc = 0.
      ok
    else.
    not ok.
    endif.
    The option Comparing all fields in Read command will compare content of all fields of the work are with all fields in itab.
    This is the output that you need.
    Regards,
    paul
    Edited by: paul the octopus on Dec 15, 2011 6:18 PM

  • Count No of records in an internal table using 4 fields

    Hi All,
    I have an internal table with about 50,000 records. I need to group these (sort) based on 4 fields and then provide the count for each combination of the 4 fields.
    For eg, if I have 3 records in the table which have the same values for all the 4 fields - say A,B,C,D, then the count is to be taken as 3 for that combination.
    So my output will be
    A B C D - COUNT -4 and so on.
    I am looking for a efficient technique (good performance) to meet the above requirements given without too many loops. Please advise if you have a good method.
    Thanks as always!
    Liz

    You can use SORT and DELETE ADJACENT DUPLICATES FROM.
    SORT itab by field1 field2 field3 field4.
    DELETE ADJACENT DUPLICATES FROM itab COMPARING field1 field2 field3 field4.
    you will be left with the unique combinations of the 4 fields.
    LINES( itab ) will give you the number of records.
    Thanks,
    Sai Ramesh.

  • How do I select a range of rows from an internal table in the debugger?

    Hi,
    I have a case where I wanted to delete a range of rows (several thousand) from an internal table using the debugger.
    It seems that rows can only be selected one at a time by selecting (clicking) on the far left side of the row.
    This is cumbersome, if not impossible when wishing to delete several thousand rows. 
    Other tools, such as Excel for example, allow for selecting a range of rows by selecting the first row and then holding the SHIFT key and selecting the last row and all rows in between will be selected.
    I can't seem to find the combination of keys that will allow this in the table (or structure) tab of the debugger.
    Is it possible to select a range of rows without having to select each row one at a time?
    Thanks for your help,
    Andy

    While it's a Table Control and should/could have a button to select all fields (or visible fields)...I don't think we can do it right now...I know it's a pain to select each row one at a time...but I don't we have any more options...
    Greetings,
    Blag.

  • In ALV reports how can we capture separate data in 3 internal table

    HI
       In ALV reports how can we capture data in 3 Internal tables and combine them in another internal table to display........

    Hello Sudhanshu
    Another option would be to display all three itabs together which is a piece of cake using OO-based ALV lists. Please refer to thread
    Re: Alv
    for a sample report.
    Regards
      Uwe

  • Replace single values in a internal table

    Hi all,
    I have two internal tables.
    In the first table (itab) I have some values which I have to "decode" using the second table (itabtext).
    This means that I have to pick every line and replace in the itab a value like "01" with "text for 01" from itabtext.
    In the itabtext "01" is the key for  "text for 01".
    What is the best way to handle this?
    Thanks a lot,
    Fabian

    Thanks for your answer but I still have the problem. The tables (two texttables instead of one what I wrote in the first message) are the following:
    DATA: BEGIN OF lt_proclocktexts OCCURS 0.
    DATA: lockprocid(2) TYPE c,
          text(40) TYPE c.
    DATA: END OF lt_proclocktexts.
    DATA: BEGIN OF lt_lockreastexts OCCURS 0.
    DATA: lockprocid(2) TYPE c,
          lockreason(2) TYPE c,
          text(40) TYPE c.
    DATA: END OF lt_lockreastexts.
    The table where I want to replace fields are the following:
    DATA: BEGIN OF lt_proclocks OCCURS 0.
    DATA: mandt type MANDT,
          lockreason(40) TYPE c,
          lockprocid(40) TYPE c,
          GPART type GPART_KK,
          LOOBJ type LOOBJ_KK.
    DATA: END OF lt_proclocks.
    When lt_proclocks-lockprocid similar to a lt_proclocktexts-lockprocid the lt_proclocks-lockprocid should be replaced by the lt_proclocktexts-text.
    When lt_proclocks-lockreason AND lt_proclocks-lockprocid is similar to a combination in the lt_lockreastexts the ID in field lt_proclocks-lockreason should be also replaced (additionally to the lt_proclocks-lockprocid field).
    Thanks,
    Fabian

  • Data fetching problem in internal table

    Hi All,
    I have two internal table which are of type as shown below.
    itab1 is of following type:
    regno(255) type c,
    uid type c
    itab2 is of following type
    regno type regno,
    uid type userid,
    address type add,
    phno type phn.
    Datas in itab2 are as follows:
    100       01       india              3454534
    200       01       china             34553543
    300       02       us                  6464654
    400       02       uk                   45654
    Itab1 is populated using the uid field as key as shown below.
    regno                          uid
    100 200                           01
    300 400                           02
    100 200 are values in field regno
    01  is uid.
    What we have done is collected all the regno which belong to the same uid for sending a single mail to the uid person with both the regno. We are able to achieve this. For this finally we loop into itab1 and fetch the uid and send mail to him.
    Now an extra requirement is to send the details of a regno (address and phno) along with the mail. The prob is in our final internal table we have a character field which will have all the regno for a uid (may be upto 20). Each regno will be of length 3.
    I have to loop into tab1 and read tab2 to achieve this using uid as key. But regno will for a uid will be combined. I have fetch each regno say 100 first and get the details and then 200 and then get the details and send a mail to uid 01. Then 300 and 400 details and then a mail to uid 02.
    Please explain how to get individual regno when i loop into tab1 and read tab2 so that i can fetch the details.
    Any suggestion will be very helpful

    Hi Aslam,
    As per my understanding...
    In itab1, instead of maintaining all the reg no in the same field(like 100 200 300 ....) againist uid 01
    maintain multiple records like
    regno  udi
    100      01
    200      01
    300      01 etc
    (in this case the combination of regno & uid becomes the key.)
    now while ur sending mail to the people, just loop the recors of itab1
    in the same loop u can just write a read statement to get the remainig details(address, phone no etc..) of that regno from itab2.
    Hope this helps you, revert back if still u hav any problm.

  • Maximum record limit for internal table

    hello all,
    can any one tell me what is the maximum limit of internal table. i would like to add all records from bseg to internal table. so i can improve processing time.
    thanks,
    raj

    hi,
    Before Release 4.0A, ABAP stored the content of internal tables in a combination of main memory and file space. This means that the maximum size of all internal tables of all programs running on such an application server at one time is about 2 GB. With Release 4.0A or greater, this size decreases to about 500 MB. (Note that those values aren't fixed, but this is a good guide. This minimum of 500 MB is the lowest limit of the real value, which varies among different operating systems and even among different releases of the same operating system.)
    It may sound strange that a newer release has a higher restriction on capacity. But it's a consequence of the fact that the contents of internal tables move from a reserved file to shared memory. When you process internal tables this way in Release 4.0A or greater, you pay for much better performance with a smaller potential size.
    Regards,
    Sourabh

Maybe you are looking for

  • Nomad Jukebox Zen Xtra - Fro

    Please help me save my Zen Xrtra! I previously updated the firmware on my Zen Xtra to version 2.0.03 so that it would be recognized by my new computer which is running Vista. All went well and I was able to sync the Zen Xtra with all my music without

  • Java Mapping: payload as mail attachment and dynamic file name .

    Hi, I have written this piece of java code. The code includes XPATH for fetching dynamic filename and the copysource( in, out ) to copy the content of payload as mail attchment. The code seems to work fine, when either of the functionality is impleme

  • Please help me install EZDrummer

    I once installed Ez drummerVSTi on my I-mac. Since i did not need it, i uninstalled it using the uninstaller. After i found that i could use it with GB, i am trying to install EZD. It says installation complete but in ..Library/Audio/Plug-ins/Compone

  • Refresh characteristic texts in query result without logoff in Bex 7.0

    Dear Experts, I'm using a query in BEx 7.0 and switched off all caching parameters in RSRT. For instantly reloading values from Cube/DSO this is working fine. Some of my characteristics are shown as key + text in query result. Unfortulately these tex

  • ERROR_INTERNET_SECURITY_CHANNEL_ERROR

    Hi, We are receiving the error mentioned while clicking on the collaboration link in the bidding process in SRM. We get page cannot be displayed when we click on the link.