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

New BAPI error: You cannot use the statement "FUNCTION" in the current environment.

Former Member
0 Likes
13,256

I am creating Customized BAPI, following the steps, structure, then followed by ZBAPI FM, Even BOR steps cleared but am ending with an error

Function Module ZBAPI_DEMOSD

You cannot use the statement "FUNCTION" in the current environment.

However, you could use the similar statement "FUNCTION-POOL".

Can anyone please tell me , what mistake have I done?

please reply.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
9,021

Priyanka, i am working on custom bapis, i could help you... could you give what/ how you did coplete your bapi and what point you getting that error.

regards

satish chandra

17 REPLIES 17
Read only

Former Member
0 Likes
9,022

Priyanka, i am working on custom bapis, i could help you... could you give what/ how you did coplete your bapi and what point you getting that error.

regards

satish chandra

Read only

0 Likes
9,021

Hi Satish,

Initially I had created a ZBAPI structure then in SE37  I had created ZBAPI FM with RFC enabled , then import one parameter and export return , here when I try to activate my FM  end with these below errors

You cannot use the statement "FUNCTION" in the current environment.

However, you could use the similar statement "FUNCTION-POOL".

Read only

0 Likes
9,021

just check this,

1. created a function group.

2. created all the relevant structures in se11 (name of structures should start with bapixxxx in your case zbapixxx)

3. create a fm in se37 make it rfc enable by selecting a radio button.

done. you should not have any problem here.

4. if you are getting error here how u completed bor procedure....

Read only

0 Likes
9,021

no issues,

Priyanka go se 37, open your bapi in change mode.

ATTRIBUTES -> PROGRAM NAME (Click here) -> un-coment on include which ends with 'TOP'.

this would solve the issue.

regards

Satish Chandra

Read only

0 Likes
9,021

I had done all the 3 above steps as  you have mentioned. Since I was trying for several times , so I jst activated with errors and started with BOR procedure but then after all steps it did not execute instead landed with Run-time error .(becuz of Same prev error)

Read only

0 Likes
9,021

Yes I have done that also but now I can see one more error

REPORT/PROGRAM statement missing, or program type is INCLUDE.

Read only

9,021

you just uncommented the first include, click on inthe same include, see the statement

 

'FUNCTION-POOL xxxxxxxxx. "MESSAGE-ID ..' un comment it. if it is commented. activate it.

no-errors.

activate function group . no-errors.

activate the fm .

regrads

Satish Chandra

Read only

0 Likes
9,021

I did the same way as  you said ;

Inside that first include also 'FUNCTION-POOL xxxxxxxxx. "MESSAGE-ID ..' is un-comment but still m facing the same error.

REPORT/PROGRAM statement missing, or program type is INCLUDE.

when I am activating that include.

Read only

0 Likes
9,021

Read only

0 Likes
9,021

hmmmmmm.... click on that error, see where it is taking us..

Read only

0 Likes
9,021

It take to the main screen; where two FM are present.

Read only

0 Likes
9,021

activate here, at activation screen select both function group and top include and activate. if error comes again click on activate anyway. It gets activated, go to source code do the syntax check. if no errors activate again.

Read only

0 Likes
9,021

Hi,

     Try this link. Hope it helps.

http://scn.sap.com/message/3923319

Regards,

Umar Syed.

Read only

0 Likes
9,021

Hey thanks a lottttttttttttttt.. it worked.

Read only

0 Likes
9,021

wow Priyanka, you done it...

remember dont go to bor until u clear it here, why to make it a mess.

Thank you, great working with you.

Be Blessed.

Reagards

Satish Chandra

Read only

0 Likes
9,021

Ya sure.. same here..

regards,

Priyanka.

Read only

hasanbacioglu
Participant
0 Likes
9,021

First activate TOP include.