cancel
Showing results for 
Search instead for 
Did you mean: 

How can i add a row in a table

Former Member
0 Kudos

Hi experts,

i have a problem where i can´t find any answer. Maybe one of you have one.

I have a scenario which is very similar to a MAM-Szenario. I'm using MI 7.1 and developing wit the newest NWDS in WebDynpro for Laptops.

I download Notification headers and as a dependend table the notification tasks. Now the user should be able to add a new task in the client if it not exists on the database.

Can anyone tell me how it is possible to dump a new entry to the database if the query, which should extract the right task is not available?

Thanks for a fast answer.

Mathias

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Mathias,

From what i understand you are simply trying to create tasks from the client.

Inorder to do so just create a CREATE BAPI WRAPPER and do a commit of the model in your application.

This should create a task in the local database and on syncronizing with the backend system , the new task will be saved in the backend.

Let me know if you have any doubt regarding this.

Regards,

Madhu.

Former Member
0 Kudos

Hi Madhu,

what do you mean with CREATE BAPI WRAPPER. Can you give me a code snipet in the client how to do so? My Structur looks like this:

source class NOTIFICATION_NOTIFICATION_HEADER

target class NOTIFICATION_NOTIFICATION_TASK.

This is my code snipet:

if (MasD.getQueryResult().isEmpty()) {

NOTIFICATION_NOTIFICATION_TASK task = model.createNOTIFICATION_NOTIFICATION_HEADER().createNewNOTIFICATION_TASKs();

task.setTASK_CAT_TYP(Category);

task.setTASK_CODEGRP(Group);

task.setTASK_CODE(Code);

task.setNOTIF_NO(wdContext.nodeNOTIFICATION_NOTIFICATION_HEADER().getNOTIFICATION_NOTIFICATION_HEADERElementAt(sel)

.getNOTIF_NO());

}

When i do a commit nothing happens.

Whats wrong?

Regards

Mathias

Former Member
0 Kudos

Hi Mathias,

If you are developing applications using MI 7.1 , then Bapi wrappers are required to communicate with the backend system.If you want to create anything in the client and if you want it to be reflected in the backend system , then a create bapi wrapper is a must .

Please use this link to know more about different kinds of bapi wrappers :

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0baafd6-52fa-2910-c6a8-fbb9399c...

After you are done with creating the bapi wrapper , just do a <model instance>.commit in your client.

Regards,

Madhu.

Former Member
0 Kudos

Hi Madhu,

dont´t think that you get me right. I know that i need a bapi wrapper to donwload data to the client and also wrappers to updtae the data in the backend. I´ve done already this stuff in the MI (7.1). Also my client is running and i can see the data. My problem now is to create a new entry in the database of the client. A model.commit is not the only thing. I think there is something missing to create the data in the client. But as i am an abap developer i have not so much experience in java developing. My goal is to create a new entry in the client. The DOE then does the synchroniziation. This should not be a problem anymore.

Regards

Mathias

Former Member
0 Kudos

Hi Matthias,

well, as we seer you have some experience in ABAP. Great!

There is one question: you need the GETLIST and GETDETAIl wrappers to get the data to the device. That you have done - okay - and it is working.

The question asked earlier is: have you done CREATE and MODIFY handers as well ind are these mapped and do they allow you to create new Entries? By the way: to avoid any conflicts, MAM does it a little different. They have a create DO sitting and all new entries are stored in this DO. While sync this data gets send to the backend and comes then later down in the original order or Notification.

Well, I hope this helps to solve some confusions and issues.

Regards,

Oliver

Former Member
0 Kudos

Hi Oliver,

yes i´ve included also a modify wrapper, but no a create wrapper because i don´t want to create a new notification on my client. I only want to add new child nodes, e.g. tasks or longtexts, in my client. The normal modify wrapper works properly, so i don´t thought that i have to add a wrapper to create a new instance.

Only child nodes have to be added in the client.

Regards,

Mathias

Former Member
0 Kudos

Hi,

in that case everything should be fine. The new DO is just to avoid any type on conflict. Lets say you have an order on the client and someone in the backend adds some info to the same order. If you add info in the same area and sync you will run into a clonflict. That is the reason why I just mentioned this additional DO.

Well, but if you have implmented a MODIFY wrapper and the fields are properly mnapped and changedable, then it should be fine. Well, what I am not so sure - is it modify cause the TOP structure as alreasdy there or is it create - cause this instance is a new instance to the top structure..... this I have to try for my own.

Are you able to modify any field on the client?

Regards,

Oliver

Former Member
0 Kudos

Hi Oliver,

any field, which i have declared to be modifiable, can be modified on the client and the modification is wroted back to the backend. Just as i mentioned: my only problem is to create a new child node of an exististing instance.

Regards,

Mathias

Former Member
0 Kudos

Hi,

then the answer is clear to me - you need to create wrapper, cause you want to crewate an Instance on the client. So now create is not only for TOP structures, but for child structures as well. Create a CREATE wrapper, add it and you should be fine.

Regards,

Oliver

Former Member
0 Kudos

Hi Oliver,

this is not the problem with a wrapper. It is a problem in the client. I do not know hoe i can add a new child instance to a head instance.

I tried to create a new head instance on the client. This works properly with following coding:

HEADER_NODE header = model.createHEADER_NODE();

header.set.....;

model.addToHEADER_NODE(header);

But how has he code to be to create a CHILD_NODE for this header?

ANy solutions would help.

Thanks,

Mathias

Former Member
0 Kudos

Solved the problem on my own. Thanks to all for help.

Mathias