on 05-31-2005 9:40 AM
Hi Guys,
I call a Bapi in R3 system which sends me already formatted text.
Is it possible to display this text and keep its formatting as it is possible with <PRE>... </PRE> tags in html ?
Thanks,
Marc
Dear VS
Pls guide me how to take print in webdynpro
Send me the code one by one i.e From the scratch.
B'cos i am new to webDynpro.
Regrads
Dhinakar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marc,
Excepts numerous options proposed let me suggest another one. It sounds wired, but it works:
1. Place IFrame UI control on WD View (we will use it to display formatted text).
2. Create in context attribute <b>AttrContent</b> of type <b>binary</b>
3. Setup binary attribute in view controller wdDoInit:
final ISimpleTypeModifiable mtype = attr.getModifiableSimpleType();
final IWDModifiableBinaryType btype = (IWDModifiableBinaryType)mtype;
btype.setFileName( attr.getName() + ".html" );
btype.setMimeType( WDWebResourceType.HTML );
5. Save reference to <i>mtype</i> in private controller variable, say <i>_contentType</i>;
6. Create <b>string</b> attribute AttrUrl in context, and bind IFrame <b>source</b> property to it.
7. Whenever you need to update content use the following:
final String formattedStr = ...; /* Get it from backend */
wdContext.currentContextElement().setAttrUrl
(
_contentType.format
(
(
"<html><head /><body><pre><code>" +
formattedStr +
"</code></pre></body></html>"
).getBytes("UTF-8")
)
);
Done.
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1.
2. sorry, the firsl line in code should be:
final IWDAttributeInfo attr = wdContext.getNodeInfo().getAttribute("AttrContent");
3. see above
4. what exactly? Declare non-static field in view controller and set it to variable mentioned (for future use).
VS
Message was edited by: Valery Silaev
Hi Valery,
I tried your suggestion !It works but i have a small problem ! its asking to open or save the file .. and not displaying it in the IFrame .
What is problem :)?what should i do to put it in the IFrame itself !
And by using the simple modifiable type and setting it to string does it mean that the string attrurl will have all the filename and mimetype details also stored ! ??
The trick seems to be the smtype.format ! Obviously .tostring of the acquired bytes wont work!
Why !
(Even if u answer i cant award points ! :(... sorry ! )
Regards
Bharathwaj
Bharathwaj,
The trick here is ISimpleType.format(), of course. It place binary content into binary cache on server and returns formatted url. Using this url it is possible to load content. When placing content corresponding file name and MIME are stored as well. Afterwards WebAS should response with correct Content-type and Content-disposition headers. For HMTL type it should be not attachment, but rather inline. In you case it seems to be treated as attachment. Probably not specifying file name will work?
VS
Hi Valery,
I did get the code to work (needed a try catch statement).
But I'm having the same issue that Bharathwaj is having, where it asks to open or save the file.
We noticed that btype is set, but it is never associated with mtype or anything else, so how does the server know that it is to use mtype with btype?
I'd love to get this to work if you have any more suggestions!
Thanks,
Jonathan
Hi Valery,
Our portal verison is EP 7 01 SP5. I have created some webdynpro forms and Iviews for them on the portal. I want to Print these forms from the portal.
I came across this thread where you have provided information regarding a solution to the print problem.
Can you let me know the complete Code that is required for this Print to work fine.
Thanks,
Sujata
Hi
I have some options for you...
option 1 - If the long formatted text in sap table is in single column with multiple rows in terms of having each line as one record and when displayed looks like a paragraph statement. So use your RFC call from SAP and make a binding with a webdynpro table to populate the rows and make invisible the row/column lines. So When you run it on the browser it will display like a long text. By default, SAP table will have column some length of 72 characters, which you change to 140 charcs( through another rfc which takes care of the carriage returns,formatting..etc), to get a long sentence formation.
option 2 - If the long text is not from SAP table and its kind of direct information, then just keep on pasting the text in the text view by providing spaces appropriately, so that the display will be a continous form of paragraph. This is a trial and error way and providing the spaces between the lines.
option 3 - Store the long text in a text file and call a import parameter, which will read the whole text and store it in string (node) and display it text view. ( alignment cannot be gauranteed - not a good option)
option 4 - Last one, is to call a office (msword) or a pdf control , which will display the long text through the word editor or a pdf form
since your text is already formatted, try with a table having multiple rows, (each containing one line).
However, the normal formatted way of having Bold,italics, different font faces, underlines cannot be done with the current versions. You can have line breaks only.
Hope this gives you a brief idea on how to go about on it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marc
Try rendering this through a jsp and display it in a Web Dynpro IFRAME
Regards
Pran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.