‎2010 Sep 03 9:50 AM
Hi,
Requirement:
The form should print Item details with 3 column Item text, Amount and currency. Here Item text is a long text, it may contain upto 300 characters.
I need to wrap the long text and print it in the first column.
To wrap the text, I used the function module RKD_WORD_WRAP. I am getting the wrapped text in OUTPUT_LINES table.
Now, how can I print output_lines internal table in the first column of the Item table in SAPscript.
For example,
Item Text Amount Currency
Long text. It may contain 200 USD
300 characters
Item Text2. 123456789087 500 USD
Testing word wrap that
contain more characters.
23456
‎2010 Sep 03 12:24 PM
This is very much possible and easy to do with smartforms. But tedious with sapscripts.....
Well, there can be some solutions..............
1. Without changing the print program...
Need to write a subroutine in sapscript to split the long text to required length for each line and collect the output in different variables. (Drawback 1: You need to assume the no of lines and declare the same number of variables. If the no of lines after splitting is more than that, the additional lines will be lost.)
Then in sapscript you can write it as....
PF Item Text,,Amount,,Currency
PF &ITEM_TEXT1&,,&AMOUNT&,,&CURRENCY&
PF &ITEM_TEXT2&
PF &ITEM_TEXT3&
PF &ITEM_TEXT4&
PF &ITEM_TEXT5&
(Drawback 2: Even if there is one line it will occupy rows for 5 lines everytime.)
2. Changing the print program........
create a separate element for this table....
PF Item Text,,Amount,,Currency
/E TABLE
PF &INT_TABLE-ITEM_TEXT&,,&INT_TABLE-AMOUNT&,,&INT_TABLE-CURRENCY&
Now this element needs to be populated inside a loop using WRITE_FORM. The internal table needs to be populated accordingly. for example
item text line 1 200 INR
item text line 2
item text line 3
item text line 4
item text line 5
item text line A 300 INR
item text line B
item text line C
item text line D
item text line E
Please let me know which method is feasible in your case. If it's not feasible to change the print program in your case, we can look into some solutions for the drawbacks with the 1st method.
I don't know if there is any easier method to achieve this.
‎2016 Oct 06 10:07 AM
Hi satyajit,
Can you please tell me how to achieve word wrap in sap smart forms .
Thanks,
RG