Skip to Content

Dynamic Search based on given input pattern if Exact input value is unknown

Hi,

This Document illustrates about how to search based on given input any two letters  using CP sql command (CP : Contains Pattern).

Scenario : when we enter any  number or any input like ’00’ in input field  , it should search all the material numbers which consists of ’00’ as shown below .

1.Enter any value in the input field whixh should be relavent to input field.

Capture.PNG

2.After click on F4 Help , result should be as shown below.

capture1.PNG

Program :

declare a range for BOM number and please use the below code for creating input help.

TYPES : BEGIN OF ty_range,

           sign TYPE char1,

           option TYPE char2,

           low TYPE stkostlnr,

           high TYPE stkostlnr,

     END OF ty_range.

TYPES : BEGIN OF ty_stko ,

         stlr TYPE stkostlnr,

         END OF ty_stko.

DATA: lt_stko TYPE STANDARD TABLE OF ty_stko,

       lw_stko TYPE ty_stko,

       lt_range TYPE STANDARD TABLE OF ty_range,

       lw_range TYPE ty_range.

PARAMETERS bom TYPE stkostlnr.

*—->Processing

******Check for BOM List for the given input value

lw_rangesign = ‘I’.

lw_rangeoption = ‘CP’.

CONCATENATE ‘*’ bom  ‘*’ INTO lw_rangelow.

APPEND lw_range TO lt_range.

SELECT stlnr

   FROM stko

   INTO CORRESPONDING FIELDS OF TABLE lt_stko

   WHERE stlnr IN lt_range .

just change the table and field names it will work…

Thanks and Regards,

Lokeswar Reddy Byni.


2 Comments
You must be Logged on to comment or reply to a post.