cancel
Showing results for 
Search instead for 
Did you mean: 

Generating a Customer Invoice through SDK

former_member197479
Active Participant
0 Kudos

Hi Guys, hope that all of you are fine!

I've been trying to deal with this on my own for a while, but honestly.. I just can't.

I'm trying to create a Customer Invoice from the sdk, as far as I know in order to do that you need first to generate a Customer Invoice Request.. here's where it gets annoying..

I tried it.. several times, with the code in the PSM (It doesn't work.. what a surprise), consuming the CustomerInvoiceRequest web service.. and nothing..

There's a web service in the system that allows to create an Invoice.. it's called ManageCustomerInvoiceRequestIn.. but i'm not able to use it..

Thanks to all of you in advance

BillGiotDel
Participant
0 Kudos

I was also able to create a customer invoice request with the external webservice (ManageCustomerInvoiceRequestIn) that is provided by SAP.

I also have a question that is related to this one: https://answers.sap.com/questions/12901205/sap-byd-in-code-customer-invoice-request-to-custom.html

I was wondering if you found out how to make a customer invoice with a customer invoice request?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Melvin, I worked on this before. Are you able to achieve this by now?

If not, can you let me know what kind of errors you are getting while creation of Customer Invoice Request?

You can post the error screenshot which would be convenient for you.

May be you can go for the webservice option, ManageCustomerInvoiceRequestIn in the worst case as I think this invoice creation would be easier to create from sdk than through webservice.

former_member197479
Active Participant
0 Kudos

Hi Srivatsava Janaswamy, I've been trying to do this with no further success...

Basically the error that I'm getting is a service exception, that something is missing into the Web Service.

It just doesn't have sense, I mean.. we should be able to generate an Invoice document through the PDI itself without needing to publish any web services..

Have you ever try to do this directly on a script into the PDI?

Thanks in advance!

Former Member
0 Kudos

Hi Melvin,

My comments on this.

You cant create all node instances of Customer Invoice Request (CIR) BO in the ABSL of the custom BO. say for e.g. Currency code is mandatory for creating CIR and it is present under PricingTerms node. You cant assign the currency code here in the custom BO action. Also there is a create() function for this node which you cant use as creation is disabled. So to come across such strange nodes, you have to extend the CIR BO where in the extended BO before save event you can assign these node data.

Basically, some data can be assigned in the custom BO action and some can be assigned in the extension BO action. So that you can manage to get rid off those errors.

has already worked on this and was successful. So he can give you the right info to create a CI

Best regards,

Hari

Former Member
0 Kudos

I have tested this code and this is working fine.

This code was written in a BeforeSave of a CustomBO.

It also contains the code for creating and releasing the Invoice after creating Request.

So, please find the syntax of creating invoice from a request(incase you missed this from studio)

I request you to use this function based on your use case.

You  might see some errors after executing this code. You can ignore them. However, both InvoiceRequest and Invoice will be created successfully.

Whatever you do, I request you NOT to change the sequence of code.

Invoice Item needs either a product or a GL account assignment. So, I have given you both examples in this code by commenting one.

Also, please make a note that you can eliminate some coding by right customer account setup.

For eg., Currency and Pricing terms can be assigned in the Sales Data of the Customer Account and so, whenever this customer along with the sales unit is used in any Customer Invoice Request, those values are picked up automatically so that you don't have to maintain them in your coding.

May be your CRM leads can help you in this setup.

import

ABSL;


import

AP.CustomerInvoicing.Global;



// define CustomerInvoiceRequest root node


var

elCustomerInvoiceRequest_Root: elementsof CustomerInvoiceRequest;


var

instCustomerInvoiceRequest;



// define CustomerInvoiceRequest BusinessProcessVariantType node


var

elCustomerInvoiceRequest_BPVT: elementsof CustomerInvoiceRequest.BusinessProcessVariantType;


var

instCustomerInvoiceRequest_BPVT;



// define CustomerInvoiceRequest buyer party node


var

elCustomerInvoiceRequest_BuyerParty: elementsof CustomerInvoiceRequest.Party;


var

instCustomerInvoiceRequest_BuyerParty;



// define CustomerInvoiceRequest sales unit party node


var

elCustomerInvoiceRequest_SalesUnitParty: elementsof CustomerInvoiceRequest.Party;


var

instCustomerInvoiceRequest_SalesUnitParty;



// define CustomerInvoiceRequest item node


var

elCustomerInvoiceRequest_Item: elementsof CustomerInvoiceRequest.Item;


var

instCustomerInvoiceRequest_Item;



var

ItemProduct : elementsof CustomerInvoiceRequest.Item.ItemProduct;



// define CustomerInvoiceRequest item accounting coding block node


var

elCustomerInvoiceRequest_ItemACBD: elementsof CustomerInvoiceRequest.Item.ItemAccountingCodingBlockDistribution;


var

instCustomerInvoiceRequest_ItemACBD;



// define CustomerInvoiceRequest item price component


var

elCustomerInvoiceRequest_Item_MainPrice: elementsof CustomerInvoiceRequest.PriceAndTaxCalculation.Item.ItemPriceComponent;


var

instCustomerInvoiceRequest_Item_MainPrice;



// InvoiceDate setting to current date for this example.


var

InvoiceDate = Context.GetCurrentUserDate();



// CustomerInvoiceRequest: create new instance




// CustomerInvoiceRequest: maintain BPVT node


// BusinessProcessVariantTypeCode = 3 describes type 'Manual Invoice'


elCustomerInvoiceRequest_BPVT

.BusinessProcessVariantTypeCode = "3";



elCustomerInvoiceRequest_Root

.CustomerInvoiceProcessingTypeCode = "CI";


instCustomerInvoiceRequest

= CustomerInvoiceRequest.Create(elCustomerInvoiceRequest_Root);


// CustomerInvoiceRequest: create new BPVT instance


// Without the BPVT node no modifications can be made to the CustomerInvoiceRequest


instCustomerInvoiceRequest_BPVT

= instCustomerInvoiceRequest.BusinessProcessVariantType.Create(elCustomerInvoiceRequest_BPVT);



// Assign currencycode


if

(!instCustomerInvoiceRequest.PricingTerms.IsSet()){


var temp = instCustomerInvoiceRequest.PricingTerms.Create();


temp.CurrencyCode = "GBP";


}


else

{


instCustomerInvoiceRequest.PricingTerms.CurrencyCode = "GBP";


}



// CustomerInvoiceRequest: maintain customer invoice processing type - mandatory


instCustomerInvoiceRequest

.CustomerInvoiceProcessingTypeCode = "CI";



// CustomerInvoiceRequest: maintain description - optional


instCustomerInvoiceRequest

.Name = "CIR From ABSL";



// CustomerInvoiceRequest:: maintain buyer party - mandatory


elCustomerInvoiceRequest_BuyerParty

.PartyKey.PartyID.content = "CP100992";



// CustomerInvoiceRequest: create new party instance


instCustomerInvoiceRequest_BuyerParty

= instCustomerInvoiceRequest.BuyerParty.Create(elCustomerInvoiceRequest_BuyerParty);



// CustomerInvoiceRequest:: maintain sales unit party - mandatory


elCustomerInvoiceRequest_SalesUnitParty

.PartyKey.PartyID.content = "P1110";



// CustomerInvoiceRequest: create new party instance


instCustomerInvoiceRequest_SalesUnitParty

= instCustomerInvoiceRequest.SalesUnitParty.Create(elCustomerInvoiceRequest_SalesUnitParty);



// Assign Cash Discount Terms


if

(!instCustomerInvoiceRequest.CashDiscountTerms.IsSet()){


var PaymentTerms = instCustomerInvoiceRequest.CashDiscountTerms.Create();


PaymentTerms.Code.content = "001";


}


else

{


instCustomerInvoiceRequest.CashDiscountTerms.Code.content = "0001";


}



// CustomerInvoiceRequest: maintain item with product



// CustomerInvoiceRequest.Item: maintain description - mandatory


elCustomerInvoiceRequest_Item

.Description.content = "Test from ABSL";



// CustomerInvoiceRequest.Item: maintain quantity - mandatory


elCustomerInvoiceRequest_Item

.Quantity.content  = 1;


elCustomerInvoiceRequest_Item

.Quantity.unitCode = "EA";



// CustomerInvoiceRequest: create item instance


instCustomerInvoiceRequest_Item

= instCustomerInvoiceRequest.Item.Create(elCustomerInvoiceRequest_Item);


if

(!instCustomerInvoiceRequest_Item.ItemProduct.IsSet()){


var instItemProduct = instCustomerInvoiceRequest_Item.ItemProduct.Create();


instItemProduct.ProductKey.ProductID.content = "P100202";


}



// CustomerInvoiceRequest.Item.ItemAccountingCodingBlockDistribution: maintain GL-account - mandatory


//elCustomerInvoiceRequest_ItemACBD.GeneralLedgerAccountAliasCode.content = "A-1500";



// CustomerInvoiceRequest.Item: create new ItemAccountingCodingBlockDistribution instance


//instCustomerInvoiceRequest_ItemACBD = instCustomerInvoiceRequest_Item.ItemAccountingCodingBlockDistribution.Create(elCustomerInvoiceRequest_ItemACBD);



// CustomerInvoiceRequest.Item.PATCItem: maintain tax code - mandatory (code 501 = Sales Tax - Standard Rate)


instCustomerInvoiceRequest_Item

.PriceAndTaxCalculationItem.TaxationCharacteristicsCode.content = "509";



// CustomerInvoiceRequest.Item.PriceAndTaxCalculationItem.ItemMainTotal: Maintain price


instCustomerInvoiceRequest_Item

.PriceAndTaxCalculationItem.ItemMainTotal.Rate.BaseDecimalValue = 150;


instCustomerInvoiceRequest_Item

.PriceAndTaxCalculationItem.ItemMainTotal.Rate.CurrencyCode     = "GBP";



// To Create Invoice from this request and to release it.


// Use the parameters of this function based on your need. Setting second parameter to "true" releases the invoice.


// Incase you miss the syntax from ByD, here you go CreateCustomerInvoices(CustomerInvoiceDate,AutomaticReleaseIndicator,BBTDBasedSeperationReqdIndicator,PDBasedSeperationReqdIndicator,InvClearingRequestedIndicator)


instCustomerInvoiceRequest

.CreateCustomerInvoices(InvoiceDate,true,false,false,false);

Message was edited by: Srivatsava Janaswamy

Former Member
0 Kudos

End of whole discussion

Cheers!!!

former_member197479
Active Participant
0 Kudos

Hi, Srivatsava Janaswamy, thanks for sharing this valuable information with me.

I already tried that code that you provide me, but I'm getting the following error:

Former Member
0 Kudos

Did you setup the Sales Data for the customer you are trying to create?

Pricing Terms and Payment Terms can be set in the customer data.

Is this setup?

former_member197479
Active Participant
0 Kudos

Everything Is set up..

I even try to generate the Manual Invoice through the system itself, with the same data and it worked.

Former Member
0 Kudos

If everything is setup, then despite of the errors you get, Invoice Request should have been created.

Did you also check in the Customer Invoicing --> Inovoice Requests if the Request which you are trying to create is there or not?

And one more question. Are you using the code pasted by me or the one which you are trying with earlier?

former_member197479
Active Participant
0 Kudos

Hi Srivatsava,

It doesn't appear to work for me.. I'm using the exactly same code that you provide me.

There's no Customer Invoices, or Requests created.. Something is not working..

former_member197479
Active Participant
0 Kudos

Hi Srivatsava!!

It worked!!

Now I have a couple of questions, is there anyway to hide or do something in order to those error messages?

Former Member
0 Kudos

Unfortunately, No Way!

former_member200567
Active Contributor
0 Kudos

Hi Srivatsava Janaswamy,

              

            I copied your code , filled my data.

            The system already has enough master data for the process.

            The invoice request is created but it is not released.

            There is nothing wrong with the data because we can release the invoice request created by ABSL from Customer Invoicing work center.

             I was stuck here. Please give me some suggestions.

Best Regards,

Naing

former_member200567
Active Contributor
0 Kudos

Hi, Srivatsava.

       I can release the invoice request now with a small change to your whole code. (Thanks for the detail codes)

       I had to change InvClearingRequestedIndicator to true.

instCustomerInvoiceRequest.CreateCustomerInvoices(InvoiceDate,true,false,false,true);

         I don't know why I had to change the parameter to true.

         Can you please explain?

Best Regards

Naing

0 Kudos

Hi Melvin,

Could you please share your code as I am trying to create a customer invoice from SDK and have been following your thread. I am trying to create customer Invoice through a file upload, I don't see any errors in process communication as well, but it doesn't not create any invoice and exactly same values generates a manual invoice when entered through BYD work center. Could you please advise? Many Thanks.

import ABSL;

import AP.CustomerInvoicing.Global;

import AP.Common.GDT;

// define CustomerInvoiceRequest root node

var elCustomerInvoiceRequest_Root: elementsof CustomerInvoiceRequest;

var instCustomerInvoiceRequest;

// define CustomerInvoiceRequest BusinessProcessVariantType node

var elCustomerInvoiceRequest_BPVT: elementsof CustomerInvoiceRequest.BusinessProcessVariantType;

var instCustomerInvoiceRequest_BPVT;

// define CustomerInvoiceRequest buyer party node

var elCustomerInvoiceRequest_BuyerParty: elementsof CustomerInvoiceRequest.Party;

var instCustomerInvoiceRequest_BuyerParty;

// define CustomerInvoiceRequest sales unit party node

var elCustomerInvoiceRequest_SalesUnitParty: elementsof CustomerInvoiceRequest.Party;

var instCustomerInvoiceRequest_SalesUnitParty;

// define CustomerInvoiceRequest item node

var elCustomerInvoiceRequest_Item: elementsof CustomerInvoiceRequest.Item;

var instCustomerInvoiceRequest_Item;

var ItemProduct : elementsof CustomerInvoiceRequest.Item.ItemProduct;

// define CustomerInvoiceRequest item accounting coding block node

var elCustomerInvoiceRequest_ItemACBD: elementsof CustomerInvoiceRequest.Item.ItemAccountingCodingBlockDistribution;

var instCustomerInvoiceRequest_ItemACBD;

// define CustomerInvoiceRequest item price component

var elCustomerInvoiceRequest_Item_MainPrice: elementsof CustomerInvoiceRequest.PriceAndTaxCalculation.Item.ItemPriceComponent;

var instCustomerInvoiceRequest_Item_MainPrice;

// InvoiceDate setting to current date for this example.

var InvoiceDate = Context.GetCurrentUserDate();

// read the uploaded XML invoice file

Trace.Info("Started BILLING upload...", this.companyID);

// CustomerInvoiceRequest: create new instance

// CustomerInvoiceRequest: maintain BPVT node

// BusinessProcessVariantTypeCode = 3 describes type 'Manual Invoice'

elCustomerInvoiceRequest_BPVT.BusinessProcessVariantTypeCode = "3";

elCustomerInvoiceRequest_Root.CustomerInvoiceProcessingTypeCode = "CI";

instCustomerInvoiceRequest

= CustomerInvoiceRequest.Create(elCustomerInvoiceRequest_Root);

// CustomerInvoiceRequest: create new BPVT instance

// Without the BPVT node no modifications can be made to the CustomerInvoiceRequest

instCustomerInvoiceRequest_BPVT

= instCustomerInvoiceRequest.BusinessProcessVariantType.Create(elCustomerInvoiceRequest_BPVT);

// Assign currencycode

if (!instCustomerInvoiceRequest.PricingTerms.IsSet()){

  var temp = instCustomerInvoiceRequest.PricingTerms.Create();

  temp.CurrencyCode = "GBP";

}

else

{

  instCustomerInvoiceRequest.PricingTerms.CurrencyCode = "GBP";

}

// CustomerInvoiceRequest: maintain customer invoice processing type - mandatory

instCustomerInvoiceRequest

.CustomerInvoiceProcessingTypeCode = "CI";

// CustomerInvoiceRequest: maintain description - optional

instCustomerInvoiceRequest

.Name = "CIR From SDK";

// CustomerInvoiceRequest:: maintain buyer party - mandatory

elCustomerInvoiceRequest_BuyerParty

.PartyKey.PartyID.content = "DCIB001";

// CustomerInvoiceRequest: create new party instance

instCustomerInvoiceRequest_BuyerParty

= instCustomerInvoiceRequest.BuyerParty.Create(elCustomerInvoiceRequest_BuyerParty);

// CustomerInvoiceRequest:: maintain sales unit party - mandatory

elCustomerInvoiceRequest_SalesUnitParty

.PartyKey.PartyID.content = "UK02-GSAL";

// CustomerInvoiceRequest: create new party instance

instCustomerInvoiceRequest_SalesUnitParty

= instCustomerInvoiceRequest.SalesUnitParty.Create(elCustomerInvoiceRequest_SalesUnitParty);

// Assign Cash Discount Terms

if(!instCustomerInvoiceRequest.CashDiscountTerms.IsSet()){

  var PaymentTerms = instCustomerInvoiceRequest.CashDiscountTerms.Create();

  PaymentTerms.Code.content = "001";

}

else

{

  instCustomerInvoiceRequest.CashDiscountTerms.Code.content = "0001";

}

// CustomerInvoiceRequest: maintain item with product

// CustomerInvoiceRequest.Item: maintain description - mandatory

elCustomerInvoiceRequest_Item

.Description.content = "Test from Deepthi";

// CustomerInvoiceRequest.Item: maintain quantity - mandatory

elCustomerInvoiceRequest_Item

.Quantity.content  = 1;

elCustomerInvoiceRequest_Item

.Quantity.unitCode = "EA";

// CustomerInvoiceRequest: create item instance

instCustomerInvoiceRequest_Item

= instCustomerInvoiceRequest.Item.Create(elCustomerInvoiceRequest_Item);

if (!instCustomerInvoiceRequest_Item.ItemProduct.IsSet()){

  var instItemProduct = instCustomerInvoiceRequest_Item.ItemProduct.Create();

  instItemProduct.ProductKey.ProductID.content = "200001";

}

// CustomerInvoiceRequest.Item.ItemAccountingCodingBlockDistribution: maintain GL-account - mandatory

//elCustomerInvoiceRequest_ItemACBD.GeneralLedgerAccountAliasCode.content = "A-1500";

// CustomerInvoiceRequest.Item: create new ItemAccountingCodingBlockDistribution instance

//instCustomerInvoiceRequest_ItemACBD = instCustomerInvoiceRequest_Item.ItemAccountingCodingBlockDistribution.Create(elCustomerInvoiceRequest_ItemACBD);

// CustomerInvoiceRequest.Item.PATCItem: maintain tax code - mandatory (code 501 = Sales Tax - Standard Rate)

instCustomerInvoiceRequest_Item

.PriceAndTaxCalculationItem.TaxationCharacteristicsCode.content = "501";

// CustomerInvoiceRequest.Item.PriceAndTaxCalculationItem.ItemMainTotal: Maintain price

instCustomerInvoiceRequest_Item

.PriceAndTaxCalculationItem.ItemMainTotal.Rate.BaseDecimalValue = 150;

instCustomerInvoiceRequest_Item

.PriceAndTaxCalculationItem.ItemMainTotal.Rate.CurrencyCode    = "GBP";

// To Create Invoice from this request and to release it.

// Use the parameters of this function based on your need. Setting second parameter to "true" releases the invoice.

// Incase you miss the syntax from ByD, here you go CreateCustomerInvoices(CustomerInvoiceDate,AutomaticReleaseIndicator,BBTDBasedSeperationReqdIndicator,PDBasedSeperationReqdIndicator,InvClearingRequestedIndicator)

//instCustomerInvoiceRequest.CreateCustomerInvoices(InvoiceDate,true,false,false,false);

CustomerInvoice.CreateWithCustomerInvoiceRequestReference(instCustomerInvoiceRequest, Context.GetCurrentUserDate(), false, false, false, true);

Trace.Info("inv create", this.companyID);

Former Member
0 Kudos

Hi Fred & Srivatsava,

We are doing a mass upload of Customer Invoice Requests and requests should be released as invoice, so I am calling the action CreateCustomerInvoices.

I also have the same problem, if I make the InvoicingClearingRequestedIndicator to true only Invoice is getting released.


CreateCustomerInvoices(InvoiceDate,true,false,false,true);


Due to this automatically Clearing ID is generated and this should not happen because we have separate file for uploading receivables part and there may be also partial payment.

Is there anyway to sort this and why it works like this?

Thanks,

Madhan

Answers (5)

Answers (5)

Former Member
0 Kudos

Hello everyone,

First, thank you very much for your example,Srivatsava, it's being very useful for me.

I am trying to make something similar with SupplierInvoice, but all my properties are locked.

Trying to following your example I have the same issue, so I think there must be related to another problem.

I'm working with a Solution-Template.

Thank you very much for your time!

Regards,

Óscar

Former Member
0 Kudos

Many of the elements seems not to have write access allowed, try to look into the PSM to find out what can you do with this object.

Also you can raise an incident to request for write access to it.

Regards.

Former Member
0 Kudos

Thank you for your answer, Arnulfo.

SupplierInvoice is writable according to PSM:

So maybe it's a issue about my ByD System...

Regards.

Former Member
0 Kudos

Hi Oscar, even when the BO is write access allowed, sometimes some of its nodes or elements don't, so you need to go deeper to know if you can write something.

Maybe an element/node that you're trying to write have no this write access, but again, if you need it, you can raise an element requesting for it.

Regards.

Former Member
0 Kudos

Not sure about complete set of restrictions levied on Solution Template.

You can't even extend screens for standard BO's there. They might not allow to execute code for Std. BO's as well? I suggest you to get help from anyone who has tried this scenario in a soln. template.

I've heard that if you are in Cust Test Tenant, some of the std. terms are locked. You might have to raise an incident stating your use case to unlock them. Not sure if this applies to your case!

But, if you are working on your devpt. tenant, I think its worth trying this in one of your experimental customer specific soln. Try out with working scenarios first, one like for Customer Invoice as Melvin already reported that its working. If you are still seeing the same errors, then you might have to raise an incident.

Former Member
0 Kudos

Hello all,

My problem was that my BOs were in a different Deployment Unit  (default for the Solution) that the standard BOs that I need to create.

Using  [DeploymentUnit(SupplierInvoicing)] businessobject BO_NAME {... in my BOs definition  the problem is resolved.

Thank you very much for your support.

Regards,

Óscar

Former Member
0 Kudos

Excelent man, I glad to know that you already solved.

Regards.

Former Member
0 Kudos

Hello Oscar,

i am having a similar problem: i would like to generate a SupplierInvoic based on a GSA with some price modification in the invoicing (discounts).

Can you post how you actaully solved this in ABSL? I was looking for some function like createSupplierInvoiceByGSAReference, but there is no documentation and I cannot find any function which come even close to this.

Thanks for any help or hint.

Best

Peter

Former Member
0 Kudos

Hi Peter,

You can find a sample in SupplierInvoice Business Object, into ByD Studio Repository Explorer:

Please, note that your BO must be in the same Deployment Unit:

If you have further question I'll be glad to help you.

Best Regards,

Óscar

Here is the sample code:

// ABSL example for Supplier Invoice

import ABSL;

import AP.FO.Product.Global;

import AP.SupplierInvoicing.Global;

import AP.FO.Party.Global;

import AP.Common.GDT;

var SI_Root: elementsof SupplierInvoice;

var SI_SParty: elementsof SupplierInvoice.Party;

var SI_BParty: elementsof SupplierInvoice.Party;

var SI_Item: elementsof SupplierInvoice.Item;

var SI_DueDate: elementsof SupplierInvoice.CashDiscountTerms;

var qrySIV_Root_QueryByElements = SupplierInvoice.QueryByElements;

var selParamsSIV_Root_QueryByElement = SupplierInvoice.QueryByElements.CreateSelectionParams();

var BTDRef: elementsof SupplierInvoice.BusinessTransactionDocumentReference;

var SI;

var inst;

var inst1;

var SI_Item1;

var SI_Root1;

var RootTempID;

var RootTempUUID;

// Set document type to Invoice

SI_Root.TypeCode = "004";

// Set Invoice Date

SI_Root.Date = Context.GetCurrentSystemDate();

SI_Root.DocumentItemsGrossAmountIndicator = false;

SI_Root.ReceiptDate = Context.GetCurrentSystemDate();

// SI_Root.TaxAmount = this.TotalTaxAmount;

SI_Root.TransactionDate = Context.GetCurrentSystemDate();

// Root node creation

SI = SupplierInvoice.Create(SI_Root);

//Set TypeCode to "CustomerInvoice"

// Set External Document ID

BTDRef.BusinessTransactionDocumentReference.ID.content = "EXT12345";

SI.CustomerInvoiceReference.Create(BTDRef);

// Set Supplier ID

SI_SParty.PartyKey.PartyID.content = "MC4000";

SI.SellerParty.Create(SI_SParty);

// Set Bill-To Party

SI_BParty.PartyKey.PartyID.content = "MC10000";

//SI.BillToParty.Create(SI_BParty);

SI.BuyerParty.Create(SI_BParty);

// Set Due Date

SI_DueDate.FullPaymentEndDate = Context.GetCurrentSystemDate();

SI.CashDiscountTerms.Create(SI_DueDate);

       // Set Product Quantity

       SI_Item.Quantity.content = 3;

       SI_Item.Quantity.unitCode = "EA";

       // Set Net Price or Gross Price

       SI_Item.NetUnitPrice.Amount.content = 60;

       // Set Price Per Item

       SI_Item.NetUnitPrice.BaseQuantity.content = 10;

       // Line Item Creation

       SI_Item1 = SI.Item.Create(SI_Item);

       // Set Product ID

       //SI_ItemProduct.ProductKey.ProductID.content = "MCA-0002";

SI_Item1.ItemProduct.ProductKey.ProductID.content = "MCA-0001";

      // set Item Location

//     SI_ItemLocation.LocationID.content = "MC10000";

      SI_Item1.ShipToItemLocation.LocationID.content = "MC64000";

       // Set Tax Code

       SI_Item1.TaxCalculationItem.TaxationCharacteristicsCode.content = "2";

       foreach(inst in SI_Item1.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment)

       {

       // Set Account Assignment Type to "Project Task"

       inst.AccountingCodingBlockTypeCode.content = "PRO";

       }

    //   var temTest = SI_Root.ReceiptDate.ToString();

      foreach(inst in SI_Item1.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment){

       // Set Project Task ID

       inst.ProjectTaskKey.TaskID.content = "MC-1239-1"; // ItemIns.ProjectTaskID;

       }

       // SI_Item1.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment.Create(AccAsmt);

       //Association with the Standard BO

    if(!SI.IsSet())

    {

    raise Error.Create("E");

    }

    this.toSIV = SI;

    this.SIV_ID = this.toSIV.ID.content;

// calculation of gross amount

this.toSIV.GrossAmount = this.toSIV.TotalGrossAmount;

SI.FinishDataEntryProcessing();

//raise success message

raise Success.Create("S",this.SIV_ID);

former_member197479
Active Participant
0 Kudos

Hi Guys! I've tried lots of examples but none of them works..

I don't understand how we aren't able to create an Invoice within the SDK and we can do it externally using Web Service..

Former Member
0 Kudos

Hi Melvin,

If you are successfull in creating Customer Invoice Request using web service, then you can import that web service as External Web Service Integration in SDK and call the same in ABSL of your custom BO to create the Customer Invoice Request.

Meanwhile I will give a try to create CIR using ABSL!

Best regards,

Hari

SAPjedi
Contributor
0 Kudos

I do not think the ManageCustomerInvoiceIn is an officially released WS from SAP (or even available). 

The official list is here:  https://www.sme.sap.com/irj/sme/community/collaboration/wiki?path=/display/AMI/SAP%20Business%20ByDe...

The webservices are all packaged as Communication Arrangements.  You will need to setup uesrid/paswd or certificates to call the SAP webservices.

You will either have to develop your own or ask SAP to develop a Customer Invoice Request WS as a custom (paid?) request. 

Former Member
0 Kudos

You could always use the WEBDAV uploads to upload an invoice XML file for automatic processing into SAP.

Former Member
0 Kudos

Hi Mr. Chang,

yes, that´s true ManageCustomerInvoiceIn is not available. It is possible to build one through the SDK, but I don´t think this is recommended as many elements are not write enabled.

For legal and security reasons, SAP decided to create Customer Invoice Requests before a Customer Invoice is generated.

Unfortunately, I don´t know to which communication arrangement it belongs. Maybe you can help?

Best Regards,

Rufat

SAPjedi
Contributor
0 Kudos

I am interacting with one of our SAP colleagues on this.

I have seen it in one of the new 1302 tenant as Customer Invoice Integration Comm Arrangement.

I suppose you can continue your POC if you find it accesible thru your URL discovery.

As soon as I have official word, I will share it here.

Tim.

ralf_baumann
Participant
0 Kudos

Hi Melvin, hi Rufat,

I would like to make you aware of the the Service Explorer (Application and User Management WoC -> Service Explorer). It lists "All synchronous Inbound Operations" and offers links to the service documentation.

Best regards,

Ralf

Former Member
0 Kudos

Hi Ralf,

that´s true, but unfortunately not for ManageCustomerInvoiceRequestIn.

The documentation is really short and not complete in the Service Explorer. I also contacted SAP

about this case. Last week I found the expanded documentation in the community (I assume it is new).

Best Regards,

Rufat

former_member197479
Active Participant
0 Kudos

Hi Guys! thanks for all your answers, Unfortunately I'm still not able to generate a proper request to create the "Customer Invoice Request", We tried with the documentation.. but the code isn't complete.. there're tags missing all over it.

Is there any chance that any of you can provide me an xml that you tried before and worked?

Thanks for the help

Former Member
0 Kudos

<glob:CustomerInvoiceRequsetBundleMaintainRequest_sync>

         <BusinessDocumentBasicMessageHeader/>

         <CustomerInvoiceRequest actionCode="04" itemListCompleteTransmissionIndicator="true">

            <BaseBusinessTransactionDocumentID>EXT_40</BaseBusinessTransactionDocumentID>

            <ProposedInvoiceDate>2012-11-07</ProposedInvoiceDate>

            <BuyerParty actionCode="04">

               <InternalID>990001</InternalID>

            </BuyerParty>

            <!--Optional:-->

            <!--<BillToParty actionCode="04">

               <InternalID>990001</InternalID>

            </BillToParty>:-->

            <SalesUnitParty actionCode="04">

               <InternalID>I20</InternalID>

            </SalesUnitParty>

            <EmployeeResponsibleParty actionCode="04">

               <InternalID>8000000000</InternalID>

            </EmployeeResponsibleParty>

            <SalesAndServiceBusinessArea>

               <SalesOrganisationID>I40</SalesOrganisationID>

               <DistributionChannelCode>01</DistributionChannelCode>

               <ServiceOrganisationID>2</ServiceOrganisationID>

            </SalesAndServiceBusinessArea>

            <PricingTerms>

               <PricingProcedureCode listID="2">PPSTD1</PricingProcedureCode>

               <CurrencyCode>EUR</CurrencyCode>

               <ProvisionDate>2013-01-25</ProvisionDate>

            </PricingTerms>

            <Item actionCode="04">

               <BaseBusinessTransactionDocumentItemTypeCode>002</BaseBusinessTransactionDocumentItemTypeCode>

               <BaseBusinessTransactionDocumentItemID>10</BaseBusinessTransactionDocumentItemID>

               <SettlementRelevanceIndicator>true</SettlementRelevanceIndicator>

               <BaseItemCancelledIndicator>false</BaseItemCancelledIndicator>

               <ReceivablesPropertyMovementDirectionCode>2</ReceivablesPropertyMovementDirectionCode>

               <CashDiscountDeductibleIndicator>false</CashDiscountDeductibleIndicator>

               <Product>

                  <InternalID>TS-001</InternalID>

                  <TypeCode>2</TypeCode>

               </Product>

               <Quantity unitCode="EA">1</Quantity>

               <QuantityTypeCode>EA</QuantityTypeCode>

               <PriceAndTax>

                  <PriceComponent>

                     <TypeCode listID="2">7PR1</TypeCode>

                     <CategoryCode>1</CategoryCode>

                     <PurposeCode>1000</PurposeCode>

                     <MajorLevelOrdinalNumberValue>10</MajorLevelOrdinalNumberValue>

                     <MinorLevelOrdinalNumberValue>1</MinorLevelOrdinalNumberValue>

                     <Rate>

                        <DecimalValue>20.0</DecimalValue>

                        <CurrencyCode>EUR</CurrencyCode>

                        <BaseDecimalValue>1.0</BaseDecimalValue>

                        <BaseMeasureUnitCode>EA</BaseMeasureUnitCode>

                     </Rate>

                     <RateBaseQuantityTypeCode>EA</RateBaseQuantityTypeCode>

                     <CalculationBasis>

                        <BaseCode>3</BaseCode>

                        <Quantity unitCode="EA">1.0</Quantity>

                        <QuantityTypeCode>EA</QuantityTypeCode>

                        <Amount currencyCode="EUR">130.00</Amount>

                     </CalculationBasis>

                     <CalculatedAmount currencyCode="EUR">2</CalculatedAmount>

                     <RoundingDifferenceAmount currencyCode="EUR">1.0</RoundingDifferenceAmount>

                     <EffectiveIndicator>true</EffectiveIndicator>

                     <ManuallyChangedIndicator>true</ManuallyChangedIndicator>

                     <GroupedIndicator>false</GroupedIndicator>

                     <OriginCode>2</OriginCode>

                     <PriceSpecificationDeterminationTimePoint>

                        <TypeCode>1</TypeCode>

                        <Date>2012-05-07</Date>

                     </PriceSpecificationDeterminationTimePoint>

                  </PriceComponent>

               </PriceAndTax>

               <AccountingCodingBlockAssignment>

                  <Percent>100.0</Percent>

                  <AccountingCodingBlock>

                     <!--Optional:-->

                <AccountingCodingBlockTypeCode>ACC</AccountingCodingBlockTypeCode>

                    <GeneralLedgerAccountAliasCode>A-1520</GeneralLedgerAccountAliasCode>

                    

                     <!--Optional:-->

                     <ProductID>TS-001</ProductID>

                     <ProjectReference/>

                   

                  </AccountingCodingBlock>

               </AccountingCodingBlockAssignment>

            </Item>

         </CustomerInvoiceRequest>

Former Member
0 Kudos

Hi Melvin,

in the following I have a sample request. It works fine for me.

Best Regards,

Rufat Gadirov

Former Member
0 Kudos

Hello Melvin,

you should use the SAP Webservice ManageCustomerInvoiceRequestIn instead of creating your own through the SDK. It is not really possible to create your own Create Method for the CustomerInvoiceRequest beacause of the restricted PSM. Besides, it is highly recommended (by SAP) to use the services offered by SAP.

There is a documentation on this webservice. Look here:

https://www.sme.sap.com/irj/sme/go/portal/prtroot/docs/library/uuid/b0b4fc41-da5b-3010-8997-f9c9e594...

I tested the webservice via SOAP UI and it worked fine.

Best Regards,

Rufat Gadirov