on 2011 May 18 8:42 AM
Hi All,<br/><br/>
Here is a scenario that has totally confused me and I don't know what to do. Any guidance in this area will be highly appreciated.<br/><br/>
I am using BAPI BAPI_INCOMINGINVOICE_CREATE for MIRO. Our client gets invoices that contains both PO lines and some Non PO lines. For the PO lines I am populating the BAPI_INCINV_CREATE_ITEMDATA table and for the non po lines I am populating the BAPI_INCINV_CREATE_GL_ACCOUNTDATA table. In the structure BAPI_INCINV_CREATE_GL_ACCOUNT I am also populating the Bus_Area field with the Business Area value along with other values. The header Bus_Area is also populated with business area code. <br/><br/>
However, when I try to post the invoice the bapi return me a message: Z1 015 "Enter Business Area" and the invoice does not get booked in SAP, <br/><br/>
I have tried searching this forum and also googled about it, but I got no help in this regard. Please help me out in understanding this problem. I am attaching the code below for ease of understanding my problem. I am using SAP .Net Connector for the purpose. However, any guide related to this error (may not be .Net specific) will be appreciated.<br/><br/>
//objects used for creating the invoice ****<br/>
BAPI_INCINV_CREATE_ADDRESSDATA Addressdata = new BAPI_INCINV_CREATE_ADDRESSDATA();<br/>
BAPI_INCINV_CREATE_HEADER Headerdata = new BAPI_INCINV_CREATE_HEADER();<br/>
BAPI_INCINV_CREATE_ACCOUNTTable Accountingdata = new BAPI_INCINV_CREATE_ACCOUNTTable();<br/>
BAPI_INCINV_CREATE_ACCOUNT Account = new BAPI_INCINV_CREATE_ACCOUNT();<br/>
BAPI_INCINV_CREATE_ITEMTable Itemdata = new BAPI_INCINV_CREATE_ITEMTable();<br/>
BAPI_INCINV_CREATE_GL_ACCOUNTTable Glaccountdata = new BAPI_INCINV_CREATE_GL_ACCOUNTTable();<br/>
BAPI_INCINV_CREATE_GL_ACCOUNT Glaccount = new BAPI_INCINV_CREATE_GL_ACCOUNT();<br/>
BAPI_INCINV_CREATE_MATERIALTable Materialdata = new BAPI_INCINV_CREATE_MATERIALTable();<br/>
BAPIRET2Table InvReturn = new BAPIRET2Table();<br/>
BAPI_INCINV_CREATE_TAXTable Taxdata = new BAPI_INCINV_CREATE_TAXTable();<br/>
BAPI_INCINV_CREATE_VENDORSPLITTable Vendoritemsplitdata = new BAPI_INCINV_CREATE_VENDORSPLITTable();<br/>
BAPI_INCINV_CREATE_WITHTAXTable Withtaxdata = new BAPI_INCINV_CREATE_WITHTAXTable();<br/>
// ****<br/>
// populating the header<br/>
Headerdata.Bus_Area = invoice.BusinessArea;<br/>
Headerdata.Comp_Code = invoice.CompanyCode;<br/>
Headerdata.Doc_Date = invoice.InvoiceDate;<br/>
Headerdata.Doc_Type = "RE";<br/>
Headerdata.Diff_Inv = invoice.VendorID;<br/>
Headerdata.Currency = invoice.Currency;<br/>
Headerdata.Exch_Rate = 1.00M; // to be replaced<br/>
Headerdata.Gross_Amount = invoice.InvoiceAmount;<br/>
Headerdata.Header_Txt = "";<br/>
Headerdata.Invoice_Ind = "X"; // X = Invoice , '' = Credit Memo<br/>
Headerdata.Inv_Rec_Date = invoice.DateReceived;<br/>
Headerdata.Pmnttrms = invoice.PaymentTerm;<br/>
if (invoice.IsMatched == "0")<br/>
Headerdata.Pmnt_Block = "A"; // in case the IsMatch Status = 0<br/>
Headerdata.Pstng_Date = invoice.PostingDate;<br/>
Headerdata.Calc_Tax_Ind = "X";<br/>
Headerdata.Del_Costs = 0.00M;<br/>
Headerdata.Ref_Doc_No = invoice.InvoiceNumber;<br/>
Headerdata.Inv_Year = "0000";<br/><br/>
// populating the line<br/>
List<Invoice.LineItem> lines = invoice.LineItems.Where(item => item.PONumber.Trim() != String.Empty).ToList();<br/>
int itemCount = 0, accSlNo = 0;<br/>
foreach (Invoice.LineItem line in lines)<br/>
{<br/>
itemCount++;<br/>
string strItemNo = FillCharacter(itemCount.ToString(), "0", 6);<br/>
BAPI_INCINV_CREATE_ITEM Item = new BAPI_INCINV_CREATE_ITEM();<br/>
Item.Invoice_Doc_Item = strItemNo;<br/>
Item.Po_Number = line.PONumber;<br/>
Item.Item_Amount = line.Amount;<br/>
Item.Quantity = line.Quantity;<br/>
Item.Po_Item = FillCharacter(line.PO_LineNo, "0", 5);<br/>
Item.Po_Unit = line.PO_Unit;<br/>
Item.Po_Unit_Iso = line.PO_Unit_Iso;<br/>
Item.Tax_Code = line.TaxCode;<br/>
Item.Cond_St_No = "000";<br/>
Item.Cond_Count = "00";<br/><br/>
Item.Ref_Doc_It = "0000";<br/>
Item.Ref_Doc_Year = "0000";<br/><br/>
Item.Po_Pr_Qnt = Convert.ToDecimal(Po_item["Quantity"]);<br/>
Item.Po_Pr_Uom = Po_item["Orderpr_Un"].ToString();<br/>
Item.Po_Pr_Uom_Iso = Po_item["Orderpr_Un_Iso"].ToString();<br/><br/>
Itemdata.Add(Item);<br/><br/>
}<br/>
// populating the GL Accounts for the non PO and PM lines where the PO number will be blank<br/>
List<Invoice.LineItem> nonPOlines = invoice.LineItems.Where(item => item.PONumber.Trim() == String.Empty && item.LineItemType == "L").ToList();<br/>
itemCount = 0;<br/>
foreach (Invoice.LineItem line in nonPOlines)<br/>
{<br/>
int multiplier = 1;<br/>
itemCount++;<br/>
Glaccount = new BAPI_INCINV_CREATE_GL_ACCOUNT();<br/>
Glaccount.Invoice_Doc_Item = FillCharacter(itemCount.ToString(), "0", 6);<br/>
Glaccount.Db_Cr_Ind = "S"; // debit<br/>
Glaccount.Neg_Postng = "";<br/>
if (line.Amount < 0.00M)<br/>
{<br/>
Glaccount.Neg_Postng = "X";<br/>
Glaccount.Db_Cr_Ind = "H"; // credit<br/>
multiplier = multiplier * -1;<br/>
}<br/>
Glaccount.Comp_Code = invoice.CompanyCode;<br/>
Glaccount.Item_Text = line.Description;<br/>
Glaccount.Item_Amount = line.Amount * multiplier;<br/>
Glaccount.Gl_Account = line.GLCode;<br/>
Glaccount.Costcenter = line.CC;<br/>
Glaccount.Profit_Ctr = line.PC;<br/>
Glaccount.Orderid = line.OrderNo;<br/>
Glaccount.Tax_Code = line.TaxCode;<br/>
Glaccount.Bus_Area = line.BA;<br/>
Glaccount.Person_No = "00000000";<br/>
Glaccount.Sdoc_Item = "000000";<br/>
Glaccount.Ref_Date = "00000000";<br/>
Glaccount.Wbs_Elem = "00000000";<br/>
Glaccount.Profit_Segm_No = "0000000000";<br/>
Glaccount.Alloc_Nmbr = line.Assignment;<br/>
Glaccount.Tr_Part_Ba = line.BA;<br/>
Glaccount.Activity = "";<br/>
Glaccount.Acttype = "";<br/>
Glaccount.Cmmt_Item = "";<br/>
Glaccount.Cmmt_Item_Long = "";<br/>
Glaccount.Co_Busproc = "";<br/>
Glaccount.Costobject = "";<br/>
Glaccount.Func_Area = "";<br/>
Glaccount.Func_Area_Long = "";<br/>
Glaccount.Fund = "";<br/>
Glaccount.Funds_Ctr = "";<br/>
Glaccount.Network = "";<br/>
Glaccount.Rl_Est_Key = "";<br/>
Glaccount.Sd_Doc = "";<br/>
Glaccount.Grant_Nbr = "";<br/><br/>
Glaccountdata.Add(Glaccount);<br/>
}<br/>
proxyPOInvoice.Bapi_Incominginvoice_Create(Addressdata, Headerdata, out FiscalYear, out InvoiceNumber,<br/>
ref Accountingdata, ref Glaccountdata, ref Itemdata, ref Materialdata, ref InvReturn, ref Taxdata, ref Vendoritemsplitdata, ref Withtaxdata);<br/>
Request clarification before answering.
Hi,
Seems like the message "Z1 015"is being issued in a customer exit/badi, open up the message class Z1 in SE91 and for the message 015 do a where used list. This will take you to the code(provided it has not been coded dynamically) where this validation against business area is being done.
Regards,
Chen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chen,
Thanks for the quick support, really appreciated. But did not find anything in SE91.
When I performed "Where Used List" on the message Z1 015, It returned nothing.
To make this more complicated (or may to make it easy to find out):
Two random invoices got successfully booked using this BAPI. How?? I do not know. The same code mentioned above has done the trick. But still, many invoices are getting stuck.
Regards
Sutirtha
Hi Sutirtha,
Did you find the message class Z1 in your system using SE91, if so look at the attributes of this message class to get the name/UID of the person who created this, may be you can get some help/inputs from him/her.
Also, since you say that a couple of documents were posted successfully, could you see the difference in data in terms of business area in these documents against the ones that are failing?
Regards,
Chen
Hi,
Please try to post the invoice directly using MIRO transaction, providing the data that you are passing to the BAPI and check if you still get the same message.
If yes, have the ABAP developer debug the transaction and identify the location of the message and the condition that generates it.
Regards,
Shyam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shyam,
I tried to create invoice directly in SAP using MIRO for all those invoices where I get this message. I am not able to create the invoice without a message.
However, for some invoice the message I received is "Enter Business Area" and for some invoice the message is different.
I am trying to find out with the client (who has entire control on the SAP servers) as to what could be the issue.
Thanks & Regards
Sutirtha
Hi,
This error was mis leading. If CalculateTax flag is set to 'X' and there is balance in the transaction currency then, instead of giving "Balance in transaction currency" error "Enter Business Area" error comes.
There must be some logic for SAP to give this error, but it was somewhat misleading. When i removed the flag for CalculateTax="", this error vanished and "Balance in transaction currency" error came. When I retrified that my invoice got booked properly.
Thanks to all anyway for the responses provided.
Best Regards
Sutirtha
User | Count |
---|---|
102 | |
39 | |
6 | |
5 | |
4 | |
3 | |
3 | |
2 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.