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

Long Text button on the module pool screen

Former Member
0 Likes
999

Hi experts,

My requirement is to design a template screen which have a template number and template title and questions and options to save a new template, change existing template and delete template. The user have to fill the answers and can choose between the options. For answers on the screen the icon "icon_create_text" will be present adjacent to each question. When the icon is clicked the text editor should be shown and when text is entered and save is clicked in the text editor the text should be saved. Also the screen has a "Save as new template" pushbutton. When this button is clicked the scope of work title will become ediatble and user has to enter the title. An automatic unique template number should be generated and the template should be saved in the custom table. The custom table will have the fields: template number, template title, question, language and answer flag which indicates if answer is present.

I have a doubt in the text editor. When I click the icon the text editor should be shown. How can I do this? If EDIT_TEXT will solve my problem should I create a textid and textobject for this in SE75? I was thinking of concatenating the uniquely generated template number and question number as the textname. But the unique number is internally generated and is varying.Can anyone let me know how to handle the text editor part like saving and deleting the text in the text editor.

Regards,

Asha

1 REPLY 1
Read only

Former Member
0 Likes
554

Hi Asha,

U need 2 create a custom Control on the screen and name it say 'TEXT_EDIT1'.

In the TOP Declaration declare the following

DATA : G_CONTAINER1 TYPE SCRFNAME VALUE 'TEXT_EDIT1' ,

TEXT1 TYPE REF TO CL_GUI_TEXTEDIT ,

G_CUSTOM_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER .

CONSTANTS: C_LINE_LENGTH TYPE I VALUE 256.

  • define table type for data exchange

TYPES: BEGIN OF MYTABLE_LINE,

LINE(C_LINE_LENGTH) TYPE C,

END OF MYTABLE_LINE.

  • table to exchange text

DATA : G_MYTABLE TYPE TABLE OF MYTABLE_LINE .

DATA : G_WA LIKE LINE OF G_MYTABLE .

In the PBO use:

-


IF G_CUSTOM_CONTAINER1 IS INITIAL.

CREATE OBJECT G_CUSTOM_CONTAINER1

EXPORTING CONTAINER_NAME = G_CONTAINER1.

CREATE OBJECT TEXT1

EXPORTING

PARENT = G_CUSTOM_CONTAINER1

WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION

WORDWRAP_POSITION = LINE_LENGTH

WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE.

ENDIF .

PERFORM READ_TEXT_IN_EDITOR .

In the PAI Use:

-


When 'SAVE_TEXT'.

Perform F_SAVE_TEXT.

When 'DISP_TEXT'

Perform DISP_TEXT.

In the Form Routines Include

&----


*& Form F_SAVE_TEXT

&----


  • text

----


FORM F_SAVE_TEXT .

  • ED_HEADER-TDNAME = ED_NAME .

ED_HEADER-TDOBJECT = 'UR_OBJECT' .

ED_HEADER-TDNAME = ED_NAME .

ED_HEADER-TDID = 'UR_ID'.

ED_HEADER-TDSPRAS = SY-LANGU.

ED_HEADER-TDLINESIZE = '072'.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = ED_HEADER

SAVEMODE_DIRECT = 'X'

TABLES

LINES = ED_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

CASE SY-SUBRC.

WHEN '5'.

MESSAGE E000(ZCVS) WITH 'ZINSPRMRKS' .

WHEN '1'.

MESSAGE E000(ZCVS) WITH 'Z001'.

ENDCASE.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " F_SAVE_TEXT

&----


*& Form DISP_TEXT

&----


FORM DISP_TEXT.

PERFORM READ_TEXT.

IF ED_LINES[] IS NOT INITIAL.

CALL METHOD TEXT1->SET_TEXT_AS_R3TABLE

EXPORTING

TABLE = G_MYTABLE

EXCEPTIONS

OTHERS = 1.

CLEAR : G_MYTABLE , G_MYTABLE[].

LOOP AT ED_LINES. " INTO G_WA.

G_WA-LINE = ED_LINES-TDLINE.

  • ED_LINES-TDLINE = G_WA-LINE.

APPEND G_WA TO G_MYTABLE.

  • CLEAR G_MYTABLE.

ENDLOOP.

ENDIF.

ENDFORM. "DISP_TEXT

&----


*& Form READ_TEXT

&----


FORM READ_TEXT .

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'UR_ID'

LANGUAGE = SY-LANGU

NAME = ED_NAME

OBJECT = ED_OBJECT

  • IMPORTING

  • HEADER = ED_HEADER

TABLES

LINES = ED_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

ENDFORM. " READ_TEXT

&----


*& Form READ_TEXT_IN_EDITOR

&----


FORM READ_TEXT_IN_EDITOR .

CONCATENATE 'ZCVS' ITAB-PRUEFLOS INTO ED_NAME .

CONDENSE ED_NAME NO-GAPS .

ED_OBJECT = 'YOUROBJECT' .

*--- For Reading Inspection Remarks Related text

IF ED_LINES[] IS INITIAL .

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'UR_ID'

LANGUAGE = SY-LANGU

NAME = ED_NAME

OBJECT = ED_OBJECT

  • IMPORTING

  • HEADER = ED_HEADER

TABLES

LINES = ED_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

IF ED_LINES[] IS NOT INITIAL.

LOOP AT ED_LINES .

G_WA-LINE = ED_LINES-TDLINE .

APPEND G_WA TO G_MYTABLE .

CLEAR G_WA.

ENDLOOP .

ENDIF .

ENDIF .

CALL METHOD CL_GUI_CFW=>FLUSH

EXCEPTIONS

OTHERS = 1.

CALL METHOD TEXT1->SET_TEXT_AS_R3TABLE

EXPORTING

TABLE = G_MYTABLE

EXCEPTIONS

OTHERS = 1.

ENDFORM. " READ_TEXT_IN_EDITOR