Skip to Content
0
Former Member
Feb 25, 2009 at 07:30 AM

Alternative Logic - Required !!!

27 Views

hi guys,

i have to write a function module for search the matching records in the table ekko.

field names : ebeln,bukrs,lifnr (3 fields).

the user will give any values from these three fields that may (all three fields or 1 field or 2 fields).

when he clicks execute it should come out the matching selection from the user.

My logic for the above requirment is :

*step-1 :

select ebeln bukrs lifnr from ekko into CORRESPONDING FIELDS OF TABLE lt_ekko1.

*step-2

if po_no is not initial.

delete lt_ekko1 where ebeln ne po_no.

endif.

*step-3

if co_code is not INITIAL.

delete lt_ekko1 where bukrs ne co_code.

endif.

*step-4

if vendor is not INITIAL.

delete lt_ekko1 where lifnr ne vendor.

endif.

*now my internal table contains the final output in lt_ekko1 internal table.

*this is perfecftly working for me.

But in the case of more fields i need to use more lines of code , instead of this , could you suggest

alternative logic to minimise the code for achieving this result.

regards,

Giri