Item Arrival Journal problem

Hi,

I have created a button on Quarantine Order screen and am creating an Item Arrival Journal on click of that button. I do not see any problem except the journal is not showing on Item Arrival Journal form.

The code to create the journal is as follows:

void clicked()
{
WMSJournalTable wmsJournalTable;
WMSJournalTrans wmsJournalTrans;
WMSJournalName wmsJournalName;

JournalTableData journalTableData;
JournalCheckPost journalCheckPost;

InventTrans inventTrans;

NumberSeq numberSeq;

str journalNum;
str journalName;

int lineNum = 1;
int logPointerLast;
int lineBeforeCLRError;

boolean errors;
;

journalName = WMSParameters::find().receptionJournalNameId;

numberSeq = NumberSeq::newGetNumFromCode(NumberSequenceReference::find(1523).NumberSequence);

journalNum = numberSeq.num();

wmsJournalName = WMSJournalName::find(journalName);

ttsbegin;

wmsJournalTable.initFromWMSJournalName(wmsJournalName);

wmsJournalTable.JournalNameId = journalName;
wmsJournalTable.JournalId = journalNum;
wmsJournalTable.journalType = WMSJournalType::Reception;
wmsJournalTable.insert();

journalTableData = JournalTableData::newTable(wmsJournalTable);

inventTrans = InventTrans::findTransId(inventQuarantineOrder.InventTransId);

wmsJournalTrans.clear();

wmsJournalTrans.initFromWMSJournalTable(wmsJournalTable);

wmsJournalTrans.JournalId = journalNum;
wmsJournalTrans.LineNum = lineNum;
wmsJournalTrans.TransDate = today();
wmsJournalTrans.ItemId = inventQuarantineOrder.ItemId;
wmsJournalTrans.Qty = inventQuarantineOrder.Qty * -1;
wmsJournalTrans.InventDimId = inventQuarantineOrder.InventDimId;
wmsJournalTrans.vendAccount = PurchTable::find(inventQuarantineOrder.TransRefId).InvoiceAccount;
wmsJournalTrans.inventTransType = inventQuarantineOrder.TransType;
wmsJournalTrans.inventTransRefId = inventQuarantineOrder.TransRefId;
wmsJournalTrans.inventTransId = inventQuarantineOrder.InventTransIdRef;
wmsJournalTrans.checkPickingLocation = NoYes::No;
wmsJournalTrans.createQuarantineOrder = NoYes::No;
wmsJournalTrans.inventDimId = inventQuarantineOrder.InventDimId;
wmsJournalTrans.insert();

journalCheckPost = WMSJournalCheckPostReception::newTypeJournalTable(JournalCheckPostType::Post,wmsJournalTable);
journalCheckPost.parmAutoBlock(true);
journalCheckPost.run();

errors = journalTableData.hasErrors();

if(errors)
error(infolog.text(logPointerLast+1));

ttscommit;

info(strfmt(“Journal # %1 created”,journalNum));
}

Will appreciate if any one of you could let me know what is wrong in this code which is preventing the record from being display on form.

Thanks in advance

Haroon

InventDimId in WMSJournalTable need to be updated in order to show this in the form.

wmsJournalTable.inventDimId = InventDim::inventDimIdBlank(); (fill with blank dimensions)

Thanks for your help. It worked.

Haroon

Hi Haroon,

I am testing with your code to fulfill one of my requirement. but I am not getting, where you initialized “inventQuarantineOrder”

object in your code. and Is it the reference to the InventQuarantineOrder table.

please update me with this initialization part.

Thank you.

You do not need to initialize the object. The code is running on button click on ‘Quarantine Order’ form. You will have to select a record and then click the button.