cancel
Showing results for 
Search instead for 
Did you mean: 

Notification creation from Mobile client

Former Member
0 Kudos

Hi Expert,

I need to create notification from mobile device in backend PM module. In my scenario i will be getting below parameters at the time when device will sync :

1. Equipment (For which notification is to be created)

2. Subject (Subject of Notification)

3. Description (Description of Notification)

4. Priority (Priority of Notification eg Low , High)

Now at the time of creation of Notification in backend i will need an additional parameter that is --

USER who created this means the user who was using that device.

How to get that user name who sync that device in Doe so that i can send this information in backend.

Regards,

Abhishek

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Abhishek,

With in DOE, the sy-uname will give you the user who is synchronizing with DOE.

This is also captured part of the parameter mbo communication header ( mbo_message_comm_hdr TypeRef to SMMW_MSG_COMM_HDR) that is propagated in the flow of a message from client.

The field being mbo_message_comm_hdr -SEND_USR .

There is another field in the same comm hdr(mbo_message_comm_hdr -MOD_USER).This represents the user who created a message in the client and this user also should be a valid webas user.

Where do you want to capture this info(in a custom service?) . If yes, then this mbo_message_comm_hdr is available as importing parameter to a custom service.

More info at

[http://help.sap.com/saphelp_nwmobile71/helpdata/en/6d/bf104d163849d1af313c492655e0f7/content.htm]

In tcode sdoe_wb on selection of your SCV.,expand the data object and inturn the flow definition tree. Choose the flow where you wish to add a custom service. Press create button in right panel. Give FM or class method. Save it and generate your data object.

You can also refer the sample custom service SDOE_SAMPLE_CUSTOMSERVICE class shipped by SAP.

Regards,

Liji

Former Member
0 Kudos

Hi Liji,

Thanks a lot for your reply and it helped me a lot but still i am confused on implementation.May be you can help after knowing my requirement.I will be having BAPI Wrappers for Notification in Backend like Modify , create , getdetail etc.

Now header structure will include below five fields:

1. Equipment

2. Subject

3. Description

4. Priority

5. User (Who will create this Notification)

Now in DOE i will create a Data object by importing those BAPIs so in my DOE i will have these five node attributes,attributes from no 1 to 4 will be mapped automatically as these four fields are already on Mobile. So these 4 values will be passed in backend.

But how to map User field in DOE.

Can you please explain it more briefly,better will be if you can provide me steps for this.

Thanks once again for your support.

Regards,

Abhishek

Former Member
0 Kudos

Hi Abhishek,

I suppose if this user field cannot be filled from client as part of the message, then in DOE you can write a custom service for this specific dataobject where the message details sent from the client could be modified by adding this attribute value sync user. Whenever a create notification comes from client to DOE(Task 'I') , then in the DOE flow, the user field of notification object is set to sync user value..

In the normal message flow, this write custom service will be plugged in which sets the attribute user to the current sync user and then the flow proceeds to BE and then to the confirmation / rejection flow.

Custom write service signature follows..

IMPORTING

MBO_MESSAGE_COMM_HDR TYPE REF TO SMMW_MSG_COMMHDR_WRAPPER

CHANGING

MBO_MESSAGE_BODY TYPE REF TO IF_MBO_READWRITE_WRAPPER

MBO_MESSAGE_FOOTER TYPE REF TO SMMW_MSG_FOOTER_WRAPPER

C_LOG_HANDLER TYPE REF TO CL_MMW_RT_LOG

The structure wrapper framework : IF_MBO_READWRITE_WRAPPER

provides methods to read and write the message contents sent from the client during the flow.

The changing parameter : MBO_MESSAGE_BODY of the above signature contains the message content of a dataobject instance(s) that is sent from the client.

There are various methods part of the above wrapper framework IF_MBO_READWRITE_WRAPPER that you can use to implement your required functionality like GET_NODE_FOR_WRITE,SETATTRIBUTE, DELETE_RECORD,ADD_RECORD etc and these can be used to set the sync user to the user attribute of the data object message

Once it is part of the message content, it will be sent to BE also and if its successfully persisted in BE, it will proceed with the flow(via getDetail) to DOE and so on.

The custom service could be a class method or a function module and it shall be defined per dataobject as i mentioned in the previous reply and after generation , this method and its functionalities become part of the flow.

Regards,

Liji

Former Member
0 Kudos

Hi,

You can also do it with backend adapters default value concept.

If User is not filled from device while Notification creation, you can configure the value in backend adapter default values.

For example if you want to pass the mobile client upload user as 'User' while creating notification, then do the following steps.

1) Go to your data object's backend adapter

2) Select default value's tab

3) Choose your 'Create' BAPI as bapi wrapper name. Choose your the backend structure that has 'User' field

4) Choose 'Data object Communication header' for user. Press F4 in value field and select SEND_USR. Save . Activate the adapter and generate.

Note: If you want to pass sy-uname(user who syncs) you can choose system fields and select uname.

Henceforth whenever user creates notification from device and syncs then corresponding user value will be passed to 'Create' BAPI(backend).

Regards,

Dhana

Former Member
0 Kudos

Hi,

Now i have two question from both of you

@Dhana : When i follwed the same steps that you told then i could not find all the parametrs of that structure in parameter List table, it was showing only few of them , now how to see all the parameters.

@Liji : Under which flow definition i need to create that custom service, there are so many services under flow definition node.

Regards,

Abhishek

Former Member
0 Kudos

Hi Abhishek,

I think that Dhana's solution will be easy for you to implement if its possible.

If you are going by custom services way, then service could be added in the flow

MMW_FLOW_INBOUND_CLIENT_AV (which is the after validation flow) ...This is my understanding..Am not really sure whether it need to be in MMW_FLOW_INBOUND_CLIENT_BV(before validation flow) by any chance..Experts please clarify this.

Regards,

Liji

Former Member
0 Kudos

I correct myself, it should be in MMW_FLOW_INBOUND_CLIENT_BV..(before its sent to backend?)

Regards,

Liji

Former Member
0 Kudos

Hi Abhishek,

Regarding the default values in BE adapter, are you not able to see the below mentioned 15 items listed part of Data Object Communication header? This will be visible when you are in edit mode and with F4 on the 'value' table field after choosing this structure name in 'map' column

CLNT_MSG_ID

DEVICE_ID

DM_SWCV

EXTRACT_KEY

GROSS_FIELDS

IS_RESTART

MBO_NAME

MESSAGE_ID

MESSAGE_TYPE

MOD_USER

SEND_TSTMP

SEND_USR

SWCV_NAME

VERSION

Regards,

Liji

Former Member
0 Kudos

Hi,

Parameter list will show list of parameters that you have it in your create BAPI structures. If some parameter (say 'User' ) is not shown then check whether you have added that parameter to your backend structure after creating the adapter and generating it. If so then you need to adjust adapter using 'Adjust adapter' button and generate your adapter again. Then you will get your new parameter 'User' in parameter list for your corresponding backend structure.

Regards,

Dhana

Former Member
0 Kudos

Hi Liji,

I have created a custom service by including the Function Module now my question is that how to send that USER into my MODIFY BAPI wrapper(which is in Backend) which has a import parameter as USER, at what point this user can be send to my BAPI wrapper and how , please clarify.In case you have any doubts please let me know.

Regards,

Abhishek

Former Member
0 Kudos

Hi Abhishek,

The import parameter User in modify wrapper will be mapped to one of your dataobject field (in root node or child nodes) right?

In the custom service, you need to update this user field in the corresponding dataobject node part of messagebody and this will be implicitly passed to the bapiwrapper as well.

Regards,

Liji

Answers (0)