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

How to give constant data in RFC function module

Former Member
0 Likes
2,195

Hello;

I have created a BAPI which doesnt have any data i want to put some data in that BAPI so tried with constants but it is not working..how put hard code data in function module..when i put the data it gives error stating that 'Function-Pool' should not be the first statement..

Thanks and Regards,

Om.

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,747

Hello,

Did you try putting the constants in the TOP include of the function group ?

BR,

Suhas

19 REPLIES 19
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,748

Hello,

Did you try putting the constants in the TOP include of the function group ?

BR,

Suhas

Read only

Former Member
0 Likes
1,747

Hi;

No i did not but if i put constants in function module then is it necessory to define it in TOP include...

Thanks,

om.

Read only

Former Member
0 Likes
1,747

well local constants are somewhat senseless so yeah declare them in the top include of the function group. they will be known in the whole function group.

Read only

Former Member
0 Likes
1,747

ok that means the same declearation i had define in the function module the same thing i hjave to define in the TOP include..OM

Read only

Former Member
0 Likes
1,747

Hi..

declare the constant in top include of fucntion group and then activate the function group..

Hope this will help you..

Regards,

Kiran

Read only

0 Likes
1,747

HI;

Ya I did it but still i am facing the same problem...can u just tel me is this right

DATA: Total TYPE p DECIMALS 3.

CONSTANTS: BEGIN OF sampledata,

CARRID TYPE c LENGTH 5 VALUE 'AA',

SEATSMAX TYPE i value '600',

SEATSOCC TYPE i value '500'.

CONSTANTS end OF sampledata.

  • Export

  • CARRID = 'AA'

  • CURRENCY = 'USD'

  • SEATSMAX = '600'

  • SEATSOCC = '500'

Total = 100 * ( seatsocc / seatsmax ).

Read only

Former Member
0 Likes
1,747

Hi!

If you are using SE80 for editing your function group, you will see under the includes tab the TOP include.

You can enter the constants here, right after the FUNCTION-POOL command.

For example if your function group is called ZMYFUGR, then the top include will be LZMYFUGRTOP.

Regards

Tamá

Read only

0 Likes
1,747

Hi;

Thanks for replying..Yup I am facing the same problem...Is that constant will get reflected in the o/p wehn i activate it.

Thanks and regards;

Om.

Read only

0 Likes
1,747

HI;

Ya I did it but still i am facing the same problem...can u just tel me is this right

DATA: Total TYPE p DECIMALS 3.

CONSTANTS: BEGIN OF sampledata,

CARRID TYPE c LENGTH 5 VALUE 'AA',

SEATSMAX TYPE i value '600',

SEATSOCC TYPE i value '500'.

CONSTANTS end OF sampledata.

  • Export

  • CARRID = 'AA'

  • CURRENCY = 'USD'

  • SEATSMAX = '600'

  • SEATSOCC = '500'

Total = 100 * ( seatsocc / seatsmax ).

Read only

0 Likes
1,747

Hi

In your program itself you are declarting the structure,

First yoou have check the corresponding Function group in SE80.

Goto SE80 ->Package Name->Function Group->Includes->

CONSTANTS: BEGIN OF sampledata,

CARRID TYPE c LENGTH 5 VALUE 'AA',

SEATSMAX TYPE i value '600',

SEATSOCC TYPE i value '500'.

CONSTANTS end OF sampledata.

ActivateFunction group

In Your report just call the variable/structure

Total = 100 * ( seatsocc / seatsmax ).

Read only

0 Likes
1,747

Hello;

I did it but what result i want that i m not getting..can u able to send me simple code which can calculate the area of circle with the help of RFC BAPI Function module..hope u must have understand..Thanks...OM

Read only

0 Likes
1,747

Hello;

I did it but what result i want that i m not getting..can u able to send me simple code which can calculate the area of circle with the help of RFC BAPI Function module..hope u must have understand..

Read only

former_member378318
Contributor
0 Likes
1,747

If they are import parameters then you can specify default values in the function module interface.

Read only

0 Likes
1,747

i did it,,but m facing error it says 'FUNCTION-POOL' should not be the first statement...Om

Read only

0 Likes
1,747

Goto SE37 for your function module then use "Goto -> Main Program". Go into the first Include you see at the top of the main program (usually the top include). The first statement in the Include should be similar to FUNCTION-POOL <your function module name>.

If it is then go back to the main program Include, double click into each Include and activate each include separately. Do this until all Includes are active. Let me know what happens.

Read only

0 Likes
1,747

Hi;

Thanks..will do that and let you know..Om

Read only

0 Likes
1,747

Hi;

Now i can enter the data but the inter table has 0 entries when i fetch the data..It will not return the RETURN value but it wont give any error..also..Om

Read only

0 Likes
1,747

Post the code you have between the FUNCTION and END FUNCTION statements including the function module interface parameters. Also post the code from your TOP include.

Read only

Former Member
0 Likes
1,747

Moderator message - Sorry - this forum is not a training forum Please read [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement], and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again. Thread locked. Rob