web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to create Retail POS transactions from code

(0) ShareShare
ReportReport
Posted on by 70

Hi,

can someone please explain how to create Retails POS Transactions from X++ / C# code ?

-------------------

I'll explain the requirement in short as follows, which lead me to the above question :

1) We have a third party e-commerce website sending Customer order data via XML ( as order and order lines).

2) We also maintain a series of AX 2012 Retail POS stores.

3) The business needs to create sales orders from incoming XML and at the same time wants to create retail transactions in AX ( mainly RetailTransactionTable, RetailTransactionSalesTrans, RetailTransactionPaymentTrans etc..) for use by BI reporting.

I thought to Import the XML data to staging tables in AX and invoke the POS code that creates Retail transactions in Channel database ( we will have a separate dummy Channel and a pos register configured for this inside the head quarters to cater for this.). Then the standard P jobs will upload the transactions to AX Retail tables and from there onwards the AX code will handle posting the transactions.

As a result we get :

1) Records in Retail transactions tables for BI reporting

2) sales orders and postings required for the financials transactions.

------

I hope the above sounds clear and hope to hear from someone who has expertise on the above. Any comments on the above design is highly appreciated.

Kind Regards

Chamila

*This post is locked for comments

I have the same question (0)
  • Syed Shabab Mujtaba Profile Picture
    278 on at

    Hi,

    Yes, it is possible.

    you need to identify the header table and corresponding child tables where data will get created for e.g. sales, purchase, drawer open/close, void transactions and many other.

    there are maximum 7 to 8 tables getting effected as per the different transactions.

    At present I don't have AX2012 so can't give you table level information's.

  • Chamila Rodrigo Profile Picture
    70 on at

    Hi Syed,

    Thanks for the response. By this point of time I have done some research into the AX Retail / POS and have actually figured out the affected tables in AX ( which is the same as Channel databases).

    The information I'm looking for is more specific on how this can be achieved in higher level instructions.

    Appreciate your help anyways !!

    Kind Regards

  • Syed Shabab Mujtaba Profile Picture
    278 on at

    Hi Chamila,

    you can create the replication of those effected AX retail transaction tables as a customized staging tables. Now from XML to Staging DB table you need to write a code which will do data messaging and write Data to your customized tables same as it does in Standard AX-POS tables, from here you can point jobs to your customized tables which will bring data in standard AX-HO tables and rest will be as per standard process of AX.

  • Chamila Rodrigo Profile Picture
    70 on at

    duplicated text deleted

  • Chamila Rodrigo Profile Picture
    70 on at

    duplicated text deleted

  • Chamila Rodrigo Profile Picture
    70 on at

    Hi Syed,

    on your comment " Staging DB table you need to write a code which will do data messaging and write Data to your customized tables same as it does in Standard AX-POS tables"

    yeah, actually I was thinking the same design ( see the latter part of my problem description in the original post).

    What we want to avoid here is to 'write a whole new logic' to create records in POS tables , say for an example RetailTransactionTable, RetailTransactionSalesTrans, RetailTransactionPaymentTrans etc.

    The main reasons are:

    1) It would be time consuming to replicate the same logic in POS in AX code which is already existing ( considering the time for development and testing which is somewhat out of scope as the project is considered).

    2) There are some operations written in POS to split item 'discounts' into separate RetailTransactionsDiscountTrans , which is a mandatory requirement from the BI department to create their report logic. This is the most challenging step I see from 'recreating the logic' path.

    Otherwise I have already created few records in the main tables artificially and run the 'post statements' process in AX to check this as a proof of concept and it's working.

    I get where you are coming from but Instead of writing this already existing work, I want to leverage the current business logic already written in POS by Microsoft to achieve that operation.

    So basically this would mean

    1) creating a C# wrapper containing logic to mimic an actual POS transaction by calling existing methods in POS runtime.

    2) call this wrapper in AX , passing the staging table record to get our work done.

    3) use the standard data distribution jobs to upload the transactions to AX as if it is from a normal POS store.

    What I don't know is if there is a reliable way of 'mimicking' an actual POS sale by calling the methods in POS and if so what sort of path should I follow ?

    sorry for the wall of text but I think it would make more sense now.

    Kind Regards

  • Chamila Rodrigo Profile Picture
    70 on at

    sorry for the duplicated responses as the browser was frozen when I submitted the answer and it didn't look like posted. tried to delete them , but looks like they stick on.

  • Suggested answer
    Community Member Profile Picture
    on at

    I am not sure, if you would be able to call the standard logic of inserting the records in standard POS Tables, as system would be passing many of the information while inserting the records.

    Better you arrange to insert the related fields directly in AX HQ tables. This would be easier and faster. We have done in one of our project and seems working fine for BI reporting.

    Discounts also can be posted in AX standard table. That's not an issue. It is not mandatory that you replicate the entire logic in your system neither it is required.

    Alternatively, you may create separate tables as per your web format and arrange to join these tables for BI reporting.

    Let me still check the possibilities of inserting the records via standard code.

  • Chamila Rodrigo Profile Picture
    70 on at

    Hi Virat,

    Thanks for the feedback :). Yeah, after posting this questions I continued on the research and looks like hacking into the CRT is not the best way (specially when the calls are made within AX). And I think I had made an assumption that POS clients registers use the CRT as their back-end but it doesn't seem like the case.

    So I'm back on the second design, creating a new logic to insert records directly into the AX HQ tables. It's a very good news to know that I don't have to replicate the exact logic inside AX for POS functionality.

    If possible, could you please give me a rough guide with some code samples on how to split the discount lines on each retail transaction line. I think I can workout the other tables involved.

    thanks again and kind regards

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    HI Chamila,

    There is one interesting class that may help you - RetailTransactionService.

    It has bunch of static methods that accepts xml and creates customers, orders and so on.

    POS use this class to work with Customer Order or to do inventroy lookup.

    You probably can use it to create customer orders because it has all the logic and validation and can be called from external application.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans