Merge 2 internal tables into one and show first record from common fields

Hello PPl,
          I have 3 tables kna1 knb1 and knvp i have to join kna1 and knb1 on kunnr and move the data into an internal table it_data then  on the basis of that data in it_data i have to retrieve records FOR ALL ENTRIES from KNVP and move it into it_knvp.
Then both it_data and it_knvp should be merged in it_alv and from that internal table report has to be displayed.
[NOTE: i had tried using loop twice but the report got messed up]
Apart from that for these set of values
0000000004
0000000418
0000000954
0000001190
0000001222
0000001451
0000001453
0000001455
0000001470
0000001508
finally knvp is showing records in such a way that for 2 records kunnr is same and so does all the other fields except PARZA and KUNN2 so the req. is to display only the first record among 2.
Plz help me by providing code for that its urgent......
Below i m providing my code so far, i hope it will be of some help.
TREMENDOUS REWARD POINTS GURANTEED!!!!!
REPORT  zfanz_alv_report_whv.
TYPE-GROUPS                                                         *
TYPE-POOLS: slis.
TYPES                                                               *
TYPES: BEGIN OF ty_data,
       kunnr TYPE kunnr,
       ort01 TYPE ort01,
       pstlz TYPE pstlz,
       regio TYPE regio,
       bukrs TYPE bukrs,
       zterm TYPE zterm,
       END OF ty_data,
       BEGIN OF ty_knvp,
       vkorg TYPE vkorg,
       vtweg TYPE vtweg,
       spart TYPE spart,
       parvw TYPE parvw,
       parza TYPE parza,
       kunn2 TYPE kunn2,
       lifnr TYPE lifnr,
       END OF ty_knvp,
       BEGIN OF ty_alv,
       kunnr TYPE kunnr,
       ort01 TYPE ort01,
       pstlz TYPE pstlz,
       regio TYPE regio,
       bukrs TYPE bukrs,
       zterm TYPE zterm,
       vkorg TYPE vkorg,
       vtweg TYPE vtweg,
       spart TYPE spart,
       parvw TYPE parvw,
       parza TYPE parza,
       kunn2 TYPE kunn2,
       lifnr TYPE lifnr,
       END OF ty_alv,
       BEGIN OF ty_kna1,
       kunnr TYPE kunnr,
       END OF ty_kna1,
       BEGIN OF ty_knb1,
       bukrs TYPE bukrs,
       END OF ty_knb1.
*DATA: IT_KNVP TYPE KNVP,
DATA: it_knvp TYPE STANDARD TABLE OF ty_knvp WITH HEADER LINE.
DATA: it_data TYPE STANDARD TABLE OF ty_data WITH HEADER LINE.
Report data to be shown.
DATA: it_alv TYPE STANDARD TABLE OF ty_alv WITH HEADER LINE.
Heading of the report.
DATA: t_heading TYPE slis_t_listheader.
*DATA: fieldcatalog type standard table of slis_fieldcat_alv with header
*line.
DATA: fieldcatalog TYPE  slis_t_fieldcat_alv WITH HEADER LINE.
*TABLES
tables:knvp,kna1,knb1.
                 CONSTANTS                                           *
CONSTANTS: c_kunnr TYPE char5 VALUE 'KUNNR',
c_ort01 TYPE char5 VALUE 'ORT01',
c_pstlz TYPE char5 VALUE 'PSTLZ',
c_regio TYPE char5 VALUE 'REGIO',
c_bukrs TYPE char5 VALUE 'BUKRS',
c_zterm TYPE char5 VALUE 'ZTERM',
c_vkorg TYPE char5 VALUE 'VKORG',
c_vtweg TYPE char5 VALUE 'VTWEG',
c_spart TYPE char5 VALUE 'SPART',
c_parvw TYPE char5 VALUE 'PARVW',
c_parza TYPE char5 VALUE 'PARZA',
c_kunn2 TYPE char5 VALUE 'KUNN2',
c_lifnr TYPE char5 VALUE 'LIFNR'.
WORKAREA                                                           *
DATA: wa_data TYPE ty_data,
      wa_knvp TYPE ty_knvp,
      wa_alv TYPE ty_alv,
      wa_fcat  TYPE slis_fieldcat_alv,
      wa_layout TYPE slis_layout_alv.
======================= Selection Screen ==========================
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*DATA: wa_kunnr LIKE kna1-kunnr,
     wa_bukrs LIKE knb1-bukrs,
     wa_vkorg LIKE knvp-vkorg,
     wa_vtweg LIKE knvp-vtweg,
     wa_spart LIKE knvp-spart,
     wa_parvw LIKE knvp-parvw.
SELECT-OPTIONS                                                      *
SELECT-OPTIONS s_kunnr FOR kna1-kunnr NO INTERVALS OBLIGATORY
SELECT-OPTIONS: s_bukrs FOR knb1-bukrs NO-EXTENSION NO INTERVALS,
s_vkorg FOR knvp-vkorg  NO-EXTENSION NO INTERVALS,
s_vtweg FOR knvp-vtweg NO-EXTENSION NO INTERVALS,
s_spart FOR knvp-spart NO-EXTENSION NO INTERVALS,
s_parvw FOR knvp-parvw NO-EXTENSION NO INTERVALS.
SELECTION-SCREEN: END OF BLOCK b1.
AT SELECTION-SCREEN                                            *
AT SELECTION-SCREEN ON s_kunnr.
  PERFORM validate_data.
START-OF-SELECTION                                                   *
START-OF-SELECTION.
  PERFORM get_data.  "fetch data from table and perform join on them
  PERFORM final_table.
  PERFORM build_fieldcatalog.            "populate field catalog
  PERFORM build_layout.
  PERFORM grid_display.                  "display the result in ALV grid
END-OF-SELECTION                                                     *
END-OF-SELECTION.
describe
SUBROUTINES (FORMS)
*&      Form  get_data
      Gets the information to be shown in the report.
      Join on tables KNA1, KNB1 and for all enteries in KNVP
-->  p1        text
<--  p2        text
FORM get_data.
  SELECT kna1~kunnr
  kna1~ort01
  kna1~pstlz
  kna1~regio
  knb1~bukrs
  knb1~zterm
  INTO TABLE it_data
  FROM kna1 INNER JOIN knb1
  ON kna1kunnr = knb1kunnr
    WHERE kna1~kunnr IN s_kunnr
   AND knb1~bukrs IN s_bukrs.
  SELECT vkorg
         vtweg
         spart
         parvw
         parza
         kunn2
         lifnr
        INTO TABLE it_knvp FROM knvp
   FOR ALL ENTRIES IN it_data
   WHERE  knvp~kunnr = it_data-kunnr
     AND  vkorg IN s_vkorg
     AND  vtweg IN s_vtweg
     AND  spart IN s_spart
     AND  parvw IN s_parvw.
ENDFORM. " get_data
*ENDFORM. " get_data
*&      Form  FINAL_TABLE
      text
-->  p1        text
<--  p2        text
FORM final_table .
  LOOP AT it_data.
    it_alv-kunnr = it_data-kunnr.
    it_alv-ort01 = it_data-ort01.
    it_alv-pstlz = it_data-pstlz.
    it_alv-regio = it_data-regio.
    it_alv-bukrs = it_data-bukrs.
    it_alv-zterm = it_data-zterm.
    APPEND it_alv.
    CLEAR it_alv.
  ENDLOOP.
  LOOP AT it_knvp.
    it_alv-vkorg = it_knvp-vkorg.
    it_alv-vtweg = it_knvp-vtweg.
    it_alv-spart = it_knvp-spart.
    it_alv-parvw = it_knvp-parvw.
    it_alv-parza = it_knvp-parza.
    it_alv-kunn2 = it_knvp-kunn2.
    it_alv-lifnr = it_knvp-lifnr.
    APPEND it_alv.
    CLEAR it_alv.
  ENDLOOP.
ENDFORM.                    " FINAL_TABLE
*&      Form  BUILD_FIELDCATALOG
      Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
  IF it_alv[] IS NOT INITIAL.
    wa_fcat-fieldname   = c_kunnr.
    wa_fcat-seltext_l   = 'Customer Master'(001).
    wa_fcat-col_pos     = 1.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_ort01.
    wa_fcat-seltext_l   = 'City'(002).
    wa_fcat-col_pos     = 2.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_pstlz.
    wa_fcat-seltext_l   = 'Postal Code'(003).
    wa_fcat-col_pos     = 3.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_regio.
    wa_fcat-seltext_l   = 'Region'(004).
    wa_fcat-col_pos     = 4.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_bukrs.
    wa_fcat-seltext_l   = 'Company Code'(005).
    wa_fcat-col_pos     = 5.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_zterm.
    wa_fcat-seltext_l   = 'Terms of payment'(006).
    wa_fcat-col_pos     = 6.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_vkorg.
    wa_fcat-seltext_l   = 'Sales Organization'(007).
    wa_fcat-col_pos     = 7.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_vtweg.
    wa_fcat-seltext_l   = 'Distribution Channel'(008).
    wa_fcat-col_pos     = 8.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_spart.
    wa_fcat-seltext_l   = 'Division'(009).
    wa_fcat-col_pos     = 9.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_parvw.
    wa_fcat-seltext_l   = 'Partner function'(010).
    wa_fcat-col_pos     = 10.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_kunn2.
    wa_fcat-seltext_l   = 'Customer number of partner'(011).
    wa_fcat-col_pos     = 11.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
    wa_fcat-fieldname   = c_lifnr.
    wa_fcat-seltext_l   = 'Account Number of Vendor'(012).
    wa_fcat-col_pos     = 12.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
   wa_fcat-fieldname   = c_parza.
   wa_fcat-seltext_l   = 'Partner counter'(013).
    wa_fcat-col_pos     = 13.
    APPEND wa_fcat TO fieldcatalog.
    CLEAR  wa_fcat.
*fieldcatalog-fieldname   = c_kunnr.
   fieldcatalog-seltext_l   = 'Customer Master'(001).
   fieldcatalog-col_pos     = 1.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_ort01.
   fieldcatalog-seltext_l   = 'City'(002).
   fieldcatalog-col_pos     = 2.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_pstlz.
   fieldcatalog-seltext_l   = 'Postal Code'(003).
   fieldcatalog-col_pos     = 3.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_regio.
   fieldcatalog-seltext_l   = 'Region'(004).
   fieldcatalog-col_pos     = 4.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_bukrs.
   fieldcatalog-seltext_l   = 'Company Code'(005).
   fieldcatalog-col_pos     = 5.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_zterm.
   fieldcatalog-seltext_l   = 'Terms of payment'(006).
   fieldcatalog-col_pos     = 6.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_vkorg.
   fieldcatalog-seltext_l   = 'Sales Organization'(007).
   fieldcatalog-col_pos     = 7.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_vtweg.
   fieldcatalog-seltext_l   = 'Distribution Channel'(008).
   fieldcatalog-col_pos     = 8.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_spart.
   fieldcatalog-seltext_l   = 'Division'(009).
   fieldcatalog-col_pos     = 9.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_parvw.
   fieldcatalog-seltext_l   = 'Partner function'(010).
   fieldcatalog-col_pos     = 10.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_kunn2.
   fieldcatalog-seltext_l   = 'Customer number of partner'(011).
   fieldcatalog-col_pos     = 11.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_lifnr.
   fieldcatalog-seltext_l   = 'Account Number of Vendor'(012).
   fieldcatalog-col_pos     = 12.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
   fieldcatalog-fieldname   = c_parza.
   fieldcatalog-seltext_l   = 'Partner counter'(013).
   fieldcatalog-col_pos     = 13.
   APPEND fieldcatalog TO fieldcatalog.
   CLEAR  fieldcatalog.
  ENDIF.
ENDFORM.                    " BUILD_FIELDCATALOG
*&      Form  build_layout
      text
-->  p1        text
<--  p2        text
form build_layout .
Set layout field for field attributes(i.e. input/output)
wa_layout-stylefname = 'FIELD_STYLE'.
  wa_layout-zebra             = 'X'.
endform.                    " build_layout
*&      Form  GRID_DISPLAY
      text
FORM grid_display. "using t_data type ty_tbl_data.
  IF it_alv[] IS NOT INITIAL.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = sy-repid
   IS_LAYOUT                         = wa_layout
     it_fieldcat                       = fieldcatalog[]
    TABLES
      t_outtab                          = it_alv[]
  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.
  ENDIF.
ENDIF.
ENDFORM.                    "GRID_DISPLAY
*&      Form  VALIDATE_DATA
      text
-->  p1        text
<--  p2        text
FORM validate_data .
  DATA : li_kna1 TYPE STANDARD TABLE OF ty_kna1,
         li_knb1 TYPE STANDARD TABLE OF ty_knb1,
         li_knvp TYPE STANDARD TABLE OF ty_knvp.
  SELECT kunnr
  FROM kna1
  INTO TABLE li_kna1
  WHERE kunnr IN s_kunnr.
  IF sy-subrc <> 0.
    MESSAGE 'Invalid Customer Number'(013) TYPE 'E'.
  ENDIF.
  SELECT bukrs
  FROM t001
  INTO TABLE li_knb1
  WHERE bukrs IN s_bukrs.
    IF sy-subrc <> 0.
      MESSAGE 'Invalid Company Code'(014) TYPE 'E'.
    ENDIF.
    SELECT vkorg
    FROM tvko
    INTO TABLE li_knvp
    WHERE vkorg IN s_vkorg.
      IF sy-subrc <> 0.
        MESSAGE 'Invalid Sales Organization'(015) TYPE 'E'.
      ENDIF.
      SELECT vtweg
      FROM tvtw
      INTO TABLE li_knvp
      WHERE vtweg IN s_vtweg.
        IF sy-subrc <> 0.
          MESSAGE 'Invalid Distribution Channel'(016) TYPE 'E'.
        ENDIF.
        SELECT spart
        FROM tspa
        INTO TABLE li_knvp
        WHERE spart IN s_spart.
          IF sy-subrc <> 0.
            MESSAGE 'Invalid Division'(017) TYPE 'E'.
          ENDIF.
          SELECT parvw
          FROM tpar
          INTO TABLE li_knvp
          WHERE parvw IN s_parvw.
            IF sy-subrc <> 0.
              MESSAGE 'Invalid Partner function'(018) TYPE 'E'.
            ENDIF.
        ENDFORM.                    " VALIDATE_DATA

*1----
FORM get_data.
  SELECT kna1~kunnr
  kna1~ort01
  kna1~pstlz
  kna1~regio
  knb1~bukrs
  knb1~zterm
  INTO TABLE it_data
  FROM kna1 INNER JOIN knb1
  ON kna1kunnr = knb1kunnr
    WHERE kna1~kunnr IN s_kunnr
   AND knb1~bukrs IN s_bukrs.
  CHECK it_data[] IS NOT INITIAL.
  SELECT kunnr
         vkorg
         vtweg
         spart
         parvw
         parza
         kunn2
         lifnr
        INTO TABLE it_knvp FROM knvp
   FOR ALL ENTRIES IN it_data
   WHERE  kunnr = it_data-kunnr
     AND  vkorg IN s_vkorg
     AND  vtweg IN s_vtweg
     AND  spart IN s_spart
     AND  parvw IN s_parvw.
  IF sy-subrc EQ 0.
    SORT it_knvp BY kunnr.
  ENDIF.
ENDFORM. " get_data
*2----
FORM final_table .
  LOOP AT it_data INTO wa_data.
    READ TABLE it_knvp
    INTO wa_knvp
    WITH KEY kunnr = wa_data-kunnr
    BINARY SEARCH .
    IF sy-subrc = 0.
      MOVE-CORRESPONDING wa_data TO wa_alv.
      MOVE-CORRESPONDING wa_knvp TO wa_alv.
      APPEND wa_alv TO it_alv.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " FINAL_TABLE
Edited by: Faisal Khan on Mar 27, 2008 1:59 PM

Similar Messages

  • How to consolidate 4 internal table into one

    how can we consolidate data from
    two or more internal tables into one
    please help
    its a bit uegent
    thanks in advance

    Hi,
    If you want to combine two internal table,you can follow 2 approaches.
    Case1: If both the internal table are of same structure,
    append lines of itab1 to itab2.
    The above statement will append all the records in itab1 to itab2.
    Case2:If both the internal table are of differnt structure,
    you need one or more common fields in the two tables to connect.
    loop at itab1.
    move-corresponding itab1 to itab.
    loop at itab2 where f1 = itab1-f1.
    move-corresponding itab2 to itab.
    append itab.
    clear : itab2, itab.
    endloop.
    clear itab1.
    endloop.
    Now itab will hold the entries from itab1 and itab2.

  • Merge multiple tables into one for export to excel

    I've got a few tables in Numbers, and I've spent ages making them all look the same, then when I exported to an excel file, they split up into seperate tables. How can i merge all these into one table so they can all be viewed in Excel, without losing the cell shading/borders etc?
    I tried just copying/pasting the tables into a new blank table, but this doesn't paste the borders etc...
    Cheers
    Adi

    Adi,
    Fill color will copy and paste, as will Text styles, but borders will not when pasting into another table. My suggestion for future work is to not use fancy borders, or don't apply them until you have combined the tables.
    If you would like Apple to consider changing the behavior of borders during Copy/Paste operations, you can leave Feedback for them under the Numbers Menu.
    Jerry
    Message was edited by: Jerrold Green1

  • Mapping of various internal tables into one existing excel

    Hi all,
              i have a problem regarding conversion into existing excel sheet.
    Actually i have multiple reports and  i have to convert all them into an existing excel sheet.. How is it possible please guide.
    Edited by: Ram Shanker on Oct 30, 2009 10:37 AM

    Hi Ram,
    You can merge different internal table data to  a single worksheet in an excel ;
    or you can keep each internal table data in separate worksheets in a  single excel.
    Both ways are possible using OLE technique.
    Refer this link.
    https://wiki.sdn.sap.com/wiki/display/Snippets/DownloadDataintoMultipleSheetExcelDocumentwithNonEditableColumns%28Passwordprotected%29UsingABAP+OLE
    Thanks,
    Nisha Vengal.

  • How do I Merge 2 Albums into one and make CD 1&2

    ive tried everything followed other forums that had the same question they just wont merge. if i could insert a video on here to show but it wont let me the icon isnt shaded in and when i press it it wont respond.
    ive tried everything that was posted on this forum
    https://discussions.apple.com/thread/5046421

    you kind of solved my question but i didnt really understand it because of the wording but heres a better way of explaining that i found on a different forum
    i added an x to both albums artist and that didnt work
    then i added an x to both albums artist and album and it grouped
    Sometimes iTunes may split an album into one or more partial albums. This split may happen if some tracks from the album have different values for Artist, Album Artist (ignored on iPod), Album, No. of Discs. or Part of a Compilation. Tiny differences such as trailing spaces, accented characters, or variants of symbols can be quite hard to spot. Normally overtyping the desired value for each shared field will complete the grouping of the album into one entity. Occasionally, however, this method seems to fail. In this instance I've found that you can force every field to update properly by adding some extra text - e.g. a trailing X, which once applied seems to complete the joining of the tracks into one album. Once this has happened the extra data can be removed and the album should remain properly grouped.
    https://discussions.apple.com/thread/1670662

  • Convert multiple rows of internal table into one row of internal table

    Hi everyone,
    I have an internal table of structure
    Objid   - Sobid
    1         -     A
    1          -    B
    1           -   C
    1            -  D
    2        -      a
    2        -      b
    Now I have to show this in ALV format
    Objid - Sobid1- Sobid2 -Sobid3 -Sobid4 -Sobid5
    1      -   A   -      B   -       C  -     D       
    2       -  a     -     b
    Kindly help me it's urgent.
    bye

    Hi sandip,
    sorry i make a mistake. I have not seen that you will have it in ALV.
    Try this an use itab1-txt in your alv:
    DATA: BEGIN OF ITAB OCCURS 0,
      OBJID(1),
      DUMMY(1) VALUE '-',
      SOBID(1),
      END   OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0,
      txt(20),
      END   OF ITAB1.
    ITAB-OBJID = '1'. ITAB-SOBID = 'A'. APPEND ITAB.
    ITAB-OBJID = '1'. ITAB-SOBID = 'B'. APPEND ITAB.
    ITAB-OBJID = '1'. ITAB-SOBID = 'C'. APPEND ITAB.
    ITAB-OBJID = '1'. ITAB-SOBID = 'D'. APPEND ITAB.
    ITAB-OBJID = '2'. ITAB-SOBID = 'a'. APPEND ITAB.
    ITAB-OBJID = '2'. ITAB-SOBID = 'b'. APPEND ITAB.
    LOOP AT ITAB.
      AT NEW OBJID.
        if sy-tabix <> 1. append itab1. clear itab1. endif.
        itab1-txt = ITAB-OBJID.
      ENDAT.
      AT NEW SOBID.
        concatenate itab1-txt ITAB-DUMMY ITAB-SOBID into itab1-txt.
      ENDAT.
    ENDLOOP.
    append itab1.
    loop at itab1. write: / itab1-txt. endloop.
    Regards, Dieter

  • Tow internal table to one commone internal table

    hi
    i have two internal table
    itab1 having fields
    f1
    f2
    f3
    f4
    and second internal table having fields
    HERE F1 IS COMMON FIELD BETTWEEN TWO
    f1
    f5
    f6
    f7
    f8
    f9
    f10
    i want the data of both the internal table into one final table having data
    F1
    F2
    F3
    F4
    F5
    F6
    F7
    F8
    F9
    F10
    IE COMBINED DATA OR BOTHE IE I AM ADDING THE COLUIMNS OF INTERNAL TABLE 1 AND INTERNAL TABLE 2 TO FINAL OUTPUT TABLE
    PLEASE SUGGEST ?
    REGARDS
    ARORA

    hi RAAM
    the situation is like this
    her is the internal table with data and rows
    IT_APC                         Table[58x64]     
    it_dep                         Table[14x48]     
    it_Dep_Apc                     Table[1x108]     
    now iand combining data of itapc and itdep to it_dep_apc
    both have only one common firled bukrs
    and as rows and columns as displayed above
    now if i do below as suggeted by u
    LOOP AT IT_APC INTO WA_APC.                                                                               
    READ TABLE IT_DEP INTO WA_DEP WITH KEY BUKRS = WA_APC-BUKRS      
    BINARY SEARCH.     
    then the all the data is not combined i suppose as i need to have the final table all the data from both the internal tables....
    ie common rows plus extra rows for bukrs
    regards
    Arora

  • Merging (Joining) two tables into one

    Is it possible to merge two adjacent tables into one table in Pages? Also, how can you split one table into multiple tables?

    If we use the exact meaning of the words, the response is no and no.
    If we play a bit with the meanings we may do the trick.
    (1) I create a table with 6 columns and 5 rows.
    (2) select cells D1 …F5, copy, paste in the document but out of the table. We get the right half of the table.
    From the tool bar, reduce the number of columns of table 1 fom 6 to 3. Bingo we have the two halves of the original table.
    (3)Select the first half and increase the number of rows from 5 to 10
    (4) copy the entire second half, select cell D1 in the enlarged table, paste.
    Bingo, we have the merged table.
    For sure, a merge and a split tables features would be welcome but as the table tool is the one used in the spreadsheet, I would be surprised if these features where introduced one day.
    _Go to "Provide Pages Feedback" in the "Pages" menu_, describe what you wish.
    Then, cross your fingers, and wait _at least_ for iWork'11
    Yvan KOENIG (VALLAURIS, France) jeudi 22 avril 2010 17:28:48

  • How to join THREE different tables into internal table using one select statement .

    How to join THREE different tables into internal table using one select statement .
    Hi experts,
    I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
    Scenario:
    Database tables:
    SPFLI
    SFLIGHT
    SBOOK.
    Table Fields:
    SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
    SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
    SEATSOCC_C SEATSMAX_F SEATSOCC_F
    SBOOK - CARRID CONNID CLASS
    MY INTERNAL TABLE IS IT_XX.
    Your help much appreciated.
    Thanks in advance.
    Pawan.

    Hi Pawan,
    please check below codes. hope it can help you.
    TYPES: BEGIN OF ty_xx,
            carrid     TYPE spfli-carrid   ,
            connid     TYPE spfli-connid   ,
            countryfr  TYPE spfli-countryfr,
            cityfrom   TYPE spfli-cityfrom  ,
            countryto  TYPE spfli-countryto,
            cityto     TYPE spfli-cityto   ,
            fldate     TYPE sflight-fldate ,
            seatsmax   TYPE sflight-seatsmax ,
            seatsocc   TYPE sflight-seatsocc ,
            seatsmax_b TYPE sflight-seatsmax_b,
            seatsocc_b TYPE sflight-seatsocc_b,
            seatsmax_f TYPE sflight-seatsmax_f,
            seatsocc_f TYPE sflight-seatsocc_f,
            class      TYPE sbook-class,
          END OF ty_xx,
          t_xx TYPE STANDARD TABLE OF ty_xx.
    DATA: it_xx TYPE t_xx.
    SELECT spfli~carrid
           spfli~connid
           spfli~countryfr
           spfli~cityfrom
           spfli~countryto
           spfli~cityto
           sflight~fldate
           sflight~seatsmax
           sflight~seatsocc
           sflight~seatsmax_b
           sflight~seatsocc_b
           sflight~seatsmax_f
           sflight~seatsocc_f
           sbook~class
      INTO TABLE it_xx
      FROM spfli INNER JOIN sflight
      ON spfli~carrid = sflight~carrid
      AND spfli~connid = sflight~connid
      INNER JOIN sbook
      ON spfli~carrid = sbook~carrid
      AND spfli~connid = sbook~connid.
    Thanks,
    Yawa

  • How can i add two table into one internal table

    I WANT TO ADD THIS TWO DIFFERENT TABLE INTO ONE INTERNAL TABLE PLEASE HELP.
    TABLES: J_1IEXCHDR, J_1IEXCDTL.
    SELECT * FROM J_1IEXCHDR WHERE STATUS = 'P'.
    WRITE: / J_1IEXCHDR-LIFNR,
              J_1IEXCHDR-DOCNO,
              J_1IEXCHDR-EXYEAR,
              J_1IEXCHDR-BUDAT.
    SELECT * FROM J_1IEXCDTL WHERE TRNTYP = J_1IEXCHDR-TRNTYP
                              AND DOCYR  = J_1IEXCHDR-DOCYR
                              AND DOCNO  = J_1IEXCHDR-DOCNO.
       WRITE: / J_1IEXCDTL-EXBAS,
                J_1IEXCDTL-EXBED,
                J_1IEXCDTL-RDOC1,
                J_1IEXCDTL-ECS.
    ENDSELECT.
    ENDSELECT.
    THANKS IN ADVANCED.

    U have to link these 2 tables like this
    <b>SELECT
    J_1IEXCHDR~DOCNO
    FROM J_1IEXCHDR inner join J_1IEXCDTL
    on J_1IEXCHDRDOCYR  = J_1IEXCDTLDOCYR
    WHERE STATUS = 'P'.</b>
    this is sample code only, and u have to check the F.key relationship.
    Regards
    Prabhu

  • How to fill the data of two different tables into one?

    Hi Experts,
    I have two tables named CDHDR and CDSHW(structure). I have extracted the  data from these two tables through two function modules named CHANGEDDOCUMENT_HEADER and CHANGEDOCUMENT_POSITION. Now I have the data in to different tables.
    These two tables neither has relationship with each other through any field nor have any field which exist in both. Can anyone tell me in this case what should be the process to take the data of both the tables into one table. How can I match the record of one table to another?
    thanks a ton in advance.
    Edited by: Moni Bindal on Apr 28, 2008 4:16 PM
    Edited by: Alvaro Tejada Galindo on Apr 28, 2008 1:42 PM

    Hye Bindal,
      without a relation, it is not possible to club the data of 2 internal tables. More over it depends on the requirement as to y u should club to non related quantities in an internal table.
    if you wish to do so, one thing is it has internal table which includes the strucute of the 2.
    data: begin of ty_out,
              first type first_structure,
              second type second_structure,
             end of ty_out.
    data: itab type standard table of ty_out.
    data: wa type ty_out.
    loop into it1 into wa1.
    move corresponding wa to wa1.
    append wa to itab.
    endloop.
    loop into it2 into wa2.
    move corresponding wa to wa2.
    append wa to itab.
    endloop.
    now the internal table itab will have all the contents of it1 and it2.
    <REMOVED BY MODERATOR>
    Thanks,
    Imran.
    Edited by: Alvaro Tejada Galindo on Apr 28, 2008 1:43 PM

  • How to fetch the SAP Standard Prog. built internal table into my_z_prog.?

    Hi Experts,
    Pls. let me know that,
    How to fetch the SAP Standard Prog. built internal table into my_z_prog.?
    For more explannation, pls. see my other thread with name of yestrday,
    SUBMIT RFGLBALANCE WITH selection criteria, then How to get resulted itab?
    thanq

    Hi
    Suppose RFGLBALANCE is your standard program and you have an internal table named I_RFGLBALANCE.
    And lets say your Z program name is Z_SRINIVAS.
    First find out the type of the internal table you want in your Z-program in the standard program. And declare an internal table of similar type in your Z-program.
    I hope you can do this much.
    Later wherever you are putting the below mentioned code.
    SUBMIT RFGLBALANCE WITH selection criteria
    Write the code which i have written.Obviously modify it to suit your requirement.
    Please show what is not working fine so that even anyone else can help you with the problem you are facing.
    Regards,
    Mayank

  • Error while downloading data from internal table into XML file

    hi all,
    i developed a program to download data from into internal table to xml file like this.
    tables: mara.
    parameters: p_matnr like mara-matnr.
    data: begin of itab_mara occurs 0,
                matnr like mara-matnr,
                ernam like mara-ernam,
                aenam like mara-aenam,
                vpsta like mara-vpsta,
          end of itab_mara.
    data: lv_field_seperator type c,     " value 'X',
          lv_xml_doc_name(30) type c,    " string value ‘my xml file’,
          lv_result type i.
          lv_field_seperator = 'x'.
          lv_xml_doc_name = 'my xml file'.
    types: begin of truxs_xml_line,
              data(256) type x,
          end of truxs_xml_line.
    types:truxs_xml_table type table of truxs_xml_line.
    data:lv_tab_converted_data type truxs_xml_line,
         lt_tab_converted_data type truxs_xml_table.
    data: lv_xml_file type rlgrap-filename value 'c:\simp.xml'.
    select matnr ernam aenam vpsta from mara into table itab_mara up to 5
           rows where matnr = p_matnr.
    CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
    EXPORTING
       I_FIELD_SEPERATOR          = lv_field_seperator
      I_LINE_HEADER              =
      I_FILENAME                 =
      I_APPL_KEEP                = ' '
       I_XML_DOC_NAME             = lv_xml_doc_name
    IMPORTING
       PE_BIN_FILESIZE            = lv_result
      TABLES
        I_TAB_SAP_DATA             = itab_mara
    CHANGING
       I_TAB_CONVERTED_DATA       = lt_tab_converted_data
    EXCEPTIONS
      CONVERSION_FAILED          = 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.
    open dataset lv_xml_file for output in binary mode.
    loop at lt_tab_converted_data into lv_tab_converted_data.
    transfer lv_tab_converted_data to lv_xml_file.
    endloop.
    close dataset lv_xml_file.
    this program is syntactically correct and getting executed, but when i open the target xml file it is showing the following error.
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'file:///C:/simp.xml'.
    will anyone show me the possible solution to rectify this error
    thanks and regards,
    anil.

    Hi,
    Here is a small sample program to convert data in an internal table into XML format and display it.
    DATA: itab  TYPE TABLE OF spfli,
          l_xml TYPE REF TO cl_xml_document.
    * Read data into a ITAB
    SELECT * FROM spfli INTO TABLE itab.
    * Create the XML Object
    CREATE OBJECT l_xml.
    * Convert data in ITAB to XML
    CALL METHOD l_xml->create_with_data( name = 'Test1'
                                         dataobject = t_goal[] ).
    * Display XML Document
    CALL METHOD l_xml->display.
    Here are some other sample SAP programs to handle XML in ABAP:
    BCCIIXMLT1, BCCIIXMLT2, and BCCIIXMLT3.
    Hope this helps,
    Sumant.

  • How to insert  data from different internal  table  into a data base table

    hi all,
             I want to insert a particular field in an internal table to a field in a data base table.Note that the fields in the internal table and database table are not of the same name since i need to insert data from different internal tables.can some one tell me how to do this?
    in short i want to do something like the foll:
    INSERT  INTO ZMIS_CODES-CODE VALUE '1'.
    *INSERT INTO ZMIS_CODES-COL1 VALUE DATA_MTD-AUFNR .(zmis_codes is the db table and data_mtd is the int.table)

    REPORT  ZINSERT.
    tables kna1.
    data: itab LIKE KNA1.
    data lv_kUNAG LIKE KNA1-KUNNR.
    lv_kuNAG =  '0000010223'.
    ITAB-kuNNR = lv_kuNAG.
    ITAB-name1 = 'XYZ'.
    INSERT INTO KNA1 VALUES ITAB.
    IF SY-SUBRC = 0.
    WRITE:/ 'SUCCESS'.
    ELSE.
    WRITE:/ 'FAILED'.
    ENDIF.
    Here lv_kunag is ref to kna1 kunnr passed in different name
    In internal table .
    Try and let me know if this logic dint work.

  • Internal table with Import and Export

    Hi All,
    Hi all
    Please let me know the use of <b>Internal table with Import and Export parameters and SET/GET parameters</b>, on what type of cases we can use these? Plese give me the syntax with some examples.
    Please give me detailed analysis on the above.
    Regards,
    Prabhu

    Hi Prabhakar,
    There are three types of memories.
    1. ABAP MEMORY
    2. SAP MEMORY
    3. EXTERNAL MEMORY.
    1.we will use EXPORT/ IMPORT TO/ FROM MEMORY-ID when we want to transfer between ABAP memory
    2. we will use GET PARAMETER ID/ SET PARAMETER ID to transfer between SAP MEMORY
    3. we will use EXPORT/IMPORT TO/FROM SHARED BUFFER to transfer between external memory.
    ABAP MEMORY : we can say that two reports in the same session will be in ABAP MEMORY
    SAP MEMORY: TWO DIFFERENT SESSIONS WILL BE IN SAP MEMORY.
    for ex: IF WE CALL TWO DIFFERENT TRANSACTIONS SE38, SE11
    then they both are in SAP MEMORY.
    EXTERNAL MEMORY: TWO different logons will be in EXTERNAL MEMORY.
    <b>Syntax</b>
    To fill the input fields of a called transaction with data from the calling program, you can use the SPA/GPA technique. SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory. SAP memory allows you to pass values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions. Each SPA/GPA parameter is identified by a 20-character code. You can maintain them in the Repository Browser in the ABAP Workbench. The values in SPA/GPA parameters are user-specific.
    ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETER statements.
    To fill one, use:
    SET PARAMETER ID <pid> FIELD <f>.
    This statement saves the contents of field <f> under the ID <pid> in the SAP memory. The code <pid> can be up to 20 characters long. If there was already a value stored under <pid>, this statement overwrites it. If the ID <pid> does not exist, double-click <pid> in the ABAP Editor to create a new parameter object.
    To read an SPA/GPA parameter, use:
    GET PARAMETER ID <pid> FIELD <f>.
    This statement fills the value stored under the ID <pid> into the variable <f>. If the system does not find a value for <pid> in the SAP memory, it sets SY-SUBRC to 4, otherwise to 0.
    To fill the initial screen of a program using SPA/GPA parameters, you normally only need the SET PARAMETER statement.
    The relevant fields must each be linked to an SPA/GPA parameter.
    On a selection screen, you link fields to parameters using the MEMORY ID addition in the PARAMETERS or SELECT-OPTIONS statement. If you specify an SPA/GPA parameter ID when you declare a parameter or selection option, the corresponding input field is linked to that input field.
    On a screen, you link fields to parameters in the Screen Painter. When you define the field attributes of an input field, you can enter the name of an SPA/GPA parameter in the Parameter ID field in the screen attributes. The SET parameter and GET parameter checkboxes allow you to specify whether the field should be filled from the corresponding SPA/GPA parameter in the PBO event, and whether the SPA/GPA parameter should be filled with the value from the screen in the PAI event.
    When an input field is linked to an SPA/GPA parameter, it is initialized with the current value of the parameter each time the screen is displayed. This is the reason why fields on screens in the R/3 System often already contain values when you call them more than once.
    When you call programs, you can use SPA/GPA parameters with no additional programming overhead if, for example, you need to fill obligatory fields on the initial screen of the called program. The system simply transfers the values from the parameters into the input fields of the called program.
    However, you can control the contents of the parameters from your program by using the SET PARAMETER statement before the actual program call. This technique is particularly useful if you want to skip the initial screen of the called program and that screen contains obligatory fields.
    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.
    Saving Data Objects in Memory
    To read data objects from an ABAP program into ABAP memory, use the following statement:
    Syntax
    EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ... TO MEMORY ID <key>.
    This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    Check this link.
    http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm
    Thanks,
    Susmitha.
    Reward points for helpful answers.

Maybe you are looking for

  • The webpage (absa.co.za - internet banking) does not display completely, data is omitted on the left hand side. Works fine in IE.

    Since it is a secure site, I cannot copy the page to the desktop for you to view. There is a column of choices on the left hand of the screen that is not visible on this notebook (LG ES30) which is a week old. The page works fine on this machine in I

  • How to format Lion OS X 10.7.5?

    I Don't figure out a lot from computers but my MacBook has been hacked I suppose and I want to format it in a cvery easy way. What is the simplest way to do it?

  • Calendar Publishes but ToDo items do not

    Hello, I've been successful at publishing my calendar and allowing subscribers to view it. But when I allow the publishing of to-do items they will not show up on the other user's to-do list. Is there something I'm missing? I've allowed todo items to

  • Repeat with php include

    Hi again I have a regular repeat table with PHP includes involved. If I put <tr spry:repeat="dsMenuAboutAng" spry:setrow="dsMenuAboutAng"> <td>{@nomang_nomdepage}</td> <td><?php require_once('{@detailang}'); ?></td> </tr> {@detailang} getting the nam

  • Extend project configuration properties

    I trying to add a new section in the C#/VB project property pages, similar to "Application, Build, ..." but I need this to work with the generic project types without creating a custom project type. Is there a way to do that? What about C++ VC projec