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

Compatibility between parameters

Former Member
0 Likes
885

Hi, I have some strange problem.

I am using a function, which communicate with another system by Web Method.

The function imports parameter type c, length 255) from user through the screen. The field in the screen is type c length 17.

The value that I need to get from user is '-1'.

So, when I getting the '-1' from user through the screen, the system which gets this parameter from function didn't work.

When I send to the function '-1' hard coded it's work.

In debugger it looks the same '-1'.

How can I solve this problem?

8 REPLIES 8
Read only

eddy_declercq
Active Contributor
0 Likes
851

Hi,

Pls check this thread

Eddy

Read only

Former Member
0 Likes
851

Thanks, but it didn't help

Read only

Former Member
0 Likes
851

hi

u have to display a negative values in parameters then u have to create a data element for that field and set data type as int4.

Read only

former_member186741
Active Contributor
0 Likes
851

if you call a function module and pass a hard-coded value to a parameter sap will convert it to the correct length.

But if you pass a parameter of the wrong type it will abend. You can move the 17 char field to an intermediate 255 variable and then pass the 255 variable to the fm.

Read only

Former Member
0 Likes
851

Hi los,

1. To actually debug,

what can be done is that

create a z table

and put the value which is imported

ie. -1

into that table.

2. After calling this fm from web system,

pass hardcoded -1 and also try with

user input -1

and then check the z table

to know, what ACTUALLY the FM

is receving.

regards,

amit m.

Read only

0 Likes
851

Hi,

Pls don't forget to reward points and close the question if you find the answers useful.

Eddy

Read only

0 Likes
851

Hi!

Sorry, I was not at work, for a few days.

The problem was not solved, but the development was changed.

Thanks to everybody, I tried first six answers, and it didn't help.

Read only

Former Member
0 Likes
851

Hi,

I agree with Neil's advice to move the screen input to an variable of type c with length 255 first, before calling the function.

WHEN CALLING A FUNCTION, ALWAYS MAKE SURE THAT THE ACTUAL PARAMETERS AND THE FORMAL PARAMETERS AGREE IN TYPE AND LENGTH. You will not necessarily get a runtime error, if they do not agree, but might get faulty data.

You write:

"When I send to the function '-1' hard coded it's work."

Do you mean you are assigning '-1' to a 255-byte character variable?

You write:

"In debugger it looks the same '-1'."

Do you mean that all 255 bytes look the same in hexadecimal notation?

You write:

"The field in the screen is type c length 17."

Are you sure the field in the screen is of type c and not a numerical field?

Kind regards,

Michael