2008 Jan 07 11:34 AM
Hi Experts,
I want to display long text string, on screen designed through module pool(SE51). I tried to display through input/output field , but it displays it in SINGLE LINE and i have to scroll all through to view all string.
I want to display it in rectangular format . It doesnt allow me to set HEIGHT of component.
Please provide solution.
Thanks in advance.
Regards
Deepak
2008 Jan 07 12:10 PM
hi,
for display a long text into a dynpro you have to create a text editor elemet. in this way:
1 - create a custom container in the dynpro called 'EDITOR'.
2 - in the top include insert this variables:
>data: cont type ref to cl_gui_custom container.
>data: editor type ref to cl_gui_textedit
> DATA: BEGIN OF my_tab OCCURS 0,
> rec(100) TYPE c,
> END OF my_tab.
3 - in the PBO process insert this code in a module or in a form
>MODULE EDITOR.
> IF editor IS BOUND.
> CREATE OBJECT cont
> EXPORTING
> container_name = 'EDITOR'.
> CREATE OBJECT editor
> EXPORTING
> parent = cont.
> ENDIF.
>
> CALL METHOD editor->SET_SELECTED_TEXTSTREAM
> EXPORTING
> selected_text = your_string
> enable_editing_protected_text = '0'
> EXCEPTIONS
> error_dp = 1
> error_dp_create = 2
> OTHERS = 3.
>
> CALL METHOD editor->set_toolbar_mode
> EXPORTING
> toolbar_mode = 0.
>
> CALL METHOD editor->set_readonly_mode
> EXPORTING
> readonly_mode = 1.
>
> CALL METHOD editor->set_statusbar_mode
> EXPORTING
> statusbar_mode = 0.
>
> CALL METHOD cl_gui_cfw=>flush.
>
>
>ENDMODULE
otherwise u can replace SET_SELECTED_TEXTSTREAM method with SET_SELECTED_TEXT_AS_R3TABLE but you have split the string text into a table.
> CALL METHOD editor->set_selected_text_as_r3table
> EXPORTING
> table = my_tab[]
> EXCEPTIONS
> error_dp = 1
> error_dp_create = 2
> OTHERS = 3.
4 - in the PAI Process in the user command module insert this code when you leave the dynpro.
> IF NOT cont IS INITIAL.
> CALL METHOD editor->free.
> CALL METHOD cont->free.
> CLEAR editor.
> CLEAR cont.
> ENDIF.
bye
Marco
Hi Experts,
I want to display long text string, on screen designed through module pool(SE51). I tried to display through input/output field , but it displays it in SINGLE LINE and i have to scroll all through to view all string.
I want to display it in rectangular format . It doesnt allow me to set HEIGHT of component.
Please provide solution.
Thanks in advance.
Regards
Deepak
2008 Jan 07 12:10 PM
hi,
for display a long text into a dynpro you have to create a text editor elemet. in this way:
1 - create a custom container in the dynpro called 'EDITOR'.
2 - in the top include insert this variables:
>data: cont type ref to cl_gui_custom container.
>data: editor type ref to cl_gui_textedit
> DATA: BEGIN OF my_tab OCCURS 0,
> rec(100) TYPE c,
> END OF my_tab.
3 - in the PBO process insert this code in a module or in a form
>MODULE EDITOR.
> IF editor IS BOUND.
> CREATE OBJECT cont
> EXPORTING
> container_name = 'EDITOR'.
> CREATE OBJECT editor
> EXPORTING
> parent = cont.
> ENDIF.
>
> CALL METHOD editor->SET_SELECTED_TEXTSTREAM
> EXPORTING
> selected_text = your_string
> enable_editing_protected_text = '0'
> EXCEPTIONS
> error_dp = 1
> error_dp_create = 2
> OTHERS = 3.
>
> CALL METHOD editor->set_toolbar_mode
> EXPORTING
> toolbar_mode = 0.
>
> CALL METHOD editor->set_readonly_mode
> EXPORTING
> readonly_mode = 1.
>
> CALL METHOD editor->set_statusbar_mode
> EXPORTING
> statusbar_mode = 0.
>
> CALL METHOD cl_gui_cfw=>flush.
>
>
>ENDMODULE
otherwise u can replace SET_SELECTED_TEXTSTREAM method with SET_SELECTED_TEXT_AS_R3TABLE but you have split the string text into a table.
> CALL METHOD editor->set_selected_text_as_r3table
> EXPORTING
> table = my_tab[]
> EXCEPTIONS
> error_dp = 1
> error_dp_create = 2
> OTHERS = 3.
4 - in the PAI Process in the user command module insert this code when you leave the dynpro.
> IF NOT cont IS INITIAL.
> CALL METHOD editor->free.
> CALL METHOD cont->free.
> CLEAR editor.
> CLEAR cont.
> ENDIF.
bye
Marco
2008 Jan 09 3:06 PM
2008 Jan 08 12:14 PM
This is the program where u can get the WA_THEAD from other program like report and trying to display and modifying that text. U can do instead of WA_THEAD u can generate here itself and use also
&----
*& Module pool ZMP_LTEXT *
*& *
&----
PROGRAM ZMP_LTEXT .
TABLES: STXL.
&----
*& Module STATUS_9000 OUTPUT
&----
MODULE STATUS_9000 OUTPUT.
CONSTANTS:line_length type i value 132.
DATA:g_editor type ref to cl_gui_textedit,
g_editor_container type ref to cl_gui_custom_container,
CONT1 type scrfname value 'CONT1',
g_repid like sy-repid,
g_ok_code like sy-ucomm,
g_mytable(132) type c occurs 0,
g_mycontainer(30) type c ,
v_result(256) type c,
g_head like thead,
it_line type table of tline with header line,
wa_stxl type stxl.
DATA : BEGIN OF IT_THEAD1,
ICON TYPE ICON-ID.
INCLUDE STRUCTURE STXL.
DATA : END OF IT_THEAD1.
DATA : IT_THEAD LIKE TABLE OF IT_THEAD1,
WA_THEAD LIKE LINE OF IT_THEAD.
IMPORT WA_THEAD FROM MEMORY ID 'ABCD'.
select SINGLE * from STXL into wa_stxl
where tdname = '00006000156500000002'.
SELECT SINGLE * from STXL into wa_stxl
where tdname = WA_THEAD-TDNAME
AND TDID = WA_THEAD-TDID
AND TDOBJECT = WA_THEAD-TDOBJECT
AND TDSPRAS = WA_THEAD-TDSPRAS.
IF SY-SUBRC NE 0.
MESSAGE 'NO RECORD EXIST' TYPE 'E'.
ENDIF.
MOVE-CORRESPONDING WA_STXL TO G_HEAD.
SET PF-STATUS 'STATUS'.
SET TITLEBAR '001'.
if g_editor is initial.
CREATE OBJECT G_EDITOR_CONTAINER
EXPORTING
PARENT =
CONTAINER_NAME = CONT1
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT G_EDITOR
EXPORTING
MAX_NUMBER_CHARS =
STYLE = 0
WORDWRAP_MODE = cl_gui_textedit=>wordwrap_at_fixed_position
for to fix number of characters in row to 132 characers
WORDWRAP_POSITION = line_length
WORDWRAP_TO_LINEBREAK_MODE = cl_gui_textedit=>true
for the word to break to next line if it dont fit in line
FILEDROP_MODE = DROPFILE_EVENT_OFF
PARENT = G_EDITOR_CONTAINER
LIFETIME =
NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
GUI_TYPE_NOT_SUPPORTED = 5
others = 6 .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH g_mytable.
MOVE: WA_THEAD-TDNAME TO STXL-TDNAME,
WA_THEAD-TDID TO STXL-TDID,
WA_THEAD-TDOBJECT TO STXL-TDOBJECT,
WA_THEAD-TDSPRAS TO STXL-TDSPRAS.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = wa_stxl-tdid
LANGUAGE = wa_stxl-tdspras
NAME = wa_stxl-tdname
OBJECT = wa_stxl-tdobject
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES = it_line
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT IT_LINE INTO V_RESULT.
APPEND V_RESULT TO G_MYTABLE.
ENDLOOP.
CALL METHOD G_EDITOR->SET_TEXT_AS_R3TABLE
EXPORTING
TABLE = G_MYTABLE
EXCEPTIONS
ERROR_DP = 1
ERROR_DP_CREATE = 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.
endif.
ENDMODULE. " STATUS_9000 OUTPUT
&----
*& Module USER_COMMAND_9000 INPUT
&----
MODULE USER_COMMAND_9000 INPUT.
CASE SY-UCOMM.
REFRESH G_MYTABLE[].
REFRESH IT_LINE[].
CLEAR V_RESULT.
WHEN 'SAVE'.
CALL METHOD G_EDITOR->GET_TEXT_AS_R3TABLE
EXPORTING
ONLY_WHEN_MODIFIED = FALSE
IMPORTING
TABLE = G_MYTABLE
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.
LOOP AT G_MYTABLE INTO V_RESULT.
APPEND V_RESULT TO IT_LINE.
ENDLOOP.
CLEAR V_RESULT.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = G_HEAD
INSERT = ' '
SAVEMODE_DIRECT = 'X'
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
LINES = IT_LINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 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.
REFRESH G_MYTABLE[].
REFRESH IT_LINE[].
CLEAR V_RESULT.
WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
LEAVE TO SCREEN '0'.
*CALL SCREEN '0'.
WHEN OTHERS.
ENDCASE.
*G_OK_CODE = SY-UCOMM.
*CLEAR SY-UCOMM.
ENDMODULE. " USER_COMMAND_9000 INPUT
2008 Jan 09 9:50 AM
Hai,
Check this.
Long Texts are stored in tables
STXH - header
STXL - details.
if you want to read the texts you can use Fun Module READ_TEXT
Any Application document Header and Item Long texts are stored in STXH table with the 4 parameters OBJECT,ID,NAME and LANG
These texts are fetched from database using READ_TEXT fun module by passing the above 4 parameters.
Double click on the text, from the text editor menu GOTO-> HEDAER
you will find the all above 4 parameters
so accordingly you have to pass to the fun module READ_TEXT to fetch the texts.
Re: upload longtext from excel file
REPORT zupload_excel_to_itab.
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.
TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
***********************************************************************
END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.
http://www.sapdevelopment.co.uk/file/file_upexcel.htm
regards.
sowjanya.b
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |