Role of field selection group in material creation using BAPI
Recently I was working on changing an existing logic of a material creation process to additionally populate a few Brazil specific fields of material master(http://help.sap.com/saphelp_470/helpdata/en/eb/7fe737db79190be10000009b38f8cf/content.htm).
BAPI_MATERIAL_SAVEDATA was used for the material creation. When I was testing my changes, I found that one of the fields which I had added to the function was not getting populated in the material master. There were no error messages returned by the BAPI as well. After a few hours spent on analysis of the problem I was pretty sure that this had something to do with the customizations but I was not sure which one. So, I had a chat with my MM consultant to get an idea about the possible customizations like field selection groups which can affect the material creation. I did not get any conclusive information from my consultant; so I started comparing the fields in the field selection group and came to know that the missing field was not assigned any group. As I did not have any solution in hand I just assigned the group which the other Brazil fields had, to the problematic field and tested my changes again. The result, to my surprise was positive, the field had the value now.
I had a feeling that this specific field would have been hidden in the material master and that can be reason for the issue. I never knew assigning a field selection group was mandatory for material creation. Prior to trying out this solution, I spent a considerable time searching about field selection groups and its impact on material creation using BAPI. But apart from the regular functions we know about the field selection group nothing else was able to be seen anywhere. So I thought this should be documented somewhere and hence my first blog. I also spent some time on finding the actual check in the BAPI and I found it in LMGMUF02. The field has to be either a key field or it must be assigned to a field group says the check.
So the next time any of you face a similar problem you can go straight to any of these to check the field selection group assignments:
- Transaction OMSR
- IMG-Logistics general – field selection – assign fields to field selection groups
- Table T130F