2008 Jun 23 12:25 PM
Hi Experts,
I want to change the Text Field Size from 117 to 255. How i can do this?
Hi Experts,
I want to change the Text Field Size from 117 to 255. How i can do this?
2008 Jun 23 12:31 PM
Michael,
I would suggest to create new Z dataelement of length 255 and attach it to your requirment.
AMit.
2008 Jun 23 12:45 PM
No, I already have my field as char 255. But in my dynpro only 117 char will be visible.
2008 Jun 23 1:37 PM
You're screen will need to be more then 255 columns wide such that you can put a field of that length on the screen.
Generally this his handle by flagging the wrap option on so that when the user types and hits the end of the visible area, they can continue to type without the loss of data up to your 255 length.
Furthermore, if you are trying to change the length of this field dynamically, you would still need to have the screen more then 255 columns, but then, you can change the length in a LOOP AT SCREEN loop and when it's this field, set the SCREEN-LENGTH value to 255.
2008 Jun 23 1:55 PM
Can I enlarge the textbox on 4 columns and if it is possible; what should I do exactly?
2008 Jun 23 2:10 PM
4 columns? are you asking if you can break the 255 field into 4 columns? I guess you could, but you wouldn't get the text to jump from one field to the next.
4 rows? Well.. not as a text box. I this case you would need to create an text editor in a Custom control and store the text in an intenral table until you wanted to combine it and move it to your single storage field. Only potential issue here is that I'm not sure you could limit it to 255 characters. I know you can protect areas of the edit box. Perhaps you could set the protection from the 256th position to the end to the text box.
2008 Jun 23 2:37 PM
I have now a Custom control, but where I can create a text editor in this?
2008 Jun 23 2:53 PM
In your global data area.
DATA:
g_editor4 TYPE REF TO cl_gui_textedit,
g_custom_container4 TYPE REF TO cl_gui_custom_container.
In your PBO routine
MODULE init_0101.
MODULE init_0101 OUTPUT.
PERFORM initialize_text_editor_0101.
PERFORM set_text_in_editor_0101.
*&---------------------------------------------------------------------*
*& Form initialize_text_editor_0101
*&---------------------------------------------------------------------*
FORM initialize_text_editor_0101.
IF g_editor4 IS INITIAL.
repid = sy-repid.
CREATE OBJECT g_custom_container4
EXPORTING
container_name = '0101_SCR_CONTAINER' "<== Name of your custome control
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT g_editor4
EXPORTING
parent = g_custom_container4
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = line_length "<== how long is a line?
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
CALL METHOD g_editor4->set_statusbar_mode
EXPORTING
statusbar_mode = 0.
CALL METHOD g_editor4->set_toolbar_mode
EXPORTING
toolbar_mode = 0.
ENDIF. "editor is initial
ENDFORM. " initialize_text_editor_0101
*&---------------------------------------------------------------------*
*& Form set_text_in_editor_0101
*&---------------------------------------------------------------------*
FORM set_text_in_editor_0101.
CALL METHOD g_editor4->set_text_as_r3table
EXPORTING table = it_pi_text "<== Your internal table for the text
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
MESSAGE i015 WITH
repid 'Error in set_text_as_r3table'.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
MESSAGE i015 WITH
repid 'set_text_as_r3table: Error in FLUSH'.
ENDIF.
ENDFORM. " set_text_in_editor_0101
In your PAI routine
MODULE text_editor_retrieve_0101.
*&---------------------------------------------------------------------*
*& Module text_editor_retrieve_0101 INPUT
*&---------------------------------------------------------------------*
MODULE text_editor_retrieve_0101 INPUT.
PERFORM text_editor_retrieve_0101.
ENDMODULE. " text_editor_retrieve_0101 INPUT
*---------------------------------------------------------------------*
* FORM text_editor_retrieve_0101 *
*---------------------------------------------------------------------*
FORM text_editor_retrieve_0101.
CHECK NOT g_editor4 IS INITIAL.
CALL METHOD g_editor4->get_text_as_r3table
IMPORTING table = it_pi_text "<== Your internal table for the text
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
MESSAGE i015 WITH
repid 'Error in get_text_as_r3table'.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
MESSAGE i015 WITH
repid 'get_text_as_r3table: Error in FLUSH'.
ENDIF.
ENDFORM.
2008 Jun 23 2:59 PM
From another program of mine, where you would need to change the g_editor# value , this can protect where the user can change areas of the text editor. This one goes from the beginning of the box to the last position of text already there. You would need to modify to have it after the 255 postion of the box.
*&---------------------------------------------------------------------*
*& Form protect_direction_txt_9020
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM protect_direction_txt_9020.
DATA:
from_line TYPE i,
from_pos TYPE i,
to_line TYPE i,
to_pos TYPE i.
from_line = 1.
from_pos = 1.
to_line = g_dir_line.
to_pos = g_dir_pos.
CALL METHOD g_editor1->set_selection_pos
EXPORTING
from_line = from_line
from_pos = from_pos
to_line = to_line
to_pos = to_pos
EXCEPTIONS
error_cntl_call_method = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE i015 WITH 'Error! Dir. text: Pos 1'.
ENDIF.
CALL METHOD g_editor1->protect_selection
* EXPORTING
* PROTECT_MODE = TRUE
* ENABLE_EDITING_PROTECTED_TEXT = false
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE i015 WITH 'Error! Dir. text: Protect 1'.
ENDIF.
*" This method places the cursor where you want it.
from_line = 0.
from_pos = 0.
to_line = 0.
to_pos = 0.
CALL METHOD g_editor1->set_selection_pos
EXPORTING
from_line = from_line
from_pos = from_pos
to_line = to_line
to_pos = to_pos
EXCEPTIONS
error_cntl_call_method = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE i015 WITH 'Error! Dir. text: Pos 2'.
ENDIF.
ENDFORM. " protect_direction_txt_9020
Edited by: Paul Chapman on Jun 23, 2008 10:01 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |