Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BSAD and BSID data i need to put in one internal table

Former Member
0 Kudos

hi experts,

from BSAD i will get cleared items , from BSID i will get open items .

i wnt to display display boath in one report how i make code plz help me.

if i select all items check box ( PLZ corect my code ) .

IF P_EX3 = 'X'.

SELECT BELNR BUKRS BLART BUDAT XBLNR FROM BKPF INTO TABLE it_final WHERE bukrs = p_bukrs

AND blart in p_blart AND budat IN budat.

SELECT belnr kunnr BUKRS augbl FROM BSID INTO TABLE it_final WHERE belnr = it_final-belnr AND kunnr in p_kunnr

AND bukrs = p_bukrs .

SELECT belnr kunnr BUKRS augbl FROM BSAD INTO TABLE it_final WHERE belnr = it_final-belnr

AND kunnr in p_kunnr AND bukrs = p_bukrs .

*IF SY-SUBRC = 0 .

APPEND it_final.

CLEAR it_final.

*endif.

*ENDSELECT.

*ENDSELECT.

*ENDSELECT.

ENDIF.

plz correct my code

Regards,

Kumar.

4 REPLIES 4

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Try this:

SELECT BELNR BUKRS BLART BUDAT XBLNR FROM BKPF INTO TABLE it_final WHERE bukrs = p_bukrs AND blart in p_blart AND budat IN budat.

SELECT belnr kunnr BUKRS augbl FROM BSID INTO TABLE it_final1 for all entries in it_final WHERE belnr = it_final-belnr AND kunnr in p_kunnr AND bukrs = p_bukrs .

SELECT belnr kunnr BUKRS augbl FROM BSAD appending TABLE it_final1 for all entries in it_final WHERE belnr = it_final-belnr AND kunnr in p_kunnr AND bukrs = p_bukrs

Former Member
0 Kudos

Hi,

If you need to add data from two tables into a single internal table the only way would be to first select data from one table and then appemd records fromthe second table into the same internal table. IF you used INTO TABLE the second table contents will overwrite the contents retrived from the first table.

So use something like


select <field list> from BSID into table itab where <condition>.

select <field list> from BSAD appending table itab wheer <condition>.

.

This will sove your problem. Just make sure the field do exist in the internal table.

Regards,

Sachin

Former Member
0 Kudos

HI,

YOU CAN USE ONE IS FOR ALL ENTRIES...

OR YOU CAN LOOP AND

USE APPENDING CORRESPONDING FIELDS OF ...

with regrads

janani

Former Member
0 Kudos

Use Appending addition in the second select Query where you are fetching the data from BSAD table.

Regards,

Nikhil Joshi