Insert Record in WMSOrderTrans

Hi

What is the correct code for inserting record in WMSOrdertrans? because my insert code is not working?.. please see my code below

any sugestion and correction is very appriciated for my improvement thanks.

static void Job9(Args _args)

{

WMSOrderTrans wmsordertrans;

wmsordertrans.ttsbegin();

select forupdate wmsordertrans;

wmsordertrans.customer=

“EATI-000002” ;

wmsordertrans.insert();

wmsordertrans.ttscommit();

print “done” ;

pause

;

this is the error: Function WMSOrderTransType.insert has been incorrectly called.

Hi,

Your error message seems to come from the insert() method of WMSOrderTransType class, you should check the ExpeditionStatus value of the datas you want to insert in the WMSOrderTrans table, it must be WMSExpeditionStatus:: registred, Activated or started.

Let me know if I’m right

Regards,

Thomas

Why you are selecting a record for update in case of insert?

What is the purpose of creating a wmsOrderTrans record?

Have a look at \Data Dictionary\Tables\WMSTransport\Methods\createTransportLine which handles the insert situation.

Hi Kranthi

I have a new form for serialscand and create also a table looks like in wmsordertrans named wmsordertranstmp, in my button click i want to transfer all records in wmsordertranstmp to wmsordertrans please let me know if select forupdate isnot right for inserting records in wmsordertrans beacuse this is I only know to insert a record in AX table.

For any suggestion and clarification is highly appriciated this is big help for me as a newbee…

Hi Thomas thanks for your reply I will look for this thanks.

Hi

I tried this already but still same error occur.

static

Job8(Args _args)

{

EATIOrderTransTmp EATIOrderTransTmp;

WMSOrderTrans _InsertEntry;

ttsBegin ;

insert_recordset _InsertEntry

(customer,DeliveryPostalAddress)

select customer,

DeliveryPostalAddress

from EATIOrderTransTmp

where EATIOrderTransTmp.Deployed!= “ok” ;

ttsCommit

;

void

You don’t need to select the table for insert. Select the tempTable and loop through all the records for inserting into the required table.

wmsOrderTrans requires a wmsOrder table record. Before creating wmsOrderTrans, you should have a wmsOrder table record,

See in \Classes\SalesFormLetter_PickingList\createWMSOutputOrder how the WMS order is being created

and \Data Dictionary\Tables\WMSOrder\Methods\updateShipment how the ordertrans is being created

Hi Kranthi

Thanks to your reply I will look on this

best regards,

Raph.

Hi Thomas

Thanks for your info it works now. it must be activated first. thanks