Site icon SAP Human Resources Experts And Solutions

SAP LSMW Translation Rules

<p>In our previous posts&comma; we&&num;8217&semi;ve learned basic rules with <a href&equals;"https&colon;&sol;&sol;saphcmsolutions&period;com&sol;advanced-lsmw&sol;" target&equals;"&lowbar;blank" rel&equals;"noopener">LSMW<&sol;a>&period; Today we need to clarify one the most important technique in data migration in SAP projects&period; We know how to use different migration tools like BAPI&comma; <a href&equals;"https&colon;&sol;&sol;saphcmsolutions&period;com&sol;data-conversion-sap-ale&sol;" target&equals;"&lowbar;blank" rel&equals;"noopener">IDOC<&sol;a>&comma; flat files&comma; <a href&equals;"https&colon;&sol;&sol;saphcmsolutions&period;com&sol;load-several-files-lsmw&sol;" target&equals;"&lowbar;blank" rel&equals;"noopener">complex files<&sol;a>&comma; batch input&period; But all these are useless if we can&&num;8217&semi;t convert data on the fly&period; This is a great advantage of Legacy Workbench in SAP is to able to convert data with integrated translation rules&period;<&sol;p>&NewLine;<p>So&comma; the translation rules are used when we need to map one value in the incoming file to any other value which is to store in SAP&period; It could be just simple text concatenation&comma; substitutions or even complex ABAP logic with a lot of functional module calls retrieving some data out of the system&period;<&sol;p>&NewLine;<p><a href&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&period;png"><img class&equals;"alignnone size-full wp-image-2895" src&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&period;png" alt&equals;"SAP LSMW transformation rules" width&equals;"909" height&equals;"375" &sol;><&sol;a><&sol;p>&NewLine;<p><&excl;--more--><&sol;p>&NewLine;<h3>LSMW Fixed Values<&sol;h3>&NewLine;<p>This conversion allows defining some fixed value which you can use further in conversion&period; It&&num;8217&semi;s like a constant which is set once in one place and used widely across the system&period; If you need to change value&comma; you change it only in this fixed value definition and the system distributes the value everywhere&period; The very simple example is loading infotype&period; We can change M200 wage type code to a constant and change it whatever we load at the moment&period;<&sol;p>&NewLine;<div id&equals;"attachment&lowbar;2896" style&equals;"width&colon; 1029px" class&equals;"wp-caption alignnone"><a href&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&lowbar;02&period;png"><img aria-describedby&equals;"caption-attachment-2896" class&equals;"wp-image-2896 size-full" src&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&lowbar;02&period;png" alt&equals;"SAP LSMW recording" width&equals;"1019" height&equals;"716" &sol;><&sol;a><p id&equals;"caption-attachment-2896" class&equals;"wp-caption-text">SAP LSMW recording<&sol;p><&sol;div>&NewLine;<p>When we match source fields with target structure in LSMW we can use either a constant value for wage type&comma; can load wage type value from the file or can refer to this fixed value translation rule&period; This solution could be used in hierarchical files when the same key fields could repeat on different file levels&period;<&sol;p>&NewLine;<h3>LSMW Translations Rules<&sol;h3>&NewLine;<p>By its naming translation rules is the main conversion tool in LSMW&period; They have a wide variety of tools to manage data&period; Have a look at the screenshot below&period;<&sol;p>&NewLine;<div id&equals;"attachment&lowbar;2898" style&equals;"width&colon; 863px" class&equals;"wp-caption alignnone"><a href&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&lowbar;03&period;png"><img aria-describedby&equals;"caption-attachment-2898" class&equals;"wp-image-2898 size-full" src&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&lowbar;03&period;png" alt&equals;"LSMW Translation Rules" width&equals;"853" height&equals;"691" &sol;><&sol;a><p id&equals;"caption-attachment-2898" class&equals;"wp-caption-text">LSMW Translation Rules<&sol;p><&sol;div>&NewLine;<p>For curious&comma; there is a FORM <strong>lsmw&lowbar;translate&lowbar;execute <&sol;strong>in the source code <strong>&sol;SAPDMC&sol;SAP&lowbar;LSMW&lowbar;CONV&lowbar;FORMS <&sol;strong>which stores business logic for data conversion&period;<&sol;p>&NewLine;<p>If you pay attention&comma; we have three frames on the screen&colon; Variant&comma; First Alternative&comma; Second Alternative&period; During data translation systems&comma; first of all&comma; runs a Variant &lpar;1&colon;1 or Interval translation&rpar;&period; If it was not able to run translation &lpar;value was not found&rpar;&comma; it tries First Alternative&comma; then Second Alternative if first one failed&period; This is a three level decision making tree&period;<&sol;p>&NewLine;<p>The first level &lpar;Variant frame&rpar; allows two types of changes&colon; one to one or interval&period; values we provide on corresponding tabs on the same screen&period; Enter value and tick checkbox next to it&period;<&sol;p>&NewLine;<p><a href&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&lowbar;04&period;png"><img class&equals;"alignnone size-full wp-image-2902" src&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&lowbar;04&period;png" alt&equals;"LSMW 1&colon;1 transformation" width&equals;"820" height&equals;"319" &sol;><&sol;a><&sol;p>&NewLine;<p>If you need an interval selection&comma; do it this way&colon;<&sol;p>&NewLine;<p><a href&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&lowbar;05&period;png"><img class&equals;"alignnone size-full wp-image-2903" src&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&lowbar;05&period;png" alt&equals;"LSMW Interval Transformation Rules" width&equals;"753" height&equals;"360" &sol;><&sol;a><&sol;p>&NewLine;<p>Fields length defined on the first tab &&num;8211&semi; Source Field&comma; Target Field&period;<&sol;p>&NewLine;<p>If the system didn&&num;8217&semi;t find the right value we can return a constant&period; Let&&num;8217&semi;s say &&num;8216&semi;ERROR&&num;8217&semi;&period;<&sol;p>&NewLine;<p><a href&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&lowbar;06&period;png"><img class&equals;"alignnone size-full wp-image-2904" src&equals;"http&colon;&sol;&sol;saphr&period;ru&sol;wp-content&sol;uploads&sol;lsmw&lowbar;transformation&lowbar;rules&lowbar;06&period;png" alt&equals;"LSMW Transformation" width&equals;"885" height&equals;"608" &sol;><&sol;a><&sol;p>&NewLine;<p>Or we choose User-Defined Routine and use an ABAP code to perform any sort of conversion&period; This is the power of the translation rules&period;<&sol;p>&NewLine;<p>Remain options&colon;<&sol;p>&NewLine;<p><strong>Transfer &lpar;MOVE&rpar;<&sol;strong> &&num;8211&semi; copy value as is&period;<&sol;p>&NewLine;<p><strong>Initial Value<&sol;strong> &&num;8211&semi; setup default value for this type of field&period;<&sol;p>&NewLine;<p><strong>No Action<&sol;strong> &&num;8211&semi; do nothing&period;<&sol;p>&NewLine;<h3>User-defined routines or custom ABAP translation rules<&sol;h3>&NewLine;<p>This is the most simple and complex rule&period; You can implement all options we were talking about right here with couple lines of code&period; Or code ZSAP for your convenience &colon;&rpar;<&sol;p>&NewLine;<h3>Test conversions<&sol;h3>&NewLine;<p>Once we&&num;8217&semi;ve done with translation rules we need to assign them to the fields&period; We do this in Define Field Mapping and Conversion Rules&comma; where we assign the source field to the target &lpar;hit Source Field button&rpar;&comma; then click on Translation button to choose your conversion rule&period;<&sol;p>&NewLine;<p>P&period;S&period; Here is also my video on Youtube how to do a basic LSMW project&colon;<&sol;p>&NewLine;<p><strong style&equals;"color&colon; &num;ff9900&semi;">Share this post with your SAP friends and colleagues&period; It won&&num;8217&semi;t cost you anything but will motivate us to write more interesting content&period;<&sol;strong><br &sol;>&NewLine;<&excl;-- Begin MailChimp Signup Form --><&sol;p>&NewLine;<style type&equals;"text&sol;css">&NewLine;&Tab;&num;mc&lowbar;embed&lowbar;signup&lbrace;background&colon;&num;fff&semi; clear&colon;left&semi; font&colon;14px Helvetica&comma;Arial&comma;sans-serif&semi; width&colon;100&percnt;&semi;&rcub;<br &sol;>&Tab;&sol;&ast; Add your own MailChimp form style overrides in your site stylesheet or in this style block&period;<br &sol;>&Tab; We recommend moving this block and the preceding CSS link to the HEAD of your HTML file&period; &ast;&sol;<br &sol;><&sol;style>&NewLine;<div id&equals;"mc&lowbar;embed&lowbar;signup">&NewLine;<form id&equals;"mc-embedded-subscribe-form" class&equals;"validate" action&equals;"https&colon;&sol;&sol;saphcmsolutions&period;us3&period;list-manage&period;com&sol;subscribe&sol;post&quest;u&equals;9946caca159afc9a77502e9a5&amp&semi;id&equals;ba2e54e4b1" method&equals;"post" name&equals;"mc-embedded-subscribe-form" novalidate&equals;"" target&equals;"&lowbar;blank">&NewLine;<div id&equals;"mc&lowbar;embed&lowbar;signup&lowbar;scroll"><label for&equals;"mce-EMAIL">Stay tuned for our best practices and top-notch advice<&sol;label><br &sol;>&NewLine;<input id&equals;"mce-EMAIL" class&equals;"email" name&equals;"EMAIL" required&equals;"" type&equals;"email" value&equals;"" placeholder&equals;"email address" &sol;><br &sol;>&NewLine;<&excl;-- real people should not fill this in and expect good things - do not remove this or risk form bot signups--><&sol;p>&NewLine;<div style&equals;"position&colon; absolute&semi; left&colon; -5000px&semi;" aria-hidden&equals;"true"><input tabindex&equals;"-1" name&equals;"b&lowbar;9946caca159afc9a77502e9a5&lowbar;ba2e54e4b1" type&equals;"text" value&equals;"" &sol;><&sol;div>&NewLine;<div class&equals;"clear"><input id&equals;"mc-embedded-subscribe" class&equals;"button" name&equals;"subscribe" type&equals;"submit" value&equals;"Subscribe" &sol;><&sol;div>&NewLine;<&sol;div>&NewLine;<&sol;form>&NewLine;<&sol;div>&NewLine;<p><&excl;--End mc&lowbar;embed&lowbar;signup--><&sol;p>&NewLine;

Exit mobile version