Troubleshooting "No Argument Exception" Errors for SAP Applications

Problem: When SAP connection properties bind to personalization keys in the mobile business object (MBO) definition, the generated Windows Mobile application throws a “No Argument exception” error when the user clicks the Submit button in the operation screen during runtime .

Solution:
  1. Open the operation form controller C# file, Generated\Form${Screen.name}Controller.cs.
  2. Find the event handler for the operation actions (Button and MenuItem) , for example:
    :
    			// button (Submit) click event handler
    			internal virtual void SubmitButton_Handler(FormsManagerDataObject dataObject)
  3. Add the following code before ${operation.name}ParameterList.Add(…):
    Sybase.Persistence.Connection defaultConnection = Sybase.Persistence.ConnectionManager.Instance.DefaultConnection;
    	           PersonalizationKeyManager pkmgr = new PersonalizationKeyManager();
    	           pkmgr.Initialize();
    	           Dictionary<string, Personalization> pkmap = pkmgr.GetAllPersonalizationKey();
    	           pkmgr.Dispose();
    	           Sybase.Persistence.ConnectionManager.Instance.DefaultConnection = defaultConnection;
    	           ${operation.name}ParameterList.Add(pkmap["<personalization key >"].KeyValue);
    	          … …           
    			${operation.name}ParameterList.Add(pkmap["<personalization key>"].KeyValue);
    
                    ${operation.name}ParameterList.Add(parameterxxxx);
  4. Replace the <personalization key> variable with the personalization key name that binds with SAP connection property.
  5. For each personalization key that binds to a SAP connection property, you must add the line: ${operation.name}ParameterList.Add(pkmap["<personalization key n>"].KeyValue);

    When adding personalization key values, you must follow the sequence that is shown in the MBO definition class ${operation.name} method parameter.

    For example, when the method is defined as: public void Createfromdat1(System.String jco_client_passwd, System.String jco_client_user, System.String jco_client_client, System.String jco_client_sysnr, System.String jco_client_ashost,…) ,, the code should be entered this way:

    createfromdat1ParameterList.Add(pkmap["<pk of password>"].KeyValue);//first

    createfromdat1ParameterList.Add(pkmap["<pk of user>"].KeyValue);//second           

    createfromdat1ParameterList.Add(pkmap["<pk of clientID>"].KeyValue);//third           

    createfromdat1ParameterList.Add(pkmap["<pk of Sysnumber>"].KeyValue);//fourth           

    createfromdat1ParameterList.Add(pkmap["<pk of AppSer>"].KeyValue);//fifth


Created September 17, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com