vendredi 29 mars 2019

How to return a value when the fields don't match in SAP Infoset

I have Main table EKPO joined to tables MLGN and MLGT as outter joins. I have created an extra field in the infoset and want it to return a value from table MLGT under certain conditions. 1. if Fields MLGN-LTKZE and MLGT-LGTYP match then return the associated MLGT-LGPLA field. 2. IF MLGN-LTKZE = R1, then only return relevant MLGT-LGPLA where MLGT-LGTYP = 006. 3. if MLGN-LTKZE <> MLGT-LGTYP return blank.

Currently I can do the 1st 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. I've tried different joint types and ways.

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.

This the current code I have in the extra field coding section.

I want the the field to return blank when the fields I mentioned before do not match. Currently it returns a copy of the field above it.

Aucun commentaire:

Enregistrer un commentaire