Powered By Blogger

How to cancel the remaining purchline quantity for invoiced order lines through custom button using standard process

 ALL PURCHASE ORDERS -> PURCHASE (CONFIRM) -> RECEIVE (RECEIPT LIST , PRODUCT RECEIPT LIST) ->  INVOICE (INVOICE) -> UPDATE MATCH STATUS -> POST  

    

 

 UNDER LINES (UPDATE DELIVERY REMAINDER (CANCEL QUANTITY))   Then it will invoiced from open order , its an standard process  

Task is this whole standard process should run in one buttton , for this we have to take one menu item button and in properties we shoulld give class and write code in class 

Code : 

 

 

internal final class PurRemClass 

  { 

    PurchLine       callerPurchLine; 

    FormDataSource  callerDataSource;     

  PdsFormCtrl_UpdateRemain formCtrl;      

          public static void main(Args _args)   

  {      

   PurchTable  purchTable 

       PurchLine   purchline ;  

       purchTable = _args.record();     

    PurRemClass p = new PurRemClass();      

   purchline = PurchLine::find(purchTable.PurchId);  

       if(purchTable)    

    {       

     while select forupdate purchLine where purchTable.PurchId == purchLine.purchid  

          {  

ttsbegin;        

        purchLine.remainPurchPhysical = 0;     

            purchLine.remainInventPhysical=0;    

            p.updateRemainPhysical(purchline);   

              ttscommit;   

         }    

     }     

} 

protected void updateRemainPhysical(PurchLine _callerPurchLine 

   {       

  PurchLine       purchLineLocal = PurchLine::find(_callerPurchLine.PurchId);     

    ;    

     InventQty       diffRemainPurchPhysical       = purchLineLocal.RemainPurchPhysical ;    

         InventQty       diffRemainInventPhysical      = purchLineLocal.RemainInventPhysical ;   

          PdsCWInventQty  diffPdsCWRemainInventPhysical = purchLineLocal.PdsCWRemainInventPhysical;   

      MCRSalesOrderCancellation mcrSalesOrderCancellation;    

     FormDataSource  purchTableDataSource;    

     Object          purchLineDataSource = callerDataSource;    

     PurchSalesOrderCancellation purchSalesOrderCancellation = new PurchSalesOrderCancellation();     

    mcrSalesOrderCancellation = purchSalesOrderCancellation.mcrSalesOrderCancelInit(mcrSalesOrderCancellationpurchLineLocal.InventRefTransId);    

       InterCompanyUpdateRemPhys::synchronize(_callerPurchLine,  diffRemainInventPhysical,  diffRemainPurchPhysical,   

                                             this.retrieveInterCompanySkipUpdateFlag(_callerPurchLine), 

                                            diffPdsCWRemainInventPhysical); 

      if (_callerPurchLine.ItemRefType  == InventRefType::Sales   

                  && _callerPurchLine.InventRefTransId   

                  && _callerPurchLine.isDropShipment())   

      {           

          _callerPurchLine.reread();      

       _callerPurchLine.RemainPurchPhysical   = 0;     

       _callerPurchLine.RemainInventPhysical   = 0;        

     _callerPurchLine.PdsCWRemainInventPhysical   = 0;    

     }        

_callerPurchLine.write();    

       purchSalesOrderCancellation.mcrSalesOrderCancel(mcrSalesOrderCancellationpurchLineLocal.InventRefTransId);    

     purchTableDataSource = purchLineDataSource.purchTable_ds();    

     purchTableDataSource.reread();     

   callerDataSource.reread();     

    callerDataSource.refresh();     

          }  

     protected InterCompanySkipUpdate retrieveInterCompanySkipUpdateFlag(PurchLine _callerPurchLine)    

{       

  return InterCompanySkipUpdate::No;  

   } 

} 

 

No comments:

Post a Comment

DisableStandredButton

 My requirement is to disable the delete button for journals that were posted:- After Posting the button is enabled fig:- Line level also th...