on 01-23-2019 10:06 AM
I have issue with using this method in my test program.
I want to toggle the readonly mode via button for the Textbox. I am using GET_READONLY_MODE protected method in my test program to get the current readonly_mode of the textbox. Here i am not able to get the readonly_mode status in the variable.But i am getting the readonly_mode status as soon as this FM 'POPUP_TO_CONFIRM' triggered. I am not able to figure it out what and where i am doing mistake. please check the code and help me out is there i am missing flushing the buffer memory or anything i have to clear or there is some mistake in code.
DATA: l_v_read TYPE i,
l_v_read1 TYPE i,
l_v_editor TYPE REF TO cl_gui_textedit,
CLASS lcl_class DEFINITION INHERITING FROM cl_gui_textedit.
PUBLIC SECTION.
METHODS:
set_readonly_mode_lcl IMPORTING VALUE(lcl_sreadonly) TYPE i,
get_readonly_mode_lcl ."EXPORTING VALUE(lcl_readonly) TYPE i.
ENDCLASS.
CLASS lcl_class IMPLEMENTATION.
METHOD get_readonly_mode_lcl.
CALL METHOD l_v_editor->get_readonly_mode IMPORTING readonly_mode = l_v_read.
"lcl_readonly = l_v_read.
"CLEAR l_v_read.
ENDMETHOD.
METHOD set_readonly_mode_lcl.
CALL METHOD l_v_editor->set_readonly_mode EXPORTING readonly_mode = lcl_sreadonly .
ENDMETHOD.
ENDCLASS.
DATA: l_v_lcl TYPE REF TO lcl_class,
l_container TYPE REF TO cl_gui_custom_container.
START-OF-SELECTION.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'PF1'.
* SET TITLEBAR 'xxx'.
CREATE OBJECT l_container
EXPORTING
container_name = 'L_CUST'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc IS INITIAL.
CREATE OBJECT l_v_editor
EXPORTING
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = 256
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
parent = l_container
max_number_chars = 100000.
IF sy-subrc IS NOT INITIAL.
MESSAGE 'TEXT EDIT BOX NOT CREATED' TYPE 'I'.
ENDIF.
ENDIF.
CALL METHOD l_v_editor->set_readonly_mode
EXPORTING
readonly_mode = 1.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc IS NOT INITIAL.
MESSAGE 'ERROR IN FLUSH' TYPE 'I'.
ENDIF.
MODULE user_command_0100 INPUT.
DATA: l_v_get TYPE i,
l_v_set TYPE i.
DATA: ok_code TYPE sy-ucomm.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
CASE sy-ucomm.
WHEN 'BUT'.
CREATE OBJECT l_v_lcl
EXPORTING
Parent = l_container.
CALL METHOD l_v_lcl->get_readonly_mode_lcl.
" Here after calling method readonly_mode status i am not able to get it into the variable.
"Tried with Importing the value also but no help.
"if i will remove this FM then GET_READONLY_METHOD is not giving any value
DATA: l_v_ans TYPE sychar01.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'CONFIRMATION'
text_question = 'DO YOU WANT TO CHANGE?'
text_button_1 = 'YES'
text_button_2 = 'NO'
default_button = '1'
display_cancel_button = 'X'
start_column = 25
start_row = 6
IMPORTING
answer = l_v_ans
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
"As soon as this FM triggers the value is coming in the variable.
"EX.
"if present Textbox readonly_mode is 1. then l_v_read is updating with value 1 or opposite.
IF sy-subrc IS INITIAL.
CASE l_v_ans.
WHEN '1'.
IF l_v_read = 1.
l_v_set = 0.
ELSE.
l_v_set = 1.
ENDIF.
CALL METHOD l_v_lcl->set_readonly_mode_lcl
EXPORTING
lcl_sreadonly = l_v_set.
CLEAR: l_v_get,
l_v_set.
WHEN '2'.
LEAVE PROGRAM.
WHEN '3'.
LEAVE PROGRAM.
ENDCASE.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc IS NOT INITIAL.
MESSAGE 'ERROR IN FLUSH' TYPE 'I'.
ENDIF.
ENDCASE.
ENDMODULE.
Please give me solution or is there anyother way to achieve this then please advice me.
Did you try to call the method "cl_gui_cfw=>flush" after the call of GET_READONLY_MODE, the pop-up FM trigger a dynpro PAI/PBO cycle so synchronize itself the automation queue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Simply use the public attribute M_READONLY_MODE.
(sorry I saw too late that you just found the solution)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got it, No need to call the get_readonly_method. Thank you so much!! and learnt alot of things.
Vote++
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.