Application Development and Automation 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: 
Read only

Search button on Table control

Former Member
0 Likes
1,155

Hi everybody!

I'll apreciate so much a code for generate a search button like (Position button) on a table control.

Regards,

DanielM

3 REPLIES 3
Read only

former_member181966
Active Contributor
0 Likes
609

Refer main prog :SAPL0H10

<b> Prog = LSVIMIXX line # 187</b>

CASE function. 'POSI'<b>

PERFORM popup_positionieren.</b>

<i><u><b>in source code :LSVIMF3I</b></u></i>

Hope this’ll give you idea!!

<b>Pl... award the points.</b>

Good luck

Thanks

Saquib Khan

"Some are wise and some are otherwise"

Read only

Former Member
0 Likes
609

Logic

1. Put a position button and entry text field (search content) under the table control. Position button should have one function code 'PBUT' (set in button arrtibute). Set the name of text field as 'POSITION_VAL'.

2. Content of table control will be in an internal table. The field field will be used for positioning.

3. Enter the search (key) field in text field. Click position button.

4. Write code for this button click in PAI event (Module user_command) of that screen.

Case sy_ucomm.

When 'PBUT'.

Write code here to bring the row as selected in table control.

Endcase.

Bala

Read only

Former Member
0 Likes
609

FORM search_element TABLES itab CHANGING tc TYPE cxtab_control.

DATA: l_action,

l_value TYPE kcd_value2,

l_cols LIKE LINE OF tc1-cols,

l_table_name(20),

l_find_by(20).

CALL FUNCTION 'POPUP_TO_SEARCH_VALUE'

EXPORTING

textline1 = text-106

titel = text-107

valuelength = '20'

IMPORTING

action = l_action

value = l_value

EXCEPTIONS

titel_too_long = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

IF l_action = 'J'.

READ TABLE tc-cols INTO l_cols WITH KEY selected = 'X'.

IF sy-subrc <> 0.

MESSAGE ...

ENDIF.

SPLIT l_cols-screen-name AT '-' INTO l_table_name l_find_by.

READ TABLE itab WITH KEY (l_find_by) = l_value.

IF sy-subrc = 0.

tc-top_line = sy-tabix.

ELSE.

MESSAGE ...

ENDIF.

ENDIF.

ENDFORM. " SEARCH_ELEMENT