Hi
How to retrieve “ProductTypeCode” by customer invoice UUID from “InputData.content” in BADI SET_LEGAL_CLS_CODE.absl ?
If anyone have idea about this issue then please suggest me.
I am trying to develop BADI implementation of legal numbering for customer invoices
that I follow “How-To Configure Legal Numbering for Customer Invoices for a Non-Localized Country” document.
URL Reference: https://www.sme.sap.com/irj/sme/solutions?rid=/library/uuid/f0758deb-b6bb-3010-8888-fedbe49079dd
But I found an issue from step number 2.7 (Create new BADI implementation),
I cannot retrieve “ProductTypeCode” by UUID from the “CustomerInvoice” business object when I create customer invoice.
My source code of SET_LEGAL_CLS_CODE.absl.
/*
Add your SAP Business ByDesign scripting language implementation for:
Enhancement Option: PDISetLegalClassCode
Operation: SET_LEGAL_CLS_CODE
Script file signature
----------------------------
Parameter: InputData of type UUID
Returns: BusinessTransactionDocumentLegalClassificationCode
Note:
- To use code completion, press CTRL+J.
*/
importABSL;
importAP.CustomerInvoicing.Global;
varinput_uuid = InputData.content;
varqry = CustomerInvoice.QueryByElements;
var_sel = qry.CreateSelectionParams();
_sel.Add(qry.ID.content,"I","EQ","XX*");
varinv = qry.Execute(_sel).GetFirst();
varproduct_type_code;
if(inv.Item.OrderBy(n => n.ID).GetFirst().ItemProduct.IsSet())
{
product_type_code = inv.Item.OrderBy(n => n.ID).GetFirst().ItemProduct.ProductKey.ProductTypeCode;
}
else
{
product_type_code = "";
}
varresult : DataType::BusinessTransactionDocumentLegalClassificationCode;
if(product_type_code == "2" || product_type_code == "6")
{
- result.content = "32";
- result.listID = "TW";
}
elseif(product_type_code == "1" || product_type_code == "3")
{
- result.content = "31";
- result.listID = "TW";
}
else
{
- result.content = "36";
- result.listID = "TW";
}
returnresult;
Thank you in advance.