Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How can we use cl_gui_html_viewer in a background process.

Former Member
0 Kudos

Hello,

Refering to this thread:

How can we use cl_gui_html_viewer in a background process.

I want to execute a html code in bakground process in abap program.

but using cl_gui_html_viewer I have an error with CNTL_ERROR in the method CONSTRUCTOR;

Thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

According to : http://help.sap.com/saphelp_nw04/helpdata/en/c9/147a36c70d2354e10000009b38f839/frameset.htm

to create a HtML_Viewer we need a Container in which the SAP HTML Viewer can be displayed.

I didn't created a custom control I used normal coding.

create object l_html_viewer

exporting

parent = l_container

But l_container is a container .

So, can I create a html_viewer objec without using a container control ?

How?

10 REPLIES 10

Former Member
0 Kudos

Marie,

I don't know about HTML viewer specifically, but whenever a GUI object is needed to be used in background, there is a standard method to avoid CNTL_ERROR.

When a program runs in background, there is no "screen" and hence no GUI, and hence a custom control can not be displayed. That is why the program generates an error.

The trick is to avoid creating the custom control in background.


  if sy-batch = 'X'. "background mode
*   We don't want to create the custom control
  else. "dialog mode
    create object l_container exporting ...
  endif.

* We really don't need a container for using CL_GUI_ objects
* Proceed with the normal coding
  create object l_html_viewer 
  exporting 
    parent = l_container
   ...

Former Member
0 Kudos

According to : http://help.sap.com/saphelp_nw04/helpdata/en/c9/147a36c70d2354e10000009b38f839/frameset.htm

to create a HtML_Viewer we need a Container in which the SAP HTML Viewer can be displayed.

I didn't created a custom control I used normal coding.

create object l_html_viewer

exporting

parent = l_container

But l_container is a container .

So, can I create a html_viewer objec without using a container control ?

How?

0 Kudos

You can not use the HTML control in the background. It requires the GUI for processing.

Regards,

Rich Heilman

raymond_giuseppi
Active Contributor
0 Kudos

cl_gui* class needs a container, a true container like in a dynpro is not available in background, so there is a trick used with cl_gui_alv_grid, creation of a cl_gui_docking_container to create a dummy container if in background mode, using the sdn search tool, you will find many samples based on cl_gui_alv_grid. (adapt solution of ) - hope that it will work for html like for alv grid.

Regards,

Raymond

rainer_hbenthal
Active Contributor
0 Kudos

The HTML-Viewer is a gui control and cant be used in background. Besides that, HTML as a markup language can not be executed.

Former Member
0 Kudos

Thank you to everyone

0 Kudos

Hi Marie...

I have the same requeriment as yours..."execut a html code in background"

And I'm having the same problem...

How did you solve that?

docking container does not work in this situation... not for me...

Have you found another class or method that works in bakground mode?

Thanks

0 Kudos

Marie, Marcelo and all of you,

HTML is no executable code, it is a page description language. The viewer is able to redirect to links, javascrip codet can be executed by the viewer. But the viewer is a GUI control, that means execution takes place in the GUI, that is on your frontend computer. No GUI, no frontend, no execution of javascript code.

Better explain what you want to achieve at the end of the day, then lets find a background solution.

Regards,

Clemens

0 Kudos

Hi Clemens,

Ok "execute" is not the right word...

My requisition is: My cell phone provider offers me a "link" witch is like:

"www.cell.com/sms/id=user&password=pass&message=mess..."

We will use it to send SMS to employees...

That is why I called it "execute".

So what I need is a method or function that send that URL throught internet...

When im foreground the viewer class works(gui stuff), but I´m going to need to send it background too...

I tryed if_http_client too, but did not work.

Tks

0 Kudos

Hi Marcelo,

this should be possible through SAP Alert Management. Take an hour and check the SAP tutorials available on SCN.

Once alerting is configured properly, you can use it with standardized function calls.

Regards,

Clemens