Convert string into ENUM str2enum in x++
This post will explain how you can assign and convert string input
either read from excel etc into ENUM type variable.
For this example, we will be going to use PurchReqCreationStatus ENUM. The ENUM has 2 key properties
1.
Name – ENUM element name
2. Label – it is used as a string for ENUM conversion
PurchReqCreationStatus PurchReqCreationStatus;
str PurchReqCreationStatusValue = 'Approved';
PurchReqCreationStatus = str2Enum(PurchReqCreationStatus,PurchReqCreationStatusValue);
Info(enum2Str(PurchReqCreationStatus));
Info(enum2Str(PurchReqCreationStatus::Approved));
Comments
Post a Comment