Posting wmsjournaltable

static void WMSJournalProd(Args _args)
{
    WMSJournalName      WMSJournalName;
    WMSJournalTable     WMSJournalTable;
    WMSJournalTrans     WMSJournalTrans;
    JournalTableData    JournalTableData;
    journalCheckPost    journalCheckPost;

    int                 logPointerLast;
    int                 lineBeforeCLRError;
    boolean             errors;
    ;
     logPointerLast = infolog.num(0);
     lineBeforeCLRError = infolog.line();

    //get journal name
    wmsJournalName = WMSJournalName::find("PrWE");
    //create new journal table record
    wmsJournalTable.initFromWMSJournalName(wmsJournalName);
    //wmsJournalTable.journalType = wmsJournalType::Production;
    wmsJournalTable.inventTransRefId = "PA389238";
    wmsJournalTable.inventTransType = inventTransType::Production;
    wmsJournalTable.inventDimId = InventDim::inventDimIdBlank();
    wmsJournalTable.insert();

    journalTableData = JournalTableData::newTable(wmsJournalTable);

    //create new journal line
    wmsJournalTrans.initFromWMSJournalTable(wmsJournalTable);
    wmsJournalTrans.transDate = systemdateget();
    //wmsJournalTrans.inventTransRefId = "PA389238";
    wmsJournalTrans.insert();

    //post the journal
    journalCheckPost = WMSJournalCheckPostReception::newTypeJournalTable(JournalCheckPostType::Post,wmsJournalTable);
    journalCheckPost.parmAutoBlock(true);  // den Wert 'vom System geblockt' auf 'TRUE', sonst Fehlermeldung
    journalCheckPost.run();
    errors = journalTableData.hasErrors();
    if(errors)
            error(infolog.text(logPointerLast+1));

}



Best regards

Michael




obewankenob wrote:

Hi,some help would be greatly appreciated on this.
30-Jan-09

Hi,

some help would be greatly appreciated on this.  Again, most of the info is
related to invent journals, but I cant seem to translate this through to the
warehouse journal.  I am having problems with posting the production journal.
 My code is as  follows:

//get journal name
wmsJournalName = WMSJournalName::find(wmsJournalNameId);
//create new journal table record
wmsJournalTable.initFromWMSJournalName(wmsJournalName);
wmsJournalTable.journalType = wmsJournalType::Production;
wmsJournalTable.inventTransRefId = myprodId;
wmsJournalTable.inventTransType = inventTransType::Production;
wmsJournalTable.insert();
//create new journal line
wmsJournalTrans.initFromWMSJournalTable(wmsJournalTable);
wmsJournalTrans.inventTransRefId = myprodId;
wmsJournalTrans.insert();
//assign pallet id
inventDim::find(wmsJournalTrans.inventDimId);
inventDim.wmsPalletId       = WMSPalletIdGenerate::nextPalletId();
wmsjournalTrans.update();
//post the journal
journalCheckPost = new journalCheckPost();
journalCheckPost.initParmDefault();
journalCheckPost.parmJournalId(wmsJournalTable.journalId);
journalCheckPost.parmJournalCheckPostType(journalCheckPOstType::Post);
journalCheckPost.parmJournalTableId(wmsJournalTable.TableId);
journalCheckPost.run();


I would really appreciate some advice on this peeps.

Thanks

"obewankenobe" wrote:

Previous Posts In This Thread:

On Tuesday, January 27, 2009 8:31 AM
obewankenob wrote:

WMSjournalCheckPost
Hi,

I am trying to post a production input journal using the WMSJournalCheckPost
class.  I originally hoped it would be similar in approach to the
InventJournalCheckPost class:

inventJournalCheckPOst::newPostJournal(inventJournalTable).run();

But when using the WMS version I only have wmsJournalCheckPost::main exposed.

Attempting to use main and give a new set of args returns errors saying my
arguments don't match:
wmsJournalCheckPost = wmsJournalCheckPost::main(new args());

I Have (well at least I think I have) created a new journal record and
assigned new lines to it for the production journal, it is now just a matter
of posting.

Can anyone help?

thanks.

On Tuesday, January 27, 2009 12:55 PM
obewankenob wrote:

As an update, my code is still issuing errors.
As an update, my code is still issuing errors.

Attempted to use JournalCheckPost to post the journal, but am having several
p[roblems:

1) creating lines in the journal - I have entered records in the
WMSJournalTrans table as well as use the wmsJournalCreateLines class and both
don't seem to be producing the goods.
2) Again, using JournalCheckPost, I am attempting to post the journal, but
am getting the following error: Buffer not specified for call
JournalStatic::findJournalTableId.

Any ideas?

"obewankenobe" wrote:

On Friday, January 30, 2009 7:27 AM
obewankenob wrote:

Hi,some help would be greatly appreciated on this.
Hi,

some help would be greatly appreciated on this.  Again, most of the info is
related to invent journals, but I cant seem to translate this through to the
warehouse journal.  I am having problems with posting the production journal.
 My code is as  follows:

//get journal name
wmsJournalName = WMSJournalName::find(wmsJournalNameId);
//create new journal table record
wmsJournalTable.initFromWMSJournalName(wmsJournalName);
wmsJournalTable.journalType = wmsJournalType::Production;
wmsJournalTable.inventTransRefId = myprodId;
wmsJournalTable.inventTransType = inventTransType::Production;
wmsJournalTable.insert();
//create new journal line
wmsJournalTrans.initFromWMSJournalTable(wmsJournalTable);
wmsJournalTrans.inventTransRefId = myprodId;
wmsJournalTrans.insert();
//assign pallet id
inventDim::find(wmsJournalTrans.inventDimId);
inventDim.wmsPalletId       = WMSPalletIdGenerate::nextPalletId();
wmsjournalTrans.update();
//post the journal
journalCheckPost = new journalCheckPost();
journalCheckPost.initParmDefault();
journalCheckPost.parmJournalId(wmsJournalTable.journalId);
journalCheckPost.parmJournalCheckPostType(journalCheckPOstType::Post);
journalCheckPost.parmJournalTableId(wmsJournalTable.TableId);
journalCheckPost.run();


I would really appreciate some advice on this peeps.

Thanks

"obewankenobe" wrote:

On Wednesday, June 10, 2009 2:43 PM
Fines wrote:

Hello obewankenobe,We had the same situation but with an item arrival journal,
Hello obewankenobe,

We had the same situation but with an item arrival journal, using this
sample code the post is working (Dynamics AX 2009 SP1):

static void testPostItemArrivalJournal(Args args)
{
WMSJournalCheckPost     _WMSJournalCheckPost;
wmsJournalTable _wmsJournalTable;
;

_WMSJournalCheckPost = new WMSJournalCheckPostReception();
_WMSJournalCheckPost.parmAutoBlock(false);
_WMSJournalCheckPost.parmShowInfoResult(true);
_WMSJournalCheckPost.parmJournalCheckPostType(journalCheckPostType::Post);
_WMSJournalCheckPost.parmJournalTableId(_wmsJournalTable.TableId);


_WMSJournalCheckPost.parmJournalId("0000121");

_WMSJournalCheckPost.run();
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.