Sunday, August 30, 2020

Reverse Customer bank transactions by X++ code

 

Hi guys,Today we see how to Reverse transaction by X++ code.


Here I wrote 2 codes.Try Any one

Code 1:

void clicked()

{

    CustTrans     custTransLocal;

    Args          args;

    str           reasonCode;

    ReasonTable   reasonTable;

    RecId         reasonRefRecID;

    BankPaymCancel bankPaymCancel;


    reasonCode = "ERROR";

    reasonTable = ReasonTable::find(reasonCode);

    reasonRefRecID = ReasonTableRef::createReasonTableRef(

    reasonTable.Reason, reasonTable.Description);




    select CustTransLocal

            where CustTransLocal.AccountNum == 'US-004'

                && CustTransLocal.Voucher == 'ARPM000784';

    


    args = new Args();


    bankPaymCancel = BankPaymCancel::newBankPaymCancel(CustTransLocal);


    bankPaymCancel.parmReason(reasonTable.Reason);

    bankPaymCancel.parmReasonComment(reasonTable.Description);

    bankPaymCancel.parmTransDate(systemDateGet());


    args.caller(bankPaymCancel);

    args.record(CustTransLocal);

    BankPaymCancel::serverRun(args);

    super();

}


Code 2:


void clicked()

{

    CustTrans                 CustTransLocal;

    TransactionReversal_Cust  transactionReversal_Cust;

    Args   args;

    

    

    select CustTransLocal

        where CustTransLocal.AccountNum == 'US-004'

            && CustTransLocal.Voucher == 'ARPM000785';

    

    if(CustTransLocal)

    {

        transactionReversal_Cust = new TransactionReversal_Cust();

        args = new Args();

        args.record(CustTransLocal);

        transactionReversal_Cust.parmReversalDate(systemdateget());

        

        transactionReversal_Cust.reversal(args);

    }

}


Keep Daxing!!


No comments:

Post a Comment