Joining of to internal tables

Hi,
I am having to internal tables it_itab and it_jtab of diffrent structure in my program.
my requirement is to add all the fields it_jtab into it_itab and write the write the write statement  so that I can see all the fields.
How is this possible.

Hi,
Just copy the below code and execute.
REPORT zstemp_qty2_  LINE-SIZE 255 .
DATA:it_vbak LIKE vbak OCCURS 0 WITH HEADER LINE.
DATA:it_vbap LIKE vbap OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF it_sales  OCCURS 0 ,
         vbeln LIKE vbak-vbeln,
         kunnr LIKE vbak-kunnr,
         posnr LIKE vbap-posnr,
         matnr LIKE vbap-matnr,
       END OF it_sales.
START-OF-SELECTION.
  SELECT * FROM vbak INTO TABLE it_vbak UP TO 50 ROWS.
  IF NOT it_vbak[] IS INITIAL.
    SELECT * FROM vbap INTO TABLE it_vbap
    FOR ALL ENTRIES IN it_vbak
    WHERE vbeln = it_vbak-vbeln.
  ENDIF.
  LOOP AT it_vbak.
    READ TABLE it_vbap WITH KEY vbeln = it_vbak-vbeln.
    IF sy-subrc = 0.
      it_sales-vbeln = it_vbak-vbeln.
      it_sales-posnr = it_vbap-posnr.
      it_sales-kunnr = it_vbak-kunnr.
      it_sales-matnr = it_vbap-matnr.
      APPEND it_sales.
      CLEAR it_sales.
    ENDIF.
  ENDLOOP.
If you want to write in it_vbak table only means it_vba we shoud have fields that correspond to another table
REPORT zstemp_qty2_  LINE-SIZE 255 .
DATA:it_vbak LIKE vbak OCCURS 0 WITH HEADER LINE.
*DATA:it_vbap LIKE vbap OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF it_sales  OCCURS 0 ,
         vbeln LIKE vbak-vbeln,
         kunnr LIKE vbak-kunnr,
         posnr LIKE vbap-posnr,
         matnr LIKE vbap-matnr,
         matkl like vbap-matkl,
         arktx like vbap-arktx,
         erdat like vbak-erdat,
       END OF it_sales.
START-OF-SELECTION.
  SELECT * FROM vbak INTO TABLE it_vbak UP TO 50 ROWS.
  IF NOT it_vbak[] IS INITIAL.
    SELECT * FROM vbap INTO corresponding fields of TABLE it_sales
    FOR ALL ENTRIES IN it_vbak
    WHERE vbeln = it_vbak-vbeln.
  ENDIF.
loop at it_sales.
  read table it_vbak with key vbeln = it_sales-vbeln.
  if sy-subrc = 0.
  it_sales-kunnr = it_vbak-kunnr.
  it_sales-erdat = it_vbak-erdat.
  modify it_sales transporting kunnr erdat.
  clear it_sales.
  endif.
  endloop.
  LOOP AT it_sales.
    WRITE:/ it_sales-vbeln,it_sales-posnr,it_sales-kunnr,
            it_sales-matnr,it_sales-matkl,it_sales-arktx,it_sales-erdat.
  ENDLOOP.
Regds
Sivaparvathi
Please dont forget to reward points if helpful......

Similar Messages

  • 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

  • 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

  • Inner join inside a internal table loop

    Hello to all,
    I have this internal table in which i have selected some records for particular coulms. For  the rest of the colums i need to join 3 tables for the data. I had in mind, of looping the internal table and then having a inner join query and  modifying the internal table(all inside the loop) Just wanted to know, whether its a qood practice performance wise ? IF not, what are the alternatives ..
    Thanks,
    Shehryar Dahar

    shehryar,
      say You have internal table ITAB.Already some columns are updated in internal table.say A,B,C,D.
    To fill rest of the columns(E,F,G) you need inter join.
    write the inner join of the table for all entries of itab where A eq itab-A.
    LOOP ITAB.
        READ TABLE ITAB1  WITH KEY X = ITAB-X.
       IF SY-SUBRC EQ 0.
         move  ITAB record to I_FINAL.
         move itab1 records to i_final.
        append i_final.
       clear i_final.
      ENDIF. 
    ENDLOOP.
    Don't forget to reward if useful...

  • Reg : Joining the all internal table records into a single internal table

    Hi all
    I am having 5 internal tables and i want to put all these entries in a single intrnal table and my requirement is for each and every record it has to go through all the internal tables and if an entry is missing meand.it has to go through the other internal tables and for missing entries i should leave it as blank and rest of the contents i have to display can any please gimme some logic how to do this??
    Thanks in advance

    Don't have time or will to deliver turnkey solutions, but here is a frame:
    LOOP AT itab1...
      READ TABLE itab2 WITH TABLE KEY... (fields linking itab1 and itab2)
      READ TABLE itab3 WITH TABLE KEY... (fields linking itab1 and itab3)
      LOOP AT itab4 WHERE... (fields linking itab1 and itab4)
        READ TABLE itab5 WITH TABLE KEY... (fields linking itab4 and itab5)
        MOVE-CORRESPONDING... (all five work areas to target work area)
        APPEND itabtarget...
      ENDLOOP.
    ENDLOOP.
    so use READ when there is a 1:1 relationship (e.g. check table entry), and LOOP when there is a 1:N relationship (e.g. items for a header)
    Thomas

  • 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

  • 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

  • Newbie: Joining internal tables

    I would like to join two internal tables, but it looks like I cannot run INNER JOIN / LEFT OUTER JOIN statements on internal tables. Is there an efficient way of achieving the same result or would I be better off creating physical tables and join them that way.
    The tables have roughly 10000 records and about 15 colums each which I think would be better dealt with in memory rather that going back to the database. Any thoughts?
    Here is the code:
    DATA: BEGIN OF WA_USREPORT,
            WA_US_GLOBN TYPE ZCA_PRODUCT-GLOBN,
            WA_US_GLOBT TYPE ZCA_PRODUCT-GLOBT,
            WA_US_DESCR TYPE ZCA_PRODUCT-DESCR,
            WA_US_INTOR TYPE ZCA_PRODUCT-INTOR,
            WA_US_ACT TYPE ZCA_PRODUCT-ACT,
            WA_US_TUOME TYPE ZCA_PRODUCT-TUOME,
            WA_US_USITM TYPE ZCA_USITM-USITM,
            WA_US_USEUMAT TYPE ZCA_USITM-USEUMAT,
            WA_US_GPSUOMC TYPE ZCA_USITM-GPSUOMC,
            WA_US_GPSDENOM TYPE ZCA_USITM-GPSDENOM,
            WA_US_GPSNUMER TYPE ZCA_USITM-GPSNUMER,
            WA_US_USPLANT TYPE ZCA_USITM-USPLANT,
            WA_US_USITMDESC TYPE /BIC/TUSITM-TXTMD,
            WA_US_USDIVSN TYPE /BIC/PUSITM-/BIC/USDIVSN,
            WA_US_USERL TYPE /BIC/PUSITM-/BIC/US_ERL,
            WA_US_USSTKTYP TYPE /BIC/PUSITMSTR-/BIC/USSTKTYP,
            WA_US_USSUPNO TYPE /BIC/PUSITMSTR-/BIC/USSUPNO,
          END OF WA_USREPORT,
          TBL_USREPORT LIKE TABLE OF WA_USREPORT WITH HEADER LINE.
    DATA: BEGIN OF WA_EUREPORT,
            WA_EU_GLOBN TYPE ZCA_PRODUCT-GLOBN,
            WA_EU_GLOBT TYPE ZCA_PRODUCT-GLOBT,
            WA_EU_EUMAT TYPE ZCA_EUMAT-EUMAT,
            WA_EU_USITM TYPE ZCA_EUMAT-USITM,
            WA_EU_GPSUOMC TYPE ZCA_EUMAT-GPSUOMC,
            WA_EU_GPSDENOM TYPE ZCA_EUMAT-GPSDENOM,
            WA_EU_GPSNUMER TYPE ZCA_EUMAT-GPSNUMER,
            WA_EU_EUMATTXT TYPE /BI0/TMATERIAL-TXTMD,
            WA_EU_PRODH1 TYPE /BI0/PMATERIAL-PRODH1,
            WA_EU_PRODH2 TYPE /BI0/PMATERIAL-PRODH2,
            WA_EU_MSTAE TYPE /BI0/PMATERIAL-/BIC/MSTAE,
            WA_EU_VENDOR TYPE /BI0/PMATERIAL-VENDOR,
          END OF WA_EUREPORT,
          TBL_EUREPORT LIKE TABLE OF WA_EUREPORT WITH HEADER LINE.
    DATA: BEGIN OF WA_REPORT,
    from ZCA_Product, ZCA_USITM, USITM and USITMSTR
            WA_US_GLOBN TYPE ZCA_PRODUCT-GLOBN,
            WA_US_GLOBT TYPE ZCA_PRODUCT-GLOBT,
            WA_US_DESCR TYPE ZCA_PRODUCT-DESCR,
            WA_US_INTOR TYPE ZCA_PRODUCT-INTOR,
            WA_US_ACT TYPE ZCA_PRODUCT-ACT,
            WA_US_TUOME TYPE ZCA_PRODUCT-TUOME,
            WA_US_USITM TYPE ZCA_USITM-USITM,
            WA_US_USEUMAT TYPE ZCA_USITM-USEUMAT,
            WA_US_GPSUOMC TYPE ZCA_USITM-GPSUOMC,
            WA_US_GPSDENOM TYPE ZCA_USITM-GPSDENOM,
            WA_US_GPSNUMER TYPE ZCA_USITM-GPSNUMER,
            WA_US_USPLANT TYPE ZCA_USITM-USPLANT,
            WA_US_USITMDESC TYPE /BIC/TUSITM-TXTMD,
            WA_US_USDIVSN TYPE /BIC/PUSITM-/BIC/USDIVSN,
            WA_US_USERL TYPE /BIC/PUSITM-/BIC/US_ERL,
            WA_US_USSTKTYP TYPE /BIC/PUSITMSTR-/BIC/USSTKTYP,
            WA_US_USSUPNO TYPE /BIC/PUSITMSTR-/BIC/USSUPNO,
    from ZCA_Product, ZCA_EUMAT and 0Material
            WA_EU_EUMAT TYPE ZCA_EUMAT-EUMAT,
            WA_EU_USITM TYPE ZCA_EUMAT-USITM,
            WA_EU_GPSUOMC TYPE ZCA_EUMAT-GPSUOMC,
            WA_EU_GPSDENOM TYPE ZCA_EUMAT-GPSDENOM,
            WA_EU_GPSNUMER TYPE ZCA_EUMAT-GPSNUMER,
            WA_EU_EUMATTXT TYPE /BI0/TMATERIAL-TXTMD,
            WA_EU_PRODH1 TYPE /BI0/PMATERIAL-PRODH1,
            WA_EU_PRODH2 TYPE /BI0/PMATERIAL-PRODH2,
            WA_EU_MSTAE TYPE /BI0/PMATERIAL-/BIC/MSTAE,
            WA_EU_VENDOR TYPE /BI0/PMATERIAL-VENDOR,
          END OF WA_REPORT,
          TBL_REPORT LIKE TABLE OF WA_REPORT WITH HEADER LINE.
    SQL Queries                                                         *
    SELECT
      PGLOBN PGLOBT PDESCR PINTOR PACT PTUOME
      UUSITM UUSEUMAT UGPSUOMC UGPSDENOM UGPSNUMER UUSPLANT
      ITMT~TXTMD
      ITMA/BIC/USDIVSN ITMA/BIC/US_ERL
      ITMSTR/BIC/USSTKTYP ITMSTR/BIC/USSUPNO
      FROM ZCA_PRODUCT AS P
        INNER JOIN ZCA_USITM AS U ON PGLOBN = USYNPROD
          INNER JOIN /BIC/TUSITM AS ITMT ON UUSITM = ITMT/BIC/USITM
            INNER JOIN /BIC/PUSITM AS ITMA ON UUSITM = ITMA/BIC/USITM
              LEFT OUTER JOIN /BIC/PUSITMSTR AS ITMSTR ON UUSITM = ITMSTR/BIC/USITMSTR AND ITMSTR/BIC/USBRPLANT = UUSPLANT
      INTO TABLE TBL_USREPORT
      WHERE ITMA~OBJVERS = 'A'
      ORDER BY PGLOBT UUSITM.
    SELECT
      PGLOBN PGLOBT
      EEUMAT EUSITM EGPSUOMC EGPSDENOM E~GPSNUMER
      T~TXTMD
      MPRODH1 MPRODH2 M/BIC/MSTAE MVENDOR
      FROM ZCA_PRODUCT AS P
        INNER JOIN ZCA_EUMAT AS E ON PGLOBN = ESYNPROD
          INNER JOIN /BI0/TMATERIAL AS T ON EEUMAT = TMATERIAL
            INNER JOIN /BI0/PMATERIAL AS M ON EEUMAT = MMATERIAL
      INTO TABLE TBL_EUREPORT
      WHERE M~OBJVERS = 'A'
      ORDER BY PGLOBT EEUMAT.
    TODO: join TBL_USREPORT and TBL_EUREPORT into TBL_REPORT and output as a list
    Thank you for your help,
    Dennis

    Hi,
    Martin :-->I missed the binary search , thanks for pointing out.
    loop at tbl_usreport.
      move-corresponding tbl_usreport to tbl_report.
      append tbl_report.
    endloop.
    sort tbl_report by globn globt.
    loop at tbl_eureport.
      read table tbl_report with key globn = tbl_eureport
                                     globt = tbl_eureport
                                     binary search.
      if sy-subrc eq 0.
       move-corresponding tbl_eureport to tbl_report.
       modify tbl_report index sy-tabix.
      else.
       move-corresponding tbl_eureport to tbl_report.
       append tbl_report.
      endif.
    endloop.
    aRs

  • Join 2 internal tables

    Hello,
    i have to join the whole content of a table with the content of a aggregated table. i "moved" the content of the 2 dictionary tables into 2 internal tables and i want to join these 2 internal tables now.
    first of all, is it generally possible to join 2 internal tables, for example with a read or loop statement?!
    at second, i know how i would solve the problem in oracle 10g, but it looks like that open-sql supports not the same features like orcale. knows anyone of you how i can rebuild the following oracle statement in abap.
    select a.id, a.col1, b.col2
    from table_a as a, (select id, sum(col2) as col2 from table_c group by id) as b where a.id = b.id order by 1
    thx

    Hello Markus
    ABAP open sql ahould be something like
    select aid acol1 sum( b~col2 )
    from table_a as a
    join table_c as b
      on aid = bid
      group by b~id
    not sure abour the order by; don't know oracle syntax exactly.
    Try!
    Regards,
    Clemens

  • How to join several internal tables?

    Hi,
    I have several internal tables. And there is a very complex LOOP to extract data from these internal tables and many other logic inside it. The LOOP is very time-consuming.
    I am thinking to join these internal tables into one big internal table, to save some logic inside the complex LOOP. But as I know there is no "join" function for internal tables.
    So is there any workaround method to perform a "join" operation on internal tables?
    Thanks a lot!

    Hi,
    I have several internal tables. And there is a very complex LOOP to extract data from these internal tables and many other logic inside it. The LOOP is very time-consuming.
    I am thinking to join these internal tables into one big internal table, to save some logic inside the complex LOOP. But as I know there is no "join" function for internal tables.
    So is there any workaround method to perform a "join" operation on internal tables?
    Thanks a lot!

  • How to join  fields from different internal tables and display into one int

    hai i have one doubt...
    how to join  fields from different internal tables and display into one internal table..
    if anybody know the ans for this qus tell me......

    hii
    you can read data as per condition and then can join in one internal table using READ and APPEND statement..refer to following code.
    SELECT bwkey                         " Valuation Area
             bukrs                         " Company Code
        FROM t001k
        INTO TABLE i_t001k
       WHERE bukrs IN s_bukrs.
      IF sy-subrc EQ 0.
        SELECT bwkey                       " Valuation Area
               werks                       " Plant
          FROM t001w
          INTO TABLE i_t001w
           FOR ALL ENTRIES IN i_t001k
         WHERE bwkey = i_t001k-bwkey
           AND werks IN s_werks.
        IF sy-subrc EQ 0.
          LOOP AT i_output INTO wa_output.
            READ TABLE i_t001w INTO wa_t001w WITH KEY werks = wa_output-werks.
            READ TABLE i_t001k INTO wa_t001k WITH KEY bwkey = wa_t001w-bwkey.
            wa_output-bukrs = wa_t001k-bukrs.
            MODIFY i_output FROM wa_output.
            CLEAR wa_output.
          ENDLOOP.                         " LOOP AT i_output
        ENDIF.                             " IF sy-subrc EQ 0
    regards
    twinkal

  • Left ouer join with internal table

    Good morning to everybody
    I need created a internal table with 2 internal table but 1 is primary.
    I tried use "left outer join" but it allows  only with table and not with internal tabel
    I would to be this result
    a             a xxx
    b                         
    c             c zzz
    d             d sss
    e
    f              f ttt
    How can i do it?
    Thanks a lot for your support
    Beste regatrds

    Hi,
    The following code is for your reference:
    data: begin of wa1,
          key type c,
          end of wa1.
    data: begin of wa2,
          key type c,
          var(3) type c,
          end of wa2.
    data: begin of wa3,
          key1 type c,
          key2 type c,
          var(3) type c,
          end of wa3.
    data: itab1 like standard table of wa1,
          itab2 like standard table of wa2,
          itab3 like standard table of wa3.
    wa1-key = 'a'.
    append wa1 to itab1.
    wa1-key = 'b'.
    append wa1 to itab1.
    wa1-key = 'c'.
    append wa1 to itab1.
    wa1-key = 'd'.
    append wa1 to itab1.
    wa1-key = 'e'.
    append wa1 to itab1.
    wa1-key = 'f'.
    append wa1 to itab1.
    clear wa1.
    wa2-key = 'a'.
    wa2-var = 'zzz'.
    append wa2 to itab2.
    wa2-key = 'c'.
    wa2-var = 'yyy'.
    append wa2 to itab2.
    wa2-key = 'd'.
    wa2-var = 'ttt'.
    append wa2 to itab2.
    wa2-key = 'f'.
    wa2-var = 'sss'.
    append wa2 to itab2.
    clear wa2.
    loop at itab1 into wa1.
      read table itab2 into wa2
      with key key = wa1-key
      binary search.
      if sy-subrc = 0.
        wa3-key1 = wa1-key.
        wa3-key2 = wa2-key.
        wa3-var = wa2-var.
        append wa3 to itab3.
        clear wa3.
      else.
        append wa1 to itab3.
      endif.
    endloop.
    loop at itab3 into wa3.
      write:/ wa3-key1, wa3-key2,wa3-var.
    endloop.
    Hope it helps.
    Regards,
    Chris Gu

  • Select (join) into internal table with nested structures

    Hello Experts,
    i wonder about the correct notation of a select statement.
    I have an internal table it_zoll including  two structures as defined below.
    The select is a join on the two tables zollp and zolls. As coded below the select is syntactically correct, but the fields
    in the nested structures are not filled ....
    Any ideas how to write the select statement ? (The internal table it_zoll must have the nested structures for other reasons ..)
    Declaration:
    TYPES: BEGIN OF ty_zollp,
      belnr     TYPE  zollp-belnr,
      werks     TYPE  zollp-werks,
      gebnr     TYPE  zollp-gebnr,
           END OF ty_zollp.
    TYPES: BEGIN OF ty_zolls,
      grnum     type  zolls-grnum,
      werks     type  zolls-werks,
      name1     TYPE  zolls-name1,
           END OF ty_zolls.
    DATA: BEGIN OF wa_zoll.
    DATA: zollp type ty_zollp.
    DATA: zolls type ty_zolls.
    DATA: END OF wa_zoll.
    DATA: it_zoll LIKE TABLE OF wa_zoll.
    Select:
      SELECT
        zollp~belnr   zollp~werks  zollp~gebnr
        zolls~grnum zolls~werks  zolls~name1
          FROM zollp
          JOIN zolls ON   zolls~werks = zollp~werks
                     AND  zolls~grnum = zollp~grnum
          INTO CORRESPONDING FIELDS OF TABLE it_zoll
          WHERE zollp~werks = werks
          AND   zollp~gebnr IN s-gebnr
          AND ...
    Thank you !

    DATA: BEGIN OF ty_zollp,
      belnr     TYPE  zollp-belnr,
      werks     TYPE  zollp-werks,
      gebnr     TYPE  zollp-gebnr,
           END OF ty_zollp.
    DATA: BEGIN OF ty_zolls,
      grnum     type  zolls-grnum,
      werks     type  zolls-werks,
      name1     TYPE  zolls-name1,
           END OF ty_zolls.
    DATA: BEGIN OF wa_zoll.
    Include structure ty_zollp.
    Include structure ty_zolls.
    DATA: END OF wa_zoll.
    The above declaration had worked. Please try.
    Regards,
    Satish Kanteti

  • SAP query change the internal table extracted after a join instruction

    Hi Gurus
    I would like to know if it is possible to change the data in internal table after that the
    join instruction has been executed .
    I should have to delete some lines extracted if some conditions are satisfied.
    Do you think that it is not possible and it is better to crete a program?
    Thanks in advance

    HI,
    use select and end select.
    select single msegbukrs msegwerks msegmatnr msegmenge msegaufnr msegsmbln msegbwart msegshkzg mseg~meins
             afkorsnum afpoverid
             maststlnr maststlal stpoidnrk stpomenge stpomeins stkobmeng
         into (itab-mblnr,
               itab-budat,
               itab-bktxt,
               itab-bukrs,
               itab-werks,
               itab-matnr,
               itab-menge,
               itab-aufnr,
               itab-smbln,
               itab-bwart,
               itab-shkzg,
               itab-meins,
               itab-rsnum,
               itab-verid,
               itab-stlnr,
               itab-stlal,
               itab-matnr_r,
               itab-bdmng,
               itab-meins_r,
               itab-bmeng)
         from mkpf
         inner join mseg on msegmblnr eq mkpfmblnr and mkpfmjahr eq msegmjahr
         inner join mara on maramatnr eq msegmatnr
         inner join afpo on afpoaufnr eq msegaufnr
         inner join mast on mastmatnr eq msegmatnr and mastwerks eq msegwerks
         inner join afko on afkoaufnr eq msegaufnr and afkostlal eq maststlal
         inner join stko on stkostlnr eq maststlnr and stkostlal eq maststlal
         inner join stpo on stpostlnr eq stkostlnr
         inner join stas on stasstlnr eq maststlnr and stasstlal eq maststlal and stasstlkn eq stpostlkn
         where mseg~werks in s_werks
         and mseg~matnr in s_matnr
         and mkpf~budat in s_budat
         and mseg~aufnr in s_aufnr
         and mseg~bwart eq '101'
         and mast~stlan eq '1'
         and stko~stlty eq 'M'
         and stpo~stlty eq 'M'.
    if condtion .
        append: itab.
    endif.
        clear: itab.
      endselect.
    Edited by: ZAHID HAMEED on Oct 12, 2011 3:56 PM

  • Join Internal Table for all entries

    Hi,
       I have put the LIKP data in the internal table and then use the for all entries statement to join the table with LIPS.  Besides, i specifiy an additional condition to filter empty batch.
    But, i found that the empty batch record still exist in the result.  Any idea??
        SELECT *
        FROM LIPS INTO  TABLE I_DELIVERY_INFO
        FOR ALL ENTRIES IN I_DELIVERY
        WHERE
        VBELN = I_DELIVERY-VBELN.
        AND
        CHARG IS NOT NULL.
    Regards,
    Kit

    Hi Kit,
    If you are using LIKP and LIPS then you can directly join them since these tables are HEADER & ITEM table.
    regd ur query you can use CHARG NE ' '.
    Regards
    Gopi

Maybe you are looking for

  • TS4357 how can i get my old music back?

    I had a warranty on my ipod touch and so I went to exchange it for a new one. Now on the new ipod I did a icloud restore so all the old content would be on my new ipod, but everything except my music downloaded fully. So my music is half there and I

  • SAP Netweaver 7.02 ABAP Trial Version (64 bit) - Installation Error

    Hi Experts, I'm running into a runtime error during phase 9 of the ABAP trial installation (Create Database Instance).  The error message from the logs reads: An error occurred while processing option <i>SAP NetWeaver 7.0 including Enhancement Packag

  • Clarification about OSS note 677377 - E-mail to credit representative

    Hello, in the OSS note mentioned in the subject I find the following statement: "The document can be released directly from the e-mail". I have this question: the option to release the document from the e-mail is available only if the workflow is act

  • Windows requirement

    I have windows ME. can i use a ipd mini with this? i can't download the cd on my computer.

  • File sizes for youtube/web

    I'm a still photographer getting my feet wet in video for the first time. I use a Nikon D800 producing .mov files, and also a Canon Legria HF G25, producing files with an .MTS extension. Right now I have Canon footage of considerable length, several