Author Topic: Executing functions(scripts) on Yes/No/Cancel button (Pop Up Screen)  (Read 4834 times)

rajesh.sabbineni

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 26
    • View Profile
When user clicks on back button on a screen with out saving the data,  user has an option to save, edit or exit out of the screen. 

Below scenario explains on how to run the same save function during regular order save when 'Yes' button is clicked on exit order processing  popup and  navigate out of transaction when 'No' button is clicked on popup and get back to order details screen when 'Cancel' button is clicked.

LiquidUI code:
if(_transaction=='VA01' || _transaction=='VA02'){
   if(_title =='Exit Order Processing'){
      onUIEvents["=YES"] ={"fcode":"/0", 'process':va0x_back, "using":{"l_val":"YES"}};
      onUIEvents["=NO"] ={'process':va0x_back, "using":{"l_val":"NO"}};
      onUIEvents["=CANC"] ={'process':va0x_back, "using":{"l_val":"CANC"}};
   }
}

//Initiate functions in esession file
load("functions_va0x.sjs");

// Function to handle Yes/No/Cancel Option -
function va0x_back(param) {
   z_val=param.l_val;
   
   if(z_val=='YES'){
      enter('CANC');
   } else if(z_val=='NO'){
      enter('/n');
      goto FUNC_END;
   } else if(z_val=='CANC'){
      enter('CANC');
         goto FUNC_END;
   }   
   onscreen 'SAPMV45A.4001'      
      if(z_val=='YES'){
         enter({'process':va0x_save});   
      }

FUNC_END:;
}

//Function to Save the order
function va0x_save(){
   // Create Standard Order: Overview
onscreen 'SAPMV45A.4001'
   enter('=KKAU');
   onerror
   message(_message);
   enter('?');
   goto END_FUNC;

   // Create Standard Order: Header Data
onscreen 'SAPMV45A.4002'
   set('F[Order reason]', '&V[z_va0x_orderreason]');
   enter('/11');
END_FUNC:;
}

Please see attachments..
« Last Edit: May 24, 2017, 01:26:58 PM by umang@guixt.com »