2013 Oct 22 8:54 PM
Hi Friends,
I am facing a problem with Dynamic Creation of Object to read the Long text given in Screen in SAPLXQQM 100.
There are 10 Long texts in my screen 100 and I am able to display them using Dynamic Object creation and Disply.
But When changed the Long text and save .. I am not getting the any text into WHY1 field in call method GET_TEXTSTREAM as shown below.
Here is the complete code in PAI.
* PAI of Screen 100
WHEN 'BUCH'. " SAVE
DO 10 Times.
move sy-index to lv_index.
MOVE 1 TO LV_INDEX.
CONCATENATE 'TEXTEDITOR' lv_index INTO lv_textedit.
CREATE OBJECT EDITOR_CONTAINER
EXPORTING
* CONTAINER_NAME = 'TEXTEDITOR1' " Instead of Hard code Used as Dynamic Container Name
CONTAINER_NAME = lv_textedit
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
CREATE OBJECT TEXTED TYPE ('CL_GUI_TEXTEDIT')
EXPORTING
PARENT = EDITOR_CONTAINER.
CALL METHOD TEXTED->GET_TEXTSTREAM
* EXPORTING
* ONLY_WHEN_MODIFIED = CL_GUI_TEXTEDIT=>TRUE
IMPORTING
TEXT = WHY1
* IS_MODIFIED =
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
NOT_SUPPORTED_BY_GUI = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
ENDDO.
But Without an Dynamic If I call the GET_TEXTSTREAM , Its getting the value what I gave in SCREEN 100,
I made this dynamic becos there are 10 Long texts in SCREEN 100 so, I dont want to repead the same code 10 times, Instead
DO 10 Times.
Use the above CODE.
ENDDO.
Please help .
Hi Friends,
I am facing a problem with Dynamic Creation of Object to read the Long text given in Screen in SAPLXQQM 100.
There are 10 Long texts in my screen 100 and I am able to display them using Dynamic Object creation and Disply.
But When changed the Long text and save .. I am not getting the any text into WHY1 field in call method GET_TEXTSTREAM as shown below.
Here is the complete code in PAI.
* PAI of Screen 100
WHEN 'BUCH'. " SAVE
DO 10 Times.
move sy-index to lv_index.
MOVE 1 TO LV_INDEX.
CONCATENATE 'TEXTEDITOR' lv_index INTO lv_textedit.
CREATE OBJECT EDITOR_CONTAINER
EXPORTING
* CONTAINER_NAME = 'TEXTEDITOR1' " Instead of Hard code Used as Dynamic Container Name
CONTAINER_NAME = lv_textedit
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
CREATE OBJECT TEXTED TYPE ('CL_GUI_TEXTEDIT')
EXPORTING
PARENT = EDITOR_CONTAINER.
CALL METHOD TEXTED->GET_TEXTSTREAM
* EXPORTING
* ONLY_WHEN_MODIFIED = CL_GUI_TEXTEDIT=>TRUE
IMPORTING
TEXT = WHY1
* IS_MODIFIED =
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
NOT_SUPPORTED_BY_GUI = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
ENDDO.
But Without an Dynamic If I call the GET_TEXTSTREAM , Its getting the value what I gave in SCREEN 100,
I made this dynamic becos there are 10 Long texts in SCREEN 100 so, I dont want to repead the same code 10 times, Instead
DO 10 Times.
Use the above CODE.
ENDDO.
Please help .
2013 Oct 23 6:48 AM
Hi,
May be you have to refer to the same instance of the text editor to read the text. I think
ME->GET_TEXTSTREAM
might help. The first time instance is created. Next time you have to refer the existing instance as you have the same instance still existing when you go to other lines.
Cheers,
Arindam
2013 Oct 23 11:15 PM
Hi Arindam,
Thanks for your reply.
That will not work.
Here is my complete code of Module pool.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
PAI Module has you see in my initial Question.
I created instance first time in PBO dynamically. Here is the Code.
In PBO:
MODULE STATUS_0100 OUTPUT.
data readonly type I value '1'.
data name type THEAD-TDNAME.
data :lt_tlines TYPE TABLE OF tline,
ls_tlines TYPE tline,
texthdr TYPE thead.
DATA: BEGIN OF LT_TXT OCCURS 0,
LINE(200),
END OF LT_TXT.
data lv_textedit(12) TYPE C.
data lv_index(2) TYPE c.
data lv_result(2) type c.
data lv_add(2) type c.
lv_add = 1.
do 10 TIMES.
move sy-index to lv_index.
CONCATENATE 'TEXTEDITOR' lv_index INTO lv_textedit.
CREATE OBJECT EDITOR_CONTAINER
EXPORTING
CONTAINER_NAME = lv_textedit
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
CREATE OBJECT TEXTED TYPE ('CL_GUI_TEXTEDIT')
EXPORTING
PARENT = EDITOR_CONTAINER
WORDWRAP_MODE = CL_GUI_TEXTEDIT=>wordwrap_at_windowborder ."WORDWRAP_AT_FIXED_POSITION
if sy-tcode = 'IW23' or
sy-tcode = 'IW22'.
COMPUTE lv_result = lv_index mod 2.
if lv_result eq 1.
CONCATENATE VIQMEL-QMNUM 'WHY' lv_add into name.
else.
CONCATENATE VIQMEL-QMNUM 'ACT' lv_add into name.
lv_add = lv_add + 1.
endif.
CALL FUNCTION 'READ_TEXT '
EXPORTING
CLIENT = SY-MANDT
ID = 'ST'
LANGUAGE = sy-langu
NAME = name
OBJECT = 'TEXT'
IMPORTING
HEADER = texthdr
TABLES
LINES = lt_tlines.
if sy-tcode = 'IW23'.
* set dISPLAY mode - Disable mode
CALL METHOD TEXTED->set_readonly_mode
EXPORTING
readonly_mode = readonly
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD CL_GUI_CFW=>FLUSH.
endif.
loop at lt_tlines into ls_tlines.
move ls_tlines-TDLINE to lt_txt-line.
APPEND lt_txt.
ENDLOOP.
CALL METHOD TEXTED->SET_TEXT_AS_R3TABLE
EXPORTING
TABLE = lt_txt[].
CALL METHOD TEXTED->AUTO_REDRAW
EXPORTING ENABLE_REDRAW = 1.
CALL METHOD CL_GUI_CFW=>FLUSH.
CLEAR lt_txt[].
CLEAR lt_tlines[].
endif.
ENDDO.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |