Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to call a BAPI that takes a table parameter

Hi,

I have a BAPI ZHRECMFM_002_PERFRAT_WARNING that has two table parameter one is PERNR_LIST of type HROBJECT and another one is PERNR_PERFRAT of type ZHRECMGLS_002_PERNR_PERFRAT that consists of two elements pernr and perf_text.

I need to set PERNR_LIST(set of pernrs) in my WDA and call the BAPI.that BAPI will return PERNR_PERFRAT table parameter.

1.How will I pass PERNR_LIST(that consists of multiple HROBJECTS) to the BAPI.

2.After executing the BAPI How will I iterate thru PERNR_PERFRAT to get pernr and corresponding perf_text.

I tried to set PERNR_LIST using the following way suggested SivaRama Krushna

IPrivate<viewname>.I<nodeame>Node prNode = wdContext.node<node>();

IPrivate<viewname>.I<nodeame>Element prEle;

for (int i = 0; i < table.size(); i++) {

HROBJECT pernrList = new HROBJECT();

pernrList.setPernr(pernr); // Set the pernr from current record

prEle = prNode.create<nodeame>Element(pernrList);

prNode.addElement(prEle);

}

My code

IPrivateVEcmPlanningView.IPERFWARNNode prNode = wdContext.nodePERFWARN();

IPrivateVEcmPlanningView.IPERFWARNElement prEle ;

Hrobject pernrList = new Hrobject();

pernrList.setPlvar("01");

pernrList.setOtype("NA");

pernrList.setObjid(pernr);

prEle= prNode.createPERFWARNElement(pernrList);

prNode.addElement(prEle);

Type Mismarch:cannot convert IWDNodeElement to IPrivate<viewname>.I<nodeame>Element.

Please help me in resolving this issue

Thanks

Bala Duvvuri

replied

Hi Bala,

Try following:

float amount = 0;
Zhrecmfm_002_Perfrat_Warning_Input input = new Zhrecmfm_002_Perfrat_Warning_Input();
wdContext.nodePERFWARN().bind(input);
if(cpamt!=null)
{
String amt = "";
amt = cpamt.toString();
amount = Float.parseFloat(amt);
}

if(amount>0.0){
pernrCounter = 1;
Hrobject pernrList = new Hrobject();
pernrList.setPlvar("01");
pernrList.setOtype("NA");
pernrList.setObjid(pernr);
input.addPERNR_LIST(pernrList);

}

Regards,

Gopal

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question