Quantcast
Channel: SCN : Popular Discussions - SAP Cloud Applications Studio
Viewing all articles
Browse latest Browse all 1333

How to retrieve “ProductTypeCode” by customer invoice UUID from “InputData.content” in BADI SET_LEGAL_CLS_CODE.absl ?

$
0
0

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

{

  1. result.content = "32";
  2. result.listID = "TW";

}

elseif(product_type_code == "1" || product_type_code == "3")

{

  1. result.content = "31";
  2. result.listID = "TW";

}

else

{

  1. result.content = "36";
  2. result.listID = "TW";

}

 

returnresult;

 

 

Thank you in advance.


Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>