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: 

Outer Join

Former Member
0 Kudos

Hi all

i have two tables BSEG and SKAT.

For a company code(BUKRS) i need to select Account number (HKONT) from BSEG table and after that for that particular (Account number) HKONT i need to select the TXT50 from SKAT table.BUt i couldnt see any common fields in BSEG and SKAT and i tried using outer join which i was not successful.Please provide me the particular piece of code where i can retrieve the data.If its about outer join please provide me the code for the above condition.Am also mention the structure below.

DATA:BEGIN OF ty_hkont occurs 0,

HKONT TYPE BSEG-HKONT,

SAKNR TYPE SKAT-SAKNR,

TXT50 TYPE SKAT-TXT50,

END OF ty_hkont.

With Regards

Vijay

2 REPLIES 2

Former Member
0 Kudos

Hi

Do like this it will solve your problem

for a particular company code fetch the data from BSEG and fetch the account number and put that account number in skat table in the field

SAKNR --> GIVE THAT ACCOUNT NUMBER WHICH U HAD FETCHED FROM BSEG AND THEN u can get the long text from this

for outer join

Try like this


PARAMETERS p_cityfr TYPE spfli-cityfrom.

DATA: BEGIN OF wa,
carrid TYPE scarr-carrid,
carrname TYPE scarr-carrname,
connid TYPE spfli-connid,
END OF wa,
itab LIKE SORTED TABLE OF wa
WITH NON-UNIQUE KEY carrid.

SELECT s~carrid s~carrname p~connid
INTO CORRESPONDING FIELDS OF TABLE itab
FROM scarr AS s
LEFT OUTER JOIN spfli AS p ON s~carrid = p~carrid
AND p~cityfrom = p_cityfr.

LOOP AT itab INTO wa.
IF wa-connid = '0000'.
WRITE: / wa-carrid, wa-carrname.
ENDIF.
ENDLOOP.

Regards

Pavan

Former Member
0 Kudos

hi,

check tables BSID/BSAD for account receivable scenario

or BSIK/BSAK for accout payable scenario. these table holds most of fields u need. and these are good performance wise also.