09-02-2014 8:14 AM
Dear SAP Gurus,
I currently have a requirement to create a custom program for Article Master Creation. Based on testing & research, I've come to the conclusion that the best FM to use is WRF_MATERIAL_MAINTAINDATA_RT.
I've tested BAPI_MATERIAL_MAINTAINDATA_RT only to find out that it is unable to extend to the Purchasing View.
Now, here's my problem: I can't seem to create an Article with an internally assigned number range.
Here's the specific error that I'm encountering:
Message no. MG503
As per my understanding, I would have to, of course, leave the field MATERIAL blank since I'm creating an internally assigned article number. I'm trying to figure out what field I missed in the execution of WRF_MATERIAL_MAINTAINDATA_RT.
(Note: I was able to successfully create an externally assigned article number by placing a value for field MATERIAL)
Below are the structures that I populated in my testing:
HEADDATA
ORGANIZATIONAL_LEVEL
CLIENTDATA
CLIENTDATAX
ADDNLCLIENTDATA
ADDNLCLIENTDATAX
MATERIALDESCRIPTION
PLANTDATA
PLANTDATAX
STORAGELOCATIONDATA
STORAGELOCATIONDATAX
UNITSOFMEASURE
UNITSOFMEASUREX
INFORECORD_GENERAL
INFORECORD_PURCHORG
As a rule, I place an 'X' value in the Checkbox structures for each field that I populate in the User Data structure. I believe I have the proper entry of field values taken care of in terms of having the User Data and Checkbox structures match.
Even if I only create an article for Basic Data view by populating only HEADDATA, CLIENTDATA, CLIENTDATAX, ADDNLCLIENTDATA, ADDNLCLIENTDATAX, MATERIALDESCRIPTION, I'm still encountering Message no. MG503.
The question is, what else do I need to do in order to create an internally assigned article number via WRF_MATERIAL_MAINTAINDATA_RT?
Please see attached screenshots.
Lastly, I decided to create this thread because as I was searching through SCN about this specific issue, I haven't found a thread that was already solved. I think I read a thread or two that were solved but the final solution was never shared.
Thank you,
Aivanny
09-05-2014 1:16 PM
I have no experience with WRF_MATERIAL_MAINTAINDATA_RT (and would not use is as it is not released and not supported) but from my experience with BAPI_MATERIAL_MAINTAINDATA_RT is that it is supporting only external number assignement (actueally it does nor care but always expects that a material number is transferred).
But what you can do is to call theI BAPI_MATERIAL_GETINTNUMBERRET first in order to get the next free internal number from the number range and used that as the article number that you transfer to WRF_MATERIAL_MAINTAINDATA_RT.
That should work
Regards
Carsten
09-05-2014 1:16 PM
I have no experience with WRF_MATERIAL_MAINTAINDATA_RT (and would not use is as it is not released and not supported) but from my experience with BAPI_MATERIAL_MAINTAINDATA_RT is that it is supporting only external number assignement (actueally it does nor care but always expects that a material number is transferred).
But what you can do is to call theI BAPI_MATERIAL_GETINTNUMBERRET first in order to get the next free internal number from the number range and used that as the article number that you transfer to WRF_MATERIAL_MAINTAINDATA_RT.
That should work
Regards
Carsten
09-08-2014 2:24 AM
Hi Carsten,
Thank you for your comment. I appreciate this. The thought of using externally assigned number range has indeed crossed my mind already. I'll try to look for other BAPIs/FMs/iDocs. I might have missed something. It's kind of weird having programs for article creation that can't generate internally assigned numbers.
If anyone has some insights also, please join this thread. Thanks!
Aivanny
09-10-2014 7:15 AM
Hi Avanny,
the material BAPIs expect that you feed them an article number. There is no mechanism or like feeding in a $ or & that is replaced by an internal number.
So what you must do is fetching a number from the internal number range and feed this into the material number fields of the BAPI.
For the BAPI_MATERIAL_MAINTAINDATA_RT this works perfectly and is even SAPs recommendation.
Don't get confused you can use this approach also with number ranges that are defined as internally assigned number ranges.
With other words:
external number assignemen --> an external application assigns the number and handles the number range. The article number comes via interface and you can feed it into the materal number fields..
Internal number assignement --> no material number is supplied and you must fetch a number using BAPI_MATERIAL_GETINTNUMBERRET (which calls MATERIAL_NUMBER_GET_NEXT). This number can be feed into the BAPI then.
Regards
Carsten
09-10-2014 8:55 AM
Hi Carsten,
Your explanation sounds good to me. Let me test this.
I'll update this thread so as to help other people as well.
Thank you!
Kai
09-11-2014 3:43 AM
Hi Carsten,
I'm now able to successfully create an internally assigned article using WRF_MATERIAL_MAINTAINDATA_RT.
I'm able to create the article successfully for all views except for the Purchasing View. I'm also able to create the Purchasing Info Record successfully. The following error is showing when I tried to view the Purchasing View in MM43:
Message no. MH047
Obviously, there's no Purchasing View in structure HEADDATA. What did I miss?
Thank you!
Aivanny
08-29-2016 5:25 AM
Hi Carsten
M writing a customised program to create articles using WRF_MATERIAL_MAINTAINDATA_RT in IS RETAIL …it is working fine for single articles (attype = '0') and generic articles(attype = '1').But I don’t know how to create variants(attype = '2') for the generic articles.which tables to populate to create variants of generic articles???
Kindly help me in this concern and give me sample code if possible..
Thanks
09-10-2014 6:15 AM
Hi Aivanny,
You can use the function module MATERIAL_NUMBER_GET_NEXT to get the next number.
The input to this function module would be the article type.
Regards,
Amit
09-10-2014 6:59 AM
Hi Amit,
Noted. But, of course, this will only work for externally assigned articles. This would defeat the purpose of using internally assigned number ranges.
Anybody find this weird? Or did I really miss something in the execution of the FM?
Thanks,
Aivanny
06-06-2023 11:17 AM
Hi Aivanny,
Could you pls help me on how to create article master for internally assigned number range?
08-23-2023 10:59 AM
Hello,
Have you try using idoc ARTMAS? I think this is more simple and effective way.