2008 Jan 24 6:37 AM
HI folks,
Please tell me how to make only the selected record editable in a table control.bcoz when i use screen-input = 1. it is making all the records editable.
regards
kiran
2008 Jan 24 6:50 AM
Hi,
The modify screen statement enables u to do this.
do like.
loop at screen.
if screen-name = <your firld name>.
screen-input = 1.
endif.
modify screen.
endloop.
Regards,
Renjith Michael.
2008 Jan 24 6:54 AM
Hi Renjith,
My question is i want to make only the selected record editable not all the records.Modify screen makes all the records editable.Please provide me any suggestions
regards
2008 Jan 24 6:57 AM
Hi,
Only the single field will change if you give like that.
like:
loop at screen.
if screen-name = <your field used in tabcntrl>.
screen-input = 1.
else. "optional
screen-input = 0. "optional
endif.
modify screen.
endloop.
use it in the last module of PBO.
Regards,
Renjith Michael.
2008 Jan 24 7:02 AM
Hi,
If you mean only the one record of your column, then,
assign the index or line no of the record to a variable.
then.
loop at screen.
if <line no or index> eq <value>.
if screen-name = <ur field name>.
screen-input = 1.
endif.
endif.
modify screen.
endloop.
Regards,
Renjith Michael.
2008 Jan 24 7:12 AM
HI Renjith,
please see the bellow example.
matnnr maktx mbew meins
row 1) field1 f ield2 field3 field4
row 2) fielld5 filed6 filed7 field8
intially all are in display mode.
now if i select row1 only this entire row should be in editable mode and row2 should be in display mode. now please suggest me what to do.
thanks in advance
kiran
2008 Jan 24 7:59 AM
HI, I hope it may be help you
TYPES: BEGIN OF ty_bukrs,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
chk TYPE char1,
END OF ty_bukrs.
DATA: it_bukrs TYPE TABLE OF ty_bukrs,
iw_bukrs TYPE ty_bukrs,
save_ok TYPE sy-ucomm,
ok_code TYPE sy-ucomm,
w_chg TYPE char1.
CONTROLS ctrl TYPE TABLEVIEW USING SCREEN 9000.
START-OF-SELECTION.
SELECT bukrs
butxt
FROM t001
INTO TABLE it_bukrs
UP TO 20 ROWS.
CHECK it_bukrs IS NOT INITIAL.
CALL SCREEN 9000.
*&----
*
*& Module STATUS_9000 OUTPUT
*&----
*
* text
*----
*
MODULE status_9000 OUTPUT.
SET PF-STATUS 'S_9000'.
w_chg = 'X'.
ENDMODULE. " STATUS_9000 OUTPUT
*&----
*
*& Module INIT OUTPUT
*&----
*
* text
*----
*
MODULE init OUTPUT.
CHECK iw_bukrs-chk = 'X'.
LOOP AT SCREEN.
IF screen-name = 'IW_BUKRS-BUTXT'
AND iw_bukrs-chk = 'X'.
screen-input = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE. " INIT OUTPUT
*&----
*
*& Module chk_modify INPUT
*&----
*
* text
*----
*
MODULE chk_modify INPUT.
MODIFY it_bukrs FROM iw_bukrs INDEX ctrl-current_line.
IF iw_bukrs-chk = 'X'.
w_chg = 'X'.
ELSE.
CLEAR w_chg.
ENDIF.
ENDMODULE. " chk_modify INPUT
*&----
*
*& Module user_command_9000 INPUT
*&----
*
* text
*----
*
MODULE user_command_9000 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'CHG'.
READ TABLE it_bukrs WITH KEY chk = 'X'
TRANSPORTING NO FIELDS.
IF sy-subrc <> 0 AND w_chg = 'X'.
MESSAGE s001(00) WITH
'Please select one item to edit'.
ENDIF.
ENDCASE.
ENDMODULE. " user_command_9000 INPUT
*&----
*
*& Module exit INPUT
*&----
*
* text
*----
*
MODULE exit INPUT.
LEAVE PROGRAM.
ENDMODULE. " exit INPUT
SCREEN 9000
PROCESS BEFORE OUTPUT.
MODULE status_9000.
LOOP AT it_bukrs INTO iw_bukrs
WITH CONTROL ctrl
CURSOR ctrl-current_line.
MODULE init.
ENDLOOP.
*
PROCESS AFTER INPUT.
LOOP AT it_bukrs.
CHAIN.
FIELD: iw_bukrs-chk,
iw_bukrs-butxt.
MODULE chk_modify ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE user_command_9000.
MODULE exit AT EXIT-COMMAND.
2008 Jan 24 8:06 AM
at screen 9000 layout
the field iw_bukrs-butxt set only ouput, when you choose one record or more, iw_bukrs-chk can be changed to 'X', when 'loop at screen', code can make
iw_bukrs-butxt of this record be input
2008 Jan 24 8:24 AM
at pbo:
'loop at it_bukrs' can control record of line, in it ,'loop at screen' can control field of column which you want to input
2008 Jan 24 10:00 AM
hi,
u using any button? menas after putting ur cursor in at one line, are u pressing any button?
2008 Jan 25 1:50 AM
2008 Jan 25 6:26 AM
Hi,
Try this logic
in PBO
Loop at..
module edit_single.
Endloop.
In Program
module edit_single.
loop at screen.
if itab-field = value. " Line is edit mode if condition is true
screen-input = 1.
else.
screen-input = 0.
endif.
modify screen.
endloop.
endmodule.
Reward me
L.Velu
2008 Jan 25 6:30 AM
Hi,
One more point in the logic
if itab-field = value. " Line is edit mode if condition is true
From above line
itab-field or itab should be use in table control.Then only it is meaningful.
L.Velu