2009 Mar 23 6:08 AM
Hi All,
i have a requirement telling we need to create text editor so that whenever u execute you get that text editor and we can enter the required text into it. and after executing we get that text in the output of smartforms.
Hello Poonam,
You cannot make a SF editable. Its not possible to edit any entries in a SF?
You need to think about a work-around.
BR,
Suhas
2009 Mar 23 6:35 AM
What you are actually trying to do is, create a smartform which is editable, right?
Well, that is not possible with smartforms, which are used as print forms based on pdf, but can not be used for editing.
So, first you will have to make sure what the exact requirement is. Are you, for example creating a custom screen on which user can enter some data, and that data needs to be printed via Smartform (or something like it). This means, you don't need to create a text editor IN smartforms.
2009 Mar 23 6:59 AM
ya actually, its one of the column's in smartforms which ll be editable.
i want to edit and save it. later when i execute i shud get it in the screen.
2009 Mar 23 7:06 AM
2009 Mar 23 8:27 AM
2009 Mar 23 8:39 AM
Hello Poonam,
You cannot make a SF editable. Its not possible to edit any entries in a SF?
You need to think about a work-around.
BR,
Suhas
2009 Mar 23 9:53 AM
i dont want to edit smartforms, i want to edit a text editor which ll be one of the columns in smartform disply.
2009 Mar 23 10:08 AM
Hello Poonam,
Please be clear on your requirement.
You want to display the SF after the user has input text in the text editor. Is this what you want ?
BR,
Suhas
2009 Mar 23 10:15 AM
yes i want it this way it self.
we are asked to have a push button so that when u use pushbutton we get that text editor in change mode so that we can add up things there and save. next when we select execute it shud display smartforms with that text.
2009 Mar 23 10:29 AM
Hello Poonam,
There you go. Your req. is not as complex as it sounded earlier. But there are a few things to be done )
1. When you push the button you call the FM: CATSXT_SIMPLE_TEXT_EDITOR. Input the text into pop-up & then pushes the "Green Button" to save the entry.
2. Call the FM: SAVE_TEXT to save the text i/p by the user.
3. When the user calls the SF, you can pass the name of the Text that you have created as a param in the SF interface & display it in the SF.
The code's gonna be lenghty, but its not complicated.
BR,
Suhas
2009 Mar 23 10:31 AM
ok... let us say you need to give a text editor on your screen.
You will fill this editor with some value.
When you display the smartform, you want to display the contents of the text editor.
Please let me know if this is the scenario and I will be able to help you solve the issue. If you want the smartform to be editable during display then you will have to go for adobe interactive forms.
2009 Mar 24 10:14 AM
2009 Mar 24 10:55 AM
On your screen create a custom container
give the name as TXTAREA
Then for the coding part
*This declarations will be in your top include
data: okcode type sy-ucomm.
data: text_editor_container type ref to cl_gui_custom_container,
text_editor type ref to cl_gui_textedit,
repid type syrepid.
data: text_tab like standard table of line,
text_wa like line.
*This will be in your PBO module
*This is for the container
if text_editor_container is initial.
create object text_editor_container
exporting
container_name = 'TXTAREA'
exceptions
others = 1.
if sy-subrc <> 0.
raise cntl_error.
endif.
endif.
if text_editor is initial.
create object text_editor
exporting
wordwrap_mode = 2
* max_number_chars = 72
* wordwrap_position = 72
parent = text_editor_container.
endif.
In the PAI before you call the smartform,
use the following code
CALL METHOD text_editor->GET_TEXT_AS_R3TABLE
* EXPORTING
* ONLY_WHEN_MODIFIED = FALSE
IMPORTING
TABLE = text_tab
* IS_MODIFIED =
EXCEPTIONS
ERROR_DP = 1
ERROR_CNTL_CALL_METHOD = 2
ERROR_DP_CREATE = 3
POTENTIAL_DATA_LOSS = 4
others = 5
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*The table text_tab will have the contents of your text editor,
*Pass this table in your smartform interface and you have the contents of the
*text area
*Cheers!!!!
2009 Mar 24 11:15 AM
2009 Mar 24 11:44 AM
Input and output parameters for ?? can you be more clear please.
2009 Mar 25 2:50 AM
Hi,
i am getting an error as text object not available.
please help me out in this.
2009 Mar 25 7:42 AM
Please write where you are getting the error.
I think you have not declared the text_area in your top include.
2009 Mar 23 9:17 AM
In smartforms
create a window
create text node
TYPE: INCLUDE TEXT
general attributes:
text name: ENGREMARKS
text object: TEXT
textid:EXRM
language:EN
U need to do modulepool program to create selection screen*
In Driver program:
for ur reference:
MODULE status_1000 OUTPUT.
SET PF-STATUS 'MENU1'.
SET TITLEBAR 'xxx'.
IF remarks IS INITIAL.
Create obejct for custom container
CREATE OBJECT remarks_con
EXPORTING
container_name = 'REMARKS'.
Create obejct for the TextEditor control
CREATE OBJECT remarks
EXPORTING
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = line_length2
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
parent = remarks_con.
CALL METHOD remarks->set_toolbar_mode
EXPORTING
toolbar_mode = '0'.
CALL METHOD remarks->set_statusbar_mode
EXPORTING
statusbar_mode = '0'.
call method mremarks->set_font_fixed
exporting
font_fixed = '0'.
*
ENDIF.
IF addnotes IS INITIAL.
Create obejct for custom container
CREATE OBJECT addnotes_con
EXPORTING
container_name = 'ADDNOTES'.
Create obejct for the TextEditor control
CREATE OBJECT addnotes
EXPORTING
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = line_length2
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
parent = addnotes_con.
CALL METHOD addnotes->set_toolbar_mode
EXPORTING
toolbar_mode = '0'.
CALL METHOD addnotes->set_statusbar_mode
EXPORTING
statusbar_mode = '0'.
call method mremarks->set_font_fixed
exporting
font_fixed = '0'.
*
ENDIF.
ENDMODULE. " STATUS_1000 OUTPUT
&----
*& Module USER_COMMAND_1000 INPUT
&----
text
----
MODULE user_command_1000 INPUT.
Remarks Editor
CLEAR : text_tab.
REFRESH: text_tab.
CALL METHOD remarks->get_text_as_stream
IMPORTING
text = text_tab.
IF NOT text_tab[] IS INITIAL.
text_header-tdobject = 'TEXT'.
text_header-tdid = 'EXRM'.
text_header-tdname = 'ENGREMARKS'.
text_header-tdspras = 'EN'.
LOOP AT text_tab INTO text_wa.
text_tdline-tdformat = '*'.
text_tdline-tdline = text_wa-line.
APPEND text_tdline.
ENDLOOP.
TRANSLATE text_wa-line TO UPPER CASE.
MOVE-CORRESPONDING text_header TO ttxit.
INSERT ttxit.
MOVE-CORRESPONDING text_header TO ttxid.
ttxid-tdshowname = 'x'.
INSERT ttxid.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = text_header
TABLES
lines = text_tdline
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
TRANSLATE text_tdline TO UPPER CASE.
IF sy-subrc = 0.
ENDIF.
CLEAR : text_tdline,text_tab.
REFRESH: text_tdline,text_tab.
*
ENDIF.
AdditionAl notes editor
Remarks Editor
CLEAR : text_tab.
REFRESH: text_tab.
CALL METHOD addnotes->get_text_as_stream
IMPORTING
text = text_tab.
IF NOT text_tab[] IS INITIAL.
text_header-tdobject = 'TEXT'.
text_header-tdid = 'EXAD'.
text_header-tdname = 'ENGADDNOTES'.
text_header-tdspras = 'EN'.
LOOP AT text_tab INTO text_wa.
text_tdline-tdformat = '*'.
text_tdline-tdline = text_wa-line.
APPEND text_tdline.
ENDLOOP.
TRANSLATE text_wa-line TO UPPER CASE.
MOVE-CORRESPONDING text_header TO ttxit.
INSERT ttxit.
MOVE-CORRESPONDING text_header TO ttxid.
ttxid-tdshowname = 'x'.
INSERT ttxid.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = text_header
TABLES
lines = text_tdline
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
TRANSLATE text_tdline TO UPPER CASE.
IF sy-subrc = 0.
ENDIF.
PERFORM print_forms.
ENDIF.
WHEN 'READ'.
**READ THE REMARKS TEXT THAT WAS SAVED BEFORE IF EXISTS
CLEAR: text_tab,text_tdline.
REFRESH: text_tab,text_tdline.
*
text_header-tdobject = 'TEXT'.
text_header-tdid = 'EXRM'.
text_header-tdname = 'ENGREMARKS'.
text_header-tdspras = 'E'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = text_header-tdid
language = text_header-tdspras
name = text_header-tdname
object = text_header-tdobject
TABLES
lines = text_tdline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ELSE.
*
LOOP AT text_tdline.
text_wa-line = text_tdline-tdline.
APPEND text_wa TO text_tab.
TRANSLATE text_wa TO UPPER CASE.
ENDLOOP.
ENDIF.
*
CALL METHOD remarks->set_text_as_stream
EXPORTING
text = text_tab.
*
*
CLEAR : text_tdline,text_tab.
REFRESH: text_tab,text_tdline.
*
*
*
text_header-tdobject = 'TEXT'.
text_header-tdid = 'EXAD'.
text_header-tdname = 'ENGADDNOTES'.
text_header-tdspras = 'E'.
*
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = text_header-tdid
language = text_header-tdspras
name = text_header-tdname
object = text_header-tdobject
TABLES
lines = text_tdline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ELSE.
*
LOOP AT text_tdline.
IF sy-tabix = 1.
CLEAR text_tdline.
ENDIF.
text_wa-line = text_tdline-tdline.
APPEND text_wa TO text_tab.
TRANSLATE text_wa TO UPPER CASE.
ENDLOOP.
ENDIF.
*
CALL METHOD addnotes->set_text_as_stream
EXPORTING
text = text_tab.
WHEN 'CLEAR'.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUT
&----
*& Form print_forms
&----
text
----
--> p1 text
<-- p2 text
----
FORM print_forms .
get FM name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = gt_forms-form_name
IMPORTING
fm_name = gv_func_mod_name.
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 FUNCTION gv_func_mod_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
gv_addresses = gv_address
gt_but000 = gt_but000
gs_title = gs_title
gs_adrc_stores = gs_adrc_stores
gv_amount = gv_amount
text_tab = text_tab.
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDFORM. " print_forms
Edited by: BrightSide on Mar 23, 2009 9:17 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |