cancel
Showing results for 
Search instead for 
Did you mean: 

Can't retrieve data from RFC when passing input parameters

Former Member
0 Kudos

Hello Everyone:

I have created a Jco Connection using BAPI_CUSTOMER_GETDETAIL2 bapi. I also created a form, an action button to get the data and a table where the data is displayed. It does work ok, however, when I try to "harcode" the input parameter it won't work. That is, I want to pass the input programatically, not as a form. I tried this:

String userID = "35";

wdContext.nodeBapi_Customer_Getdetail2_Input().currentBapi_Customer_Getdetail2_InputElement().setCompanycode(userID);

But it won't work... won't show any errors though, just as if there are no records for that query...... does anyone have any ideas about this?

Thanks

Alejandro

Accepted Solutions (1)

Accepted Solutions (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

The BAPI requires that you pass it a customer number. Not sure what you are doing with "userId", company code is optional, but you can pass it if you want. Make sure that your values are zero filled left as I have shown below. Company code is a 4 character field, customer number is a 10 character field.

Try this....



String customerId = "0000012345";
wdContext.nodeBapi_Customer_Getdetail2_Input     
     ().currentBapi_Customer_Getdetail2_InputElement
                ().setCustomerno(customerId );


String comCode = "0035";
wdContext.nodeBapi_Customer_Getdetail2_Input     
     ().currentBapi_Customer_Getdetail2_InputElement
                ().setCompanycode(comCode);



Regards,

Rich Heilman

Former Member
0 Kudos

funny.... the zero's thing did the trick, I must say I wouldn't have been able to figure it by myself... how come it was working if I placed the number (with out zero's) in the form, but not in a programatic manner?

Thanks again!

Alejandro

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

The reason is, SAP has made it easy on you and is doing the conversion for you automatically. These are called conversion routines in the ABAP world. SAP has designed webdynpro java the same way, when you are creating the model(importing from R/3) it is looking at all of these things so that you don't have to handle them manually. Of course when filling values programatically you must respect how the data is being stored on the backend.

Regards,

RIch Heilman

Answers (0)