Issue in Material creation from BAPI
Hi All,
I am working on Mass material upload from the program using BAPI function module: BAPI_MATERIAL_SAVEDATA.
But the problem is for Material Type 'Finished Product' I could get all the views from the structure BAPIMATHEAD except for views Oil-specific data and Plant Stock.
So is there any other FM or Structure which includes there 2 views also as its field?
Thanks.
Hi,
Check the bellow links for Material Master Bapi.
Create Material Master Data with BAPI
And Check the bellow BAPI for your requirement.
BAPI_MATERIAL_GET_DETAIL
or
BAPI_MATERIAL_GETDETAIL
Regards,
Goutam Kolluru.
Similar Messages
-
Issue while retrieving data from BAPI
Problem:
The initial exception that caused the request to fail, was:
com.sap.dictionary.runtime.DdException: Wrong amount type (not decimal): Unit service cannot be instantiated
at com.sap.dictionary.runtime.DdBroker.getUnitService(DdBroker.java:215)
at com.sap.dictionary.runtime.DdBroker.getUnitService(DdBroker.java:233)
at com.sap.tc.webdynpro.services.datatypes.core.DataTypeBroker.getUnitService(DataTypeBroker.java:337)
at com.sap.tc.webdynpro.progmodel.context.DataAttributeInfo.initReferenceAttribute(DataAttributeInfo.java:342)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.initStructureType(NodeInfo.java:708)
... 30 more
I have a BAPI - ZPM_CREATE_ORDER. I am trying to write a record to that BAPI. Did the Model Import from R/3[including the Commit ].
The structures of BAPI are like this:
Zpm_create_Order_Input
Order - Zpm_Hdr
Operations - [ Line Items structure ]
I have created the mapping between Model & Custom Controller with Order & Operations. Did the mapping between the Custom Controller & the View Controller. Binded them to the UI elements from View Controller with an input form.
But there are ABAP - decimal fields under Operations - price & Amount which are a Currency field and Quantity . So when I just try to run the application, I get the amount mismatch error. When I say run, I could nt even see the GUI even. I get the 500 error with the above problem.
I read in the forums that I need to declare as a Simple type and re cast the fields to right type and bind that structure back. How ever, I could nt get the complete understanding of it.
For a Retrieval Bapi with the exact same structure, the same issue if I map the Operations. How ever, if I skip the Operations and just map the Order i.e., header, then I could retrieve the records.
Interestingly even if I just map a String(char) field under Operations structure I am getting teh same error.
Any help is appreciated. Thanks in advance...Satyajit,
You are right. One of the fields needed is Waers(currency) which I have mapped from the Model to Custom Controller. I think, that is one of the causes but there are other fields too (for instance, Decimal type).
The surprising thing to me is that, even if I just map the character fields in that structure and not map the Decimal or Currency fields, then also I am getting the same error.
Thanks for the Reply...
--Vivek -
Sales Order Creation from BAPI Error
Hi Friends,
I am using BAPI_SALESORDER_CREATEFROMDAT1 to create the Sales Order. But I am getting an error when I am executing the FM. I am filling the following Information and passing on the information to the BAPI FM. Details:
IMPORT PARAMETERS:
ORDER_HEADER_IN:
DOC_TYPE: OR
SALES_ORG: BP01
DISTR_CHAN: 01
DIVISION: 01
REQ_DATE_H: 29.08.2008
PURCH_DATE: 29.08.2008
INCOTERMS1: FH
INCOTERMS2: PALO ALTO
PMNTTRMS: 0001
SHIP_COND: 01
CURRENCY: USD
TABLES:
ORDER_ITEMS_IN:
ITM_NUMBER: 10
MATERIAL: XXXX-6
PLANT: BP01
REQ_QTY: 20
SALES_UNIT: EA
ITEM_CATEG: AGN
SHORT_TEXT: TEST MATERIAL
ORDER_PARTNERS:
PARTN_ROLE: SH
PY
BP
SP
PART_NUMB: 1000
1000
1000
1000
By using the above information, when I am executing the FM I am getting error
EXPORT PARAMETERS
RETURN:
TYPE: E
ID AM
NUMBER 216
MESSAGE Incomplete address; enter country
But when I am creating it from the VA01 Transaction, I am able to create Sales Order Successfully.
Friends, please help me in this regard.
Yours
Pradeep Goli
Edited by: Pradeep Goli on Sep 8, 2008 2:56 PMHi,
I hope the below link will help you.
Help needed with BAPI_SALESORDER_CREATEFROMDAT1 parameters
Thanks,
Khushboo. -
Hi gurús,
I am using BAPI_MATERIAL_SAVEDATA to create material. But the ejecution show the following message:
046Field WERKS has been transferred inconsistently or is blank.
I really cant find where i have to charge it. I think im do it in all the fields where WERKS is necesary.
Regards
EnzoHi Enzo I ussualy use BAPI_MATERIAL_MAINTAINDATA_RT to create materials, if not resolve the problem, you can try with this.
Regards -
Material Master Creation Using BAPI
Hi,
I m using BAPI_MATERIAL_SAVEDATA for Material creation using BAPI.
Now the problem is , i have created a Screen exit long back in Purchasing view.. the corresponding Z field is created in table MARC..
How can i pass value to this Z field using BAPI.
i tried with BAPI_MARC.. my Z field is not coming in that structure.
Can anyone guide me how can this be achieved.
Thanks in Advance
Aravindh ManiHi,
The Function Module BAPI_MATERIAL_SAVEDATA has the options to pass the Z fields. There exits a structure parameters
EXTENSIONIN
EXTENSIONINX
in BPAI. In EXTENSIONIN pass the data and value part you can pass in EXTENSIONINX. So this will update the Z fileds in material
master . -
Effect of issuing Material directly from Interim Storage BIN?
Dear Experts,
What is effect of issuing(311) material directly from Interim storage BIN without storing to Storage BIN.
Because i am unable to do LB11& LB12 for both GR's(101) and TP(311) as it has directly picked from Interim Storage BIn to do
TP(311).
So please someone explain me the effect of the above Scenario?
Thanks & Regards,
Olet MallaYou can do it but in general you should not allow picking from interim Storage Types. For example you don't want Sales trying to pick materials sat in the PSAs, you don't want Production trying to pick from materials in 916 etc. etc.
-
Issue in material master update from presentation server using BAPI....
Hi Guru's...
i am trying to change the material master from presentation server (desktop flat file)
using BAPI(BAPI_MATERIAL_SAVEDATA) ....
while executing my program i am getting the message like material had changed...
but while in mm02 i am un able to fine the updates...
please find below program logic and correct me if any mistakes....
thanks in advance...
*& Report ZAREPAS36
REPORT zarepas36.
DATA : gs_bapimathead TYPE bapimathead,
gs_clientdata TYPE bapi_mara,
gs_clientdatax TYPE bapi_marax.
TYPES : BEGIN OF gty_itab1,
matnr(18),
matkl(9),
spart(2),
ntgew(13),
gewei(3),
meins(3),
END OF gty_itab1.
DATA : gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
gwa_itab1 TYPE gty_itab1.
TYPES: BEGIN OF gty_itab2,
abc(132),
END OF gty_itab2.
DATA: gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
gwa_itab2 TYPE gty_itab2.
flat file at selection screen
PARAMETERS: p_files TYPE string.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = p_files
filetype = 'ASC'
CHANGING
data_tab = gt_itab2
EXCEPTIONS
OTHERS = 8.
LOOP AT gt_itab2 INTO gwa_itab2.
IF gwa_itab2-abc(1) = 'S'.
gwa_itab1 = gwa_itab2-abc(132).
APPEND gwa_itab1 TO gt_itab1.
ENDIF.
ENDLOOP.
loop at gt_itab1 into gwa_itab1.
*Material
gs_bapimathead-material = gwa_itab1-matnr.
*Material details at client data
*material group.
gs_clientdata-matl_group = gwa_itab1-matkl.
gs_clientdatax-matl_group = 'X'.
*Division
gs_clientdata-division = gwa_itab1-spart.
gs_clientdatax-division = 'X'.
*Net Weight
gs_clientdata-net_weight = gwa_itab1-ntgew.
gs_clientdatax-net_weight = 'X'.
*Unit of Weight
gs_clientdata-unit_of_wt = gwa_itab1-gewei.
gs_clientdatax-unit_of_wt = 'X'.
*Base Unit of Measure
gs_clientdata-base_uom = gwa_itab1-meins.
gs_clientdatax-base_uom = 'X'.
endloop.
*calling BAPI for making changes in material and saving thru BAPI.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = gs_bapimathead
clientdata = gs_clientdata
clientdatax = gs_clientdatax.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE: / 'Error occured while changing material'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'material',gs_bapimathead-material,'changed'.
ENDIF.hi hello Guru's
i resolved the issuee..
pleaso go thru the below proram logic for your reference..........
*& Report ZAREPAS36
REPORT zarepas36.
DATA : gs_bapimathead TYPE bapimathead,
gs_clientdata TYPE bapi_mara,
gs_clientdatax TYPE bapi_marax.
TYPES : BEGIN OF gty_itab1,
matnr(18),
matkl(9),
spart(2),
ntgew(13),
gewei(3),
meins(3),
END OF gty_itab1.
DATA : gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
gwa_itab1 TYPE gty_itab1.
TYPES: BEGIN OF gty_itab2,
abc(132),
END OF gty_itab2.
DATA: gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
gwa_itab2 TYPE gty_itab2.
DATA:ls_return TYPE bapiret2,
lt_bapiret2 TYPE standard table of bapiret2.
flat file at selection screen
PARAMETERS: p_files TYPE string.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = p_files
filetype = 'ASC'
CHANGING
data_tab = gt_itab2
EXCEPTIONS
OTHERS = 8.
LOOP AT gt_itab2 INTO gwa_itab2.
IF gwa_itab2-abc(1) = 'S'.
gwa_itab1 = gwa_itab2-abc(132).
APPEND gwa_itab1 TO gt_itab1.
ENDIF.
ENDLOOP.
LOOP AT gt_itab1 INTO gwa_itab1.
*Material
gs_bapimathead-material = gwa_itab1-matnr.
*Material details at client data
*material group.
gs_clientdata-matl_group = gwa_itab1-matkl.
gs_clientdatax-matl_group = 'X'.
*Division
gs_clientdata-division = gwa_itab1-spart.
gs_clientdatax-division = 'X'.
*Net Weight
gs_clientdata-net_weight = gwa_itab1-ntgew.
gs_clientdatax-net_weight = 'X'.
*Unit of Weight
gs_clientdata-unit_of_wt = gwa_itab1-gewei.
gs_clientdatax-unit_of_wt = 'X'.
*Base Unit of Measure
gs_clientdata-base_uom = gwa_itab1-meins.
gs_clientdatax-base_uom = 'X'.
ENDLOOP.
*calling BAPI for making changes in material and saving thru BAPI.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = gs_bapimathead
clientdata = gs_clientdata
clientdatax = gs_clientdatax
IMPORTING
return = ls_return.
LOOP AT lt_bapiret2 INTO ls_return.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE: / 'Error occured while changing material'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'material',gs_bapimathead-material,'changed'.
ENDIF. -
Issue during automatic Creation of Work Order from Notification
Hi,
I have a issue during automatic Creation of Work Order from Notification.
BADI implemented: NOTIF_EVENT_POST
BAPI called in BADI: BAPI_ALM_ORDER_MAINTAIN
I am able to create Work Order successfully but after that i need to update notification header with created work order number.
But i am unable to update the same (VIQMEL-AUFNR).
Can anybody provide solution for the same!
Thanks,
Kumar.Hi,
Any inputs on above posted issue!
Thanks in advance.
Thanks,
Kumar. -
IDOC/BAPI for Production order creation from Legacy system
Hi all
We are using an interface to create Production orders from legacy to SAP. Would you recommend an IDOC or a BAPI to create Production orders. If IDOC or BAPI then could you please mention which one?
thanks a bunchHi John,
For your purposes, please use BAPI for production order creation from legacy system. There is no standard inbound IDoc available to use. SAP has an IDoc for outbound interface only (message type LOIPRO).
If there is an inbound IDoc available, I would recommend to use an IDoc.
IDoc technology has excellent error handling and will allow you to reprocess an error (if any).
BAPI is also good approach to use and fast in term of processing.
For BAPI approach, you can use BAPI BAPI_PRODORD_CREATE.
Hope this will help.
Regards,
Ferry Lianto -
Issue in PO creation for Direct Material Procurement.
Hi Experts,
I am working with SRM 7.0 Classic Scenario.
I have no issues with SC creation for indirect materials with Account Assignment.
But when I select Order as Direct material in SC for any material with out account assignment on Approval of SC PO is created in SRM system as Extendended Classic Scenario even though I have not activated Extended classic scenario.
Kindly help me out in this issue how can I order as DIRECT MATERIAL WITH Classic scenario.
Regards,
B.N.Karthikeyan.karthi
it is standard behavior,
but you can do one thing .
BBP_CREATE_BE_PO_NEW BADI - TRY . CLEAR THE ACCOUNT ASSIGNMENT .Thats all . check it up with technical resoucre.
but you have to decide by developemnt what are the materials are PO with account / without account assignment
br
muthu -
PR Creation from Main Order based on Material Availability Check
Hi Experts.
I have activated material check for maintenance order, and system is checking material availability. But system is not generating purchase requisition if material not available.
PR creation from main order is feasible in case I will select item category as Non Stock - N; but system is not creating PR for stock item IC - L.
Can u further guid me, how system will generate PR for material assign in maintenace order, but required stock not available.
Thanks in advance....
Rgds,
DipenHi,
As Venu told, for the Item Category L, system will create the reservation. While running MRP for that item, system will check the stock qty & required qty, then it will create the PR for the unavailable qty.
Only for item category N, from maintenance order, PR will be created.
Maintain the MRP type in Material Master.
Regards,
Maheswaran. -
Required reference document to issue the material from project stock
Hi All,
we have procure the project stock material with Acct. assignment Grp as "Q", now the material is laying in project stock.
the things is we can issue the warehouse material with reference to Project Reservation similarly my client wanted to use some SAP document for records purpose to issue the material from project stock.
i have checked this functionality in SAP which is not available except straight way issuing the material from project stock using MB1A( 221 Q).
please help me out to resolve this requirent.
manoj singh
we canHi,
Did you implement PS module in your system? How were your project stocks reserved?
Cheers,
HT -
Cideon / Autocad 2007 / Material BOM Creation from autocad
Hi,
we are using Cideon integration for AutoCad 2007 & SAP ERP communication. DIR's in DMS are created from AutoCad drawings via SAP menu.
We want to create Material & Material BOM from AutoCad but we cannot see any option present in SAP menu. We can just create Header Material from SAP menu in AutoCad, no BOM option. What steps should be taken to enable material & bom creation from AutoCad SAP menu.
Thanks
Edited by: Rob Burbank on Oct 22, 2010 3:56 PMModerator message - Welcome to SCN
Please read [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement], How to post code in SCN, and some things NOT to do... and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again.
In particular, offering points is against forum rules
Rob -
Material replication from R/3 to SRM - Issue with Material group
Hello All,
I am working on BADI PRODUCT_CUSTOMER2 and method MAP_R3_TO_CRM_MATERIALMaterial replication part from R/3 to SRM.
I am using a Ztable to map r/3 material group to SRM material group(Product category).
For example Material M1 with material group 100 is transferred to SRM. Material group(Product category) 100 exist in SRM, but I am changing the material group to 200 in the product_customer2 badi. its working fine.
In another scenario, Material with material M1 with material group 300. Material group(product category) 300 does not exist in SRM,
I am changing the material group to 200 in the bdoc, in the product_customer2 badi. It is not working. The LUW is failing in SMQ2 transaction with the error "Error in Mapping (Details: transaction SMW01)". The BDOC is failing with error "Category for material group 300 does not exist"
I tried to deactivate the badi PRODUCT_CUSTOMER2, even then the FM MAP_BAPIMTCS_AND_PROCESS is validating the material group from R/3.
I tried to change the material group 300 to the existing material group 200 at initial stage in debugging in function module MAP_BAPIMTCS_AND_PROCESS but still the bdoc is failing with error "No storage form defined for product type 01 / logical system".
I am doing my testing using the following steps.
1. change the material descriptioni in MM02 in R/3.
2. An item is displayed in the queue in SMQ2 in SRM.
3. I have debugged the LUW and analyzed my badi by setting breakpoint at method MAP_R3_TO_CRM_MATERIAL, its changing the material group in the bdoc properly.
that didnt work.
also i tried to change the material group in the function module MAP_BAPIMTCS_AND_PROCESS before the badi is called.
4. I am checking the BDOc status using tcode SMW01 and checking the material using tcode COMMPR01.
can someone tell me how I can change the R/3 material group to SRM material group at the time of mapping in SRM?
Thanks
Sathish PMHi find below for the product cat
Steps to create the product category in SRM:
1) Create MM material groups in ECC client. This will create a transport. Go to SRM Tcode R3AS and select the object u201CDNL_CUST_PROD1u201D from the list and run it. You can monitor the job using R3AM1 in SRM. This will bring the material group into SRM. This can be seen in TCode u201CCOMM_HIERARCHYu201D in SRM.
2) Once it is done. Go to IMG in SRM and go to path SRM> SRM server> Cross app biz settings> Account aassigmnet> Define GL code for Acc *** Cat and Prod Cat. Maintain the GL code against this prod cat for all the account assignment codes. This is client specific setting and need to be done in every client by opening it. This GL code is given in the form in ticket.
3) Do a test and check if the product category is available for procurement in SC.
Regards,
Satish -
What are the parameters have to pass to bapi material creation?
can any one help me in creating material by using bapi.....
which is 'BAPI_MATERIAL_SAVEDATA'.....by using the above bapi wen i am creating material....how to pass data to that bapi....what are the thing s i ahve to pass.........hi
please chk this code
TYPES : BEGIN OF S_BAPI,
MATNR LIKE MARA-MATNR,
MBRSH LIKE MARA-MBRSH,
MTART LIKE MARA-MTART,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
END OF S_BAPI.
DATA : I_BAPI TYPE STANDARD TABLE OF S_BAPI WITH HEADER LINE.
PARAMETER : P_FILE LIKE RLGRAP-FILENAME DEFAULT 'C:\Documents and Settings\mansi_makhijani\Desktop\upload.txt'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = P_FILE
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = I_BAPI
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA : S_HEADDATA TYPE BAPIMATHEAD,
S_CLIENTDATA TYPE BAPI_MARA,
S_CLIENTDATAX TYPE BAPI_MARAX,
I_MAKT TYPE STANDARD TABLE OF BAPI_MAKT WITH HEADER LINE.
LOOP AT I_BAPI.
S_HEADDATA-MATERIAL = I_BAPI-MATNR.
S_HEADDATA-IND_SECTOR = I_BAPI-MBRSH.
S_HEADDATA-MATL_TYPE = I_BAPI-MTART.
S_CLIENTDATA-MATL_GROUP = I_BAPI-MATKL.
S_CLIENTDATA-BASE_UOM = I_BAPI-MEINS.
S_CLIENTDATAX-MATL_GROUP ='X'.
S_CLIENTDATAX-BASE_UOM ='X'.
I_MAKT-MATL_DESC = I_BAPI-MAKTX.
I_MAKT-LANGU_ISO ='EN'.
I_MAKT-LANGU ='EN'.
I_MAKT-DEL_FLAG =' '.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = S_HEADDATA
CLIENTDATA = S_CLIENTDATA
CLIENTDATAX = S_CLIENTDATAX
PLANTDATA =
PLANTDATAX =
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA =
VALUATIONDATAX =
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
NO_DEQUEUE = ' '
IMPORTING
RETURN =
TABLES
MATERIALDESCRIPTION = I_MAKT
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
NFMCHARGEWEIGHTS =
NFMCHARGEWEIGHTSX =
NFMSTRUCTURALWEIGHTS =
NFMSTRUCTURALWEIGHTSX =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
ENDLOOP.
~hitesh
If your queries are solved try to close the thread
Maybe you are looking for
-
ABAP Query transports not handled by CHARM
Hi, How should ABAP query transports be handled in CHARM?? The ABAP query transport tool doesn't allow picking a transport that is already created (Own transport), it creates a new transports which is outside of CHARM. I had to assign the objects in
-
Production and warehouse database on same server
I have a production database that move every six months to warehouse where it is stored for history record., there will not be much intraction with production to warehouse. But both databases are exists in one server. I would like to know what is the
-
How to view records frm higher to lower using sql statement
Dear all i have tables RATING: 50 76 55 60 80 90 95 100 20 30 32 34 i want to view this record into higher to lower and 5 records only will appear in sql .. Like this : 100 95 90 80 76 thank you very much
-
I'm working on inserting a recordset up Google Calendar entries into my site database. I have a form set up that allows me to insert new entries into the data table, but when I try to loop the insert query over the Google recordset, I get nothing (no
-
HT4718 Mountain lion install- no recovery hd error
I am trying to install mountain loin and keeping getting"can't install-no recovery hd" error.. I have installed mountain lion on an external drive as suggested but when I try to install afterwards back on the MacBook it still says it can't install du