09-23-2008 5:58 PM
Hi there,
Interesting problem -
READ_TEXT can return the contents of a standard text, however if the standard text has an include command - for example "INCLUDE STDTXTKEYxxxx OBJECT TEXT ID ST" then the command text will be returned and not the actual contents of STDTXTKEYxxxx.
Is there a function module that would return the full long text and process the commands and look their text up?
Your help would be invaluable. A solution would provide the most points.
Thanks
Mantas
09-23-2008 6:52 PM
Hi,
What you should do is after calling READ_TEXT you check if you returned lines contains INCLUDE standard text. If yes then you call again READ_TEXT for this standard text and add lines retrieved from this call to original returned lines. Please also make note of line number where this is called because you will have to adust same.
You may also consider going for loop logic so that you keep on call READ_TEXT untill the retuned lines doesn't contain any further include. But then then only if this can be a possible scenario in your case.
Let me know if you have any doubt on this.
Enjoy SAP.
Pankaj Singh.
09-23-2008 6:14 PM
Hi,
I've not tried it but the method GET_TEXT of class CL_SAPSCRIPT_LONGTEXT looks like it will do the trick.
method get_text .
*-- returns the the text with placeholders like &V1& or &DATE&
*-- replaced by the corresponding texts as set by method
*-- ADD_PLACEHOLDER_VALUES
data: c_line_width type i value 80.
result = me->raw_text.
me->header-tdform = 'S_DOCU_PRINT'.
call function 'PRINT_TEXT'
exporting
header = me->header
device = 'OTF_MEM'
tables
lines = result
exceptions
others.
call function 'CONVERT_OTF_MEMORY'
exporting
max_linewidth = 80
tables
lines = result
exceptions
others.
endmethod.
Cheers,
Darren
09-24-2008 9:40 AM
Good suggestions there. Unfortunately I'm working with 4.6C and cannot find CL_SAPSCRIPT_LONGTEXT.
09-23-2008 6:52 PM
Hi,
What you should do is after calling READ_TEXT you check if you returned lines contains INCLUDE standard text. If yes then you call again READ_TEXT for this standard text and add lines retrieved from this call to original returned lines. Please also make note of line number where this is called because you will have to adust same.
You may also consider going for loop logic so that you keep on call READ_TEXT untill the retuned lines doesn't contain any further include. But then then only if this can be a possible scenario in your case.
Let me know if you have any doubt on this.
Enjoy SAP.
Pankaj Singh.
09-23-2008 8:17 PM
This sounds kind of dangerous. What if you have a self-referencing include or include loops?
09-23-2008 8:21 PM
Only if you thing it can be possible scenario.. and if yes you not loop and just go for one level check..
Enjoy SAP.
Pankaj Singh