Pages

Monday, December 7, 2015

Episode 460: Brush-up on Customer Master Data by "Corporate Identification Number System Web-API"

"Company name (trade name) will be changed."
"Transaction company will be changed for a group restructuring."

You may have often received "Name change notification letters" from suppliers. However, it is really insecure to carry out maintenance on"Customer Master data", only relying on such a letter.

Since December 1st, 2015, the Japanese government has started running a "Web-API function" for the "Corporate Number system".

If the application side has obtained the "Corporate Number of business partners" (13-digit number), it is possible to refer the registration information such as the business name and location of the customer, at any time. In addition, it is now able to detect change information (processing segment), such as the "Name Change", "Merger", "Company dissolution".

The following workflow definition is a mechanism to automatically detect "Name changes", utilizing this "Web-API function".

Here, we assume that the "Business Partner Master" (Business-Connection. xml) is present on the Workflow platform. In other words, trade names that are registered in the "Business Partner Master" will be confirmed if it is as the same as the information registered in government. It is set to be automatically run every Sunday morning.

[Automatic check of Trade-name Registration in Customer Master]



Maintenance of "Customer Master" is not so easy work, when you get more trading partners.

It could happen that "a business partner company have been extinguished before you know". This Workflow definition is excellent for nothing else but it is completely unmanned.

However, you should note that "One Web-API request" has been performed for a single "Corporate Number". If you want to run on Questetra, there is a limit of "total number of steps: up to 500". That means, you will need devising separately in case more than 160 companies are in your "Customer Master", while it works with no problem for fewer. (To be continued to the next post...)


P.S.
By the way, you will need an "Application ID" for the part of Requesting to Web-API. For the "Application ID", it is needed to make application by respective companies. The [request transmission event] of this Business Template (.qar) is set as "APPLICATIONID", but it must be rewritten before the operation.


P.S. 2
It should be noted that, until the release of v10.4 of Questetra (November 2, 2015), It was the state that is not capable of storing "Response in XML format". (That is, It was a state that not assumed "Response in MIME type: application / xml".) However, it is now capable of storing the "response of XML format" to [string type data], with v10.4.1 (December 7, 2015) or later.


[Automatic check of Trade-name Registration in Customer Master:"1. Confirm" screen]

▼ Setting sample for [Throwing Request Event]
  • Access URL: https://api.houjin-bangou.nta.go.jp/1/num [Fixed value]
  • HTTP Method: GET [Fixed value]
  • Send parameter:
    • id: APPLICATIONID [Fixed value]
    • number: {requestId}
    • type: 12 [Fixed value] (File format: XML)
    • history: 0 [Fixed value] (Exclude Change history)

▼ Sample codes for Auto-Step "Count # of clientsXML" (Server side)
//// == Retrieving == 
// XML file registered in [Common files] (M319) 
// returns "List<ItemView>" 
optionsList = itemDao.findAll("Business-Connections.xml", true); 

//// == Calculating == 
var numOfClients = 0; // javascript number 
numOfClients = optionsList.size(); // Number of registered customers 

var clientsCorporateNumbers = ""; // javascript string 
var clientsCorporateNames = ""; 
for (j = 0; j < numOfClients; j++){ 
  clientsCorporateNumbers += optionsList.get(j).getValue().substr(7, 13) + "\n"; 
  clientsCorporateNames += optionsList.get(j).getDisplay() + "\n"; 
} 

//// == Updating == 
retVal.put("1", java.math.BigDecimal(numOfClients) ); // The same as the number of looping in this sample 
retVal.put("2", java.math.BigDecimal(numOfClients) ); // numOfClients == numOfLoops 
retVal.put("3", clientsCorporateNumbers ); 
retVal.put("4", clientsCorporateNames ); 

retVal.put("5", java.math.BigDecimal(0) ); // i=0 
retVal.put("11", "vvv Check Log vvv\n" ); // Releasing state of null 

if( numOfClients == 0 ){ 
  retVal.put("11", "Business-Connections.xml: no such file ?" ); 
} 

▼ Sample codes for Auto-Step "Request Prep" (Server side)
//// == Retrieving == 
var i = 0; // javascript number 
i = data.get("5") - 0; 

var clientsCorporateNumbers = ""; // javascript string 
var clientsCorporateNames = ""; 
clientsCorporateNumbers = data.get("3") + ""; // (multi-lines) 
clientsCorporateNames = data.get("4") + ""; 

//// == Calculating == 
var iRequestCorporateNumbers = ""; // javascript string 
var array = clientsCorporateNumbers.split("\n"); 
iRequestCorporateNumbers = array[i]; 

var iCorporateNames = ""; // javascript string 
var array2 = clientsCorporateNames.split("\n"); 
iCorporateNames = array2[i]; 

//// == Updating == 
retVal.put("6", iRequestCorporateNumbers ); 
retVal.put("7", iCorporateNames ); 

▼ Sample codes for Auto-Step "Respose Chk / i++" (Server side)
//// == Retrieving == 
var i = 0; // javascript number 
i = data.get("5") - 0; 
var iCorporateNames = ""; // javascript string 
iCorporateNames = data.get("7") + ""; 
var diffLog = ""; // javascript string 
diffLog = data.get("11") + ""; 

var iResponseTmp = ""; // javascript string 
iResponseTmp = data.get("8") + ""; 
iResponseTmp = iResponseTmp.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); 
// E4X bug 336551 
var iResponseXML = new XML(iResponseTmp); // javascript xml 

//// == Calculating == 
var iResponseCorporateNames = ""; // javascript string 
iResponseCorporateNames += iResponseXML.corporation[0].name; 

diffLog += iCorporateNames + " is " + iResponseCorporateNames; 

if(iCorporateNames == iResponseCorporateNames){ 
diffLog += ": ok" + "\n"; 
} else { 
diffLog += ": NG" + "\n"; 
} 

// for XML debug 
//diffLog += " lastUpdateDate: " + iResponseXML.lastUpdateDate + "\n"; 
//diffLog += " count: " + iResponseXML.count + "\n"; 
//diffLog += " divideNumber: " + iResponseXML.divideNumber + "\n"; 
//diffLog += " divideSize: " + iResponseXML.divideSize + "\n"; 
//diffLog += " sequenceNumber - " + iResponseXML.corporation[0].sequenceNumber + "\n"; 
//diffLog += " process - " + iResponseXML.corporation[0].process + "\n"; 
//diffLog += " updateDate - " + iResponseXML.corporation[0].updateDate + "\n"; 
//diffLog += " changeDate - " + iResponseXML.corporation[0].changeDate + "\n"; 
//diffLog += " name - " + iResponseXML.corporation[0].name + "\n"; 

//// == Updating == 
retVal.put("5", java.math.BigDecimal(i + 1) ); 
retVal.put("10", iResponseCorporateNames ); 
retVal.put("11", diffLog ); 

[Data items list]


[Free Download]
<Similar Models>
<<Related Articles>>

[Japanese Entry (ε’Œζ–‡θ¨˜δΊ‹)]