Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table control with long text

Former Member
0 Likes
850

Hi to all

I am developing a module pool in which i am using table contro.

In table control one field contain longtext.

Please tell me how to impose a button on table control and when i double click on that a editor window should open and there text is to be inserted and store in table.

Plz guide me and send me coding if possible.

OR suggest me another way to do. Because my requirement is to enter text in half or more page.

Thanks & Regards

Anubhav

1 REPLY 1
Read only

Former Member
0 Likes
432

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 don’t 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

note :-

in ur case it(WA_THEAD) get data from u r table conrtol clicked line. ie u need to have table control line with checkbox.

and u select taht line then u can click one of radiobutton. then that row values can be fetched to wa_thead and then export to abap memory...