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 do we capture the record selected in the table control?

Former Member
0 Kudos

Hi,

In the table control when the user selects a record we need to capture that record and pass it to the next screen.how can we do this?

Thanks,

Rakesh.

11 REPLIES 11

Former Member
0 Kudos

HI,

By using the CONCATENATE statement u can select it.

Kishore.

0 Kudos

Hi Kishore,

can u plz explain in detail how can we do that using concatenate statment?

Thanks,

Rakesh.

Former Member
0 Kudos

1. Add on more field to ur internal table of lenght 1 say BOX(1)

2. Double click on table control , in attributes , select the checkbox <b>w/ selColumn</b> and to right of that give ITAB-BOX where itab is ur internal table

3. And on attributes screen under Line Selection select Single Selection

4. Now you can select your table control entries using that BOX

5. Now using READ statement you can get the selected records details and pass them to next screen

0 Kudos

Hi Chandrashekhar,

We have implemnted the box the internal table.My question is when we select the record where will that record be stored.Do we need to read the int table used to display the record and in which event?

Thanks,

Rakesh.

0 Kudos

hi Rakesh,

You can loop at the internal table in PAI

   Loop at itab where BOX eq 'X'.
      Here you can get the record details , you can pass them to next screen
   Endloop.

0 Kudos

Hi Chandrasekhar,

The check value 'X' is not getting captured in the internal table.we have implemented all the requirments.so after looping the int table we are not able to capture the record selected.

loop at t_itab1 into w_itab1.

if w_itab1-check = 'X'.

call screen 300.

endif.

endloop.

Thanks,

Rakesh.

0 Kudos

Have you given the box name as t_itab1-CHECK ?

check the demo program DEMO_DYNPRO_TABCONT_LOOP and compare if you had forgptten anything

0 Kudos

Hi,

If the value is not getting in captured in the internal table then i guess it might be storing at the work area level . Do like this.

In PBO where you declared the table control.

loop at it_itab1 into wa_itab1.... with tc_table-currentline.

*Modify your internal table.

MODULE modify_itab.

endmodule.

Module modify_itab.

if wa_itab-box is not initial.

modify it_itab1 from wa_itab transporting selec where matnr = wa_itab-matnr.

endif.

endmodule.

Now it will record the selected values based on that write your logic.

Br,

Laxmi

former_member673464
Active Contributor
0 Kudos

Hi Rakesh,

You can use get cursor as follows.

To find out the cursor position, use the following statement:

GET CURSOR FIELD <f> [OFFSET <off>]

[LINE <lin>]

[VALUE <val>]

[LENGTH <len>].

This statement transfers the name of the screen element on which the cursor is positioned during a user action into the variable <f>. If the cursor is on a field, the system sets SY-SUBRC to 0, otherwise to 4.

The additions to the GET CURSOR statement have the following functions:

OFFSET writes the cursor position within the screen element to the variable <off>.

LINE writes the line number of the table to the variable <lin> if the cursor is positioned in a table control. If the cursor is not in a table control, <lin> is set to zero.

VALUE writes the contents of the screen field in display format, that is, with all of its formatting characters, as a string to the variable <val>.

LENGTH writes the display length of the screen field to the variable <len>.

Cursor position on the screen.

PROGRAM DEMO_DYNPRO_GET_CURSOR.

DATA: OK_CODE LIKE SY-UCOMM,

SAVE_OK LIKE OK_CODE.

DATA: INPUT_OUTPUT(20) TYPE C,

FLD(20) TYPE C,

OFF TYPE I,

VAL(20) TYPE C,

LEN TYPE I.

CALL SCREEN 100.

MODULE INIT_SCREEN_0100 OUTPUT.

SET PF-STATUS 'STATUS_100'.

ENDMODULE.

MODULE USER_COMMAND_0100 INPUT.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

WHEN 'CANCEL'.

LEAVE PROGRAM.

WHEN 'SELE'.

GET CURSOR FIELD FLD OFFSET OFF VALUE VAL LENGTH LEN.

ENDCASE.

ENDMODULE.

When you run the program, the user can select any screen element by double-clicking it, or use any screen element connected to the function code SELE. The output fields on the screen return the cursor position.

regards,

veeresh.

Former Member
0 Kudos

HI,

example:

DATA : FNAM(20) TYPE C,

IDX TYPE C.

MOVE 1 TO IDX.

LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.

CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.

NOTE: LFBK-BANKS this must be the first field in the table control.

Kishore.

Former Member
0 Kudos

Hi Rakesh,

I have solution to your problem... Do give points once u find solution...

Here we go....

loop at t_itab1 into w_itab1.

if w_itab1-check = 'X'.

<<<< here u set a prameter id for the field which u want to pass the data...>>>

It will go with the data in that parameter and u will see it present on that screen 300

call screen 300.

endif.

endloop.

Hope this will resolve the problem...

DARSHAN