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

Editable Table control

Former Member
0 Likes
1,174

hi,

i had got a table control with 4 fields

orderno item material quantity

when i enter a record with same item niumber it gives me an error message, till that is fine

but now i want edit the table control ... i had written the folowing code,but still it is not working

loop at screen.

if SCREEN-NAME = 'ZTEST2-POSNR'.

screen-input = 1.

modify screen.

endif.

endloop.

11 REPLIES 11
Read only

Former Member
0 Likes
1,137

hi..

actually i didnt understand yur question..but if u want to edit it u dont have to write screen input programming..

do u want to save the edited data in database??if yes i can help u.

Read only

0 Likes
1,137

consider empname n empid are fields of ur tabcon.

and table is zemp.

and write the following after process after input.

it will look.

process after input.

loop at tabcon .

field: itab-empid, itab-empname module update_table.

end loop.

now double click on update_table.

MODULE update_table.

insert itab tabcon-current_LINE.

insert into zemp values itab.

endmodule.

Read only

0 Likes
1,137

hi chitra,

actually i want to edit the row itself, ie when user enters a wrong entry .

after entering a record that record gets updated in ztable .this requirement is fulfilled

but now i want that updated ztable should be dispalyed in a table control.

Read only

0 Likes
1,137

hi pawan,

do u want to display modified table on smae table control??

if yes just press enter see if it helps.

regards chitra

Read only

0 Likes
1,137

Hi,

LOOP AT it_timesheet.

CHAIN.

FIELD fs_timesheet-date. " Date

FIELD fs_timesheet-pid. " Project ID

FIELD fs_timesheet-pname. " Project name

FIELD fs_timesheet-oid. " Object ID

FIELD fs_timesheet-oname. " Object name

FIELD fs_timesheet-aid. " Activity ID

FIELD fs_timesheet-aname. " Activity name

FIELD fs_timesheet-wtime. " Worked time

FIELD fs_timesheet-desc. " Description

FIELD fs_timesheet-tstat. " Task status

FIELD fs_timesheet-bstat. " Billing status

FIELD fs_timesheet-sdn. " SDN status

  • u can write ur code in this module

MODULE validations.

ENDCHAIN.

Hope it helps you.

Regards

Manjari.

Read only

0 Likes
1,137

Do updation part aftr chain endchain code .It will work

Read only

0 Likes
1,137

hey pawan did you write select queries for table control in process before outpute module??

Read only

0 Likes
1,137

hi pawan,

do u want to display modified table on smae table control??

if yes just press enter see if it helps.

regards chitra

Read only

Former Member
0 Likes
1,137

Hi Pawan,

You can edit the table control. Follow the procedure below.

1) Go to the layout of the screen where you designed table control.

2)Double click on the field for which you want that field as editable and you will get a window which consists of attributes of the selected field. Select the 'program' tab in that window and choose appropriate option for the field which you selected.

Read only

Former Member
0 Likes
1,137

Hi,

try like this.

data : cols like line of tc-cols.

in the PBO write.

loop at tc-cols into cols.
      if cols-screen-group1 = 'MOD'.
        cols-screen-input = '0'.
        modify tc-cols from cols.
      endif.
   endloop.

here tc is table control name.

assign fields which you want to display into one group(MOD),do this in table control.

so that you can get n no of fields in display mode.

in case of any clarity revert back.

Regards,

Sathish Reddy.

Read only

0 Likes
1,137

hi satish..

hey i had modified my code , but still it is not working

for ur reference this is my code.......

i want to display the data in same table control..

-


FLOW LOGIC----


PROCESS BEFORE OUTPUT.

MODULE STATUS_0200.

loop with control tctrl.

endloop.

PROCESS AFTER INPUT.

loop with control TCTRL.

MODULE USER_COMMAND_0200.

endloop.

MODULE display.

MODULE BACK.

-


code in PAI----


data : item type ztest2-posnr,

mat type mara-matnr.

  • FLAG TYPE I.

case sy-ucomm.

when 'CREATE'.

if ztest2-posnr is initial or

ztest2-matnr is initial or

ztest2-zmeng is initial.

message E003(zpawan) with 'error'.

endif.

item = ztest2-posnr mod 10.

if item ne 0.

message E000(zpawan) with 'error'.

endif.

******material number should be selected from mara**************

select single matnr

from mara

into mat

where matnr = ztest2-matnr.

  • endselect.

  • select SINGLE matnr from mara into mat where matnr = ztest2-matnr.

if sy-subrc ne 0.

message E001(zpawan) with 'error'.

endif.

***************for Duplicate item number*******************

loop at it_test into wa_test.

if zTEST2-POSNR eq wa_test-POSNR.

message i004(zpawan) with 'information'.

*message e004(zpawan) with 'error'.

  • call screen 200.

endif.

endloop.

refresh it_test.

select max( orderno ) from ztest2 into order. "selecting max value.

order = order + 1.

WA_TEST-ORDERNO = order.

WA_TEST-POSNR = zTEST2-POSNR.

WA_TEST-MATNR = zTEST2-MATNR.

WA_TEST-ZMENG = zTEST2-ZMENG.

append wa_test to it_test.

insert into Ztest2 values wa_test.

clear wa_test.

endcase.

if sy-subrc eq 0.

message S002(zpawan) with 'success'.

endif.

ENDMODULE. " BACK INPUT

&----


*& Module display INPUT

&----


  • text

----


MODULE display INPUT.

*data: sales type ztest2-orderno.

*order = sales.

case sy-ucomm.

when 'DISPLAY'.

select orderno

posnr

matnr

zmeng

into table it_test

from ztest2.

append wa_test to it_test.

endcase.

ENDMODULE. " display INPUT

&----


*& Module BACK INPUT

&----


  • text

----


MODULE BACK INPUT.

case sy-ucomm.

when 'REFRESH'.

CALL SCREEN 200.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN 'EXIT'.

LEAVE TO SCREEN 0.

ENDCASE.

-


CODE IN PBO----


MODULE

STATUS_0200 OUTPUT.

SET PF-STATUS 'BACK'.

SET TITLEBAR 'TITLE'.

data : cols like line of tctrl-cols.

data: flag type i.

if flag = 1.

clear wa_test.

*refresh it_test.

endif.

select max( orderno ) from ztest2 into order. "selecting max value.

order = order + 1.

WA_TEST-ORDERNO = order.

*

tctrl-lines = 100. "vertical scroll bar

*tctrl-v_scroll = 'x'.

loop at tctrl-cols into cols.

if cols-screen-group1 = 'MOD'.

cols-screen-input = '0'.

modify tctrl-cols from cols.

endif.

endloop.