SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

ITS WebRFC programming



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Mar 09, 2008 11:16 am    Post subject: ITS WebRFC programming Reply with quote

ITS WebRFC programming
AUTHOR: Kevin Wilson
Original: http: //www.erpgenie.com/its/webrfc.htm
Do you want to add links to your web-enabled reports?

1 Introduction

WEBRFC allows you to publish your standard SAP reports to the web.

Information on HTML templates are stored in table WWWDATA with more
detail in WWWPARAMS (background colors, file extensions). See the CAALR.HLP file for details on WEBRFC programming.

Webrfc provides additional functionality to your standard reports:
- Create links in your standard reports to:
-- other reports
-- external web pages
-Dynamically change templates by using placeholders

1.1 Requirements

For a SAP report to be published to the web you need to have completed the
following:

· Given the program an authorization code. The ITS user that runs the reports will need access to this group

· The report needs to have been released for internet use on each applicable client. (SMWO)

NOTE: The current WEBRFC setup has a small issue when logging on. If you make users log into the WEBRFC and they happen to make a mistake with their login details, SAP keeps this first attempt for all future attempts to run WEBRFC reports, thus leading to the user never getting into a WEBRFC report until he closes his browser and reopens another one and correctly enters his details!!!

1.2 Tweaking your reports
1.2.1 Adding URLs in your reports

To link a URL to a specific part of a line in the list generated by an ABAP report program, use function module WWW_SET_URL in the program. Take the following steps:

1. Generate the list line with the WRITE statement.
2. Call WWW_SET_URL directly after the WRITE statement.
3. Specify the offset of the desired link in the OFFSET import parameter.
4. Specify the length of the desired link in the LENGTH import parameter.
5. Specify the URL you want to link to as a literal or as a variable in the FUNC import parameter.
6. Pass an empty internal table with structure W3QUERY to the tables parameter QUERY_STRING.

When you execute the program in the R/3 System, the resulting list has the same appearance as it always does. However, when you execute the program from a Web page, the specified part of the list line is presented as a link. If you click on this link, you access the URL address.

Example

Code:
data qstring like w3query occurs 10.                           
data: url(200), url2(200), url3(200), fullurl(200).           
url = 'http://testweb/scripts/wgate/zvw10a/!?~language=en'.   
url2 = '&~OkCode(LGON)=LGON&login-login_user='.               
url3 = '&vbcom-vbeln='.                                       
 
concatenate url url2 kna1-kunnr url3 vbak-vbeln into fullurl.   
write: /'Sales order:', vbak-vbeln, vbak-erdat.                 
call function 'WWW_SET_URL'                                     
  exporting                                                   
         offset = 12                                           
         length = 10                                           
         func   = fullurl                                     
  tables                                                           
    query_string  = qstring                                   
  exceptions                                                     
    invalid_table = 1                                         
    others        = 2.


The WWW_SET_URL function module will have result that the 10 characters following the string Sales Order: will be a link as follows:



2 Debugging

When developing applications that retrieve data from an R/3 System by Remote Function Call (RFC), you can debug RFC calls via the SAPgui. When you switch on the debugger, the SAPgui is started for each RFC call. You can then check the ABAP code of the called function module, examine the variables, and so on. As an R/3 user, you need authorizations for debugging SAP code before you can to this.

On your PC, do the following:

1. Install Windows NT 4.0 on your PC.
2. Install an HTTP server supported by the SAP Internet Transaction Server (ITS).
3. Install the SAPgui and run SAPGUI.EXE at least once to update the Windows NT registry.
4. Install the ITS, since RFC can display the SAPgui only on PCs where the ITS is running.
5. Shut down the ITS Mapping Manager service and change its startup setting to manual.
6. In the \Program Files\SAP\ITS\AGate\ directory, start AGATE.EXE.
7. Insert the ~RFCDebuggingOn parameter with the value 1 in XGWFC.SRVC or any other WebRFC service file you want to use for debugging.
8. Start your favorite Web browser and start the WebRFC application you want to debug.

If you perform all the above steps properly, the SAPgui appears, and you see a debugging screen with the first line of the called function module.

· When you have finished debugging and want to activate ITS to run as a service again, do not forget to delete the ~RFCDebuggingOn parameter from the service file or set its value to 0.

· Since WGATE.DLL and AGATE.EXE can run on different computers, you do not need to install an HTTP server on your PC (see the documentation on ITS Administration and Tuning). This is especially important if you are using a Windows NT Workstation, since some HTTP servers require a Windows NT Server.

More detail...

In WebRFC applications, HTML pages are not generated exclusively with ABAP code, but derived from templates stored separately in a database table. In addition to standard HTML tags, these templates contain placeholders that are replaced with data at runtime.

SAP delivers a number of standard HTML templates, but you can modify any of these or even create your own. Using any standard text editor or HTML authoring tool, you can (for example):
  • Display your own company logo
  • Set foreground and background colors
  • Change the order and alignment of placeholders

This ability to modify HTML templates allows you some freedom to adapt WebRFC applications, but it still does not go far enough, because the HTML code that replaces the placeholders is determined by the applications themselves.

To allow you to customize generated HTML code, WebRFC applications can load and use named attributes (parameters) for each template. The templates and template parameters used in WebRFC applications are stored in the following database tables:
  • WWWDATA (templates)
  • WWWPARAMS (template parameters)

When developing WebRFC applications, you can maintain the objects of both these tables with the following function modules:
  • WWW_HTML_MERGER
  • WWW_LOAD_TEMPLATE_ATTRIBUTES
  • WWW_LOAD_OBJECT_ATTRIBUTES

In practice, WebRFC applications support different types of Web objects, all of which can be stored in the database table WWWDATA. Types of data include:
  • HTML templates
  • Binary data (for example, graphics)
  • SAP Internet Transaction Server (ITS) files
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.