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

Table control query

Former Member
0 Likes
777

Hello All,

I have a query for table control.

I am displaying my internal table in a table control & allowing user to change data when he ckicks change.

The requirement is that the first row should not get open for input.

Sample code Please.

Regards,

Dilip

7 REPLIES 7
Read only

dhananjay_khamkar
Participant
0 Likes
748

Hi Diliip,

Have you used index to resd table line.

e.g.

DATA: L_STEPL TYPE SYSTEPL,

READ TABLE itab INDEX L_STEPL.

Hope this will work.

If not please post your code here.

Rgards,

Dhanu.

Read only

0 Likes
748

Hello,

Following is my code which is making all the lines in table control editable.

loop at tab-cols into cols.

IF cols-screen-input = '0'.

cols-screen-input = '1'.

ELSEIF cols-screen-input = '1'.

cols-screen-input = '0'.

ENDIF.

MODIFY tab-cols FROM cols INDEX sy-tabix.

endloop.

Read only

0 Likes
748

Are you doing this in PBO? Any screen modification should be done in PBO.

Read only

0 Likes
748

Hi Again,

Please check follwing code where i have underlined.

or check program RSDEMO_TABLE_CONTROL .

&----


*& Report RSDEMO_TABLE_CONTROL *

*& *

&----


*& *

*& *

&----


REPORT RSDEMO_TABLE_CONTROL .

CONTROLS TABLE_CONTROL TYPE TABLEVIEW USING SCREEN 100.

<u>TABLES SDYN_SDW4.

DATA SDYN_ITAB LIKE STANDARD TABLE OF SDYN_SDW4.</u>DATA INIT.

DATA OK_CODE LIKE SY-UCOMM.

DATA SAVE_OK LIKE SY-UCOMM.

DATA MARK.

DATA COL TYPE CXTAB_COLUMN.

CALL SCREEN 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GRUND'.

SET TITLEBAR '100'.

IF INIT IS INITIAL.

  • Datenbeschaffung

SELECT CARRID CONNID CITYFROM AIRPFROM CITYTO AIRPTO DEPTIME ARRTIME

DISTANCE DISTID

FROM SPFLI

INTO CORRESPONDING FIELDS OF TABLE SDYN_ITAB.

DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES.

INIT = 'X'.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module FILL_TABLE_CONTROL OUTPUT

&----


  • text

----


MODULE CHANGE_SDYN_CONN OUTPUT.

<u>* you can change the content of current table control line via

  • sdyn_conn

  • READ TABLE sdyn_itab INTO sdyn_conn INDEX table_control-current_line.</u>

ENDMODULE. " FILL_TABLE_CONTROL OUTPUT

&----


*& Module READ_TABLE_CONTROL INPUT

&----


  • text

----


MODULE READ_TABLE_CONTROL INPUT.

  • Check input values

IF MARK = 'X' AND SAVE_OK = 'DELETE'.

DELETE TABLE SDYN_ITAB FROM sdyn_sdw4.

<u>DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES.</u> ENDIF.

ENDMODULE. " READ_TABLE_CONTROL INPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

WHEN 'SORT'.

DATA: FLDNAME(100),HELP(100).

READ TABLE TABLE_CONTROL-COLS INTO COL WITH KEY SELECTED = 'X'.

SPLIT COL-SCREEN-NAME AT '-' INTO HELP FLDNAME.

SORT SDYN_ITAB BY (FLDNAME).

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module EXIT INPUT

&----


  • text

----


MODULE EXIT INPUT.

LEAVE PROGRAM.

ENDMODULE. " EXIT INPUT<u></u>

Hope this help you.

Regards,

Dhanu.

Read only

0 Likes
748

Hi,

Do the following changes for your code and check it.

loop at tab-cols into cols.

if sy-tabix = 1.

IF cols-screen-input = '0'.

ELSE

cols-screen-input = '1'.

ENDIF.

MODIFY tab-cols FROM cols INDEX sy-tabix.

endloop.

Read only

0 Likes
748

Refer to transaction DWDM for this requirement. You can have many more features like this.

Regards,

Ankur Bhandari

p.s: Reward points if you feel it helped you.

Read only

Former Member
0 Likes
748

hi,

Please refer <b>demo_dynpro_tabcont_loop_at</b> in <b>abapdocu</b>.

Regards,

Sailaja.