cancel
Showing results for 
Search instead for 
Did you mean: 

about field length of BAPI

Former Member
0 Kudos

Dear experts,

I am calling an BAPI from web dynpro java, but I encountered on problem. The length of the data field 'material' is 18. We test the BAPI in se37, and input the material with '80010509', everything is fine. But when we test it in web dynpro jave, and input the value '80010509', but reports one error, it need to input '0000000000080010509' to make it works properly.

The BAPI runs on ECC5, is there any way to solve this problem, many thanks!

Best Regards,

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

The easiest way to handle this would be to use conversion routine for your input parameter in BAPI itself so that it would add those remaining 0s to the mataerial number. Ask an ABAPer in your team to help you with this on R/3 side itself.

Regards,

Murtuza

lokesh_kamana
Active Contributor
0 Kudos

Hi,

More clearly for ur question.



if(x.length()==8)
x="00000000000"+x;
if(x.length()==7)
x="000000000000"+x;
if(xI.length()==6)
x="0000000000000"+x;
if(x.length()==5)
x="00000000000000"+x;
.
.
.
.
if(x.length()==1)
x="000000000000000000"+x;

and now set the x value to the import parameters in teh RFC.

Thanks & regards,

Lokesh

lokesh_kamana
Active Contributor
0 Kudos

Hi,

Do one thing.Already you might have binded the input field to a atrribute in context.

Get the attribute into string.

String x = wdcontext.currentcontextelement.get<attribute>

if(x.lenght() == 😎

{

x="0000000000"+x;

}

and set this particular value to the RFC import paramter.

ZBAP_XX n = new ZBAP_XX();

n.set<attribute>(x);

In the same way keep the conditions for all the inputs given by the user.

Check the length and append it with the number of zeros req and set it to the function module import parameter.

Thanks & Regards,

Lokesh

Former Member
0 Kudos

As for my experience with accessing rfc's u should send the field with leading zeros.

If u will try to fill the field in se37 with leading zeros it will work fine also.

Former Member
0 Kudos

Hi nitsan greenhut ,

Yes of course, if user input the field with leading zeros, the input will definitly works fine. But we can't ask the users to input the leading zeros, right?

former_member197348
Active Contributor
0 Kudos

Hi,

What is the type of the field 'material' in BAPI? Is it 'char' or 'num'? Try with 'num'.

Regards,

Siva

Former Member
0 Kudos

Hi Siva Rama Krushna,

Yes, it is 'char', it is a standard function, we can't change it, so is there any way to fix this problem?

former_member192434
Active Contributor
0 Kudos

try to set the input field length 18 on webdypro side.and see it works or not

Former Member
0 Kudos

Thanks Anup!

The inputfield in web dynpro is 18 length, which can input 18 chars. I also checked with the data in java dictionary which is imported from the ECC, it is 18 length.

Any other inputs?