cancel
Showing results for 
Search instead for 
Did you mean: 

starting transaction in SAPGUI via JCo

Former Member
0 Kudos

Hello,

I'm trying to start SAPGUI for Windows using parameter

setSapGui(1), but the GUI Window does not show. When I'm using setAbapDebug(true)than the GUI window starts in debug mode.

What can be wrong? Does anyone have any ideas?

I'm trying to start transaction se11 using BAPI RFC_CALL_TRANSACTION.

Code looks like this:

// Obtain parameter list for function 
      JCO.ParameterList input = function.getImportParameterList(); 
	
	  // Obtain table for function
	  JCO.Table BDCtable = function.getTableParameterList().getTable("BDCTABLE");	
      //BDCtable.setRow(0);
      
      BDCtable.appendRows(4);
      BDCtable.setValue("SAPMSRD0", "PROGRAM");
      BDCtable.setValue("0102", "DYNPRO");
      BDCtable.setValue("X", "DYNBEGIN");
      BDCtable.nextRow();
      BDCtable.setValue("BDC_CURSOR", "FNAM");
      BDCtable.setValue("RSRD1-TBMA_VAL", "FVAL");
      BDCtable.nextRow();
      BDCtable.setValue("BDC_OKCODE", "FNAM");
      BDCtable.setValue("=SHOW", "FVAL");
      BDCtable.nextRow();
      BDCtable.setValue("RSRD1-TBMA", "FNAM");
      BDCtable.setValue("X", "FVAL");
      BDCtable.nextRow();
      BDCtable.setValue("RSRD1-TBMA_VAL", "FNAM");
      BDCtable.setValue("BUKRS", "FVAL");
      BDCtable.nextRow();
      BDCtable.setValue("SAPMSRD0", "PROGRAM");
      BDCtable.setValue("0102", "DYNPRO");
      BDCtable.setValue("X", "DYNBEGIN");
      
      // Pass function parameters 
      input.setValue(transactionName, "TRANCODE"); 
      
      //input.setValue(daneKlienta, "DANE_KLIENTA"); 
      
      conn.execute(function, conn.createTID());

Regards Artur

Message was edited by: Artur Welke

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Artur,

This answer is in relation to BSP but i think concept is same, it will give you an idea. This answer is taken from

Brain's <a href="/people/brian.mckellar/blog/2003/10/23/bsp-trouble-shooting-frequently-asked-short-questions weblog.

<i>Typical question: "We have developed a BSP application and we're trying to call some function. It doesn't work. However, if we execute the BSP application in debug mode, everything works fine. Why?"

When you log onto a WebAS system the Dynpro engine is started that contains all the logic to handle interaction with the SAPGUI. For example, things such as rendering controls and doing file upload/download are all available.

When you run an HTTP request into Web AS, a very special "dark" (or background) Dynpro is started. A minimal Dynpro is required to get ABAP up and running. But now there is no SAPGUI available, so no SAPGUI-based service will work. Also little things such as popup windows do not work.

So why does the code work in the debugger? Because, once the debugger is triggered,it realizes that a normal Dynpro is required for the debugger and not the "dark" one. So the full-blown Dynpro engine is started, making all SAPGUI services available.

You can consider finding the code that causes the error and bracket it with IF-statements in this function, so that no SAPGUI interaction is required in the context of a HTTP call.</i>

Also visit this <a href="https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/thread.jspa%3FthreadID%3D35880%26tstart%3D60">thread</a>, this will certainly help you.

Regards,

Narinder Hartala