Skip to Content
avatar image
Former Member

two transparent table into one internal table

good day experts.

I just want to ask this cause I am puzzled what to do.

I have two transparent tables (BSID and BSAD). I want to take the fields BUDAT and DMBTR on both tables and place it on a single internal table. So what I did is, i make two SELECT statements like this:

*first select statement giving One (1) result

SELECT budat dmbtr INTO table it_lastPay

FROM bsid

WHERE kunnr = p_wa_data_kunnr

AND budat =< s_date

AND blart = 'DZ'

AND umsks IN ('', 'L', 'A')

AND umskz IN ('', 'L', 'A')

AND bschl IN ('15', '19').

*second select statement giving Four (4) results

SELECT budat dmbtr INTO table it_lastPay

FROM bsad

WHERE kunnr = p_wa_data_kunnr

AND budat =< s_date

AND blart = 'DZ'

AND umsks IN ('', 'L', 'A')

AND umskz IN ('', 'L', 'A')

AND bschl IN ('15', '19').

But the result is not what I expect. With this staments above, the result will be just four records.

The first select stament was superceded by the second statement.

Is there any idea to correct this statement or anything to do to produce five records using one internal table?

Thanks a lot for your replies.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Oct 20, 2008 at 09:15 AM

    replace "INTO" by "APPENDING" in second select statement.

    Thomas

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 09:17 AM

    hi,

    In second select stmt use APPENDING.....

    for syntax press f1 on select stmt.

    Rgds.,

    subash

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 20, 2008 at 09:17 AM

    hi,

    Use Appending in the second select query

    check the similar select quieries

    
      SELECT   KNA1~KTOKD KNA1~KUNNR KNA1~LIFNR KNA1~adrnr
               KNA1~LAND1 KNA1~SPRAS KNA1~VBUND
               KNB1~BUSAB KNB1~BUKRS KNB1~ALTKN 
         INTO TABLE T_KNA
               FROM KNA1 INNER JOIN KNB1
               ON ( KNA1~KUNNR = KNB1~KUNNR )
             FOR ALL ENTRIES IN T_KUNNR
            WHERE KNA1~KUNNR = T_KUNNR-KUNNR
              And t_kunnr-type = u2018Cu2018
              AND KNB1~BUKRS = P_BUKRS.
                         
    
    
      SELECT   LFA1~KTOKD lFA1~KUNNR LFA1~LIFNR LFA1~ANRNR
               LFA1~LAND1 LFA1~SPRAS LFA1~VBUND
               LFB1~BUSAB LFB1~BUKRS LFB1~ALTKN 
               APPENDING TABLE T_KNA                                       " Check this
               FROM LFA1 INNER JOIN LFB1
               ON ( LFA1~KUNNR = LFB1~KUNNR )
             FOR ALL ENTRIES IN T_KUNNR
            WHERE LFA1~KUNNR = T_KUNNR-KUNNR
              And t_kunnr-type = u2018Vu2018
              AND lfB1~BUKRS = P_BUKRS.
    
    

    regards

    prasanth

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 09:18 AM

    Hi,

    Define internal table with four fields and then select..

    SELECT budat dmbtr INTO (it_lastPay-budat1 , it_lastpay-dmbtr1) FROM bsad

    ....

    ....

    ....

    ...

    same second select..

    SELECT budat dmbtr INTO (it_lastPay-budat2 , it_lastpay-dmbtr2) FROM bsid

    ......

    Rgds,

    Add comment
    10|10000 characters needed characters exceeded