To Select the data from two table one is transp table and onther is cluster

Hi All,
I want to select the data from two tables
Here i am giving with an example.
Fileds: kunnr belnr from bseg.  table bseg
fields: adrnr from kna1     table: kna1.
Know i want to put these into one internal table based on kunnr and belnr.
Thanks in advance.
Ramesh

Hi,
   U cant use joins on cluster table and BSEG is a cluster table so use FOR  ALL ENTRIES for taht
refer this code
*&      Form  sub_read_bsak
      text
-->  p1        text
<--  p2        text
FORM sub_read_bsak.
*--Select data from BSAK Table
  SELECT lifnr
         augdt
         augbl
         gjahr
         belnr
         xblnr
         blart
         dmbtr
         mwskz
         mwsts
         sgtxt
         FROM bsak
         INTO CORRESPONDING FIELDS OF TABLE it_bsak
         WHERE belnr IN s_belnr
         AND   augdt IN s_augdt.
  IF sy-subrc EQ 0.
*--Sort table by accounting document and vendor number
    SORT it_bsak BY belnr lifnr.
  ENDIF.
ENDFORM.                    " sub_read_bsak
*&      Form  sub_read_bseg
      text
-->  p1        text
<--  p2        text
FORM sub_read_bseg.
  IF NOT it_bsak[] IS INITIAL.
*--Select data from BSEG table
    SELECT belnr
           gjahr
           shkzg
           kostl
           hkont
           ebeln
           ebelp
           FROM bseg
           INTO CORRESPONDING FIELDS OF TABLE it_bseg
           FOR ALL ENTRIES IN it_bsak
           WHERE belnr EQ it_bsak-belnr
           AND   gjahr EQ it_bsak-gjahr
           AND   shkzg EQ 'S'.
    IF sy-subrc EQ 0.
*--Sort table by accounting document
      SORT it_bseg BY belnr.
    ENDIF.
  ENDIF.
ENDFORM.                    " sub_read_bseg

Similar Messages

  • Fetch the data from two tables

    hell all
    i want to fetch the data from two tables, one is from internal table and another one is data base table. what syntax i have to use either FOR ALL ENTRIES or INNER JOIN?

    hi
    Use FOR ALL ENTRIES.
    see the sample code
      select * into table tvbrk from vbrk
                                where fkart in ('F2', 'F3', 'RE',
                                           'ZVEC' , 'ZVEM' , 'ZVED',
                                           'S1')
                                and erdat in so_erdat
                                and kunag in s_kunag. 
                                      erdat in so_erdat
                               and   fkart in ('F2', 'F3', 'RE',
                                                 'ZVEC' , 'ZVEM').
    if not tvbrk is initial.
        select * into table t_zregion from zregion
                      for all entries in tvbrk
                       where country = tvbrk-land1
                       and   region = s_regio.
      endif.
    thanks
    sitaram

  • How to upload the data from two sheets in one excel into SAP

    Hi experts,
                    My requirement is to upload the data from two sheets in an excel into an internal table.How can this be achieved.Is some OLE application has to be used?
    Thanks
    Abhishek

    Hi
    see this program will upload excel file to application.
    *& Report  ZSD_EXCEL2
    REPORT  ZSD_EXCEL2.
    types: begin of ttab ,
          fld1(30) type c,
          fld2(30) type c,
          fld3(30) type c,
          fld4(30) type c,
          fld5(30) type c,
          end of ttab.
    data: itab type table of ttab with header line.
    selection-screen skip 1.
    parameters: p_file type localfile default
                'C:\test.xls'.
    selection-screen skip 1.
    at selection-screen on value-request for p_file.
      call function 'KD_GET_FILENAME_ON_F4'
           exporting
                static    = 'X'
           changing
                file_name = p_file.
    start-of-selection.
      clear itab. refresh itab.
      perform upload_data.
      loop at itab.
        write:/ itab-fld1, itab-fld2, itab-fld3, itab-fld4, itab-fld5.
      endloop.
    * Upload_Data
    form upload_data.
      data: file type  rlgrap-filename.
      data: xcel type table of alsmex_tabline with header line.
      file = p_file.
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           exporting
                filename                = file
                i_begin_col             = '1'
                i_begin_row             = '1'
                i_end_col               = '200'
                i_end_row               = '5000'
           tables
                intern                  = xcel
           exceptions
                inconsistent_parameters = 1
                upload_ole              = 2
                others                  = 3.
      loop at xcel.
        case xcel-col.
          when '0001'.
            itab-fld1 = xcel-value.
          when '0002'.
            itab-fld2 = xcel-value.
          when '0003'.
            itab-fld3 = xcel-value.
          when '0004'.
            itab-fld4 = xcel-value.
          when '0005'.
            itab-fld5 = xcel-value.
        endcase.
        at end of row.
          append itab.
          clear itab.
        endat.
      endloop.
    endform.

  • How to select the data from a Maintainance View into an internal table

    Hi All,
    Can anybody tell me how to select the data from a Maintainance View into an internal table.
    Thanks,
    srinivas.

    HI,
    You can not retrieve data from A mentenance view.
    For detail check this link,
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
    Regards,
    Anirban

  • Saving the data from two info path forms in to a single list in share point 2010

    Hi ,
    I have two  info path forms are in share point page FM 1 and FM 2.
    In FM 1 I am getting data from lists by using drop down and casket drop down  and FM 2 i need to enter manually after entering
    i want to save both forms information(FM 1 & FM 2 ) in to a single list of  share point 2010
     If any knows the solution please reply me  
    Thanking You,
    Arun Darly

    Hi,
    Based on your description, my understanding is that you want to save the data from two info path forms in to a single list in share point 2010.
    We can't save the data from two info path forms in to a single list, but we can
    save the data from two info path forms in to a single library.
    Open the  FM 1 and FM 2 in Infopath(you have save it Locally once).
    Publish the FM 1 and FM 2 as content types named FM 1 and FM 2.
    Add the content types FM 1 and FM 2 into a document library, Then you can save the data
    from two info path forms in to a single library.
    Best Regards,
    Lisa Chen
    Lisa Chen
    TechNet Community Support

  • How to make users to select the date from calendar control my making the date field read only in date time control in external list in sharepoint 2010

    How to make users to select the date from calendar control only, by my making the date text field read only (don't want to let users type the date) in date time control in external list in sharepoint 2010. I am looking for a solution which can
    be done through sharepoint desginer / out of the box.
    thanks.

    Congratulate you got the solution by yourself. I am new to a
    WinForms calendar component, I feel so helpless on many problems even I'd read many tutorials. This question on the
    calendar date selection did me a great favor. Cheers.

  • Can a time machine usb drive backup the data from an external usb drive connected to and airport extreme*

    can a time machine usb drive conected to my mac book backup the data from an external usb drive connected to and airport extreme ?

    Hi Adam, if you think yoiur HD may be failing you could do a TM restore onto the new disk. I would rather see you do a clone either SuperDuper or CarbonCopy Cloner.Of your internal drive. That way you have a bootable backup in case it does fail.
    btw - what are the symptoms of your failing drive?
    -mj
    Message was edited by: macjack

  • Joining the data from two Tables

    I create a table with six months date from Jan to Jun. Another table with July trough Sept.
    Now I want one table in which I am going to at the end of the year have all 2007 fiscal data.
    I do not want to restore them ever back to the components. How do I do this?

    If I understand you correctly, I think you merely want to enlarge the first table enough to accommodate the data from the second table. Then select the cells in the second table and copy and paste them into the newly created space in the first table. Ask if you need more detail instructions on how to do this.

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

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

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

  • Get the data from a structure not a transparent table

    Hello masters, does anyone knows how to retrieve data from a structure?

    Structures do not contain data, they are mearly a way to describe it and are usually used in screen programming to collect data into which come from transparent tables.  For example, lets say you have data from two tables that need to be displayed on a screen, the data is related, so a good programming practice is to use a structure either described internally in the program, or in the ABAP dictionary.  Then in the program, you retrieve the data from the transpart tables and move the data to the structure fields, these structure fields are then defined within the screen. 
    Anyway, when you do F1 help on a field in a screen, and it is says that it is part of a structure, then this is becasue the structure is being used to group these fields into a common container when doing the screen programming, so it is a little trickier to find where the data is coming from, but not impossible.  One way is to use the ST05 to do a SQL trace on the program, this will tell you the tables being hit, and you can find the data that way.  Another way, is to debug the program, and see where the data is coming from.
    Regards,
    Rich Heilman

  • How to select the data from DB and write into File?

    Hi Experts,
    Can any one please help me,
    I want to write the data from a table "T1" from Data Base to one file in windows.
    This functionality i need to achive in SSIS package through script component and Execute SQL task if it's passible.
    If any other way is there please help me.

    through script component and Execute SQL task if it's passible
    The easier way is to use a "Data Flow" Task with a "OleDB Data Source" pointing the the SQL Server table / query and a "Flat File Destination" to export to a file.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Loading the data from a text file to a table using pl/sql

    Hi Experts,
    I want to load the data from a text (sample1.txt) file to a table using pl/sql
    I have used the below pl/sql code
    declare
    f utl_file.file_type;
    s varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    loop
    utl_file.get_line(f,s);
    insert into sampletable (a,b,c) values (s,s,s);
    c := c + 1;
    end loop;
    exception
    when NO_DATA_FOUND then
    utl_file.fclose(f);
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;
    and my sample1.txt file looks like
    1
    2
    3
    The data is getting inserted, with below manner
    select * from sampletable;
    A     B     C
    1     1     1
    2     2     2
    3     3     3
    I want the data to get inserted as
    A     B     C
    1     2     3
    The text file that I have is having three lines, and each line's first value should go to each column
    Please help...
    Thanks

    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;SY.

  • MDX query for to get the data from two cubes

    Hi
    Can you tell me how to create MDX query to get the values from two cubes.  (One hierarchy from first cube and one hierarchy from second cube)
    Can you give me one example.
    Regards,
    Madhu.
    Sudhan

    Hi Sudhan,
    According to your description, you want to retrieve data from two different cubes, right? The short answer is yes. To query multiple cubes from a single MDX statement use the LOOKUPCUBE function (you can't specify multiple cubes in your FROM statement).
    The LOOKUPCUBE function will only work on cubes that utilize the same source database as the cube on which the MDX statement is running. For the detail information about it, please refer to the link below to see the blog.
    Retrieving Data From Multiple Cubes in an MDX Query Using the Lookupcube Function
    Regards,
    Charlie Liao
    TechNet Community Support

  • Selecting the data from database and sending to users  using javamail

    how to select the records from database table in oracle and send automatically to users using javamail. I am able to send the txt msg. but dont know how to send the selected table data to users automatically.
    can anyone suggest how to write the steps with database connection to send msgs containing data to different users
    Thank You

    using JDBC..you want to
    1. create the connect
    2. open the connection
    3. query the table for the data
    4. loop through the resultset to retrieve rows of data
    5. do something with the data
    6. email the result
    once you have the data, it is up to you to determine the format to send to the user using JavaMail. It is easiest to send plain text
    here's a site that give code example (for all steps above relating to JDBC):
    http://javaalmanac.com/egs/java.sql/pkg.html

  • Problem in Selecting the data from EKPO and KONV tables

    Hi Experts,
    Presently I am working on Report with Comparision-Sheet Between the vendor's Quotations. I have to display the Discount, Freight, Packing and Forwarding, Vat in Item level data based on the conditions made in PO.
    As per my Knowledge, Condition Types are stored in KONV Table. But there is no relation between KONV and EKPO tables.  So, I am unable to print the data for Discount, Freight, Packing and Forwarding, Vat... How can I get the values from EKPO and KONV tables?
    Thanks in Advance.
    Thanks n Regards,
    Muralikrishna.

    Don't recall if this is correct, but you may need the condition number from the header (EKKO) combined with EKPO-EBELP or other field as you key to access KONV (KNUMH and KPOSN).  My site doesn't run PP, so can't verify if the data is actually stored that, so just a possibility.

Maybe you are looking for

  • Applet working on JBuilder but not on appletviewer!!!!!

    I ve made a keybord.Here some buttons are missing. The user presses the buttons and shapes a word!When the jButton22 is pressed(Comparison button) the applet tells him if the result is true or false and displays an image(imageIcon foruser in jlabel f

  • No longer manage to copy music from iPod to iTunes

    After the installation of iTunes 7, I cant find a way to transfer the music files from my iPod to iTunes 7. YamiPod failed with error window pop up - "You have used this iPod with an unknown iTunes version, probably a new one." Also I am failed by us

  • Connection object for a Business Partner

    Hi all I have to add a new field in ES55 screen to display Business partner Number.I tried with all screen exits by applying break-point but till now no success. My requirement is: when I create Connection object for a busines partner the address det

  • OBIEE 11.1.1.5.0 v. installation ERROR

    when I Install BI on my lap Windows 7 64x i found this message and i can't understand what he want "Enter the disk with label Oracle Fusion Middleware Business Intelligence 11g and disk number 4 or browse to the location containing the files for the

  • Saving videos from email

    I have some videos in my email that I would like to save in my Videos app on my Iphone but can't figure out how to save them.  Is it possible??