cancel
Showing results for 
Search instead for 
Did you mean: 

Calling SAPGUI transaction out of BSP application

Wolfgang_Mayer
Active Participant
0 Kudos

Hello,

we're using some BSP application (running directly in browser, no SAP portal) to display CRM data, e.g. activities. I'm looking for a way to call a CRM SAPGUI transaction directly out of the browser. I already know how this works while the browser runs within a HMTL container in a screen, however, not when the application directly runs within the browser.

I saw in the SAP portal that there's a way to log on to SAP systems using SSO.

Is there a simple way to "copy" this technique from SAP portal and use it in self-developed BSP applications? Additional information: We don't use an ITS.

Thanks for any input & kind regards

Wolfgang

Accepted Solutions (0)

Answers (1)

Answers (1)

eddy_declercq
Active Contributor
0 Kudos

Hi,

Pls check things like

/people/thomas.jung3/blog/2004/08/26/updated-calling-a-bsp-application-from-a-sapgui-transaction

Eddy

PS.

Did you put yourself on the SDN world map already? Pls check

/people/eddy.declercq/blog/2006/06/14/from-the-grumpy-old-man-hoy-en-el-mundo

for details.

Wolfgang_Mayer
Active Participant
0 Kudos

Hi Eddy,

the blog you've mentioned deals with the opposite direction (calling BSP out of SAPGUI). I'm looking for a solution to call the SAPGUI out of a BSP application (not embedded into a GUI screen).

Regards

Wolfgang

Former Member
0 Kudos

Hi,

I understand that you want make a BSP that open the SAPGUI program (in other window?) and logon to the server and start a especific transaction. Well I do it in two diferent ways. The Easy Way and the Not so Easy Way. I'm using both depending on requirements

You can use shortcut files, like in saplogon, generated from the server. Is easy and fast but "dirty", with some problem with password, and things like this.

You can use SAPGUI Scripting, a more Powerfull aproach. Is possible start SAPGUI inside the Web page, hide toolbars, fill fields, control which transaction you are executing and so on.But It is a little more complicated.

If you tell me what do you want, I explain in more detail.

Agur(s)

athavanraja
Active Contributor
0 Kudos

is the system where the ABAP transaction is there is on WAS6.40? if yes (i know you said you dont use ITS) it comes with integrated ITS and calling a transaction from BSP page isactually calling a url (for integrated ITS)

if you are not on ITS

you can use this FM

data: itab1 type standard table of BDCDATA ,

ERRORS type standard table of BDCMSGCOLL .

CALL FUNCTION 'RFC_CALL_TRANSACTION_USING'

EXPORTING

TCODE = 'SE38'

MODE = 'E'

  • IMPORTING

  • SUBRC =

TABLES

bt_data = itab1

l_errors = errors

EXCEPTIONS

AUTHORITY_NOT_AVAILABLE = 1

OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

but this will open a new GUI session

Regards

Raja

Wolfgang_Mayer
Active Participant
0 Kudos

Hi Agur(s),

I'd prefer the SAPGUI scripting way. What kind of information could you provide?

I didn't give you points yet since - at the moment - I cannot tell whether this solves my problem or is a helpful answer. However - no doubt about that - I'll give them as soon as I understand what you mean.

Thanks & regards

Wolfgang

Wolfgang_Mayer
Active Participant
0 Kudos

Hi Raja,

We're running on Netweaver 2004s (7.00). I've posted your coding into the "OnInputProcessing" part of a BSP application. However, as soon as the coding is called, the below error message appears. Unfortunately it is in german, however, maybe some terms are in English.

I didn't give you points yet since - at the moment - I cannot tell whether this solves my problem or is a helpful answer. However - no doubt about that - I'll give them as soon as it helped me.

Regards

Wolfgang

Hinweis

Folgender Fehlertext wurde im System PC2 prozessiert: Error sending data, session terminated

Der Fehler trat auf dem Applikationsserver phoron01s_PC2_03 und im Workprozess 0 auf.

Die Abbruchart war: TH_RES_FREE

Die ABAP-Aufrufhierarchie war:

SYSTEM-EXIT of program SAPLWBABAP

Function: WB_PGEDITOR_INITIAL_SCREEN of program SAPLWBABAP

Method: IF_WB_PROGRAM~PROCESS_WB_REQUEST of program CL_WB_PGEDITOR_INITIAL_SCREEN=CP

Method: DO_THE_NAVIGATION of program CL_WB_NAVIGATOR===============CP

Method: DO_THE_NAVIGATION of program CL_WB_NAVIGATOR_VIS_AS_DYNPRO=CP

Method: PROCESS_WB_REQUEST of program CL_WB_MANAGER=================CP

Method: PROCESS_REQUEST_QUEUE of program CL_WB_MANAGER=================CP

Method: IF_WB_MANAGER~SET_WORKSPACE of program CL_WB_MANAGER=================CP

Method: START_INTERNAL of program CL_WB_STARTUP=================CP

Module: MANAGER_START of program SAPLWB_MANAGER

athavanraja
Active Contributor
0 Kudos

i take back the suggestion about using

'RFC_CALL_TRANSACTION_USING'

this has some issues.

Regards

Raja

athavanraja
Active Contributor
0 Kudos

ok the issue using the FM is if you are already logged on to the system and sap gui is running it seems to work fine, when i close the sap gui session and tried it failed and gave me a same error.

anyhow since you are on was 7 (NW2004s) calling a transaction is simply calling a URL using integrated ITS

for example to call se38 the url will be like below.

http://washost.domain.com:port/sap/bc/gui/sap/its.webgui/?~transaction=se38&sap-client=<clinet no>

Regards

Raja

athavanraja
Active Contributor
0 Kudos

this may be of interst to you. i found this piece of code on the internet and it works from a normal html page.

<script language="JavaScript">
<!--
retcd = 0;
exceptions = 0;
// *** SAPLogon() creates an object that has the methods to
// execute a call to an SAP function module
function SAPlogon()
{ fns = new ActiveXObject("SAP.Functions");
trans = fns.Transactions;
conn = fns.connection; /* get a new connection
object */
conn.System = "DEV"; /* Set the system ID (see: SY-SYSID)
*/
conn.user = "<userid>"; /* set userid (blank for dialog) */
conn.password = "<pwd>"; /* set password (blank for dialog) */
conn.Client = "200"; /* set password (blank for dialog) */
conn.Language = "E"; /* set language (blank for default)
*/
conn.tracelevel = 6; /* set password (blank for dialog) */
conn.RFCWithDialog = false; /* true: opens visible session window */
exceptions = 0;
conn.logon(0, 0); /* *** this call creates the object *** */
};
function SAPlogoff()
{ conn.logoff(0, 0);
exceptions = 0;
};
// *** execute the SAP function MODULE "RFC_CALL_TRANSACTION_USING"
// as a method execution of object type SAP.functions
function SAPcallTransaction(tcode)
{ exceptions = 0;
callta = fns.add("RFC_CALL_TRANSACTION_USING");
callta.exports("TCODE") = "SE38";
callta.exports("MODE") = "E";
retcd = callta.call;
conn.logoff();
alert(retcd);
SAPcallTransaction = retcd;
};
// --></script>
<body>
<!—Create an HTML button with a JavaScript call attached -->
Call SE38
<input TYPE = "submit"
VALUE = "SE38"
OnClick = "SAPlogon();
SAPcallTransaction(&quot;VA02&quot;);
SAPlogoff()"
>
</body>

Regards

Raja

Wolfgang_Mayer
Active Participant
0 Kudos

Hi Raja,

regarding your posts:

1. ITS webgui

I want to start the trx in normal SAPGUI. By the way, the customer where I want to implement this is still running on SAP basis 6.20.

2. Javascript

This is really nice (I gave you some points for that), however, it's not the solution I'm searching for. The user is already authorized due to login of the BSP application.

Regards

Wolfgang

Former Member
0 Kudos

Hi Wofgang,

Don't worry about points, I learn a lot in SDN, is a pleasure to be able to help.

SAPGUI Scripting is an OO interface to the SAPGUI, all the action you can do in the SAPGUI are availables. You can use other languages (JS) but we use VBS (Visual Basic Script) because the SAPGUI for Windows have a tool to record user action that generate code in that language.

First of all you need to change an instance parameter in the server.

SAPGUI/USER_SCRIPTING must be true

Now you can record and execute Scripts in the SAPGUI.

There a lot of detailed information and tools in

http://service.sap.com/sapgui

under the node SAPGUI Scripting. I recommend specially the 2003 Workshop presentations and the recorder tool under Download section.

If you need To embed SAPGUI in Web Pages there are an activeX control involved. I paste an example of html page.

<html>

<title>Test SAPGUI Scripting</title>

<body>

<table width="100%" height="90%">

<tr>

<td>

<object

classid="clsid:B90F32AD-859E-4EDD-BFAE-C9216849520C"

id="GuiAppl"

width="100%"

height="100%"

align=left

hspace=0

vspace=0>

</object>

</td>

</tr>

</table>

<br>

<FORM NAME="Formulari">

<INPUT TYPE="BUTTON" NAME="Executa" VALUE="Connect to server">

<INPUT TYPE="BUTTON" NAME="ExecutaInplace" VALUE="Connect to server (Inplace)">

</FORM>

<SCRIPT LANGUAGE="VBScript">

Sub Executa_onClick

Dim Form

Set Form = Document.Forms("Formulari")

GuiAppl.openConnection("HEC1")

End Sub

Sub ExecutaInplace_onClick

Dim Form

Set Form = Document.Forms("Formulari")

GuiAppl.openConnection("HEC1/INPLACE")

End Sub

</SCRIPT>

</body>

</html>

In the way of integrate SAPGUI with SAPGUI Scripting the are a lot of little problems to solve (conection strings, multiple nodes control, information pop up, visual style, hide some actions to the user, ...) and is necesary to study the method of the objects to learn what it is possible and what no. I have no problem to answer your doubts

Agur(s)

athavanraja
Active Contributor
0 Kudos

Hi Augustin,

i tried your code, (changed HEC1 to my DEV002 - is this right?)

when i click on the buttons, a message comes "script is connecting to DEV002" but after that a script error is coming and its not working.

the script error says

error description not available

(line 35 char 5)

Can you help me with that.

Regards

Raja

Wolfgang - i hope you dont mind me hijacking this thread

Former Member
0 Kudos

Hi Raja,

Yes the HEC1 is the name of your sap conection in SAPLOGON. In a productive enviroment you must use string connection to connect to the server.

Two possible reason to the error message:

Have you change the server instance parameter SAPGUI/USER_SCRIPTING to true?

Are you using IE or FireFox? Unfortunately I think it doesn't work with Firefox.

Agur(s)

athavanraja
Active Contributor
0 Kudos

i fixed it after reading "Yes the HEC1 is the name of your sap conection in SAPLOGON"

i was using DEV002 - 002 is the client number.

when i changed to DEV it works fine, thanks for the help.

i am using IE

Regards

Raja