Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

a problem when using a data element in BAPI

Former Member
0 Likes
1,190

Hi there,

I build a function module, and want to use it as a BAPI. But when I add the function module as a method of a BAPI object, it gives me the following error: data type xxxxx cannot be used for methods.

I guess the problem happens because of the type of data element I used for the input parameter of the function module. Thus I tried many other data elements, but I keep getting the same error. I am really out of the game. Could anyone tell me which data element I should use for the input parameter of the function module? The function module has only one input parameter, which should be a string with length less than 100.

Thank you so much!!

Sincerely,

Bing

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,099

hope when you are creating the FM the parameter is set to TYPE and not LIKE.

8 REPLIES 8
Read only

Former Member
0 Likes
1,099

Could anybody help me with this question? Any comments or suggestions are sincerely appreciated!!

Read only

Former Member
0 Likes
1,100

hope when you are creating the FM the parameter is set to TYPE and not LIKE.

Read only

0 Likes
1,099

Thanks very much for the reply. I used "TYPE".

Read only

0 Likes
1,099

I still can't solve this problem. Could anyone help me with that? Thanks a lot.

Bing

Read only

0 Likes
1,099

HI,

Can you give the importing and exporting parametes of your FM so that we can check it .

Regards

Raj

Read only

0 Likes
1,099

The function module has only one input parameter, which should be a string with length less than 256. (I tried many predefined data element like RPLM_STRING, but when I tried to add the function module as a method of BAPI, the SAP always gave me the error: data type xxxxx cannot be used for methods)

It only has one output parameter: RETURN (associated type: BAPIRETURN)

I am really not familiar with ABAP program, let alone BAPIs. Any suggestions would be very helpful to me. I sincerely appreciate your help.

Bing

Read only

0 Likes
1,099

Hello Noyan,

Can you try this: Create a New Structure in SE11 Say ZBAPITEST. In that Structure create a field with length of type CHAR256 say ZZ_STRING. Now In the BAPI Interface, For the Input parameter Specigy the typeas ZBAPITEST-ZZ_STRING. Hope this Works.

Also make sure that you check the 'Pass By Value flag' and your FM has attibutes as 'RFC Enabled'.

Regards

Saket Sharma

Read only

0 Likes
1,099

Thank you very much. I get this problem solved!

Regards,

Bing