How to use if conditions in your script
10x, 11x, 12x.
If first transaction - used when an action will only need to be taken for the first data record
Example: ME22N often requires the display be toggled (Display/Change command) for the first record in order to allow for any updates, however this only has to happen for the first record as all subsequent records will be in change mode.
If Not first transaction - used when an action will not be needed for the first data record, but will be needed for any subsequent records
Example: ME22N often collapses the header, item overview, and/or, item detail tables for subsequent records. Because of this you will want to include opening these tables in your script, while including an If NOT first transaction condition around them.
If on SAP field - used to check if a value exists or does not exist in SAP prior to updating that record
Example: In MM02 if you want to validate a specific material group and update a specific set of fields for that group
If on Index field - allows you to search and update multiple rows based on one fields value
Example: In CA02 there is no a good way to identify the correct operation number you'd like to update using the entry number. As there is not a way to filter out the correct operation number an if on index condition can be used to locate the specific operation in order to update the related fields.
If - allows you to setup a range of condition types dependent on the operator selected
Example: For an FB50 multi-company posting, your header company code will apply for all of the line items unless the company code is replaced with at the time the line item is entered. Because of this in your data file you may want to leave the company codes blank for the accounts that have the header company code. For this you can use an IF company code column Not Blank condition
= - If column value equals a specific value
> - If column value is greater than a specific value
< - If column value is less than a specific value
>= - If column value is greater than or equal to a specific value
<= - If column value is less than or equal to a specific value
<> - If column value does not equal a specific value
Blank - If column value is blank (does not have a value)
Not Blank - If column value is not blank (has a value)
Starts with - If column value starts with a specific value
Contains - If column value contains a specific value
Ends with - If column value ends with a specific value
Between - If column value is between two specified values