User Defined Program to calculate fields

63 Views Asked by At

I have to take a document from SAP ERP and then send it out through a CSV file with values delimited by pipes (|).

The configuration works, I built it, mapped some segments... but I don't know how to map a specific segment which I'm asked to map thru User-Defined function (logic via Java).

All I have is this:

Target Field: AdjProductNum (numeric value)

IDoc segment: ZMSEG

Logic to code: When BWART = 309 AND MATNR <> UMMAT AND ( WERKS= UMWRK AND LGORT = UMLGO AND CHARG = UMCHA); = UMMAT

This is the logic I have designed with help of a colleague:

public class CheckIdocProductNum {

    public static void  CheckIDocProductNum(String[] args) {
        // TODO Auto-generated method stub
              // code to check AdjProductNum

              if (BWART.equals("309") && 
                      !MATNR.equals(UMMAT) &&
                      WERKS.equals(UMWRK) &&
                      LGORT.equals(UMLGO) &&
                      CHARG(UMCHA)) 
               return UMMAT; // Condition fulfilled

              else = FAIL;// Returns blank if does not fulfill IF    
    }
}
0

There are 0 best solutions below