cancel
Showing results for 
Search instead for 
Did you mean: 

Using my own Bapi in IdM

ankit_anz
Discoverer
0 Kudos
288

Hello,

I have a requirement where I have to call a standard remote enabled BAPI FPB_PERS_POST_FOR_DIALOG in IDM

Please see attached snapshot for input parameters for standard BAPI in SAP where I need to pass values

I need to pass values (highlighted yellow in snapshot)

Row
IT_VALUES
Column         APPLID  | FILEDNAME |  F  |  LOW
Values         LO_SRS  | PLANT     |  V  |  4060 

Row             Values
ID_DIALOGID     DIA_LO_SRS
ID_PERSKEYTP    U
ID_PERSKEY      USERID
ID_ORIGIN       A

I was able to pass row values for ID_DIALOG, ID_PERSKEY, ID_PERSKEYTYP, ID_ORIGIN without any issue (see code below)

Row             Values
ID_DIALOGID     DIA_LO_SRS
ID_PERSKEYTP    U
ID_PERSKEY      USERID
ID_ORIGIN       A

// Main function: z_Call_BAPI


function z_Call_BAPI(Par){


var dialog = Par.get("ID_DIALOG");
var perskeytyp = Par.get("ID_PERSKEYTYP");
var perskey = Par.get("ID_PERSKEY");
var origin = Par.get("ID_ORIGIN");


var repName = uGetRepositoryName();


var ASHOST = uGetConstant("rep.JCO_CLIENT_ASHOST");
var CLIENT = uGetConstant("rep.JCO_CLIENT_CLIENT");
var LANGUAGE = uGetConstant("rep.JCO_CLIENT_LANG");
var PASSWORD = uGetConstant("rep.JCO_CLIENT_PASSWD");
var SYSNR = uGetConstant("rep.JCO_CLIENT_SYSNR");
var USERNAME = uGetConstant("rep.JCO_CLIENT_USER");
var MSHOST = uGetConstant("rep.JCO_CLIENT_MSHOST");
var GROUP = uGetConstant("rep.JCO_CLIENT_GROUP");
var R3NAME = uGetConstant("rep.JCO_CLIENT_R3NAME");


try
{
     importClass(Packages.com.sap.mw.jco.JCO);
     if (MSHOST == "" || MSHOST.length == 0)
     {
          mConnection = JCO.createClient(CLIENT, USERNAME, PASSWORD, LANGUAGE, ASHOST, SYSNR);
     }
     else
     {
          mConnection = JCO.createClient(CLIENT, USERNAME, PASSWORD, LANGUAGE, MSHOST, R3NAME, GROUP) ;
     }
     mConnection.connect();
}
catch (e)
{
     uError(e);
}


mRepository = new JCO.Repository(repName, mConnection);
var func = mRepository.getFunctionTemplate("FPB_PERS_POST_FOR_DIALOG").getFunction();
var importParams = func.getImportParameterList();
uWarning(importParams);


importParams.setValue(dialog, "ID_DIALOG");
importParams.setValue(perskeytyp, "ID_PERSKEYTP" );
importParams.setValue(perskey ,"ID_PERSKEY");
importParams.setValue(origin ,"ID_ORIGIN"); 


mConnection.execute(func);


mConnection.disconnect();


}

But input field IT_VALUES is an internal table in SAP and have got 4 columns

Row
IT_VALUES
Column        APPLID  | FILEDNAME |  F  |  LOW

I have to pass below column values in IT_VALUES

Row
IT_VALUES
Column         APPLID  | FILEDNAME |  F  |  LOW
Values         LO_SRS  | PLANT     |  V  |  4060

Any suggestion on how to pass IT_VALUES ? 🙂

View Entire Topic
Chenyang
Contributor

Hi Ankit,

You need to import some addtional JCo class in your script to meet your requirement, e.g. JCO.Structure or JCO.Table.

Please check JCo3 documentation on how this can be done.


Cheers

Chenyang