I have the main table EKPO joined to tables MLGN and MLGT as outer joins.
I have created an extra field BINALOC
in the infoset and want it to return a value from table MLGT under certain conditions:
- If the fields MLGN-LTKZE and MLGT-LGTYP match then return the associated MLGT-LGPLA field.
- If MLGN-LTKZE = 'R1', then only return relevant MLGT-LGPLA where MLGT-LGTYP = '006'.
- If MLGN-LTKZE <> MLGT-LGTYP return blank.
Currently I can do the first 2 conditions but unable to fit in the 3rd as it conflicts with the number 2.
I have tried a variety of IF statements and various orders for the IF conditions, and different join types.
This the current code I have in the extra field BINALOC
coding section:
IF MLGN-LTKZE = 'R1'.
select LGPLA as LGPLA
from *MLGT into BINALOC
where *MLGT~LGTYP eq '006'.
ENDSELECT.
else.
select LGPLA as LGPLA
from *MLGT into BINALOC
where *MLGT~LGTYP eq MLGN-LTKZE.
endselect.
endif.
I want the field to return blank when the fields I mentioned before do not match.
Currently it returns a copy of the field above it.
this?