on 04-09-2020 7:27 AM
Hi everyone,
I was going trying to create a report which would allow the user to enter a free text. On saving this text, a workflow would get triggered via this report and the text would be the body of the mail in tcode SBWP.
However, the entire text is not getting displayed in the body of the mail. I even made the workflow container as "multiline", but still I am getting some text missing.
Below are the complete steps :
1) I created a class ZCL_WF_TEST2. A standard attribute GS_OBJ type SIBFLPOR was created (even though I didnt need it in my class).
An event was created with a parameter .
2) A method was created with an importing parameter.
3) Below is the code written for the method:
method UPDATE_PO.
DATA: lr_cont TYPE REF TO IF_SWF_IFS_PARAMETER_CONTAINER.
data: lv_text TYPE char255.
CALL METHOD cl_swf_evt_event=>get_event_container
EXPORTING
im_objcateg = 'CL'
im_objtype = 'ZCL_WF_TEST2'
im_event = 'START_WF'
RECEIVING
re_reference = lr_cont .
TRY.
lr_cont->set(
EXPORTING
name = 'EV_TEXT'
value = ev_TEXT ).
CATCH cx_swf_cnt_cont_access_denied. " Change Access to Container Not Allowed
CATCH cx_swf_cnt_elem_access_denied. " Element Must Not Be Changed
CATCH cx_swf_cnt_elem_not_found. " Element Not Found
CATCH cx_swf_cnt_elem_type_conflict. " Type Conflict Between Value and Current Parameter
CATCH cx_swf_cnt_unit_type_conflict. " Type Conflict Between Unit and Current Parameter
CATCH cx_swf_cnt_elem_def_invalid. " Element Definition (For Example, Type Name) Is Invalid
CATCH cx_swf_cnt_container. " Exception in the Container Service
ENDTRY.
TRY.
CALL METHOD cl_swf_evt_event=>raise
EXPORTING
im_objcateg = 'CL'
im_objtype = 'ZCL_WF_TEST2'
im_event = 'START_WF'
im_objkey = gs_obj-instid
im_event_container = lr_cont .
COMMIT WORK.
CATCH cx_swf_evt_invalid_objtype .
CATCH cx_swf_evt_invalid_event .
ENDTRY.
endmethod.
4) Then in SWDD, I created a container element for an instance (with importing parameter) of type ZCL_WF_TEST2 and a long text (with importing parameter) of char255.
5) The binding looks like this:
6) I created a mail step and put the text as the body of the mail which will be the text entered by the user.
7) Then I created a report and called a screen 100 where I created a custom control in the layout. Below is the complete code of the report.
REPORT zlong_text.
DATA: line_length TYPE i VALUE 254,
editor_container TYPE REF TO cl_gui_custom_container,
text_editor TYPE REF TO cl_gui_textedit.
DATA: text TYPE string.
START-OF-SELECTION.
CALL SCREEN '100'.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_100'.
IF text_editor IS INITIAL.
CREATE OBJECT editor_container
EXPORTING
container_name = 'TEXTEDITOR'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT text_editor
EXPORTING
parent = editor_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = line_length
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
CALL METHOD text_editor->set_toolbar_mode
EXPORTING
toolbar_mode = cl_gui_textedit=>false.
CALL METHOD text_editor->set_statusbar_mode
EXPORTING
statusbar_mode = cl_gui_textedit=>false.
ENDIF.
* SET TITLEBAR 'xxx'.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
DATA: l_ref TYPE REF TO zcl_wf_test2.
CASE sy-ucomm.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'SAVE'.
CALL METHOD text_editor->get_textstream
* EXPORTING
* ONLY_WHEN_MODIFIED = CL_GUI_TEXTEDIT=>TRUE
IMPORTING
text = text
* 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.
MESSAGE 'Text saved successfully' TYPE 'I'.
CREATE OBJECT l_ref.
l_ref->update_po( EXPORTING ev_text = text ).
IF sy-subrc = 0.
WRITE 'WF triggered'.
ENDIF.
ENDCASE.
ENDMODULE.
😎 I execute the report, enter some free text and save it. I get the below output as per the logic I wrote.
9) But when I open my inbox, I can see that my surname didnt get displayed in the mail body. I entered another long text and I saw that only a part of the text was getting displayed.
So why is the entire text not getting displayed ? Is there a constraint somewhere that I am missing ?
Regards,
Manish
Hi,
Can you try to declare container element as 'TEXT' not 'text'.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.