Joining of two internal tables...... urgent.

Dear all experts,
I am going to join two internal tables, one table contains some fields from mara
and another table contains some fields from makt.
i have to join these tables without using for all entries.
below is program mentioned... I am not getting exactly how to put the logic, to get fields into table itab_3.
<b>*------- defining internal tables.</b>
DATA: BEGIN OF <b>itab_1</b> OCCURS 0,
        matnr  TYPE mara-matnr,
      END OF itab_1.
DATA: BEGIN OF <b>itab_2</b> OCCURS 0,
        matnr  TYPE makt-matnr,
        maktx  TYPE makt-maktx,
        spras  TYPE makt-spras,
      END OF itab_2.
DATA: BEGIN OF <b>itab_3</b> OCCURS 0,
        matnr TYPE mara-matnr,
        spras TYPE makt-spras,
      END OF itab_3.
<b>*---taking data to first internal table.-</b>
SELECT matnr
             FROM mara
             INTO TABLE itab_1
             WHERE ernam = 'RUDISILL'.
<b>*--taking data to second internal table.--</b>
SELECT matnr maktx spras
       FROM makt
       INTO TABLE itab_2.
sort itab_1 by matnr.
sort itab_2 by matnr.
can anybody please tell, how to take fields of itab_2 to itab_3, where all matnr in itab_2  should be equal to all matnr in itab_1.
points will be surely assigned to your help.
waiting
Warm regards
Vinay.

hi,
kindly chk this sample.
check this.
data : begin of itab1 occurs 0. "itab with work area.
key_field1 like ztable1-key_field1,
field1 like ztable1-field1,
field2 like ztable1-field2,
endof itab1.
data : begin of itab2 occurs 0. "itab with work area.
key_field2 like ztable2-key_field2,
field3 like ztable2-field3,
field4 like ztable2-field4,
endof itab2.
data : begin of itab_final occurs 0.
key_field1 like ztable1-key_field1,
field1 like ztable1-field1,
field2 like ztable1-field2,
field3 like ztable2-field3,
field4 like ztable2-field4,
endof itab_final.
put the date final(merged) internal table
1. loop at itab1.
read table itab2 with key keyfield2 = itab1-keyfield1.
if sy-surc = 0.
itab_final-key_field1 = itab1-keyfield1
itab_final-field1 = itab1-field1.
itab_final-field2 = itab1-keyfield2.
itab_final-field3 = itab2-field2.
itab_final-field4 = itab2-keyfield2.
append itab_final.
clear itab_final.
endif.
endloop.
or
LOOP AT ITAB1.
MOVE-CORRESPONDING TO ITAB1 to ITAB_FINAL.
READ TABLE ITAB2 WITH KEY FILED1 = ITAB1-FIELD1.
if sy-subrc = 0.
MOVE-CORRESPONDING TO ITAB2 to ITAB_FINAL.
endif,
READ TABLE ITAB3 WITH KEY FILED1 = ITAB1-FIELD1.
if sy-subrc = 0.
MOVE-CORRESPONDING TO ITAB2 to ITAB_FINAL.
endif,
append itab_final.
clear itab_final.
endloop
Regards,
Anversha

Similar Messages

  • Joining Two Internal Tables - ( Urgent )

    Could anybody please give me the whole code for joining two internal tables
    and putting the data in a third internal table. Please, very urgent.
                                                                                    Regards,
                                                                                    SAURAV

    Hi,
      Refer this code
    *&      Form  SUB_READ_VBRK
          text
    FORM sub_read_vbrk.
      SELECT vbeln
             rplnr
             bukrs
             FROM vbrk
             INTO TABLE it_vbrk
             WHERE vbeln IN s_vbeln
             AND   rplnr NE ' '.
      IF sy-subrc EQ 0.
        SORT it_vbrk BY rplnr.
      ENDIF.
    ENDFORM.                    " SUB_READ_VBRK
    *&      Form  SUB_READ_FPLTC
          text
    FORM sub_read_fpltc.
      IF NOT it_vbrk[] IS INITIAL.
        SELECT fplnr
               fpltr
               ccnum
               FROM fpltc
               INTO TABLE it_fpltc
               FOR ALL ENTRIES IN it_vbrk
               WHERE fplnr EQ it_vbrk-rplnr
               AND   ccins EQ 'GIFC'.
        IF sy-subrc EQ 0.
          SORT it_fpltc BY fplnr.
        ENDIF.
      ENDIF.
    ENDFORM.                    " SUB_READ_FPLTC
    *&      Form  SUB_COLLECT_DATA
          text
    FORM sub_collect_data.
    *--Local variables
      DATA : lv_count(3) TYPE c.
      IF NOT it_fpltc[] IS INITIAL.
        LOOP AT it_fpltc INTO wa_fpltc.
          lv_count = wa_fpltc-fpltr+3(3).
          wa_final-ccnum = wa_fpltc-ccnum.
          wa_final-rfzei = lv_count.
          CLEAR : wa_vbrk.
          READ TABLE it_vbrk INTO wa_vbrk WITH KEY rplnr = wa_fpltc-fplnr
                                                   BINARY SEARCH.
          IF sy-subrc EQ 0.
            wa_final-vbeln = wa_vbrk-vbeln.
            wa_final-bukrs = wa_vbrk-bukrs.
          ENDIF.
          APPEND wa_final TO it_final.
          CLEAR : wa_vbrk,
                  wa_fpltc,
                  lv_count.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " SUB_COLLECT_DATA
    Regards,
    prashant

  • Join the two internal table

    Hi Guys,
    I have two internal tables with same structure, ITAB1 is having 100 records and ITAB2 is having 150 records, i need to club two internal tables into ITAB3.
    I hope, we can loop one internal table append record by record.
    Is any other way, can we club two internal tables.
    Thanks,
    Gourisankar.

    Hi,
    You can use INSERT LNES OF ITAB1 INTO ITAB3 and afterwards do the same with ITAB2.
    Regards, Gerd Rother

  • 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

  • How to join two internal table rows in alternative manner into one internal table?

    How to join two internal table rows in alternative manner into one internal table?
    two internal tables are suppose itab1 &  itab2 & its data
    Header 1
    Header 2
    Header 3
    a
    b
    c
    d
    e
    f
    g
    h
    i
    Header 1
    Header 2
    Header 3
    1
    2
    3
    4
    5
    6
    7
    8
    9
    INTO itab3 data
    Header 1
    Header 2
    Header 3
    a
    b
    c
    1
    2
    3
    d
    e
    f
    4
    5
    6
    g
    h
    i
    7
    8
    9

    Hi Soubhik,
    I have added two additional columns for each internal table.
    Table_Count - It represents the Internal Table Number(ITAB1 -> 1, ITAB2 -> 2)
    Row_Count  - It represents the Row Count Number, increase the row count value 1 by one..
    ITAB1:
    Header 1
    Header 2
    Header 3
    Table_Count
    Row_Count
    a
    b
    c
    1
    1
    d
    e
    f
    1
    2
    g
    h
    i
    1
    3
    ITAB2:
    Header 1
    Header 2
    Header 3
    Table_Count
    Row_Count
    1
    2
    3
    2
    1
    4
    5
    6
    2
    2
    7
    8
    9
    2
    3
    Create the Final Internal table as same as the ITAB1/ITAB2 structure.
    "Data Declarations
    DATA: IT_FINAL LIKE TABLE OF ITAB1.          "Final Internal Table
    FIELD-SYMBOLS: <FS_TAB1> TYPE TY_TAB1,     "TAB1
                                   <FS_TAB2> TYPE TY_TAB2.     "TAB2
    "Assign the values for the additional two column for ITAB1
    LOOP AT ITAB1 ASSIGNING <FS_TAB1>.
         <FS_TAB1>-TABLE_COUNT = 1.             "Table value same for all row
         <FS_TAB1>-ROW_COUNT = SY-TABIX. "Index value
    ENDLOOP.
    "Assign the values for the additional two column for ITAB2
    LOOP AT ITAB2 ASSIGNING <FS_TAB2>.    
         <FS_TAB2>-TABLE_COUNT = 2.                  "Table value same for all row
         <FS_TAB2>-ROW_COUNT = SY-TABIX.      "Index value
    ENDLOOP.
    "Copy the First Internal Table 'ITAB1' to Final Table
    IT_FINAL[] = ITAB1[].
    "Copy the Second Internal Table 'ITAB2' to Final Table
    APPEND IT
    LOOP AT ITAB2 INTO WA_TAB2.
    APPEND WA_TAB2 TO IT_FINAL.
    ENDLOOP.
    "Sort the Internal Table based on TABLE_COUNT & ROW_COUNT
    SORT IT_FINAL BY  ROW_COUNT TABLE_COUNT.
    After sorting, check the output for IT_FINAL Table, you can find the required output as shown above.
    Regards
    Rajkumar Narasimman

  • Join two internal tables

    hi all
        please give a query for joining of three internal tables and store into another table,and we should retrive data from that third table
    please take those fields as material number,plant,storage location,stock,units

    Hello Raja,
    SELECT EKKNEBELN EKKNEBELP EKKNKOSTL EKKNPS_PSP_PNR EKKN~SAKTO
          EKETWEMNG EKETETENR EKETBEDAT EKPOKNTTP EKPOLOEKZ EKPOMATNR
          EKPOWERKS EKPOMATKL  EKPOMENGE EKPOMEINS EKPONETPR EKPOPEINH
          EKPONETWR EKPOMTART EKPOEFFWR EKKOBUKRS EKKOBSART EKKOERNAM
          EKKOLIFNR EKKOEKORG EKKOEKGRP EKKOWAERS EKKO~BEDAT
          EKKO~MEMORY INTO TABLE G_T_OUTTAB
       FROM ( EKKN
               INNER JOIN EKET
               ON EKETEBELN = EKKNEBELN
               AND EKETEBELP = EKKNEBELP
               INNER JOIN EKPO
               ON EKPOEBELN = EKETEBELN
               AND EKPOEBELP = EKETEBELP
               INNER JOIN EKKO
               ON EKKOEBELN = EKPOEBELN )
             WHERE EKKN~EBELN IN S_EBELN
               AND EKKN~EBELP IN S_EBELP
               AND EKKN~KOSTL IN S_KOSTL
               AND EKKN~PS_PSP_PNR IN S_WBS
               AND EKKN~SAKTO IN S_SAKTO
               AND EKPO~KNTTP IN S_KNTTP
               AND EKPO~LOEKZ IN S_LOEKZ
               AND EKPO~MATKL IN S_MATKL
               AND EKPO~MATNR IN S_MATNR
               AND EKPO~WERKS IN S_WERKS
               AND EKKO~BEDAT IN S_BEDAT
               AND EKKO~BSART IN S_BSART
               AND EKKO~BUKRS IN S_BUKRS
               AND EKKO~EKGRP IN S_EKGRP
               AND EKKO~EKORG IN S_EKORG
               AND EKKO~ERNAM IN S_ERNAM
               AND EKKO~LIFNR IN S_LIFNR
               AND EKPO~MTART IN S_MTART
               AND EKKO~MEMORY IN S_MEMORY
               AND EKET~BEDAT IN S_DAT_ET.
    Try with this code.
    If useful reward.
    Vasanth

  • Reg  comparison of two  internal tables

    hi friends,
    please help me solving this.
    there are two internal tables t_zvs38 and t_value
    1.t_value like seahlpres
    2.t_zvs38 like zvs38.
    values in t_value will be like this.
    first line wil contain zmdtype(mandatory document) and second line will contain
    zmdtypet (the description for zmdtype).
    eg.
    D001 -
    -zmdtype
    internal----
    zmdtypet
    D002
    external
    D003
    renewal
    values in t_zvs38.
    for a particular sales.org the zmdtype is filled.
    select vkorg zmdtype into corrsponding fields of table t_zvs38
    where vkorg = p_vkorg.
    Now i want to compare t_value and t_zvs38 with field zmdtype
    and delete the contents of  t_value which are not in t_zvs38.
    i have written like this.
    loop at t_value.
    read table t_zvs38 with key zmdtype = t_value-string.
    if sy-subrc ne 0.
    delete t_value. "to delete zmdtype
    sy-tabix = sy-tabix + 1.
      delete t_value. " to delete zmdtypet
    else.
    sy-tabix = sy-tabix +2. "to go to next zmdtype.
    endif.
    endloop.
    but it is deleting all the contents of t_value.
    points are assured.

    CLEAR zvs32t.
      SELECT zvs32tzmdtype zvs32tzmdtypet
        INTO (zvs32t-zmdtype, zvs32t-zmdtypet)
        FROM zvs32t
        JOIN zvs32
        ON   zvs32tzmdtype = zvs32zmdtype
        WHERE zvs32t~spras    = sy-langu
        AND   zvs32~zfrenewal = space.
         WRITE zvs32t-zmdtype TO t_value.
        APPEND t_value.
        WRITE zvs32t-zmdtypet TO t_value.
        APPEND t_value.
      ENDSELECT.
      SELECT vkorg vkbur zmdtype FROM zvs38 INTO CORRESPONDING FIELDS OF TABLE t_zvs38
      WHERE vkorg = p_vkorg
    AND vkbur = p_vkbur.
      LOOP AT t_value INTO wa_area1.
        v_index = sy-tabix.
        READ TABLE t_zvs38 INTO wa_area2 WITH KEY zmdtype = wa_area1-string
      BINARY SEARCH.
       IF sy-subrc NE 0.
          IF l_flag IS INITIAL.
            DELETE t_value INDEX v_index.
           ELSE.
            CLEAR l_flag.
          ENDIF.
       ELSE.
          l_flag = 'X'.
       ENDIF.
      ENDLOOP.
    Using this code ,i am unable to ge the correct output.Thank u all for ur help.

  • Alv with two internal tables

    I have two separate internal tables. However , they have a common field matnr. In the report output, the two internal tables should be joined by this common field. Can this be done with an ALV . The common field Matnr should appear to the extreme left. Followed by itab1 and then itab2 . Its in a sense Matnr is the header , but it shows as rows. Each matnr has several item in both itab1 and itab2 , it is not necessary that total number of item data in itab1 and itab2 will be same .

    You can see example program :
    TYPE-POOLS: slis.
    DATA: BEGIN OF itab OCCURS 0,
            vbeln TYPE vbeln,
            expand,
          END OF itab.
    DATA: BEGIN OF itab1 OCCURS 0,
            vbeln TYPE vbeln,
            posnr TYPE posnr,
            matnr TYPE matnr,
            netpr TYPE netpr,
          END OF itab1.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname   = 'ITAB'.
    s_fieldcatalog-rollname  = 'VBELN'.
    s_fieldcatalog-outputlen = '12'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'VBELN'.
    s_fieldcatalog-outputlen = '12'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'POSNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'POSNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'MATNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'MATNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'NETPR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'NETPR'.
    s_fieldcatalog-do_sum    = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    DATA: s_layout TYPE slis_layout_alv.
    s_layout-subtotals_text            = 'SUBTOTAL TEXT'.
    s_layout-key_hotspot = 'X'.
    s_layout-expand_fieldname = 'EXPAND'.
    SELECT vbeln UP TO 100 ROWS
           FROM
           vbak
           INTO TABLE itab.
    IF NOT itab[] IS INITIAL.
      SELECT vbeln posnr matnr netpr
             FROM vbap
             INTO TABLE itab1
             FOR ALL ENTRIES IN itab
             WHERE vbeln = itab-vbeln.
    ENDIF.
    DATA: v_repid TYPE syrepid.
    v_repid = sy-repid.
    DATA: s_keyinfo TYPE slis_keyinfo_alv.
    s_keyinfo-header01 = 'VBELN'.
    s_keyinfo-item01   = 'VBELN'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
         EXPORTING
              i_callback_program = v_repid
              is_layout          = s_layout
              it_fieldcat        = t_fieldcatalog
              i_tabname_header   = 'ITAB'
              i_tabname_item     = 'ITAB1'
              is_keyinfo         = s_keyinfo
         TABLES
              t_outtab_header    = itab
              t_outtab_item      = itab1
         EXCEPTIONS
              program_error      = 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.
    Thanks
    Seshu

  • Appending two internal tables

    hello friends,
    I have two internal tables of different structure.
    i have filled those two internal tables using join statements.
    But one field is common in both the tables, when i try to append both tables into another new internal table.
    i cant get the value for the 2nd tables field.
    EX.
    vbeln is common in vbuk, vbup, vbap, vbak, likp, lips.
    but its sale order number in vbak, vbap.
    delivery document in likp,lips.
    vbup has both sales order and delivery in the vbeln field.
    so, i made a join to between vbak, vbup and lips to see the goods movement status in vbup.
    for that the vbeln should be delievery number.
    and in other table, i have added vbup and vbak and vbep to get the delievery status.
    for that the vbeln should be sale order no.
    when i append both the tables into the third internal table that has the structure of both internal tables.
    i could not get the vbeln of  the second table(sale order no) in the third table.
    help me guys.
    rewards for helpful solutions.

    hello,
    types:
    begin of str,
    vbeln like vbak-vbeln,
    vkorg like vbak-vkorg,
    vtweg like vbak-vtweg,
    end of str.
    types:
    begin of st1,
    lfstk like vbuk-vbeln,
    end of st1.
    types:
    begin of st2,
    vbeln like vbak-vbeln,
    vkorg like vbak-vkorg,
    vtweg like vbak-vtweg,
    lfstk like vbuk-lfstk,
    end of st2.
    selection-screen: s_order for vbak-vbeln,
                              s_div for vbak-vtweg.
    data: it type table of st with header line,
            it1 type table of st1 with header line,
            it2 type table of st2 with header line.
    select vbeln vkorg vtweg from vbak into table it
    where         vbeln in s_order and
                     vkorg in s_div.
    select lfstk from vbuk into table it1 for all entries in it
          where vbeln = it-vbeln.
    it2[] = it[].
    append it1-lfstk into it2[].
    or
    move-corresponding it1 to it2.
    " when i execute this code with a grid or list display, i m not able to get the values or entries for the 2nd table it1.
    the it2 has the lfstk cloumn blank in the final display.
    help me for  a remedy.
    rewards for useful suggestion.

  • Problem in Smartforms Printing two internal tables

    Dear ABAPers,
           I am working in SAP Smartforms.
    I am passing two internal tables in Main Window one after another.After Printing the Data in the first internal Table.It prints the data in the Second internal table.My requirement is it should print from the Next Page.
    It is very Urgent Requirement.Please help me to solve this problem.
    Thanks & Regards,
    Ashok.

    Hi,
    Create a new page in your form in one page put one internal table and in the second page put the other.
    ->in each page in the page attributes select the nextpage = same page name
    -> After the loop of the first internal table in first page
    ->create a command node and select the checkbox goto newpage and select the second page in the dropbox.
    Thanks,
    NN.

  • Using for all entries of two internal tables in where clause of the select

    Hi experts,
    My requirement is, need to select Marc-minbe and wrpl-sobst, for all the entries of the two internal tables it_mara , and it_t001w.
    here is the select queries i have used,
    select matnr normt from  mara into it_mara for all entries in it_data where normt = it_data-normt.
    select konnr werks from t001w into it_t001w for all entries in it_data where konnr = it_data-konnr.
    now i need to select minbe of marc table and sobse of wrpl table for all the entries of above internal tables, it_mara and it_t001w, using both matnr of it_mara and werks of it_t001w in where condition.
    Pls advise how i can do it.
    Thanks.
    Moderator message: very basic, please work on this yourself first, these forums are not a substitute for ABAP training.
    Edited by: Thomas Zloch on Dec 6, 2010 9:38 AM

    Hi
    call SE16 with table TFTIT in order to get a full list (it will be long...)
    A list of FMs with parameters can be found in table FUNCT.
    Finally go to sm37rsdf4
    that will give you all the function modules with description
    Here is the list:
    http://www.erpgenie.com/abap/functions.htm
    hope this helps...
    Regards
    CSM Reddy

  • Comparing each value of two internal tables

    HI  everybody,
    i have two internal tables  itab1 and itab2 same structure
    both r having four fields each and field with values
    now i need to compare the two internal tables
    and if every value of itab1 matches itab2
    then i have to write one select quirie  for the following given description
    compare past and current shipping point
    compare internal_table2 and internal_table3
    if entry in internal_table2 and internal table3 match
    variable_tknum = internal_table2-tknum
    endif.
    for each entry that matches:
    select vlabdata into zi_vlabdata from vlbl where vbeln = variable_tknum and vlbl-vlabtyp = 'ZIBOOKNO'.
    plz give me solution for this
    thanks
    hridhayanjili.

    sort : ITAB1 by f1,f2,f3,f4,
           ITAB2 by f1,f2,f3,f4.
    LOOP AT ITAB1.
      READ TABLE ITAB2 WITH KEY F1 = ITAB1-F1
                                F2 = ITAB1-F2
                                F3 = ITAB1-F3
                                F4 = ITAB1-F4 BINARY SEARCH.
      IF SY-SUBRC = 0.
    *--all the fields of ITAB1 and ITAB2 are matching .
    *--write your logic here
      ELSE.
    *--ITAB1 and ITAB2 records are not matching.
      ENDIF.
    ENDLOOP.
    Regards
    Srikanth
    Message was edited by: Srikanth Kidambi

  • Downloading two internal tables in same text file

    I have one internal table as like below.
    Data:begin of itab1 occurs 0,
         rec(5),
         end of itab1.
    Itab1 is getting updated from input text file(Continuous text).
    Here Itab1 contains one record with Indicator '01 and n number of records with indicator '02'.
    This needs to be seperated in to two internal tables.
    data:Begin of Itab_Head occurs 0,
         Rec_ind(2) type C,
         Name(3) type C,
         end of itab_Head.
    data:Begin of Itab_Item occurs 0,
         Rec_ind(2) type C,
         Id(3) type C,
         Status(10,
         end of itab_Item.
    loop at itab1.
    If itab1-Rec+0(2) = '01'.
       Itab_Head-Rec_Ind = itab1-rec+0(2).
       Itab_Head-Name = itab1-rec+2(3).
       Append Itab_Head.
    elseif itab1-rec+0(2) = '02'.
       Itab_Item-Rec_Ind = itab1-rec+0(2).
       Itab_Item-Id = itab1-rec+2(3).
       Append Itab_Item.
    endif.
    endloop.
    After moving to the internal tables I am doing some processing and updating the status of Itab_item.
    After all these again I have to download the internal table as a text file.Now my question is.
    I have values in 2 diff internal tables.How to download the two in same file.

    See this sample code.
    data: itab1 type string occurs 0 with header line,
          itab2 type string occurs 0 with header line.
    itab1 = 'itab1_text'.
    append itab1.
    itab2 = 'itab2_text'.
    append itab2.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        exporting
          FILENAME = 'C:\ftext.txt'
        APPEND = 'X'
        changing
         DATA_TAB = itab1[].
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        exporting
          FILENAME = 'C:\ftext.txt'
          APPEND = 'X'
        changing
         DATA_TAB = itab2[].
    Svetlin

  • Two internal tables in to one internal table

    Hi , 
               I have two internal tables ITAB1 and ITAB2, i would like to put fields from  two internal tables in to one internal table(ITAB3) with out using inner joint. any one of you can give the sample code for this
    Thanks
    Raja.

    Hi,
    Kamesh wrote :
          Read itab2 into wa_itab2 with key f2 = itab1-f1 <USe your where conditions here>.
    Read statement does not have WHERE conditions.
    Please be careful while posting. Your thread will be reffered by many people. Please dont mislead.
    Regards,
    Swapna.

  • Function module for comparing contents of two internal tables

    Hi All,
    Is there any function module to compare contents of two internal tables of same structure?
    If yes please let me know.
    Thanks in advance.
    Amol

    Hi
    call SE16 with table TFTIT in order to get a full list (it will be long...)
    A list of FMs with parameters can be found in table FUNCT.
    Finally go to sm37rsdf4
    that will give you all the function modules with description
    Here is the list:
    http://www.erpgenie.com/abap/functions.htm
    hope this helps...
    Regards
    CSM Reddy

Maybe you are looking for