ABAP Meets #Blockchain
Yesterday I was reading about Blockchain, its architecture and other technical detail. I being from ABAP background thought of coding a basic blockchain in ABAP. Please note that intent here is to build a basic blockchain so that its understanding can be increased. Implementation of the blockchain may differ based on the requirements but basic concept remains the same.
The other features such as power of distributed data management and sync, validation of blocks etc. is out of scope of this blog.
Blockchain Basics
As the name suggests Blockchain is basically chain or collection of blocks. Typically a block comprises of a header which has different fields, a hash (cryptic value) of previous block and Transactions Data in hashed form (we will dig into this in our next blog). The first block in the blockchain is known as genesis block. N number of transactions together make a block. These all block are distributed over the network as local copy on each connected node.
Once the maximum number of transactions in a block is reached, the three parts of the block which are header, data(detail of transactions) & previous block hash are combined and hashed(encrypted ) with a key known as proof of work or nonce. The correct key or proof of work is determined based on the difficulty level. For example we say a generated hash is valid only and only if it contains 5 leading zero’s. So this leading 5 zero’s is known as the difficulty level.
The process of determining the right key consumes the major time and is known as mining. Depending on which currency it is, rewards are given accordingly to the one who finds a valid Proof of Work. The moment someone finds a valid proof of work all the connected nodes are informed and if 50% of the nodes agreed then this new hash is added as a new block to the chain.
What we are planning to build
* A basic prototype of Blockchain, where a report will take input as difficulty level and number of blocks to be generated and then output will be hash and nonce for value for each hash. In the current blog our focus is to highlight how it works. In next blog we will focus on how the transactions are arranged in a block:)
ABAP Implementation of basic Blockchain
* Created a basic report with below mentioned selection screen parameter
* A Type for basic blockchain structure
* Genesis block
* First step is to add genesis block, we are using SHA1 algorithm for encryption.
* Determine Next Block Hash
* An iterative loop to repeat number of blocked needed – 1 since genesis block is already added.
* Inside block loop have another loop to concatenate current and previous hash data along with Nonce value and generate a hash. Validate the hash as per difficulty if valid exit and append the block
* Output Display
What is expected next?
* Deep dive into Block transactions arrangement – Merkel tree
* Implementing Blockchain using BOPF – This will be more like learning BOPF by implementing a blockchain using it
* Adding flavor of CDS to Blockchains with annotations:)
* Finally if time permits a HCP UI5 app to display and run this chain rather than traditional report
Feel free to provide your feedback,open to all ears:). Lets share and learn. http://bit.ly/2urF1P0 #SAP #SAPCloud #AI
SAP IBP : Using EPM Formatting to restrict user inputs on a predefined condition
EPM Formatting has been a powerful tool for all the planners who are exploring the strength of SAP IBP to solve their supply chain business issues.
On the similar lines , I am writing this blog to demonstrate as to how can we utilize the EPM formatting option to restrict the users to input a key figure values based on pre defined conditions in excel UI.
Usually we write the conditions in Key figure calculations or we create an alert key figure with those conditions and then display alert once the data is saved or we run simulation.
In this blog I explore the possibility of informing/restricting the user as soon as the value is entered and it violates the condition.
In this example , we have a condition where in Sales team has decided not to provide any Sales discount more than 60%. So they want to restrict the discount value entered in the planning views to be always below 60%.
Steps :
The below in the Sales Plan View and we have a KF for Sales Price Discount where user can enter the discount %.
To open the EPM Formatting sheet , Select Edit Planning View–> View Formats ,
You will see that a new sheet appears, Open it
Since we are trying to put the condition on the KF , we will try to indetify the KF under Row section of the sheet. (Please note that if the KF is not displayed you can add it via Add Member/Property option)
Now for the KF Sales Fcst Price Discount , for the column ‘Use’ (as above) , double click to select the ‘Data Validation’ option and click OK
Now for the same KF , under Column ‘Data’ , Right Click –> EPM–>Data Validation
Once you select Data Validation , a new pop up box will appear , under settings maintain the validation criteria. Since we are displaying this KF in % we are giving 0.6 value.
Under Input message , please specify as to what message you want to display to user when the cells for that KF is selected.
Under, Error Alert , you can Select the style either as Error (Stop) , Warning or Information. Give the title and description and Click Ok.
Now EPF Formatting is completed. Return to the main sheet and Refresh the sheet. You will see that on selecting any cell of that KF you get an info message displayed.
If user inputs any value which violates the condition , system throws an error pop up.(since we have created a Stop style)
In this way we can restrcit user inputs based on our business logic using EPM Sheet formatting.
Hope you like the approach.
Open for feedback.
Regards,
Anurag
PS : Some EPM Formatting help :https://help.sap.com/viewer/b28ffdd739bf45678ef36c44e64652d7/1711/en-US/e073d4c2207e4800a50605c011e0baf7.html
http://bit.ly/2GeQ4AG #SAP #SAPCloud #AI
Integrating Apache OpenNLP Into Apache NiFi For Real-Time Natural Language Processing of Live Data Streams
This is an update to the existing processor. This one seems to work better and faster.
Versions
Apache OpenNLP 1.8.4 with Name, Location, and Date Processing. https://goo.gl/cEmgdN #DataIntegration #ML