Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issue when adding custom code to field in LSMW

Former Member
0 Likes
1,001

Dear experts:


This is my very first post to the SCN world so if I’m not following established etiquette please forgive.  I have been working with LSMW’s for about 4 years now but I have never done any custom coding in the field mapping and conversion rules section as of myself. I would normally have that done by a developer but I am now wanting to learn how to do this. 

I have created a LSMW using the BAPI/Idoc method to create Material Masters and have been able to run it successfully until I added custom code to the Availability Check field (MTVFP).  I checked the syntax function and it says it is correct and works.  The code says if (XCHPF) is ‘X’ then (MTVFP) equals ‘CH’ else (MTVFP) equals ‘02’.

When I run ‘Read Data’ step it populates the input file correctly with the right values.  When I run the ‘Convert Data’ step and display the results it populates and translates the right values as well but when I finish creating the material, (XCHPF) and (MTVFP) are both blank in the material master.

Please let me know what I am missing or how to get this to work.

Please see attached file for more detailed information and screen shots.

                                                   

Dear experts:


This is my very first post to the SCN world so if I’m not following established etiquette please forgive.  I have been working with LSMW’s for about 4 years now but I have never done any custom coding in the field mapping and conversion rules section as of myself. I would normally have that done by a developer but I am now wanting to learn how to do this. 

I have created a LSMW using the BAPI/Idoc method to create Material Masters and have been able to run it successfully until I added custom code to the Availability Check field (MTVFP).  I checked the syntax function and it says it is correct and works.  The code says if (XCHPF) is ‘X’ then (MTVFP) equals ‘CH’ else (MTVFP) equals ‘02’.

When I run ‘Read Data’ step it populates the input file correctly with the right values.  When I run the ‘Convert Data’ step and display the results it populates and translates the right values as well but when I finish creating the material, (XCHPF) and (MTVFP) are both blank in the material master.

Please let me know what I am missing or how to get this to work.

Please see attached file for more detailed information and screen shots.

                                                   

3 REPLIES 3
Read only

JL23
Active Contributor
0 Likes
791

The coding is right and works as you could see in the Display converted data step.

The usual error people make with BAPIs is that they miss to care about the corresponding fields in X-structures

In this case with the batch indicator it is even more important to know what your batch level setting is, because SAP knows 2 batch management fields, one at MARA (batch level is client or material level) and one at MARC (batch level is plant level).

Read only

VijayCR
Active Contributor
0 Likes
791

Hi Can you Please check if the BAPI is released in your system.Did you try to use the BAPI manually.PLease try to check the BAPI first.Let me know if it works.

Thanks,

VIjay

Read only

Former Member
0 Likes
791

Jurgen - Thanks for the heads-up on the different batch levels.  That solved the problem.  Thanks again for the comments and help.