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 in Table Control

Former Member
0 Likes
1,186

Hi Experts..

I am working in table control.

I have one input/output field on screen, I want to search the entered field in the table control and mark that one.

means when user will enter data in that field and press enter, cursor should go to that field in table control.

how to do this..

thanks in advance...

Hi Experts..

I am working in table control.

I have one input/output field on screen, I want to search the entered field in the table control and mark that one.

means when user will enter data in that field and press enter, cursor should go to that field in table control.

how to do this..

thanks in advance...

11 REPLIES 11
Read only

Former Member
0 Likes
1,102

hi,

For this you should either go for a Table control with Position button ( SEARCH SCN) or See F1 Help for FIND IN TABLE.

Regards

Karthik D

Read only

Former Member
0 Likes
1,102

Hi,

Please try this logic in the PAI.

loop at itab into wa where field eq entered_value.

wa-w_sel = 'X'.

modify itab from wa transporting field index sy-tabix.

endloop.

Read only

Former Member
0 Likes
1,102

Hello,

When some one enters a entry and clicks enter.

in your PBO add a MODULE.

just inside your loop endloop.

LOOP AT itab INTO wa WITH CONTROL tbcl.

MODULE move_records_for_display.

MODULE mark_a_particular_record.

ENDLOOP.

-


MODULE mark_a_particular_record.

IF wa-field1 = search_field.

<then mark the w\selection parameter as X>

SEL = 'X'

ENDMODULE.

Hope this will solve your problem.

Cheers,

Suvendu

Read only

Former Member
0 Likes
1,102

hi

try this

in se51

PBO

Module_status_0800.

loop with control <tcname>

module fill_tc.

endloop.

PAI

Module_usercommand_0800.

loop with control <tcname>

module read_tc.

endloop.

module fill_tc.

IF wa-field1 = search_field.

<then mark the w\selection parameter as X>

SEL = 'X'

endloop.

OR

if wk_field1 is not initial.

loop at screen.

if ( ( screen-name = 'ITAB-SNO' or

screen-name = 'ITAB-SNAME' or

screen-name = 'ITAB-SCITY' or

screen-name = 'ITAB-SEDU' or

screen-name = 'ITAB-SPERCENT' )

and control-line_selector eq itab-select ).

screen-input = 1.

endif.

modify screen.

endloop.

endmodule

Regards

Read only

0 Likes
1,102

Thanks Murali..

But I cann't understand, what is 'wa-field1',

is it internal table field or what.

and what is 'SEL'?

can u explain me?

Read only

0 Likes
1,102

Hello,

SEL is the w\selection parameter in table control attribute.

and wa-field1 is the name of the field for which you are creating the search help.

Cheers,

Suvendu

Read only

0 Likes
1,102

'SEL' or whatever it is is the field name that you have used for the selection button in the table control.

Read only

Former Member
0 Likes
1,102

Hi,

Loop at through the internal table, which is associated with the table control and use 'SET CURSOR' statement when you find the approprite line.

Thanks and regards,

Venkat

Read only

Former Member
0 Likes
1,102

HI,

I hope you under stand SEL .

This field should be present in your Internal table.

You will be running a loop in PAI for Table control (It won't help to find the lines you want).

So Run a seperate loop Outside for the ITAB.

Check for the value you want if it found make the SEL = "X".

Note down the sy-tabix value.

then PBO will run to Populate the TC.

After that.

Set TC-Top_line = sy-tabix.(not sure about the TC property- check the help of TC)

Then.

Screen will display with the line you want as first line

Hope this will Help you

Read only

Former Member
0 Likes
1,102

Hi,

First loop the internal table and the index number of the record of value you have entered in the first screen.

in table control screen


LOOP AT GT_EMP INTO WA_EMP
  WITH CONTROL TC1 CURSOR TC1-CURRENT_LINE.

 MODULE M_MOVE_DATA.

ENDLOOP.

in that M_MOVE_DATA module.



MOVE-CORRESPONDING WA_EMP TO ZEMP_REC.
  IF WA_EMP-REQNO = P_REQNO.
    TC1-CURRENT_LINE = SY-STEPL.
    TC1-TOP_LINE = INDEX.
    SET CURSOR FIELD 'ZEMP_REC-REQNO' LINE TC1-CURRENT_LINE.
  ENDIF.

Hope these will solve the problem

Regards,

Kumar M.

Read only

Former Member
0 Likes
1,102

HI I have done the same in my program,hope the code will be useful to u.

Requirement :For this there should be one table control, one input field (inwhich u will enter something and will search in the table control),one find button(is a push button to which a fcode is attached),one find next button(is a push button to which a fcode is attached),and a clear button.

Process:first enter material no in the input field and press find button twice - it will take u to that line item in table control. Then press find next button - it takes u to all other line items starting from first line item...Then press clear button to start searching for another new material number.

Code:It should be in PBO,should be the last code

IF SY-UCOMM EQ 'SER'.
    PERFORM SEARCH_MATNR.
  ELSEIF SY-UCOMM EQ 'SERN'.
    PERFORM SEARCH_MATNR_NEXT.
  ELSEIF SY-UCOMM EQ 'CLE'.
    PERFORM CLEAR_MATNR.
  ENDIF.

****find button code

FORM SEARCH_MATNR .
  DATA: WA_BOQ_DUMMY TYPE ST_BOQ.
  CLEAR WA_BOQ_DUMMY.
  IF S_MATNR IS NOT INITIAL.
    LOOP AT IT_BOQ INTO WA_BOQ_DUMMY WHERE MATNR EQ S_MATNR.
      WA_BOQ_DUMMY-SEL = 'X'.
      MODIFY IT_BOQ FROM WA_BOQ_DUMMY.
      TAB_CNTL-TOP_LINE = SY-TABIX.
      EXIT.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " SEARCH_MATNR

**find next code

FORM SEARCH_MATNR_NEXT .
  DATA: VAR_FLAG14 TYPE C.
  CLEAR VAR_FLAG14.
  DATA: WA_BOQ_DUMMY TYPE ST_BOQ.
  CLEAR WA_BOQ_DUMMY.
  IF S_MATNR IS NOT INITIAL.
    VAR_FLAG14 = 'X'.
    LOOP AT IT_BOQ INTO WA_BOQ_DUMMY WHERE MATNR EQ S_MATNR.
      IF TAB_CNTL-TOP_LINE NE SY-TABIX.
        IF VAR_FLAG14 EQ 'X'.
          WA_BOQ_DUMMY-SEL = 'X'.
          MODIFY IT_BOQ FROM WA_BOQ_DUMMY.
        ELSEIF VAR_FLAG14 EQ ' '.
          WA_BOQ_DUMMY-SEL = 'X'.
          VAR_FLAG14 = 'X'.
          TAB_CNTL-TOP_LINE = SY-TABIX.
          MODIFY IT_BOQ FROM WA_BOQ_DUMMY.
        ENDIF.
      ELSEIF TAB_CNTL-TOP_LINE EQ SY-TABIX.
        WA_BOQ_DUMMY-SEL = 'X'.
        VAR_FLAG14 = ' '.
        MODIFY IT_BOQ FROM WA_BOQ_DUMMY.
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " SEARCH_MATNR_NEXT

***clear code

FORM CLEAR_MATNR .
  CLEAR S_MATNR .
  DATA: WA_BOQ_DUMMY TYPE ST_BOQ.
  CLEAR WA_BOQ_DUMMY.
  LOOP AT IT_BOQ INTO WA_BOQ_DUMMY WHERE SEL EQ 'X'.
    WA_BOQ_DUMMY-SEL = ' '.
    MODIFY IT_BOQ FROM WA_BOQ_DUMMY.
  ENDLOOP.
ENDFORM.                    " CLEAR_MATNR

If it was useful,then provide points

Regards

Sajid

Edited by: shaik sajid on May 29, 2009 12:35 PM