cancel
Showing results for 
Search instead for 
Did you mean: 

Print in webdynpro (need to open the same window in another broswer )

Former Member
0 Kudos

Hi Webdynpro Gurus,

I am looking for a soilution for PRINT button in webdynpro application which is required in many applications in our big project.

Our User requirement is - When user presses PRINT button, we have to print the webdynpro application.

Currently i am using Print option provided in web browser settings, but the problem is i have to open the application (which is filled by user) in seperate browser, this is to hide all the buttons when printing. How to open a webdynpro application in seperate browser with all data entered by user.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi pavan

check this out

[https://forums.sdn.sap.com/click.jspa?searchID=19750177&messageID=6463197]

and for printing you can take some help from this thread

[https://forums.sdn.sap.com/click.jspa?searchID=19750432&messageID=6677799]

Edited by: Neha Thukral on Dec 10, 2008 11:21 AM

Former Member
0 Kudos

Thankyou Neha.

The two options given are already checked, it doesnt fill our requirement.

1) The Create_External_window method doesnt allow to pass data from current application. It opens a new application in new browser.

CALL METHOD l_window_manager->create_external_window

EXPORTING

url = lv_url

RECEIVING

window = l_window.

l_window->open( ).

2) I cant use ALV .

My requirement is to open the same application in another browser with all data.

Is any solution available for the following:

1) Is it possible to take print of POP-UP window ? (Only POP-UP window)

2) Is it possible to convert webdynpro application into a PDF document ?

3) How to open the application in a browser with all data entered?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>1) Is it possible to take print of POP-UP window ? (Only POP-UP window)

Not possible. The Pop-Up is not an actual window to the browser. It is just an iFrame that is floating over the main window. Therfore there is no way to address it directly by the browser for printing it alone.

>2) Is it possible to convert webdynpro application into a PDF document ?

Manually designing a PDF document using the Adobe Lifecycle tools is the only supported method or converting to PDF using a client side PDF Print Driver is the only way. There is no automatic conversion or printing on the server side because the content is not rendered until it reaches the browser.

>3) How to open the application in a browser with all data entered?

This is tricky but possible. What you would want to do is to serialize your entire context to XML and then store this XML document in a server cookie (basically just storing it in the database with a unique key). Then you pass the key to the server cookie as a single URL parameter to the new browser window. Although this new window has a separate server session, it can read the XML document from the database using the key passed via URL parameter and then deserialize the data and restore it into the context. Depending upon the size and complexity of the context, however, this can be a lot of work. You would obviously have to add logic to the initialization of the component to do this restoration.

Former Member
0 Kudos

Thankyou very much Thomas.

This is tricky but possible. What you would want to do is to serialize your entire context to XML and then store this XML document in a server cookie (basically just storing it in the database with a unique key). Then you pass the key to the server cookie as a single URL parameter to the new browser window. Although this new window has a separate server session, it can read the XML document from the database using the key passed via URL parameter and then deserialize the data and restore it into the context. Depending upon the size and complexity of the context, however, this can be a lot of work. You would obviously have to add logic to the initialization of the component to do this restoration.

Thomas, Please explain me how to do this.

serialize the context data to XML

1) is this done in webdynpro component ? How to do it?

deserialize the data and restore it into the context

2) is this done in webdynpro component ? How to do it?

store this XML document in a server cookie

3) in which format i have to store? any Methods/Function modules available for this?

read the XML document from the database using the key passed via URL parameter

4) how to read the XML document? any Methods/Function modules available for this?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>serialize the context data to XML

>1) is this done in webdynpro component ? How to do it?

I would imagine you would want to write this codein the WD Component Controller. Not sure where else you would have access to the global context. Look at the ABAP Keywords CALL TRANSFORMATION. There is no magic bullet here. I don't necessarily recommend trying to just serialize the entire context. Instead you will need to read all the data out of the context one node at a time and then serialize it with the CALL TRANSFORMATION command. I actually would suggest creating a custom ABAP class with attributes for all the abap internal tables, structures, etc that you have in your context. Load up an instance of this class with the data and then serialize it to XML with the CALL TRANSFORMATION command. I used to use this technique a lot in BSP to store model class objects between requests in stateless applications.

method save_model.
*@78\QImporting@  I_MODEL TYPE REF TO CL_BSP_MODEL  BSP: Model Basis Class

  data: ostream type string,
         xslt_err type ref to cx_xslt_exception.

***** serialize model class
  try.
      call transformation id
      source model = i_model
      result xml ostream.

****Write cookie it into the Server Cookie
      cl_bsp_server_side_cookie=>set_server_cookie( name = i_name
        application_name = runtime->application_name
        application_namespace = runtime->application_namespace
        username = sy-uname
        session_id = runtime->session_id
        data_name = i_name
        data_value = ostream
        expiry_time_rel = '1200' ).
    catch cx_xslt_exception into xslt_err.
  endtry.


endmethod.

>deserialize the data and restore it into the context

>2) is this done in webdynpro component ? How to do it?

Now you just do the reverse. Restore your class object or data objects from XML and then write them back into the context using normal context commands (like BIND_TABLE).

method read_model.
*@7B\QReturning@  VALUE( R_MODEL )  TYPE REF TO CL_BSP_MODEL  BSP: Model Basis Class

  data: istream type string,
         xslt_err type ref to cx_xslt_exception.

**** Read Server cookie
  call method cl_bsp_server_side_cookie=>get_server_cookie
    exporting
      name                  = i_name
      application_name      = runtime->application_name
      application_namespace = runtime->application_namespace
      username              = sy-uname
      session_id            = runtime->session_id
      data_name             = i_name
    changing
      data_value            = istream.

**** deserialize the Class
  if istream is not initial.

    try.
        call transformation id
        source xml istream
        result model = r_model.

      catch cx_xslt_exception into xslt_err.
    endtry.

  endif.

endmethod.

>store this XML document in a server cookie

>3) in which format i have to store? any Methods/Function modules available for this?

See above samples. We have the class cl_bsp_server_side_cookie for this. It has BSP in the name, but isn't BSP specific. You might have to code alternatives to some of the runtime attributes I'm passing in; but in general the server cookie works just fine in WDA as well. Afterall it is just storing the XML document into the database. If you don't want to use a server cookie you can use your own custom Z-Table to store the data as well.

>read the XML document from the database using the key passed via URL parameter

>4) how to read the XML document? any Methods/Function modules available for this?

Also see above. You use the same CALL TRANSFORMATION comamnd to both read and write XML documents.

Former Member
0 Kudos

Hi,

[https://forums.sdn.sap.com/click.jspa?searchID=19733796&messageID=6463197]

you can use the same idea

or you can use pop up for the above purpose ............

you can take helpat this example

[https://forums.sdn.sap.com/click.jspa?searchID=19733796&messageID=6230882]

Edited by: Neha Thukral on Dec 10, 2008 6:35 AM

Former Member
0 Kudos

Thankyou.

I can pop-up the current application data into a new window, but problem is i cant take the print from pop-up window.

Is it possible to take print of POP-UP window using browser settings?

If not possible, i have to open the same application in new browser( to hide all the buttons and take print) passing all data entered.

How to open the same application in new browser with all data entered?

Former Member
0 Kudos

Hi ,

If you are displaying some record then you can use ALV for that because ALV has a inbuit funtionality of Print option from where you can print your output.

Thanks,

Satya