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: 

Table Control

Former Member
0 Kudos

hi all,

I am doing table control program.

I know about view data from database in table control program.

but i want to search the data in table control.

First type as input field in empno. then click as search button..

view data in table control..

how is the program it..

if u can it then send me program..

reply me soon.

thx,

s.suresh

7 REPLIES 7

Former Member
0 Kudos

Hi,

DATA text_table TYPE TABLE OF string.

APPEND: 'Sweet child in time' TO text_table,

'you''ll see the line' TO text_table,

'the line between' TO text_table,

'good and bad.' TO text_table.

SEARCH text_table FOR '.see.' AND MARK.

in the same way u can search table control.

Plzz reward points if it helps.

0 Kudos

hi..

i cannot understand it..

please check correct program..

Former Member
0 Kudos

hi,

Do u want like this ?

U displaying ur data in table control and when u press search button it should ask for input and then it will find that entry from table control?

If u looking for this then i can help u......

reply me

0 Kudos

hi dhwani,

yes i want it..

send me correct program..

reply me soon..

thx,

s.suresh.

0 Kudos

hi,

create one button on screen named 'FND'.

write down in user_command module of that screen

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

now in the user_command module of second screen ( which is called to enter search term)

write this

MODULE user_command_1001 INPUT.

CASE sy-ucomm.

WHEN 'OK'.

CALL SCREEN 1000. first screen......

ENDCASE.

ENDMODULE. " USER_COMMAND_1001 INPUT

now u having one module in which u fetching data from database table in PBO...

write like 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

here strin is my I/O field on second screen 1001 in which i entre search term

reward if usefull....

Edited by: Dhwani shah on Jan 30, 2008 11:11 AM

0 Kudos

In first screen say 0100 create a button for "position", if user click on that button call anothoer screen (0210) with input search fields, here if user click on ok it will back to the main screen (0100) at the seleted field: check the code which I used:

*In MAin screen (0100) PAI:

WHEN 'POSI' .

CALL SCREEN 0210 STARTING AT '27' '7' ENDING AT '70' '14' .

ENDCASE.

*In screen 210 PAI

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0210.

CASE sy-ucomm.

WHEN 'CANC'. "Cancel

CLEAR : g_210plant ,

g_210reqno .

WHEN 'OK'. "OK

LOOP AT gt_scr200 TRANSPORTING NO FIELDS

WHERE werks = g_210plant OR reqpr = g_210reqno.

SET CURSOR LINE sy-tabix.

tc_scr200-top_line = sy-tabix .

CLEAR : g_210plant ,

g_210reqno .

EXIT.

ENDLOOP.

ENDCASE.

LEAVE TO SCREEN 0 .

*g_210plant and g_210reqno are my search fields*

tc_scr200 is a table contron in first screen,

gt_scr200 is the internal table.

Thanks,

Sridhar

Edited by: sridher reddy on Jan 30, 2008 1:30 PM

Former Member
0 Kudos

hi

good

The fun module TABLE_GET_KEY_TO_SET_CUR_ROW is called for the Function position to find the correct Row .

Means suppose in you table control you have lot of records .To find particular and select that this Fm is useful..

EX:

1) add a button say search box .

2) when user clicks on this button show

dialog box with enter key field No:

3) when user enter box no search table control

intternal table and if found

set tc1-current_line = sy-tabix of record found.

DATA : ata: h_table_key(20) type c.

'V_TQ85 is internal table.

call function 'TABLE_GET_KEY_TO_SET_CUR_ROW'

EXPORTING

table = 'V_TQ85'

IMPORTING

table_key = h_table_key

EXCEPTIONS

cancelled_by_user = 1

table_not_found = 2

others = 3.

reward point if helpful.

thanks

mrutyun^