Home > X++ stuffs > How to perform Inbound & Outbound without AIF setup

How to perform Inbound & Outbound without AIF setup

 

Hi……For sending/receiving any XML the Dynamics AIF Framework is used. There is an alternate way of doing the same operation without AIF setup. Please find the below examples for all the actions.

 

Example: Read  

static void VendorOutbound(Args _args)

{

    AxdVendTable                    axdVendTable;

    AifEntityKey                       entityKey       = new AifEntityKey();

    AifPropertyBag                   aifPropertyBag;

    VendTable                          vendTable;

    XmlDocument                     xmlDocument = new XmlDocument();

    ;

    select firstonly vendTable;

    entityKey.parmKeyDataMap(SysDictTable::getKeyData(vendTable));

    axdVendTable = AxdBase::newClassId(classnum(AxdVendTable));

    xmlDocument.loadXml(axdVendTable.read(entityKey, null, new  AifEndpointActionPolicyInfo(), new AifConstraintList(), aifPropertyBag));

    xmlDocument.save(‘c:\\AxdServiceOrder_Out1.xml’);

}

 

Example: Create 

static void createInboundProjectHourJournal(Args _args)

{

    AxdProjectHourJournal                axdProjetcHourJournal;

    XmlDocument                             xmlDocument;

    AifEndPointActionPolicyInfo         endPointAction = new AifEndPointActionPolicyInfo();

    AifConstraintList                         aifConstraint     = new AifConstraintList();

    AifDocumentXml                         xmlDoc;

    ;

 

    xmlDocument = new xmlDocument();

    xmlDocument.load("c:\\ProjectHourCreate.xml");

    axdProjetcHourJournal = AxdBase::newClassId(ClassNum(AxdProjectHourJournal));

    xmlDoc = xmlDocument.toString();

    axdProjetcHourJournal.create(xmlDoc, endPointAction, aifConstraint);

} 

 

Example: CreateList 

static void createListInboundServiceOrder_Item(Args _args)

{

    AxdServiceOrder                         axdServiceOrder;

    XmlDocument                             xmlDocument;

    AifEndPointActionPolicyInfo         endPointAction = new AifEndPointActionPolicyInfo();

    AifConstraintListCollection           aifConstraint     = new AifConstraintListCollection();

    AifDocumentXml                         xmlDoc;

    ;

 

    xmlDocument = new xmlDocument();

    xmlDocument.load("c:\\AxdServiceOrderCreate.xml");

    axdServiceOrder = AxdBase::newClassId(ClassNum(AxdServiceOrder));

    xmlDoc = xmlDocument.toString();

    axdServiceOrder.createlist(xmlDoc, endPointAction, aifConstraint);

}

 

Example: Update

static void updateInboundServiceOrder_Item(Args _args)

{

    AxdServiceOrder                      axdServiceOrder;

    XmlDocument                          xmlDocument;

    AifEndPointActionPolicyInfo     endPointAction = new AifEndPointActionPolicyInfo();

    AifConstraintListCollection       aifConstraintC  = new AifConstraintListCollection();

    AifConstraintList                     aifConstraint    = new AifConstraintList();

    AifDocumentXml                     xmlDoc;

    AifEntityKey                           entityKey;

    ;

 

    xmlDocument = new xmlDocument();

    xmlDocument.load("c:\\axdServiceOrderInventDim.xml");

    axdServiceOrder = AxdBase::newClassId(ClassNum(AxdServiceOrder));

    xmlDoc = xmlDocument.toString();

    axdServiceOrder.update(entityKey, xmlDoc, endPointAction, aifConstraint);

}

 

Example: Delete

static void deleteServiceOrder(Args _args)

{

    AxdServiceOrder                 axdServiceOrder;

    AifEntityKey                       entityKey        = new AifEntityKey();

    AifEntityKeyList                  entityKeyList   = new AifEntityKeyList();

    AifPropertyBag                    aifPropertyBag;

    SMAServiceOrderTable        sMAServiceOrderTable;

    XmlDocument                      xmlDocument = new XmlDocument();

    ;

 

    select firstonly sMAServiceOrderTable where sMAServiceOrderTable.ServiceOrderId == ‘0000083_SO’;

    entityKey.parmKeyDataMap(SysDictTable::getKeyData(sMAServiceOrderTable));

    axdServiceOrder = AxdBase::newClassId(classnum(axdServiceOrder));

    entityKeyList.addEntityKey(entityKey);

    axdServiceOrder.deleteList(entityKeyList , new AifEndpointActionPolicyInfo(), new AifConstraintListCollection());

}

 

Hope this piece of information was useful…Smile

 

Advertisements
Categories: X++ stuffs
  1. Santosh.
    December 10, 2008 at 4:12 am

    If you need to send PickingList information into XML document then you needs to select the uniqure record based on the criteria. So as to fetch the XML.Sample Example:[select * from X join Y where X. x1 == Y.y1;]

  2. Cristofer
    November 5, 2008 at 2:24 pm

    Hi,
    I\’m an italian university student, talking about inboud-outbound in AIF, I\’ve read you post about the argument and I tried the same, what if I want to export a Picking List in a xml document? with your code I see that the line:
     
    "select firstonly vendTable"
     
    uses a simple query, but in my case the query consist of 3 tables. If I use QyeryRun with the argument query "AxdPickingList", how can I later set the entityKey with the line code:
     
    "entityKey.parmkeyDatamap(SysDictTable::getkeyDasta(vendTable));"
     
    thanks,
     
    Cristoforo.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: