07-10-2020 2:39 PM
07-14-2020 10:26 AM
Just as you did with table CSKT, define for LFA1 a LEFT JOIN instead of an INNER JOIN, because the reason for your select to not have any hits with the INNER JOIN, is that either your selected ACDOCA~LIFNR records do either not contain any data, or they do not contain any matching LFA1~LIFNR data, which could also because of missing zeros for ACDOCA~LIFNR. So first analyse what data you have in your selected ACDOCA records for attribute LIFNR, and then compare it to those in LFA1 for attribute LIFNR. You might have to analyse it in the debugger to realize whether it is because of missing zeros or not.
SELECT a~rldnr, a~rbukrs, a~gjahr, a~belnr, a~racct, a~rcntr, a~prctr, a~wsl, a~budat,
a~blart, a~zuonr, a~lifnr, a~ps_posid, a~sgtxt, a~koart, a~timestamp,
b~saknr, b~txt50, c~bukrs, c~belnr AS belnr1, c~gjahr AS gjahr1, c~bktxt,
d~name1, d~lifnr AS lifnr1, e~posid, e~post1, f~kostl, f~ltext
FROM acdoca AS a
INNER JOIN skat AS b ON a~racct EQ b~saknr AND b~spras = @sy-langu
INNER JOIN bkpf AS c ON a~rbukrs EQ c~bukrs AND a~gjahr EQ c~gjahr AND a~belnr EQ c~belnr
LEFT JOIN lfa1 AS d ON a~lifnr EQ d~lifnr
INNER JOIN prps AS e ON a~ps_posid EQ e~posid
LEFT JOIN cskt AS f ON a~rcntr EQ f~kostl AND f~spras = @sy-langu
INTO TABLE @DATA(lt_acdoca).
WHERE a~rldnr = @lc_led
AND a~rbukrs = @p_rbukrs
AND a~belnr IN @so_belnr
AND a~racct IN @so_racct.
cl_demo_output=>display( lt_acdoca ).
Once you have assessed the problem, this will explain to you, why you dont hit any records with the INNER JOIN for LFA1. Afterwards, the community will be able to help you out more, but this would require another community question in case it deals with a situation where ACDOCA~LIFNR is not filled or filled incorrectly.
07-10-2020 3:43 PM
Please use the "code" button when posting code.
07-10-2020 5:41 PM
Please format your code with button "CODE".
07-13-2020 11:36 PM
Do you not have matching records in LFA1?
An inner join filters against the other side per definition...
07-14-2020 10:26 AM
Just as you did with table CSKT, define for LFA1 a LEFT JOIN instead of an INNER JOIN, because the reason for your select to not have any hits with the INNER JOIN, is that either your selected ACDOCA~LIFNR records do either not contain any data, or they do not contain any matching LFA1~LIFNR data, which could also because of missing zeros for ACDOCA~LIFNR. So first analyse what data you have in your selected ACDOCA records for attribute LIFNR, and then compare it to those in LFA1 for attribute LIFNR. You might have to analyse it in the debugger to realize whether it is because of missing zeros or not.
SELECT a~rldnr, a~rbukrs, a~gjahr, a~belnr, a~racct, a~rcntr, a~prctr, a~wsl, a~budat,
a~blart, a~zuonr, a~lifnr, a~ps_posid, a~sgtxt, a~koart, a~timestamp,
b~saknr, b~txt50, c~bukrs, c~belnr AS belnr1, c~gjahr AS gjahr1, c~bktxt,
d~name1, d~lifnr AS lifnr1, e~posid, e~post1, f~kostl, f~ltext
FROM acdoca AS a
INNER JOIN skat AS b ON a~racct EQ b~saknr AND b~spras = @sy-langu
INNER JOIN bkpf AS c ON a~rbukrs EQ c~bukrs AND a~gjahr EQ c~gjahr AND a~belnr EQ c~belnr
LEFT JOIN lfa1 AS d ON a~lifnr EQ d~lifnr
INNER JOIN prps AS e ON a~ps_posid EQ e~posid
LEFT JOIN cskt AS f ON a~rcntr EQ f~kostl AND f~spras = @sy-langu
INTO TABLE @DATA(lt_acdoca).
WHERE a~rldnr = @lc_led
AND a~rbukrs = @p_rbukrs
AND a~belnr IN @so_belnr
AND a~racct IN @so_racct.
cl_demo_output=>display( lt_acdoca ).
Once you have assessed the problem, this will explain to you, why you dont hit any records with the INNER JOIN for LFA1. Afterwards, the community will be able to help you out more, but this would require another community question in case it deals with a situation where ACDOCA~LIFNR is not filled or filled incorrectly.
09-13-2020 5:18 AM
shanmukhtejas6242_3, do you continue to have issues or were you able to solve your problem?
Please add comments to your question that further describe your problem or add an answer that describes how you solved your problem.
If your problem is solved, accept an answer if it helped you and please close the question.