Very often when programming AMDP routines in BW transformations it is necessary to create a complete list of the existing fields in the source/target.
Frequently Excel templates are used to enable some degree of automation in creating these field lists.
In this blog we will show you another way that works without Excel and can be used right in the Eclipse Editor. For this the “Find and Replace” functionality in combination with regular expressions is used.
- In the AMDP routine, scroll up to the type definition of the desired structure. In the example it is the output table of the end routine.
Copy all the fields there along with the type definitions:
|Find||([^ ]*)( type).*|
Now all you have to do is remove the final comma and the field list is ready.
3 Explanation of the regular expression:
Explanation of the search:
|([^ ]*)||First group, consisting of everything that’s not an empty space.|
Only this part should remain for the field list
|( type).*||Second group consisting of everything that comes after ” type”|
This part is not needed in the field list
Explanation of the replace:
|“||The character – ” -, which should go at the beginning|
|$1||References the first group, i.e. whatever is not an empty space and comes before ” type”|
|“,||The characters – “, -, which should go at the end|