2023 May 09 1:06 PM
Hello,
I need a program that accepts a block and outputs it in a box. For example, "This is a test" becomes:
********
* This *
* is *
* a *
* test *
********
2023 May 09 1:09 PM
SPLIT ... AT space INTO TABLE ...
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapsplit.htm
2023 May 09 2:38 PM
Why not just editing your question with Actions > Edit ?
Please use the COMMENT button for comments, asking for complements, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.
2023 May 09 3:04 PM
2023 May 09 4:41 PM
I'm not much about helping people who ask me to do their homework, but although it's a pretty useless requirement, sounds funny. What should I do?
Of course, it's just my algorythm, I'm sure it can be bested, and, obviously I will not provide a single line of code.
2023 May 09 8:53 PM
Thank you for your help. It was really helpful. I wrote this code, but I want that the box around the words be the size of longest word in the sentence. With what code I can find the longest word and ask it to write that.
REPORT z_words.
PARAMETERS: p_words TYPE string.
DATA: words TYPE TABLE OF string,
word TYPE string.
SPLIT p_words AT ` ` INTO TABLE words.
WRITE 😕 '*******'.
LOOP AT words INTO word.
WRITE :/'*', word, '*'.
ENDLOOP.
WRITE 😕 '*******'.
2023 May 10 10:30 AM
Do a first LOOP and get the longest strlen( ). Something like
loop at words into word.
data(maxlen) = cond i( when strlen( word ) > maxlen then strlen( word ) else maxlen ).
endloop.
(you can do it with a FOR, I assume, but I'm not used yet to that sentence.
2023 May 09 8:56 PM
Yes I have written it until here, but I have no idea what should I do in continuation.
REPORT z_words.WRITE 😕 '*******'.