Introduction

Users may experience ServiceObjectModel Auto Compile errors when publishing a Service Object. The error is due to BAPI fields or structures containing invalid characters when they are compiled into .NET classes.

Background

When the SAP BAPI is published it’s converted to C# classes and a C# class or property name cannot start with an invalid character for example a number. Owing to this, when the user attempts to compile ServiceObjectModel Auto Compile Errors are thrown.

Shown in the image below is a BAPI where the structure’s friendly name and the property name contain invalid characters.

Recommended Troubleshooting Steps

Note: The steps described below are recommended methods to resolve this issue only.

To rectify the problem, the user can change the friendly name to a name that does not start with a number. For example change 2Step_Pick to TwoStep_Pick and then republish. Alternatively, an underscore can be used as a prefix, for example 2Step_Pick can be changed to _2Step_Pick and this is valid.

Note: The Service Object must be republished after any changes have been made for them to take effect.

The above resolution is suitable for making changes where invalid characters are known to exist. To locate other instances where invalid characters may exist the user can browse the *.cs files that have been generated by Microsoft Visual Studio:

  1. Browse to the directory <K2 connect Installation Folder>\Configuration\tempComp folder
  2. Locate the [filename].cs filed for the published entities
  3. Select the file required and open the file using Microsoft Visual Studio
  4. Once the invalid characters have been found as illustrated in the example below, the user can rectify them as discussed above

    [SourceCode.ServiceObjectModel.Server.Runtime.Attribute public virtual string 2STEP_PICK]
    get {
          return _2STEP_PICK;
     }
     
     set {
          _2STEP_PICK = value;
     }
    }