Tuesday, February 5, 2019

Customer transaction automatic settlement for specific customer groups only

Hi Friends,
Recently I come to the requirement of my company
where I have to automatic settle the customer transaction for
the specific group of customer, So here is the customization details,
May be it help to some one to understand the logic behind it.

Here basically we have to update settleVoucher (For journal in LedgerJournalTrans table and For Sales order invoice SalesTable) field with OpenTrasact (For Auto settlement) or None based on customer user group, All other posting done based on this field, Here are the class and table method used
LedgerJournalEngine (Class) - InitFromCustTable
LedgerJournalEngine_CustPayment (Class) - InitFromCustTable
SalesTableType (Class) - InitValue
LedgerJournalTrans (Table) - InitFromCustTable
LedgerJournalTrans (Table) - setSettleVoucher

Best Regards
B K Sharma | Dynamics AX Technical Architect |  My blog  | LinkedIn
Phone : 9950068421
Udaipur, India

Sunday, September 17, 2017

Microsoft Dynamics Ax 2012: Difference between modifiedField and modifiedFieldValue methods

Problem description
In a project for a customer I had an issue that some business logic didn’t work. During an import of related data we found out that everything in test and debugger worked fine, but it didn’t work in batch.
Solution
To solve this we moved the code from the modifiedFieldValue method to the modifiedField method and this solved the issue.
So this means that the code in the modifiedFieldValue isn’t executed in batch (CIL) which is different from the modifiedField method. This method is executed on the client, server and the batch.
I couldn’t find documentation on the internet about this. So be aware that the client execution of code can differ from the batch.

Reference : http://www.van-veldhuizen.eu/blog/2012/06/08/microsoft-dynamics-ax-2012-difference-between-modifiedfield-and-modifiedfieldvalue-methods/

Thanks

Thursday, September 14, 2017

Custom workflow in ax 2012

Dear Friends,

I have come to know a very good blog for a custom workflow in ax 2012, you can go to the blog reference and check

http://www.axpulse.com/dynamics-ax-2012-custom-workflow/

Thanks
B K Sharma

Monday, September 11, 2017

Upload excel data to Ax Table

Hi,

To upload excel data to ax table we use following x++ code

static void UploadExceldatatoTable(Args _args)
{
   SysExcelRange                       sysExcelRange;
   #AviFiles
   #define.Star('*')
   #define.ExcelDataRange("A1:IV65536")
   SysOperationProgress                _progressBar = new SysOperationProgress();
   int                                 record;
   DialogField                         dialogPath;
   Dialog                              dialog;
   Filename                            filename;
   CommaIO                             inFile;
   SysExcelApplication                 xlsApplication;
   SysExcelWorkBooks                   xlsWorkBookCollection;
   SysExcelWorksheets                  xlsWorkSheetCollection;
   SysExcelWorksheet                   xlsWorkSheet;
   SysExcelCells                       Cells;
   SysExcelCell                        RCell;
   int                                 nRow; //,i;
   NoYes                               _NoYes;
   TimeOfDay                           time;
   S3_FrequencyIdentifier                      _frequency;
   S3_EquipmentTypes                           eqptTypeMaster;
   WCL_bk_EqptTaskLastInspectionDate           _eqptTaskLastInspDate;
   WCL_SS_RouteEquipment                       _RouteEquipment;
   S3_EquipmentTable                           _eqptTable;
   WCL_InspectionCheckListHeader               _inspChkLstHeader;
   WCL_InspectionCheckListLines                _inspChkLstLine;
   #Excel
   // convert into str from excel cell value
   str COMVariant2Str(COMVariant _cv, int _decimals = 0, int _characters = 0, int _separator1 = 0, int _separator2 = 0)
   {
       switch (_cv.variantType())
       {
           case (COMVariantType::VT_BSTR) :
           return _cv.bStr();
           case (COMVariantType::VT_R4):
           return num2str(_cv.float(),_characters,_decimals,_separator1,_separator2);
           case (COMVariantType::VT_R8):
           return num2str(_cv.double(),_characters,_decimals,_separator1,_separator2);
           case (COMVariantType::VT_DECIMAL):
           return num2str(_cv.decimal(),_characters,_decimals,_separator1,_separator2);
           case (COMVariantType::VT_DATE):
           return date2str(_cv.date(),123,2,1,2,1,4);
           case (COMVariantType::VT_EMPTY):
           return "";
           default:
           throw error(strfmt("@SYS26908", _cv.variantType()));
       }
   return "";
   }
   ;
   dialog = new Dialog('Equipment task Last inspection date import');
   dialogPath = dialog.addField(extendedTypeStr(Filenameopen), 'File Name');
   dialog.run();
   if (dialog.run())
   {
       filename = (dialogPath.value());
   }
   inFile = new CommaIO (filename, 'R');
   if (!inFile || infile.status() != IO_Status::Ok )
   {
       throw error (strfmt("@SYS19312",filename));
   }
   try
   {
       xlsApplication          = SysExcelApplication::construct();
       xlsWorkBookCollection   = xlsApplication.workbooks();
       xlsWorkBookCollection.open(filename);
       xlsWorkSheetCollection  = xlsApplication.worksheets();
       xlsWorkSheet            = xlsWorkSheetCollection.itemFromNum(1);
       Cells                   = xlsWorkSheet.Cells();
       nRow = 2;
       RCell = Cells.Item(nRow, 1);
       sysExcelRange           = xlsWorkSheet.cells().range("A1:IV65536");
       sysExcelRange           = sysExcelRange.find(#Star, null, #xlFormulas, #xlWhole, #xlByRows, #xlPrevious);
       if (sysExcelRange)
       {
           record = sysExcelRange.row();
       }
       _progressBar.setCaption("Last inspection date uploading. . .");
       _progressBar.setAnimation(#AviUpdate);
       _progressBar.setTotal(record);
       ttsBegin;
       while (COMVariant2Str(RCell.value()) != "")
       {
           _progressBar.setText(strfmt("Step %1", nRow));
           _progressBar.setCount(nRow, 1);
           if(WCL_SS_RouteMaster::find(strLTrim(strRTrim(COMVariant2Str(Cells.item(nRow,1).value())))))
           {
               while select _RouteEquipment join _eqptTable join _inspChkLstHeader join _inspChkLstLine
                 where _RouteEquipment.EquipmentId           == _eqptTable.S3_EquipmentId &&
                       _eqptTable.EquipmentType              == _inspChkLstHeader.EquipmentType &&
                       _eqptTable.EquipmentSubType           == _inspChkLstHeader.EquipmentSubType &&
                       _inspChkLstHeader.CheckListHeaderID   == _inspChkLstLine.CheckListHeaderID &&
                       _RouteEquipment.RouteID               == strLTrim(strRTrim(COMVariant2Str(Cells.item(nRow,1).value()))) &&
                       _inspChkLstLine.Frequency             == _frequency
               {
                   if(!WCL_bk_EqptTaskLastInspectionDate::find(_RouteEquipment.EquipmentId, _inspChkLstLine.TaskCode))
                   {
                       _eqptTaskLastInspDate.EquipmentId           = _RouteEquipment.EquipmentId;
                       _eqptTaskLastInspDate.TaskCode              = _inspChkLstLine.TaskCode;
                       _eqptTaskLastInspDate.LastInspectionDate    = str2Date(strLTrim(strRTrim(COMVariant2Str(Cells.item(nRow,3).value()))),123);
                       _eqptTaskLastInspDate.insert();
                   }
               }
           }
           else
           {
               error(strFmt("%1 - Route not found in the master",strLTrim(strRTrim(COMVariant2Str(Cells.item(nRow,1).value())))));
           }
           nRow++;
           RCell = Cells.Item(nRow, 1);
       }
       ttsCommit;
       info("Equipment Task last inspection date uploaded successfully");
   }
   catch
   {
       error('Error!');
       xlsApplication.quit ();
       xlsApplication.finalize ();
       return;
   }
}

Thanks
B K Sharma

Print/Insert Image (.jpeg) object in SSRS Report (AX 2012 R3) attach via Document handling

Hi Friends,
I am presenting a process to print/Insert the Ax document handling attached image/file in a SSRS report in ax 2012 r3. Below example taken from purchase order attached file in document handling.

1. When we open purchase order list page than we can open document handling form from attachment menu item where we can add any type of file to this form, here we are attaching a image file.
2. After attachment of file now we want to print this image to our SSRS report, so basic method we are using to complete this task is to use image URL as image source in ssrs report. To get the image url we will use this query from DocuRef table and join it to the PurchTable
- This query is used in ProcessReport method of RDP class of SSRS report.

select docuRef where docuRef.RefCompanyId == PurchTable::find(vendInvoiceJour.PurchId).dataAreaId &&
docuRef.RefRecId == PurchTable::find("TestPO0001").RecId && 
docuRef.RefTableId == PurchTable::find("TestPO0001").TableId;

this table method will provide us the file url
DocuRef.CompleteFikleName() - after getting file name we will save it to our temp table of ssrs report.

3. Now open SSRS report design in visual studio and add an image in report body or footer as per our requirement and set the Image source property to External and add the dataset field (File path) here in expression (fx) and deploy the report, now it will display in your report.
after set this property just build and deploy report and we will get the attached image to the ssrs report.

Regards
B K Sharma

Thursday, April 9, 2015

Debug Batch job in Ax 2012

Debug Batch job in Ax 2012

Like services that you create in Microsoft Dynamics AX, batch jobs are compiled into CIL and run on the server. Therefore, you must use Visual Studio to debug batch jobs.
Batch jobs are used when you have code that you want to schedule to run at a specific time or in regular intervals. One example is if you have code that performs lots of processing that you want to run when the system is not heavily used. Code that runs as a batch job must be contained in a class that extends the RunBaseBatch class. For more information.
The process for debugging a batch job is similar to debugging a service. When you create your class in X++, you can use the standard Microsoft Dynamics AX debugger. To debug a class that is running as a batch job, you then use the Visual Studio debugger.
The high-level process for debugging a batch job from Visual Studio is as follows:
  1. Open Visual Studio. In Application Explorer, locate the batch job class and open the source code.
  2. Set a breakpoint in the code.
  3. Attach the Visual Studio debugger to the Microsoft Dynamics AX server process (Ax32Serv.exe).
  4. In Microsoft Dynamics AX, schedule the batch job that calls your class to run.
  5. When code execution hits the breakpoint that you set, the context switches to Visual Studio and you can continue to step through the code.

Thanks
B K

Thursday, November 6, 2014

Send report pdf as email in ax 2009 using batch job configuration

Hi friends,

if you want to send your report pdf as email to user through batch job than below code important for you.

First we have make a class for batch job configuration.

After it we have to save the file to server in a share folder using below method.


Static void SaveReport(str fileName)
{
    fileName = @'\\myPc\\testfile.pdf'; // it should be in UNC format
    Args                args = new Args("PMExceptionReport");
    reportRun reportRun = new reportRun(args);
    ;

    reportRun.query().interactive(False);
    reportRun.report().interactive(False);
    reportRun.setTarget(printMedium::File);
    reportRun.printJobSettings().setTarget(PrintMedium::File);
    reportRun.printJobSettings().preferredTarget(PrintMedium::File);
    reportRun.printJobSettings().format(PrintFormat::PDF);

    reportRun.printJobSettings().warnIfFileExists(False);
    reportRun.printJobSettings().suppressScalingMessage(True);
    reportRun.printJobSettings().packPrintJobSettings();
    reportRun.printJobSettings().fileName(filename);
    reportRun.run();
    //info("Done");
}

if our file is saved to shared folder than we can send it as mail attachment and for it code is listed below

static void SendMail(str email, str filename)
{
    InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
    SysMailer   mailer;
    SysEmailParameters parameters;
    ;

    CodeAccessPermission::revertAssert();
    permission.assert();
    mailer = new SysMailer();
    parameters = SysEmailParameters::find();

    if (parameters.SMTPRelayServerName)
    {
        mailer.SMTPRelayServer(parameters.SMTPRelayServerName, parameters.SMTPPortNumber, parameters.SMTPUserName, SysEmailParameters::password(), parameters.NTLM);
    }
    else
    {
        mailer.SMTPRelayServer(parameters.SMTPServerIPAddress, parameters.SMTPPortNumber, parameters.SMTPUserName, SysEmailParameters::password(), parameters.NTLM);
    }

    mailer.fromAddress('donotreply@wondercement.com');
    mailer.tos().appendAddress(email);

    mailer.htmlBody('Please find attached exception report. <Br>\n do not reply this mail.');
    mailer.subject('Exception Report');
    mailer.attachments().add(filename);
    mailer.sendMail();

    CodeAccessPermission::revertAssert();
}


Printing reports from a server can be more efficient than printing from a client. When printing a report from a client, Microsoft Dynamics AX must upload details about page size, report dimensions, fonts, and string sizes to the client before the report can print. When printing a report from a server, these details are readily available. No extra processing is required.
To enable users to print reports from the server, you must configure the AOS server and each client.
Complete the following steps on the AOS server:
  1. Open the Server Configuration Utility (Start > All Programs > Microsoft Dynamics AX).
  2. Select the Allow clients to connect to printers on this server option.
  3. Click OK.
Complete the following steps on each client computer:
  1. Open the Client Configuration Utility (Start > All Programs > Microsoft Dynamics AX).
  2. Click the Connection tab.
  3. Select Connect to printers on the server.
  4. Click OK.

Thanks
B K 

Tuesday, September 2, 2014

Print PDF file from AX

Print PDF file from AX 

This job illustrates how we can print an external PDF file to a printer chosen in AX through X++ code. Here a code sample (X++ job) to do this.


static void theAxapta_pdfprint(Args _args)
{ 
    PrintJobSettings    printJobSettings = new PrintJobSettings(); 
    Dialog              dialog = new Dialog(); 
    DialogField         dialogFileName; 
    str                 adobeExe; 
    str                 adobeParm; 
;
    dialogFilename  = dialog.addField(typeid(FilenameOpen));

    if (dialog.run()) 
    {     
        printJobSettings.printerSettings('SysPrintForm');     
        adobeExe = WinAPI::findExecutable(dialogFileName.value());
       
        adobeParm = strFmt(' /t "%1" "%2" "%3" "%4"',
                           dialogFileName.value(),
                           printJobSettings.printerPrinterName(),
                           printJobSettings.printerDriverName(),
                           printJobSettings.printerPortName());

        winAPI::shellExecute(adobeExe,  adobeParm); 
    }
}

Wednesday, August 20, 2014

How to create new Number Sequence in Ax 2009

Steps to Create Number Sequence in Ax 2009

Step - 1
Create an EDT just like i have created 'ReasonCode'

Step 2
Go to the Module Table : SalesParameters
Create a method:
public client server static NumberSequenceReference numRefReasonCode()
{;
    return NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(ReasonCode)));

}

Step 3
Go to the module Class : NumberSeqReference_Customer
Select the LoadModule Method:
//Start
    numRef.DataTypeId                 = typeId2ExtendedTypeId(typeid(ReasonCode));
    numRef.ReferenceHelp            = literalstr("Reason Code");
    numRef.WizardContinuous         = False;
    numRef.WizardManual             = NoYes::No;
    numRef.WizardAllowChangeDown    = NoYes::No;
    numRef.WizardAllowChangeUp      = NoYes::No;
    numRef.WizardHighest            = 999999;
    numRef.SortField                = 418;
    this.create(numRef);  
//End

Step 4
Go to the Table :  Override initvalue method just like below
public void initValue()
{
    NumberSeq       NumSeq;
    ;
    super();
    NumSeq =  NumberSeq::newGetNum(SalesParameters::numRefReasonCode(),true);
    this.ReasonCode = NumSeq.num();
}

Step 5
Go to Module Parameter Form and select Number Sequence Tab, There is a line Created for Reason Code which is selected in Given Image


Step 6
Now Go To maint Table form of Number Sequence and Create a line for number sequence and select it for Reason Code as gshown in below image

Step 7
Now Your number sequence setting is up to date and you can create record in form as shown in below image

Thats All!!



Thanks






Wednesday, July 9, 2014

Deletion of Invoiced Orders and Order Lines in AX ...

Armanino Dynamics Blog: Deletion of Invoiced Orders and Order Lines in AX ...: In AX, it is possible to delete an invoiced Purchase Order or Sales Order. You can also just delete an invoiced order line. Further, you can...

Thursday, June 26, 2014

Open Axapta form in Maximize mode

If we want to open any Ax form in Maximize mode than we have to create a Run method of form as Below

public void run()
{
    #WinApi
    ;
    super();
    WinApi::showWindow(this.hWnd(), #SW_SHOWMAXIMIZED);
}


Thanks

Sunday, August 4, 2013

Microsoft Dynamics AX 2009 - Sytem architecture


Microsoft Dynamics AX 2009 - Sytem architecture
Understanding the internal architecture of Microsoft Dynamics AX can help you make decisions when planning, customizing, and deploying a system. This topic provides a high-level overview of the system architecture of Microsoft Dynamics AX. 

The diagram below provides a high-level overview of Microsoft Dynamics AX system architecture. This diagram does not depict the system topology or physical infrastructure required for the deployment. 

Your infrastructure can consist of many Microsoft Dynamics AX components on a single physical server or on multiple physical servers. For considerations in planning your deployment infrastructure, see Planning system topology

For details on Microsoft Dynamics AX components, see Component architecture. For up-to-date hardware and software requirements for Microsoft Dynamics AX, see the system requirements Web page


Dd362112.System_architecture(en-US,AX.50).gif



All users accessing Microsoft Dynamics AX require Windows authentication and mapping of their Windows IDs to the Microsoft Dynamics AX system. Authenticated Windows users are not required to log in separately to the Microsoft Dynamics AX application. 

Access to data, business functionality, and presentation elements (forms, menus, fields and reports) is governed by Microsoft Dynamics AX security. Anonymous Web users can access Enterprise Portal with limited functionality.
A client provides an interface to Microsoft Dynamics AX data and functionality. An external application integrates programmatically with Microsoft Dynamics AX to consume functionality or exchange data. 
  • The Microsoft Dynamics AX Windows client is a native 32-bit Windows program that provides a rich user interface.
  • Supported Web browsers give access to Microsoft Dynamics AX functionality and data through Enterprise Portal.
  • External applications interact with Microsoft Dynamics AX via the Application Integration Framework (AIF). The AIF is an extensible framework that enables XML-based enterprise application integration (EAI), business-to-business (B2B), and service-oriented architecture (SOA) scenarios.
It is possible for an external application or a custom client to interact with Microsoft Dynamics AX using the .NET Business Connector, another integration component. However, using the AIF is the recommended approach for integration with the Microsoft Dynamics AX application.
If you use AIF Web services or you consume external Web services, we recommend that you deploy Windows SDK for Windows Server 2008 and .NET Framework 3.5. The SDK includes additional configuration tools that simplify advanced configuration and reduce the risk of manual configuration errors. To download the SDK, visit the Microsoft Download Center.
The application tier consists of one or more of the following Microsoft Dynamics AX components or computer roles. 

Windows Active Directory Domain Controller

Microsoft Dynamics AX requires Windows authentication and uses Windows integrated security. 
An Active Directory domain controller is a prerequisite for installing Microsoft Dynamics AX.

Application Object Server

The Application Object Server (AOS) controls communication among Microsoft Dynamics AX clients, databases, and applications. You can deploy the AOS on a single computer or create a load-balanced cluster of multiple AOS servers. 

The AOS is a Windows service and requires a Windows Server operating system. For up-to-date hardware and software requirements for Microsoft Dynamics AX, see the system requirements Web page.

Enterprise Portal

Enterprise Portal and its applications allow you to interact with Microsoft Dynamics AX from a Web browser. Enterprise Portal enables internal users (employees) and external users (vendors, customers, business partners) to access data and functionality through a highly customizable, role-based Web portal. 

You can also create Internet-facing public sites with restricted functionality for anonymous users. Enterprise Portal requires ASP.NET, Microsoft Windows SharePoint Services or Microsoft Office SharePoint Server, and Internet Information Services (IIS).

Reporting Services

Microsoft SQL Server Reporting Services is a solution that enables users to create and view both traditional, paper-based reports and interactive, Web-based reports. 

To integrate Microsoft Dynamics AX and Reporting Services, you must install the reporting extensions on a server running Reporting Services. 
After you install the reporting extensions, you will be able to deploy Microsoft Dynamics AX reports to Reporting Services.

Analysis Services

Microsoft SQL Server Analysis Services is a server-based solution that provides online analytical processing (OLAP) functionality. OLAP reports help users analyze business data and identify trends that they might not otherwise discover when viewing traditional reports. 
To integrate Microsoft Dynamics AX and Analysis Services, you must install the analysis extensions on a server running Analysis Services. 
When you install the analysis extensions, a default OLAP database and cubes are deployed to Analysis Services.

Workflow

Microsoft Dynamics AX 2009 supports workflow processes, such as the approval of purchase requisitions. The workflow infrastructure consists of AOS and IIS workflow runtimes. The Microsoft Dynamics AX workflow component is automatically installed on the AOS and the Microsoft Dynamics AX Windows client computers during installation. Workflow requires Internet Information Services (IIS) and the Windows Workflow Foundation, which is part of .NET Framework 3.5.

Application Integration Framework (AIF)

The Application Integration Framework provides a programming model, tools and infrastructure support for XML-based integration of application functionality and data with Microsoft Dynamics AX 2009. AIF enables Microsoft Dynamics AX to expose its functionality via WCF-based services and documents. AIF also enables Microsoft Dynamics AX to consume functionality exposed by external applications as Web services. 
You will need to deploy additional software depending on the transport adapter you are using: 
  • AIF Web services requires IIS.
  • The file system adapter relies on the Windows file system (a folder or a network share).
  • BizTalk Server requires the BizTalk adapter for Microsoft Dynamics AX to be installed on the BizTalk server host.
  • The MSMQ adapter requires Microsoft Message Queuing (MSMQ).
The following common roles are also found in infrastructures that are running Microsoft Dynamics AX. 

Microsoft Office Project Server 2007 integration

The Microsoft Dynamics AX synchronization service synchronizes project data in Microsoft Dynamics AX with data in Microsoft Office Project Server 2007. To use this functionality, you must install both the synchronization service and the Microsoft Dynamics AX synchronization proxy. For more information about Project Server 2007 integration, see Synchronization service and synchronization proxy architecture.

Messaging server

A messaging server enables the sending and receiving of e-mail messages and instant messages, and can be used to send alerts to users. Microsoft Dynamics AX requires a messaging server that supports SMTP.

Firewall

A firewall is part of a security system that helps protect a local network from external threats.
The data tier consists of one or more of the following Microsoft Dynamics AX components or computer roles. 

Relational database

A Microsoft Dynamics AX database stores your Microsoft Dynamics AX data on Microsoft SQL Server or Oracle Database Server installation. Windows SharePoint Services requires a SQL Server database, as does SQL Reporting Services. Support for OLAP cubes requires a SQL Server Analysis Services database. 
Microsoft SQL Server is required for Analysis Services and Reporting Services regardless of the database server that is used for the Microsoft Dynamics AX transactional database.

Application File Server

An application file server manages the files containing Microsoft Dynamics AX application objects and business logic. An AOS instance accesses this folder or file share to load the required application objects for execution. We recommend a Windows Server operating system, instead of the client operation systems such as Windows Vista or Windows 7, for the application file server. For up-to-date hardware and software requirements for Microsoft Dynamics AX, see thesystem requirements Web page.

Friday, July 26, 2013

Basics of Fetch Method in Ax Report

It is my first Blog...expecting it will help freshers..

// #. A Fetch Method Override for A Date Range Data Retrial from Cust Trans Table as on ...
public boolean fetch()
{
    // 0. Declare Variables
    QueryRun qr;
    QueryBuildDatasource QueryBuildDatasource1;
    QueryBuildRange rangeTransDate;
    Boolean ret;
    CustTable custTable;
    CustTrans custTrans;

    // 1. A QueryRun object called qr is initialized with the active query of the report,
    qr = new QueryRun(element);

    // 2. Get DAtaSource from current element query
    QueryBuildDatasource1 = element.query().dataSourceTable(tablenum(CustTrans));

    // 3. A range for the customer transaction date field is added to Datasource
    rangeTransDate = QueryBuildDatasource1.addRange(fieldnum(CustTrans, transDate));

    // 4. Actusl Date Range Value is added to qr
    rangeTransDate.value(queryRange(systemdateGet() - daysBack, systemDateGet()));

    // 5. The range is locked, so the user cannot change it.
    rangeTransDate.status(RangeStatus::LOCKED);

    // 6. The transaction date range is added to the caption of the report.
    element.design().caption(strfmt("%1, %2", element.design().caption(), rangeTransDate.value()));

    // 7. At this point, the query is looped. The standard loop of the query and the printout of the
    // record is what the super() call in fetch() handles. Before the query is looped, there is a
    // check to see whether the dialogs for the query and the report are called.These are the two dialogs which are wrapped by RunBaseReportStd
    if (qr.prompt() && element.prompt())
    {
        // 8. query is looped
        while (qr.next())
        {
            // 9. Within each loop, the tables CustTable and CustTrans are initialized.
            // If no records are found, the loop breaks and the report ends.
            // If a data source has changed, a new record is found
            // and the record is printed using the send() method.
            custTable = qr.get(tableNum(CustTable));
            custTrans = qr.get(tableNum(CustTrans));

            if (!custTable)
            {
                ret = false;
                break;
            }
            // 10. Note the second parameter in the send() method.
            // The second parameter defines the level of the record. CustTable is on the first level of the query and
            // CustTrans is on the second level. This is important since, if it is not set correctly,
            // auto sums will not be printed.
            if (qr.changed(tableNum(custTable)))
            {
                 element.send(custTable, 1);
            }
            if (qr.changed(tableNum(custTrans)))
            {
                 element.send(custTrans, 2);
            }
        }
    ret = true;
    }
    else
        ret = false;
    return ret;
}
// 11.     ------Tactics of reports---
// In the fetch example, the query of the report was looped. The case could also be looping
// a WHILE statement, SELECT statement, or a combination of both. For each record
// looped in the query, you might want to select a record from a table which is not part of
// the query, or even build a temporary table to be printed. For each record to be printed,
// all you have to do is call the send() method
Thanks

Customer transaction automatic settlement for specific customer groups only

Hi Friends, Recently I come to the requirement of my company where I have to automatic settle the customer transaction for the speci...