0
Aug 19, 2020 at 03:00 PM

# Count issue in mapping sap cpi

1126 Views

HI Guys,

I need to implement a logic in an interface where below is the logic:
we need to check how many times a empld is repeating and count the amount. For an example in the file the price is different so we need to count and send the output as 15000.

i have written the logic like below but am not getting the expected result can you help me please where am going wrong.

import com.sap.it.api.mapping.*;
def void countValues(String[] EmpID, String[] Price, Output resPrice, MappingContext context){
int gPrice = 0;
boolean flag = false;
for(int i=0;i<EmpID.length;i++)
{
int tEmpID = 0;
int tPrice = 0;
try
{
tEmpID = Integer.parseInt(EmpID[i]);
}
catch(Exception e)
{
tEmpID = 0;
}
try
{
tPrice = Integer.parseInt(Price[i]);
}
catch(Exception e)
{
tPrice = 0;
}
// Price Logic
if(tEmpID == )
{
gPrice = tPrice;
flag = true;
}
if(flag==true)
{ break;
}
}
for(int i=0;i<EmpID.length;i++)
{
int tEmpID = 0;
int tPrice = 0;
//int tPrice = 0;
try
{
tEmpID = Integer.parseInt(EmpID[i]);
}
catch(Exception e)
{
tEmpID = 0;
}
try
{
tPrice = Integer.parseInt(Price[i]);
}
catch(Exception e)
{
tPrice = 0;
}
// sectionWeight Logic
if(tEmpID == )

{