Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add find button

Former Member
0 Kudos

I want to add a find button in a screen, so what is the concept and code to impliment the functionality of find button.

Points will be rewarded if help full.

Thanks & Regards.

SC Mahanta.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

here i have done same...

when user press find button , one screen get call and i enter search term in that and then it finds the row with same string...

if u want so then do like this

MODULE user_command_1000 INPUT.

CASE sy-ucomm.

WHEN 'BACK' OR 'UP' OR 'CANC'.

LEAVE PROGRAM.

WHEN 'FND'.

CALL SCREEN 1001 STARTING AT 37 5 ENDING AT 87 22.

ENDCASE.

ENDMODULE. " user_command_1000 INPUT

when user enters search term u need to call ur main screen

MODULE user_command_1001 INPUT.

CASE sy-ucomm.

WHEN 'OK'.

CALL SCREEN 1000.

ENDCASE.

ENDMODULE. " USER_COMMAND_1001 INPUT

now u will have on module in PBO in which u fetching data...

write this in that module..

MODULE fetch_data OUTPUT.

SELECT matnr matkl INTO CORRESPONDING FIELDS OF TABLE itab

FROM mara

WHERE matnr BETWEEN '000000000000000101' AND '000000000000000115'.

IF strin IS NOT INITIAL.

wa_itab-mark = 'X'.

LOOP AT itab.

IF itab-matnr = strin.

line1 = sy-tabix.

EXIT.

ENDIF.

ENDLOOP.

IF line1 0.

MODIFY itab INDEX line1 FROM wa_itab TRANSPORTING mark.

SET CURSOR LINE line1.

tab1-top_line = line1.

ENDIF.

ENDIF.

ENDMODULE. " fetch_data OUTPUT

strin is variable of screen 1001 in which i give search term..

reward if usefull.

2 REPLIES 2

Former Member
0 Kudos

Hi,

Its based on your reaquirement. You can place a button on the screen or application tool bar for 'FIND'. If you have more records to display as search result, then use table control for that.

Former Member
0 Kudos

hi,

here i have done same...

when user press find button , one screen get call and i enter search term in that and then it finds the row with same string...

if u want so then do like this

MODULE user_command_1000 INPUT.

CASE sy-ucomm.

WHEN 'BACK' OR 'UP' OR 'CANC'.

LEAVE PROGRAM.

WHEN 'FND'.

CALL SCREEN 1001 STARTING AT 37 5 ENDING AT 87 22.

ENDCASE.

ENDMODULE. " user_command_1000 INPUT

when user enters search term u need to call ur main screen

MODULE user_command_1001 INPUT.

CASE sy-ucomm.

WHEN 'OK'.

CALL SCREEN 1000.

ENDCASE.

ENDMODULE. " USER_COMMAND_1001 INPUT

now u will have on module in PBO in which u fetching data...

write this in that module..

MODULE fetch_data OUTPUT.

SELECT matnr matkl INTO CORRESPONDING FIELDS OF TABLE itab

FROM mara

WHERE matnr BETWEEN '000000000000000101' AND '000000000000000115'.

IF strin IS NOT INITIAL.

wa_itab-mark = 'X'.

LOOP AT itab.

IF itab-matnr = strin.

line1 = sy-tabix.

EXIT.

ENDIF.

ENDLOOP.

IF line1 0.

MODIFY itab INDEX line1 FROM wa_itab TRANSPORTING mark.

SET CURSOR LINE line1.

tab1-top_line = line1.

ENDIF.

ENDIF.

ENDMODULE. " fetch_data OUTPUT

strin is variable of screen 1001 in which i give search term..

reward if usefull.