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

Process a field type string with editor

ekekakos
Participant
0 Likes
2,641

Hello, I have a field which is TYPE STRING and I ant the user to edit it through the small editor that SAP provides (by pressing a button that I have put in the Screen Painter).

Can someone tell me ho to do?

But keep in mind that the TYPE of the FIELD Comments is STRING.

I tried to find to find sth for STRINGs and not for CHARs but I couldn't.

Thanks in advance

Elias

1 ACCEPTED SOLUTION
Read only

MateuszAdamus
Active Contributor
2,350

Hello elkekakos

Google: SAP ABAP edit string value in text editor: https://www.google.com/search?q=sap+abap+edit+string+value+in+text+editor

First result: https://answers.sap.com/questions/6606796/how-to-create-text-editor.html

One of the answers contains whole example (I have not tested it): https://answers.sap.com/answers/6607286/view.html

Kind regards,
Mateusz
7 REPLIES 7
Read only

MateuszAdamus
Active Contributor
2,351

Hello elkekakos

Google: SAP ABAP edit string value in text editor: https://www.google.com/search?q=sap+abap+edit+string+value+in+text+editor

First result: https://answers.sap.com/questions/6606796/how-to-create-text-editor.html

One of the answers contains whole example (I have not tested it): https://answers.sap.com/answers/6607286/view.html

Kind regards,
Mateusz
Read only

0 Likes
2,350

Thanks Mateusz, but there is a missing point in this. There is no method to pass the already existing text for editing. Here I couldn't find a way for strings type elements. I found a lot of FM but all are for CHARs data element and ends with ST22 error.

So my question is how to pass the existing TEXT to the editor.

I found the below but I cannot fill the ITAB it is asking because it must be charlike.

DATA: gt_outtab       TYPE STANDARD TABLE OF as4text
CALL METHOD text_editor->set_text_as_stream
      EXPORTING
        text            = gt_outtab
      EXCEPTIONS
        error_dp        = 1
        error_dp_create = 2
        OTHERS          = 3.<br>

Again thanks

Read only

0 Likes
2,350

Hello

Class CL_GUI_TEXTEDIT contains method SET_TEXTSTREAM which imports a text with STRING type. Have you tried it?

Kind regards,
Mateusz
Read only

0 Likes
2,350

Damn, damn, ... I saw also this metho yesterday but I choose the other one. And I was trying to find a way to convert the STRING to CHAR. I found this after your 1st answer (CONVERT_STRING_TO_TABLE) with hich I managed to overcome my problem (fill a charlike table from the string). I was preparing my answer and you came to tell me the correct method that must be used. Jesus, what a waste time.

Thnks a lot Mateusz Adamus

Read only

0 Likes
2,350

No worries. We've all been there - looking at the obvious and not seeing it.


Kind regards,
Mateusz
Read only

0 Likes
2,350

Elias Kekakos Hopefully "fill the ITAB it is asking because it must be charlike", hopefully it must be charlike to store text... 😉

If it's about how to transfer string to itab, it has already been asked in the forum.

Read only

0 Likes
2,350

Yes you are right Sandra, here I found the above FM CONVERT_STRING_TO_TABLE. But unfortunately yesterday I read about other FMs that unfortunately convert big CHARs to a charlike ITAB. Maybe my mistake was that I was trying to find an answer to 'split a string into a charlike ITAB'.

Thanks