cancel
Showing results for 
Search instead for 
Did you mean: 

Strange issue - BAPI returning only 1 record

Former Member
0 Kudos

Hi Experts,

I am using following code to get data from backend. I am getting only 1 record from the back end. When I am executing the same BAPI using se37, I can see 28 records. Can you please let me know what is going wrong here? I have done proper context mapping etc. I am NOT new for Web Dynpro.

Regards,

Gary

public void executeData( )
  {
    //@@begin executeData()
	BigDecimal a ;
	a = BigDecimal.valueOf(0);
	Bapi_Orgunitext_Data_Get_Input input = new Bapi_Orgunitext_Data_Get_Input();
	wdContext.nodeBapi_Orgunitext_Data_Get_Input().bind(input);
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setScenario("MDT1");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setObjid("50050585");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setPlvar("01");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setKeydate(new java.sql.Date(System.currentTimeMillis()));
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setEvalpath("o-s-p");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setEvaldepth(a);
	try {
	 wdContext.currentBapi_Orgunitext_Data_Get_InputElement().modelObject().execute();
	 wdContext.nodeOutput_orgunit().invalidate();
	}
	catch (Exception e) { 
	 wdComponentAPI.getMessageManager().reportException("error while getting orgunit from Bapi_Orgunitext_Data: " +e.getLocalizedMessage(), false);
	}
	

Accepted Solutions (1)

Accepted Solutions (1)

nikhil_bose
Active Contributor
0 Kudos

Hi Gari,

Your code looks fine.

Are you sure about the test case gives 28 records in SE 37?

You are passing current date for "keydate" field!

Finally, I hope you bound the exact node which contains BAPI return data to the 'Table'. Can you post the output node structure?

Nikhil

Former Member
0 Kudos

Hi Jaya,

I printed the size of model node immediately after execute BAPI. Its value is 1. The first record is being returned. I am not using supply function.

Hi Nikhil,

I am sure that using se37, I can see 28 records.Keydate is correct i.e. today's date

Hi Murali,

All records are unique record in backend. Also we are using SAP standard BAPI. So, the BAPI has been coded correctly.

Hi Lokesh,

The table data source is correct - Bapi_Orgunitext_Data_Get_Input.Output_orgunit.Actortab. Table data source property is the output node of BAPI.

Hi Santosh, Ponraj

The exact code is as below

BigDecimal a ;
	a = BigDecimal.valueOf(0);
	Bapi_Orgunitext_Data_Get_Input input = new Bapi_Orgunitext_Data_Get_Input();
	wdContext.nodeBapi_Orgunitext_Data_Get_Input().bind(input);
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setScenario("MDT1");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setObjid("50050585");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setPlvar("01");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setKeydate(new java.sql.Date(System.currentTimeMillis()));
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setEvalpath("o-s-p");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setEvaldepth(a);
	try {
	 wdContext.currentBapi_Orgunitext_Data_Get_InputElement().modelObject().execute();
	 wdContext.nodeBapi_Orgunitext_Data_Get_Input().size();
	 wdComponentAPI.getMessageManager().reportSuccess("size "+wdContext.nodeBapi_Orgunitext_Data_Get_Input().size());
	 wdContext.nodeOutput_orgunit().invalidate();
	}
	catch (Exception e) { 
	 wdComponentAPI.getMessageManager().reportException("error while getting orgunit from Bapi_Orgunitext_Data: " +e.getLocalizedMessage(), false);
	}

Thanks every one. Kindly help me.

Regards,

Gary

former_member187439
Active Participant
0 Kudos

Gary, You wrote that your table data source is Bapi_Orgunitext_Data_Get_Input.Output_orgunit.Actortab

so, can u print

wdContext.nodeActortab().size();

instead of printing

wdContext.nodeBapi_Orgunitext_Data_Get_Input().size();

Sure that would also be 1 as the main node size is also one.Still try.

Also Can you print the values by getElement(0, 1 etcs).

Former Member
0 Kudos

Hi Kavitha,

Thanks. I changed the code to

wdContext.nodeActortab().size();

However, I am still getting value as 1.

Regards,

Gary

former_member187439
Active Participant
0 Kudos

Is the cardinality of nodeActortab "o to n" in your view's context?

Try to create a local value node. After executing the FM, copy the values from Actortab to this local value node and see. Map your table's data source to this value node and change your table's "VisibleRowCount" property as "-1".

former_member187439
Active Participant
0 Kudos

Before you try local value node, I suggest you check the "length" of these two input fields both in R3 and WebDynpro.

wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setObjid("50050585");

wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setPlvar("01");

If the length of Plvar is 8 in the FM in R3, then instead of passing "01" as input in your code, please pass "00000001". Try this kind of correction for both of your numeric inputs.

Because, when you execute with same inputs in SE37, internally ABAP will append the necessary number of zeros and execute. Whereas in a remote call like portal, we have to manually append the zeros.

Edited by: Kavitha on Jul 1, 2009 2:55 PM

Former Member
0 Kudos

Hi Gary,

Looks like some confusion is there with output node.

Are you sure that node Actortab is mapped to the right table of Function module export parameters?

Can you please paste your complete node structure (including both Request and Response nodes).

Regards,

Jaya.

Answers (7)

Answers (7)

Former Member
0 Kudos

ok

Edited by: Preeti Kaur on Jul 1, 2009 4:15 PM

Former Member
0 Kudos

Hi,

I guess there is some problem with the input you are passing from WebDynpro.

Check whether you are giving the same input while testing in R/3?

Regards,

Charan

Former Member
0 Kudos

Hi All,

Thanks a lot. The issue got resolved. The input parameters are case sensitive.

Using the following code issue got resolved. Points awarded

Regards,

Gary

	BigDecimal a ;
	a = BigDecimal.valueOf(0);
	Bapi_Orgunitext_Data_Get_Input input = new Bapi_Orgunitext_Data_Get_Input();
	wdContext.nodeBapi_Orgunitext_Data_Get_Input().bind(input);
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setPlvar("01");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setOtype("O");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setObjid("50050585");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setKeydate(new java.sql.Date(System.currentTimeMillis()));
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setScenario("MDT1");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setEvalpath("O-S-P");
	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setEvaldepth(a);
//	wdContext.currentBapi_Orgunitext_Data_Get_InputElement().setOtype("0");
	try {
	 wdContext.currentBapi_Orgunitext_Data_Get_InputElement().modelObject().execute();
	 wdComponentAPI.getMessageManager().reportSuccess("size "+wdContext.nodeStructuraldata().size());
	 wdContext.nodeOutput_orgunit().invalidate();
	}
	catch (Exception e) { 
	 wdComponentAPI.getMessageManager().reportException("error while getting orgunit from Bapi_Orgunitext_Data: " +e.getLocalizedMessage(), false);
	}
	

Former Member
0 Kudos

hi gary

to solve your problem and come out of the confusion , can you please provide the structure , node name and paramteres inthe so that every one understand .

can you provide the input and output node you are using ,

and have you debugged you webdynrpo application , have you put the external debugging and check whether the parameter you are passing are send to the RFC .

Former Member
0 Kudos

Hi Gary,

I hope you bind the model node to a table in the view to see the result.

Print the size of that particular node (model node) immediatley after executing the BAPI.

Are you using any supply function?

Also, which record is coming in your view out of 28 records? Is it the first record or last record or randomly it is coming?

Regards,

Jaya.

Former Member
0 Kudos

hi

does the records in the backend table which are about 28 , are these unique or all the 28 records are same , i mean some times it happens that Abaper may create duplicate records

inthe table , but during populating the table you will see only one record , or

you can go for external debugging of your webdynpro application with the help of your abaper and check whether you are able to send the table to the RFC correctly if there is some thing

as such . if there are any inputs that need to be passes toRFC , you can test your RFC inthe backend with some test data and you can use the same data as hard cord values and test the

application in the backend.

Thanks

Former Member
0 Kudos

How are you printing the output of the BAPI in webdynpro.

If you have written some code please post the same.

Try binding the output node which contains 28 records to the Data source of any table and see the output.

Let us know for any problems

Former Member
0 Kudos

Hi Gary,

Please post the code which you have written for returning the output from BAPI. Try printing the size of the node which is returning all the records from BAPI.

Regards,

Ponraj M

lokesh_kamana
Active Contributor
0 Kudos

Hi,

Check printing the output node size whether it is returning the same 28 records or not.

If you are using a atble to show the output and if you are facing the error.

Try the following it may help you.

Table data source property to the output node of ur BAPI.

Thanks & Regards,

Lokesh