How to create custom order number instead of YNumber in OMS ?

By | 05/17/2017

create custom order number :

createOrder Out-of-Box API has user exit com.yantra.yfs.japi.ue.YFSGetOrderNoUE (Java Interface)

getOrderNo() Method

Steps to implement

  • Go to createOrder API documentation
  • Look for YFSGetOrderNoUE user exit
  • Create java class CreateCustomerOrderNumberUE which implements YFSGetOrderNoUE user exit
  • Code
  1. Open CREATE_ORDER transaction
  2. Configure the newly created user exit
  3. Build and deploy
  4. Call createOrder API without passing an order number

  5. Call createOrder API with passing an order number

Points to remember

This user exit called only when order number (OrderNo Attribute) not passed. if order number passed this user exit not called.

Any exception: Current transaction rolled back

How to apply custom order number creation only for Sales order ?

When we implement user exit YFSGetOrderNoUE method getOrderNo(), logic gets applied to all the Order type.

If we wanted to apply only for one specific type follow below steps

a) Application Platform –> Order Fulfillment –> Order Fulfillment Repository –> Create Order Transaction

create custom order number

b) Open com.yantra.yfs.japi.ue.YFSGetOrderNoUE click on green color + symbol and select “Sales Order” from drop down for Document Type


Also you can read about How to check installed software 32 or 64 bit

16 thoughts on “How to create custom order number instead of YNumber in OMS ?

  1. SAR

    Nice Article – I would like to add few more important points,

    If your requirement is to have your order number based on the Document Type, say for an example,
    Purchase Order Number should start with “P”, Return Order Number should start with “R”, Sales Order Number should start with “S”, then you can write custom logic in the YFSGetOrderNoUE implementation like below,

    public String getOrderNo(YFSEnvironment env, @SuppressWarnings(“rawtypes”) Map inMap) {
    String strDocumentType = (String) (inMap.get(“DocumentType”));
    return getDocumentTypePrefix(sDocumentType) + String.valueOf(System.currentTimeMillis());

    private String getDocumentTypePrefix(String strDocumentType){
    if (strDocumentType.equals(“0001”)) {
    return “O”;
    } else if (strDocumentType.equals(“0003”)) {
    return “R”;
    } else if (strDocumentType.equals(“0004”)) {
    return “TP”;
    } else if (strDocumentType.equals(“0005”)) {
    return “P”;
    } else if (strDocumentType.equals(“0006”)) {
    return “T”;
    } else if (strDocumentType.equals(“0007”)) {
    return “MS”;
    } else if (strDocumentType.equals(“0015”)) {
    return “QT”;
    return “NA”;

    Using this approach you can have only one userexit implemented which will take care of all the different type of document type order number requirement.

    Happy Coding!!!!!

    1. ActiveKite-Admin Post author

      Thanks for valuable comments. For sure more to learn. Keep posting your comments.

      1. PTI

        Instead of DocumentType, can we do this with orderType?

        1. admin

          Yes. If the order type part of Map you can always use any attribute from order XML. Hope this helps !!!

    1. admin

      Yes we are working on it. Will post ASAP. Thanks

    1. admin

      We are working on the answers. Keep you posted soon.

  2. Ram

    Instead of returning System.currrentTimeInMillis..mostly DB sequences are used.

    1. admin

      We agree with you. System.currrentTimeInMillis given just for explaining user exit. Anyhow we should have given with DB sequence. We accept your suggestion.

  3. Ashok

    While overriding UE with a java class and if, I have configured with a class name, which is not present.
    ex. For a getOrderNoUE, if I have configured with class name as yyzz etc. Whether while creating order, sterling will throws an error.


Leave a Reply

Your email address will not be published. Required fields are marked *