cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Order Header creation webdynpro

d_fautini
Participant
0 Kudos

Hi Mobile friends,

I´m making test apps. for laptop devices with Mobile 7.1. Actualy I'm playing with ORDERHEADER Data Object (the same referenced at HELP.SAP MOBILE). I can display all the records in a view but, when I'm creating an order and sync to the DOE it's display me the error: "Field symbol has not yet been assigned"

The create method is:

ORDERHEADER_ORDERHEADER orderItem = model.createORDERHEADER_ORDERHEADER();

orderItem.setDATE(wdContext.currentFormNodeElement().getDATE());

orderItem.setORDER_ID(wdContext.currentFormNodeElement().getORDER_ID());

orderItem.setSTATUS(wdContext.currentFormNodeElement().getSTATUS());

orderItem.setTIME(new Time(System.currentTimeMillis()));

orderItem.setUSER("XXXXX");

model.addToORDERHEADER_ORDERHEADERs(orderItem);

model.commit();

If you look the code, I'm using all the setters created by the Dev Studio (date, orderId, status, time, user).

The new record is succefully registrered on my local database.

I'm missing something??

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi,

ORDERHEADER_ORDERHEADER orderItem = model.createORDERHEADER_ORDERHEADER();

=> this is perfectly ok

orderItem.setDATE(wdContext.currentFormNodeElement().getDATE());=> instead of saying currentForm.. try to use the method starting with ORDERHEADER

orderItem.setORDER_ID(wdContext.currentFormNodeElement().getORDER_ID()); same like above

orderItem.setSTATUS(wdContext.currentFormNodeElement().getSTATUS()); same like above

orderItem.setTIME(new Time(System.currentTimeMillis())); this seems ok

orderItem.setUSER("XXXXX"); ok

model.addToORDERHEADER_ORDERHEADERs(orderItem); ok

model.commit(); ok

also you need not use the above setter method but instead you can just use these three lines which you have done earlier :becoz the order header has all the changes that you have made.

ORDERHEADER_ORDERHEADER orderItem = model.createORDERHEADER_ORDERHEADER();

model.addToORDERHEADER_ORDERHEADERs(orderItem);

model.commit();

Thanks and Regards,

Narayani

d_fautini
Participant
0 Kudos

Hi Narayani,

I don't understand the comment: "instead of saying currentForm.. try to use the method starting with ORDERHEADER"

Forget the currentForm Node. If I set:

ORDERHEADER_ORDERHEADER orderItem = model.createORDERHEADER_ORDERHEADER();

orderItem.setDATE( a Date);

orderItem.setORDER_ID(an Id);

orderItem.setSTATUS(a Status);

orderItem.setTIME(new Time(System.currentTimeMillis()));

orderItem.setUSER(a user);

model.addToORDERHEADER_ORDERHEADERs(orderItem);

model.commit();

What's wrong with the code? I miss something?

Regards,

David Faustini

0 Kudos

Hi David,

Your code below is absolutely ok.

ORDERHEADER_ORDERHEADER orderItem = model.createORDERHEADER_ORDERHEADER();

orderItem.setDATE( a Date);

orderItem.setORDER_ID(an Id);

orderItem.setSTATUS(a Status);

orderItem.setTIME(new Time(System.currentTimeMillis()));

orderItem.setUSER(a user);

model.addToORDERHEADER_ORDERHEADERs(orderItem);

model.commit();

Only that all the rows will have same data.

Two things you can check if :

1) you have added a create bapi wrapper in the Backend adapter

2) You have set the lead Selection

Both the code that you have written should work.I have tried both.

But the better way :

ORDER_ROOT root = model.createORDER_ROOT();

model.addToORDER_ROOTs(root);

Have a save button for : reason incase you need to edit the row before saving.

model.commit();

Thanks and Regards,

Narayani

d_fautini
Participant
0 Kudos

Hi Narayani,

I've detected the problem. The node hierarchy is:

-orderheader

--customer

--equipment

I don't know why need to create the tree nodes at same time before the commit method.

Regards,

0 Kudos

Hi,

If you have mapped the child nodes separately you will have to create and bind them separately,

but if you have chosen them as part of the parent then it is not required.

Thanks and Regards,

Narayani

d_fautini
Participant
0 Kudos

Hi Narayani,

The problem was solved. The cause was the wrappers.

Thanks a lot.

Regards,

David Faustini

Answers (0)