cancel
Showing results for 
Search instead for 
Did you mean: 

Work Manager 6.2: Adding custom field for notification creation

CRVMANISH
Contributor
0 Kudos

Hello Experts &

I have similar problem which Marcal posted

http://scn.sap.com/thread/3597335

Please let me know if anything wrong i am doing in java code.

I have added work center field in EditTransaction which was not in screenset but its there in object and transaction property , i have extended two java classes.

     1. NotificationEdit

     2. NotificationPostBAPI

But work center does not seems to be populated in my SAP BAPI

public class ZNotificationEdit extends NotificationEditBAPI{

  public ZNotificationEdit(User u, SAPObject obj) throws Exception {

        super(u, obj);   

    }

   @Override

   protected void setHeaderParameters(Logger log) throws Exception {

  

         JCO.Structure header = _imports.getStructure("IS_NOTIF_HEADER");

         JCO.Structure xStruct = _imports.getStructure("IS_NOTIF_HEADER_X");

         setEditValue(header, xStruct, log, "PM_WKCTR", _notification.getWorkCenter());

         //PM_WKCTR

     }   

  @Override

   public ArrayList<SAPObject> processResults() throws Exception {

         return super.processResults(); 

  }

}

public class ZnotificationPostBAPI extends NotificationPostBAPI{

  public ZnotificationPostBAPI(User u) throws Exception {

  super(u);

  }

  @Override

    protected void setHeaderParameters(Logger log) throws Exception{

    if (_bapiType.equals("CREATE")) {

    if (_notification.getIsLocal()) {

         JCO.Structure header = _imports.getStructure("IS_NOTIF_HEADER");

         setValue(header, log, "PM_WKCTR", _notification.getWorkCenter());

    }   

  

    }

    else if (_bapiType.equals("UPDATE")) {

       JCO.Structure header = _imports.getStructure("IS_NOTIF_HEADER");

         JCO.Structure xStruct = _imports.getStructure("IS_NOTIF_HEADER_X");

         setEditValue(header, xStruct, log, "PM_WKCTR", _notification.getWorkCenter());

      

           }       

  }

}

Regards

Manish

Accepted Solutions (0)

Answers (1)

Answers (1)

Marçal_Oliveras
Active Contributor
0 Kudos

Hi Manish,

Have you added the work center field in the add transaction too?

Before trying the Edit, I think you should try with the create (adding the field in the creation screen and transaction if they are not there). The way you extended NotificationPostBAPI looks fine, if the configuration portal changes are correctly implemented it should work.

You should debug if the _notification attribute has the work center informed when your overriden setHeaderParameters is called.

Regarding the edit, I  think you must extend NotificationPostUpdateBAPI instead of NotificationEditBAPI.

CRVMANISH
Contributor
0 Kudos

Workcenter is already there in add and edit transaction. I added the work center in screensets. I will try with NotificationPostUpdateBAPI.

Do I need to write anything in steplet and steplet handler, i am using WM6.2

Regards

Manish

Marçal_Oliveras
Active Contributor
0 Kudos

No, you don't have to modify steplet and step handler.

But debug them to see if they are correctly getting your custom BAPI class name from configuration portal and not the standard.

CRVMANISH
Contributor
0 Kudos

Hello Marcal,

NotificationPostUpdateBAPI is for LAM(com.syclo.sap.component.lam.notification.bapi ), we are not using LAM.


I am using com.syclo.sap.component.notification.bapi

In this package there is no method to set header parameters.


Regards

Manish

Marçal_Oliveras
Active Contributor
0 Kudos

In my project (Work Manager 6.1), the LAM is not used but the configuration portal is still pointing to the LAM java classes, so I created the extensions from lam classes. I'm not sure if this is due to a wrong backend installation, a wrong BC Set activation or it is just the standard way for WM 6.1.

Anyway, that is not really relevant. You just have to go to your configuration portal and see which class is being used in order to extend it and then replace it.

You say that com.syclo.sap.component.notification.bapi.NotificationPostUpdateBAPI does not have set header parameters, but this is not true. This class is inheriting from NotificationPostBAPi which has the method, but NotificationPostUpdateBAPI doesn't override it. That doesn't prevent you to override it in your extended class...

CRVMANISH
Contributor
0 Kudos

Hello Marcal,

LAM package has HeaderParameters but not in  this package( com.syclo.sap.component.notification.bapi.NotificationPostUpdateBAPI).

I have attached screenshot for reference.

Regards

Manish