cancel
Showing results for 
Search instead for 
Did you mean: 

Qty Input field - need to initialize field

Former Member
0 Kudos

Hello,

I am using Bapi_Goodsmvt_Create to post material documents. When I display input view the first time the Qty input field is blank as desired. Once I have posted document the user has option to post another movement. With this option I initialize the all values for Bapi_Goodsmvt_Create.

Example:

wdContext.currentGoodsmvt_ItemElement().setEntry_Qnt(null);

When the input view is displayed it contains "0" rather then being blank.

Any ideas how to initialize the Qty field so that field is empty?

Rgds,

Keith L.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Keith,

Seems that the only way is to re-create node element with fresh model object (Bapi_Goodsmvt_Create) and then populate new model object with attributes of previous one (except Qty).

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Valery,

Sounds like you have seen this before... When I create a new node element the qty field picks up zero from the previous node element. How would I populate the new model object but skip the qty attribute?

Thanks,

Keith L.

Former Member
0 Kudos

How are you replacing element?

Should be something like:

node<Name>.invalidate();

node<Name>.bind( new <ModelObject>() );

VS

Former Member
0 Kudos

Valery,

Here is the code I am using. Values are set back to initial but qty field still contains "0".

wdContext.currentGoodsmvt_ItemElement().setMaterial(null);

wdContext.currentGoodsmvt_ItemElement().setEntry_Qnt(null);

wdContext.currentGoodsmvt_ItemElement().setEntry_Uom(null);

wdContext.currentGoodsmvt_ItemElement().setBatch(null);

wdContext.currentGoodsmvt_ItemElement().setCostcenter(null);

wdContext.currentGoodsmvt_ItemElement().setOrderid(null);

wdContext.currentGoodsmvt_ItemElement().setGl_Account(null);

wdContext.currentGoodsmvt_ItemElement().setPlant(null);

wdContext.currentGoodsmvt_ItemElement().setStge_Loc(null);

wdContext.currentGoodsmvt_ItemElement().setMove_Type(null);

wdContext.currentGoodsmvt_ItemElement().setGr_Rcpt(null);

wdContext.currentGoodsmvt_HeaderElement().setHeader_Txt(null);

// node<Name>.invalidate();

// node<Name>.bind( new <ModelObject>() );

wdContext.nodeZ_Mm_Wd_Bapi_Goodsmvt_Create_Input().invalidate();

Z_Mm_Wd_Bapi_Goodsmvt_Create_Input Input = new Z_Mm_Wd_Bapi_Goodsmvt_Create_Input();

// Set GM CODE

Input.setGoodsmvt_Code(new Bapi2017_Gm_Code());

IGoodsmvt_CodeNode Gm_Code_Node = wdContext.nodeGoodsmvt_Code();

IGoodsmvt_CodeElement Gm_Code_Element = Gm_Code_Node.createGoodsmvt_CodeElement(new Bapi2017_Gm_Code());

Gm_Code_Element.setGm_Code("03");

// Set default date for posting

Input.setGoodsmvt_Header(new Bapi2017_Gm_Head_01());

IGoodsmvt_HeaderNode Head_01_Node = wdContext.nodeGoodsmvt_Header();

IGoodsmvt_HeaderElement Head_01_Element = Head_01_Node.createGoodsmvt_HeaderElement(new Bapi2017_Gm_Head_01());

Head_01_Element.setPstng_Date(new Date(System.currentTimeMillis()));

// Create new node

Input.addGoodsmvt_Item(Item_Create);

Input.addGoodsmvt_Serialnumber(Serialnumber);

// Bind

wdContext.nodeZ_Mm_Wd_Bapi_Goodsmvt_Create_Input().bind(Input);

Former Member
0 Kudos

Valery,

You solved my problem. Thanks !! I have been looking at this one for many hours..

//// node<Name>.invalidate();

//// node<Name>.bind( new <ModelObject>() );

Final Solution

-


wdContext.nodeGoodsmvt_Item().invalidate();

Bapi2017_Gm_Item_Create Bapi2017_Gm_Item = new Bapi2017_Gm_Item_Create();

IGoodsmvt_ItemElement NewModelelement = wdContext.nodeGoodsmvt_Item().createGoodsmvt_ItemElement(Bapi2017_Gm_Item);

wdContext.nodeGoodsmvt_Item().addElement(NewModelelement);

// Bind to Model

wdContext.nodeGoodsmvt_Item().bind(NewModelelement);

Best Regards,

Keith L.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Keith,

where, You are writing

wdContext.currentGoodsmvt_ItemElement().setEntry_Qntnull);

statement.

are u writing this statement in event handler of 'another documnet' button.

if u did that

try this code in event handler of 'another documnet' button.

wdcontext.currentGoodsmvt_ItemElement().modelobject().setEntry_qnt(null);

Regards

Naidu