04-27-2009 8:38 AM
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.
04-27-2009 8:54 AM
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
04-27-2009 9:14 AM
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
04-27-2009 9:18 AM
HI,
YOU CAN USE ONE IS FOR ALL ENTRIES...
OR YOU CAN LOOP AND
USE APPENDING CORRESPONDING FIELDS OF ...
with regrads
janani
04-27-2009 9:43 AM
Use Appending addition in the second select Query where you are fetching the data from BSAD table.
Regards,
Nikhil Joshi