Hi, I have a XM3 for method validatePutawayLocation in MMRTVPAL.
public void main() {
// Check if extension should run for current user
if (!shouldRun()) {
return
}
PutawayInfo pInfo = method.getReturnValue();
def OPCD = method.getArgument(0); /* Operation code */
TableRecordAPI table = method.getArgument(1); /* MITPCE Stock Location table */
ReadOnlyData ds = method.getArgument(2); /* MMRTVPAL Data Structure */
def WHSL = table.get("MSWHSL") /* Verify if the current location (WHSL) in MITPCE follows business rules */
logger.info("Operation code: " + OPCD)
logger.info("MITPCE location: " + WHSL)
logger.info("MMRTVPALDS Location : " + ds.get("SYWHSL"))
if (OPCD == '*RTV' || OPCD == '*RTVNITBAL') {
logger.info("RRTV")
if (WHSL == 'STOCK') {
pInfo.setERCD((char)'1')
logger.info("RRTV Location is invalid... ")
}
} else if (OPCD == '*CHK' || OPCD == '*CHKNQT') {
logger.info("RCHK")
if (WHSL == 'STOCK') {
pInfo.setERCD((char)'1')
pInfo.setMSID("WLO3301") // Location &1 is invalid -> Replace &1 with MSGD value
pInfo.setMSGD((String) WHSL)
logger.info("Location is invalid. Standard message is displayed.")
} else if (WHSL == 'STOCK') {
pInfo.setERCD((char)'1')
pInfo.setMSID("CPF9898") // &1 -> Replace &1 with MSGD value
pInfo.setMSGD("This is a custom message. Location is " + WHSL)
logger.info("Location is invalid. Custom message is displayed.")
}
}
method.setReturnValue(pInfo);
}
When WHSL is "STOCK" I set the ERCD field to '1' to set as invalid.
Standard MMRTVPAL has this code:
@Override
public PutawayInfo validatePutawayLocation(MvxString XXOPC, GenericMDB record, sMMRTVPALDS MMRTVPALDS) {
PutawayInfo pInfo = new PutawayInfo();
return pInfo;
}
public boolean isValidLocation() {
boolean valid = true;
PutawayInfo pInfo = validatePutawayLocation(XXOPC, ITPCE, MMRTVPALDS); // Extension
if (pInfo.getERCD() == '1') {
valid = false;
XXRPQT = 0d;
XXINCL = 'N';
if (conceptRetrievePutAwayLocationEnabled) {
KQLOG.concept(cLogConcept.RETRIEVE_PUTAWAY_LOCATION, "MMRTVPAL: " + "Location " + ITPCE.getWHSL() + " is excluded. EXTENSION.");
}
}
return valid;
}
If pInfo.getERCD() == '1' then the record should not be displayed. But it is not working. I set the log to show this category and I do not see the KQLOG "Location XX is excluded. EXTENSION" So I suppose that by any reason the this condition the field ERCD is not '1'. But I do not see what is wrong in my extension code. When I run it the extension with a whsl "STOCK" the log is showing me the trace in extension: "Location is invalid. Standard message is displayed." so the sentence pInfo.setERCD((char)'1') has been done, but for any reason the pInfo that is retrieving MMRTVPAL has not this ERCD to '1'... Any idea?