Data Services Scripting Guidelines

Home » SAP Data Services » Data Services Scripting Guidelines
December 9, 2015 SAP Data Services No Comments

Scripting Guidelines

  • Statements in a script object or custom function must end with a semicolon (;)
  • Comment lines must start with a # character.
  • Use single quotes for string constants.
  • Uses the backslash (\) as the escape character.

    Also strings including curly braces or square brackets cause a processing error. We can avoid the error by preceding the braces or brackets with a backslash (\).
  • Data Services does not strip trailing blanks from strings that are used in scripts or custom functions. To remove trailing blanks, we can use the rtrim or rtrim_blank function.
  • Variable Names must be preceded by a dollar sign ($).
  • Global Variables used in a script or expression must be defined at the Job level using the Variables and Parameters window.
  • Local Variables used in a script or expression must be defined in the Job or Workflow context that calls the script, using the Variables and Parameters window; Local variables used in a Custom Function must be defined using the Smart Editor.
  • The square brackets ([]) indicate that the value of the expression should be substituted.
  • The curly braces ({}) indicate that the value of the expression should be quoted with single quotation marks.

Sample Examples

Other useful custom scripts

  1. Drop a database table after determining the database type:
  2. Set repository password same as username else defined via Global variable during Job Execution
  3. Test repository connection at run-time
  4. Import database table at run-time
  5. Copy the error file to custom error directory at Catch block (Windows)
  6. Terminate a Job when the rows are rejected during loading
  7. Delete a file if exists
  8. Wait for a file
  9. Print the contents of a file in the Execution log ( Windows )
  10. List the XML files and count in a directory

LEAVE A COMMENT