Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Purpose :

We had a requirement to build a Form layout sorted based on material and Storage Bin and display dynamic subtotal at the end of each material storage bin combination.

In below example i have shown how we can sort the table data present in adobe form layout using script editor present in Adobe form life cycle.

Similar approach can be followed to sort table data based on any field combination present in Adobe form.

Restrictions:

In S/4 HANA public cloud we can write our custom logic only in script editor present in Adobe life Cycle designer.

We don't have any standard "sort" function in script editor of Adobe life cycle designer to achieve this.

So we can follow below approach to perform sort and calculate subtotal for any field combinations.

Expected output as per below.


Since in S/4 HANA Public cloud we have to write all our logic in Adobe life cycle designer and we do not have any other interface like ECC or On- Prem System.

So 1st we'll develop a logic to sort the data source in ADLC based on material and storage bin.

Method :    Form Ready  / Layout Ready.

Steps:       Get the length of internal table and and run a For loop.

Inside For loop  concatenate material and storage bin for current line item and next line                       item and store it in separate variables .

compare those two variables and if the current line item value is less than next line item                     value then switch the position of these line items.

Perform this comparison for all the line item of data source.

Please refer below sample coding for the same.
var i = 0;
var j = 0;
var k = 0;
var temp1;
var x;
var y;
var length = Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem.all.length;
for i = 0 upto length - 1 do
x = concat( Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[i].tblInnerTable.rowItem.colStorageBin,
Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[i].tblInnerTable.rowItem.colMaterialID
for j = i + 1 upto length - 1 do
y = concat( Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[j].tblInnerTable.rowItem.colStorageBin,
Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[j].tblInnerTable.rowItem.colMaterialID
if ( x < y ) then

//Item No column
temp1 = Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[j].tblInnerTable.rowItem.colItemID;
Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[j].tblInnerTable.rowItem.colItemID = Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[i].tblInnerTable.rowItem.colItemID;
Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[i].tblInnerTable.rowItem.colItemID = temp1;

temp1 = "";

//Do this activity for all the fields present in output layout.

To perform subtotal based on sorted data.

Steps :     Get the length of internal table and and run a For loop.

Inside For loop  concatenate material and storage bin for current line item and next line                       item and store it in separate variables .

Sum up the quantity value where material and storage bin combination and place it at                         end of the line item at end of combination.

Perform this comparison for all the line item of data source.

Please refer below sample code to perform the same
for i = 0 upto length1 - 1 do
k = Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[i].tblInnerTable.rowItem.colDeliveryQuantity1;
for j = i + 1 upto length1 - 1 do
if (( Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[i].tblInnerTable.rowItem.colMaterialID == Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[j].tblInnerTable.rowItem.colMaterialID )
and ( Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[i].tblInnerTable.rowItem.colStorageBin == Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[j].tblInnerTable.rowItem.colStorageBin ) ) then

Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[j].tblInnerTable.rowTotal.frmTotal.Total_Quantity = k + Form.bdyMain.frmTableBlock.tblRemarkRowTable.rowItem[j].tblInnerTable.rowItem.colDeliveryQuantity;

//Sum up the total quantity for this condition.
//Place the total quantity field at the end of this combination.

 

Conclusion : Since adobe life cycle designer for S/4 HANA public cloud doesn't provide any specific way to perform sort and subtotal of table data, above method/way can be used to perform the same.
1 Comment
Labels in this area