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

BDC - Error capturing

Former Member
0 Likes
1,084

I'm trying to display BDC errors to the user within a program. I have a MESSAGES INTO statement in the call for the BDC but it doesn't identify the record it had the error with just the actual error. Is there a way to get the record that raised the error? I'm doing FB01 BDC and get an autorization error for the cost center as the user doesn't have access to post to that cost center. Is there a function I might be able to call to check the authorizations ahead of time before submitting it to FB01?

Code:

CALL TRANSACTION 'FB01' USING bdc MODE 'A' UPDATE 'S'

MESSAGES INTO mess_tab.

Error:

"User not authorized to post to this Cost Center."

Thanks,

David

7 REPLIES 7
Read only

Former Member
0 Likes
858

Step 1 :You would need to know the authorization object called for transaction FB01 .

A) You can check with your S&C / Basis guy as what authorization is required

to use transaction :FB01 .

or

B) You can debug the code till you hit Auhtority-Object (auth Obj) .

or check the Authorization trace using t code St01 .

Once you have figured out the Auth Obj., make a note of what all parameters being passed to the Auth Object.

Say you get Auth Object 'XYZ'

-


C) In your program before calling 'Call transaction' command .

Call the Authority Object 'XYZ' ..

If sy-subrc = 0 .

==> Authorization to use T code FB01

endif .

Hope this helps

Read only

0 Likes
858

Hi,

Try to post a dcument manually via using transaction FB01, and put a breakpoint on statement autority-check.

And see where the sy-subrc value is getting changed, This will give you the information regarding the authority object.

Let me know if you are not able to find it by this way.

With best regards,

Navneet Chaubey

Read only

Former Member
0 Likes
858

Hi,

Run your program again. Once you have got the error message, go to tcode SU53 and you can see the authorization object which got failed and you can use the same authorization object in your program.

Hope this helps.

With best regards,

Navneet Chaubey

Read only

0 Likes
858

SU53 doesn't get loaded when I run the program for some reason.

Read only

0 Likes
858

Su53 will show you last authorization check was successful or not .

Try Transaction : S_BCE_68001420

Read only

Former Member
0 Likes
858

Its authorization issue. report back to basis person and you will be given appropriate role .

Read only

0 Likes
858

It's more of a validation check for the cost center that gives the error then a role/authorization issue. I wish it was as easy as going to basis for new roles. They batch upload anywhere from 100-500 lines in a document to post and sometime mistype cost centers. Then when it tried to post they have a cost center in their file while they aren't allowed to post too. We need to identify this cost center so they can correct the data as they aren't allowed to post to the cost center. It's the old needle in a hay stack problem and the only fix is manually looking through hundreds of lines or being able to run the file against something to check it for them. So far no luck trying to figure out how FB01 actually determines if they are allowed to post or not. The temporary solution is to run the program in foreground so they hold the enter key down till it errors then fix the problem and repeat till the document posts.

Anyone know if there's a function I can pass a cost center to check if it's validate to post too?