12-12-2007 5:07 AM
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
12-12-2007 7:28 AM
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
12-12-2007 7:36 AM
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.