I have created a virtual field of type 13 (extended field calculation) in CMS012 and added it to MMS001/B. The relation is maintained between MITMAS and MITBAL. I am using OB01(MMGRWE) and OB02(MBSSQT) for calculation. Not able to see the result in MMS001/B.
Program : CREXTVFC
Method: extendVirtualField
Advice: POST
This is the code written in XtendM3
public class calculationUsingVIFL extends ExtendM3Trigger {
private final LoggerAPI logger;
public calculationUsingVIFL(LoggerAPI logger) {
this.logger = logger;
}
public VirtualFieldData extendVirtualField(
int CONO,
String IBCA,
String VIFL,
double FLDP,
double OB01,
double OB02,
double OB03,
double OB04,
double OB05,
double OB06,
double OB07,
double OB08,
double OB09,
double OB10,
double RESULT) {
VirtualFieldData vfd = new VirtualFieldData();
double res = 0.0;
double v1 = Double.isNaN(OB01) ? 0d : OB01; // MMGGWI (Gross weight)
double v2 = Double.isNaN(OB02) ? 0d : OB02; // MBSSQT (Safety stock)
logger.info("VIFL="+VIFL+", OB01="+OB01+", OB02="+OB02+",IBCA"+IBCA);
if (VIFL != null && VIFL.trim().equals("&QTYT")) {
res = v1 + v2;
vfd.setRESULT(res);
logger.info("Calculated Result = " +res);
return vfd;
}
public void main() {}
}