Skip to Content

Generating a Customer Invoice through SDK

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 31, 2013 at 05:29 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Fred K

      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

  • Mar 01, 2013 at 05:49 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 08, 2013 at 09:22 PM

    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%20ByDesign%20Integration%20Offerings

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Mar 17, 2013 at 04:36 AM

    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..

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Mar 01, 2013 at 12:48 PM

    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-f9c9e594f6a1?QuickLink=solutions&58029303155603

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

    Best Regards,

    Rufat Gadirov

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 13, 2013 at 08:05 PM

    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


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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);