Skip to Content
0
Feb 05, 2009 at 04:29 PM

Portal Component Project - calling BAPI

25 Views

I have written a program which called a backend system and see whether the user name I am sending is exists or not.

the BAPI I am calling from Portal Project is having input as USERNAME and output as RETURN , the RETURN contains other fields like NUMBER

NUMBER = 088 determains that user does exists else NO.

I could send the Input values to BAPI but not getting the NUMBER field from RETURN.

this is my program , please help where I am doing wrong.

//	get the Interaction interface for executing the command 
				IInteraction ix = client.createInteractionEx();
				// Get interaction spec and set the name of the command to run 
				IInteractionSpec ixspec = ix.getInteractionSpec();
				// the well known example BAPI EMPLOYEE LIST 
				String functionName = "BAPI_USER_EXISTENCE_CHECK";
				// Put Function Name into interaction Properties. 
				ixspec.setPropertyValue("Name", functionName);
				// return structure
			
				String return_out = "RETURN";
				RecordFactory rf = ix.getRecordFactory();
				MappedRecord input = rf.createMappedRecord("input");
				// put function input parameters 
				input.put("USERNAME", username);
				
				MappedRecord output = (MappedRecord) ix.execute(ixspec, input);

				IRecordSet rsRETURN = null;

				try {
					Object result = output.get(return_out);

					if (result != null && (result instanceof IRecordSet))
						rsRETURN = (IRecordSet) result;
						
						while (rsRETURN.next()) {
						number = String.valueOf(rsRETURN.getInt("NUMBER"));

					}

				} catch (Exception ex) {
					ex.printStackTrace();
				}

			} catch (Exception e) {
				e.printStackTrace();

			}

Edited by: kiran jakkaraju on Feb 5, 2009 5:35 PM

Edited by: kiran jakkaraju on Feb 5, 2009 10:45 PM