Z-Custom DS on Field

The above dynamic skips mentioned in previous chapter were the built in DS types provided in Mapper. To check the values “on the Fly” during run-time and perform some action based on that, you can use Custom DS.

Select Custom Dynamic Skip from the drop-down for amount field.

Custom DS screen will pop-up. This is a small IDE, where users can write their VB.Net code to perform various Run-Time actions based on the data they put in their excel data sheet.

Besides the inbuilt DS types, custom DS also supports various options.

Let us understand the pre-defined variables and return types that can be used in Custom DS on field with VB.Net code.

Variables

Description

iSheet

Current excel sheet

iCurrentExcelRowNumber

Current absolute excel row number

iValue

Current value pertaining to mapping

iMapType

Mapping Type

iMapValue

Mapped Value

iExcelLogColumn

Excel Log column

iExcelStatusColumn

Excel Status column

iLoopExcelHeaderRow

Looping header row

iLoopExcelEndRow

Looping End Row

IsTestRun

Check whether Current Run Is Test Run

IsLineLevelTestRun

Whether Line Level Test Run or Whole Document Test Run

IsDRSActive

Is DRS Active in Current File

DRSBlockValue

DRS Block length

IsDRSBalancingRow

Whether current Executing Row Is DRS Balancing Row

IsRowSelectionPass

Whether the row selection passed in analyzing/preparing rows for Run

IsHeaderLevelTestRun

Whether Line Level Test Run is executing And Header Row is Executing in Loop

iReturnID

Return ID in Log/Status column

iReturnMessage

Return Message in Log/Status column

GVar1, GVar2, GVar3, GVar4, GVar5

Object variables **These variables are valid only per call and will be reset once the call is finished. These are object variables, so you can store any value (eg. Int, float, text..etc.) in that.

GVars

Hash table object

Return Types: (Any other value will continue the operation as if Dynamic Skip was absent)

0: Default return value. This will tell Process Runner to send the row to SAP and not suppress it.

1: Suppress or do not send the field to SAP. This will tell Process Runner to suppress a row and will not send it to SAP.

2: Skip current excel row. This will tell Process Runner to skip a row and not send it to SAP.

3: Skip current call. This will skip one entire call to SAP.

4: Stop current SAP execution. Similar to pressing Stop button in Process Runner.

SAPProcess

Return SAP Transaction/BAPI/Table name

SAPSystem

Returns logged-in SAP System ID

SAPClient

Returns logged-in SAP Client

SAPUser

Returns logged-in SAP User

SAPLang

Returns logged-in SAP Language

SAPSystemNo

Returns logged-in SAP SystemNo

Example:

If Trim(iSheet.Cells(iCurrentExcelRowNumber,"i").Text) = "31"

Return 0

else

Return 1

End If

The above code tells Process runner if there is 31 in column I for the current row in current sheet then only execute (Return 0) the row else suppress (Return 1) it.

Here we will see a small example that if we encounter $ in amount field it should stop the transaction.

iValue contains the field value for which we have defined Custom DS.

It’s “amount” here.

Following is the VB.Net code.

If iValue.ToString() = “$” then

Return 4

End If

Returning 4 will stop the transaction there itself.

To test your code, enter $ in iValue & click on Test button.

It will display Result: 4 (the return value).

Look at the description below it.

** If there is any Syntax error in your code it will also notify about that.

Click OK button. Run it.

For information about how to restrict a Process file to be run in a particular SAP system using Custom Dynamic Skip, see Restrict Access to Specific SAP System.