Author Topic: Smartattributes - rf_validate  (Read 5256 times)

Benjamin Dasari

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 95
    • View Profile
Smartattributes - rf_validate
« on: October 05, 2017, 05:16:51 PM »
Purpose:
The Validation Smart Attribute determines whether or not the input you entered is valid.
This determination is performed by matching the user input to the pattern assigned to the field.
The key is rf_validate.

When SAPgui is used, the validation process is normally performed when a page is submitted to the SAP application server.
However, individual fields can be validated prior to this step by marking them for validation.
Marking a field for validation informs the application that the field should be validated immediately following any pattern matching.
The validation process is usually triggered by a 'done entering text' signal.
If a single field is to be validated, the application displays a 'post-validation' screen.
This can be either the previous screen with the user input or an entirely different screen.
When an entire page is displayed, the post-validation screen does not appear instead the ensuing screen in the process will display instead.

If validation is used then the value entered into the field must match the pattern in order for the validation to succeed and for the process to continue.

Any screens that already contain text are assumed by Mobile to be already validated.
However, if you alter or modify any input, then the field will be re-validated when the page is submitted for validation.
The validation process is mostly transparent to you. When the 'done entering text' signal is transmitted, the screen will clear and the validation will be performed by the script.
You can specify a number of variable actions, such as the following:
• Screen to display when the validation is complete.
• Field to have focus in the post-validation screen.
In addition, you can specify transaction codes, function codes (Fcodes) and internal Fcodes.
In the case of Fcodes or internal Fcodes, the script author can identify the Fcodes and perform validation on the input as shown in the below example.

NOTE:
Make sure the "Smart Attributes -> Validate" is checked in "Advanced Setting" tab in the Profile settings of a mobile device.

Syntax:
{"smartattributes":"rf_pattern=???^rf_validate=/[tcode]"}
The [tcode] would be replaced by a SAP transaction code.
   

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs       // Easy Access
----------------------------------------------------------------------------------------------------------------------------------------------
clearscreen();
inputfield( [1,1], "Material", [1,23], {"name":"z_mm02_matl", "size":18, "required":true, "smartattributes":"rf_validate=/7"});
inputfield( [2,1], {"name":"z_mm02_matldesc", "size":40, "readonly":true, "nolabel":true});
pushbutton([4,1], "@2L@Get Material Description", "/nMM02", {"size":[2,26], "process":mm02_getDescription});
onUIEvents["/7"] = {"fcode":"/nMM02", "process":mm02_getDescription};

function mm02_getDescription(){
   onscreen 'SAPLMGMM.0060'
      set('F[Material]', '&V[z_mm02_matl]');
      enter("/5");
      
   onscreen 'SAPLMGMM.0070'
      set("cell[TABLE,0,1]","X");
      enter();
      
   onscreen 'SAPLMGMM.4004'
      set("V[z_mm02_matldesc]",'&F[MAKT-MAKTX]');
      enter("/n");
}


See attachments for code samples!
« Last Edit: December 18, 2017, 11:05:31 AM by Benjamin Dasari »