Search code examples
sap-gui

SAP sapshcut.exe forward slash in fieldname trying to prepopulate


I am facing a problem with sapshcut.exe.

What I want to achieve

Basically, I want to generate Links in an Reporting System which opens a specific SAP transaction and prepopulate fields.

The Plan

I found the SAP Shortcut Tools which does exactly what I try to achieve. With sapshcut.exe I can open an SAP connection, start a transaction and can prepopulate fields. That is working great for standard transaction. Example (in brackets [] I have removed my own data due to secret information), all in one line:

C:\"Program Files (x86)"\SAP\FrontEnd\SapGui\sapshcut -user="%username%" -language="DE"
-system="[system]" -client=[xxx] -type=transaction
-command="[transaction] [structure]-[fieldname]=value;"

The Issue

The transaction I start is a custom transaction in an own namespace which includes forward slashes e.g. /yxz/xxxxxxx. And also the fields are in the same namespace /xx/xxxxx-xxxxx.
To build up the sapshcut.exe string it looks like this:

C:\"Program Files (x86)"\SAP\FrontEnd\SapGui\sapshcut -user="%username%" -language="DE"
-system="[system]" -client=[xxx] -type=transaction 
-command="/[namespace]/[transaction] /[namespace]/[structure]-[fieldname]=value;"

Somehow this is not executed correctly. Instead of opening the transaction, SAP is only starting a GUI Information view. Without the field, the transaction is opened correctly. It is definitely the forward slash from the namespace of the field which is causing the issue. I have also tried to execute the opening of the transaction and the population of the field in the SAP Command field which works fine:

/n/[namespace]/[transaction] /[namespace]/[structure]-[fieldname]=value

-edit-Additional Information-
After additional try&error I found that this is related to our namespace starting with "v" which means this results in /v*** which starts the GUI information screen like the option -version. so I search for escaping this somehow.
-end edit-

I have tried different escape signs e.g. / ' etc. which results in opening the transaction in SAP but not populating the field.

Also, I did activate the trace with the command "-trace=3" but cannot see any issues in the tracefile.

Has anyone of you a solution for this? Unfortunately, I cannot change the namespace.


Solution

  • I could do extensive tests and it must be a bug when you have a field with namespace starting with /V (and preceded with a space).

    As a workaround, I could make it work with the following command (presented as 3 lines here but must be on one line when you execute it), by using a fake parameter before each /V field with ; between, and without space before /V... (below DUMMY=DUMMY;/VTEST/FIELD=HELLO):

    C:\Program Files (x86)\SAP\FrontEnd\SapGui\sapshcut.exe" -user="myuser" -pw="mypw"
    -language="EN" -system="DEV" -client="100" -type=transaction 
    -cmd="ZZTEST DUMMY=DUMMY;/VTEST/FIELD=HELLO; /ATEST/FIELD=WORLD;"
    

    (*) NB: I think it's a bug because:

    1. If I enter directly this string preceded with /N in the SAP GUI Command Field and press Enter, it works correctly:
      /NZZTEST /VTEST/FIELD=HELLO;
      
    2. But with sapshcut.exe this command displays the version popup/is buggy (NB: with sapshcut.exe, the command must never be preceded with /N):
      C:\Program Files (x86)\SAP\FrontEnd\SapGui\sapshcut.exe" -user="myuser" -pw="mypw" 
      -language="EN" -system="DEV" -client="100" -type=transaction 
      -cmd="ZZTEST /VTEST/FIELD=HELLO;"
      

    I have this version of SAP GUI for Windows:

    MAIN MODULE INFORMATION:
       sapfront.dll
       SAP Frontend for Windows
       760 Final Release
       7600.1.0.3384
       1902768