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

Authority Check in Class Interface CMD_EI_API

0 Likes
2,621

I am using the class CMD_EL_API in order to create new customer.

The class is working very well, but there is a problem.

Not all the users that are going to utilize this aplicacion can have access to XD01 and XD02 and the class check the authorization on these transactions.

Error:

You are not authorized to use Transaction XD01.

Already it was given them access to all the objects of the XD01 and XD02 but continues marking the same error.

It wold be able someone to indicate me that can be done.

Thank you

Blanca Segovia

1 ACCEPTED SOLUTION
Read only

mvoros
Active Contributor
0 Likes
2,140

Hi,

there is transaction SU53 which returns last authorization check which failed. It should help you to figure out which authorization is still missing in user's profile. Immediately after you get an error run this transaction. Be aware sometimes it's confusing because last one does not have to the right one.

Another way how to check authorization checks is to set up break point for all authorization checks. This can be easily done in new debugger. You just need to set breakpoints for ABAP command AUHORITY-CHECK and debug your program.

Cheers

10 REPLIES 10
Read only

mvoros
Active Contributor
0 Likes
2,141

Hi,

there is transaction SU53 which returns last authorization check which failed. It should help you to figure out which authorization is still missing in user's profile. Immediately after you get an error run this transaction. Be aware sometimes it's confusing because last one does not have to the right one.

Another way how to check authorization checks is to set up break point for all authorization checks. This can be easily done in new debugger. You just need to set breakpoints for ABAP command AUHORITY-CHECK and debug your program.

Cheers

Read only

0 Likes
2,140

Hi

The validation is in the next method:

Where iv_tcode = u2018XD01u2019

The problem is that users can be given no access to the transaction XD01

You will have any other suggestions?.

METHOD authority_check_cust_transact .

DATA: ls_bapiret2 TYPE bapiret2.

  • Initialize exporting parameter

CLEAR: es_error.

  • Authorization for transaction

AUTHORITY-CHECK OBJECT 'S_TCODE'

ID 'TCD' FIELD iv_tcode.

IF sy-subrc IS NOT INITIAL.

  • Fill error parameter

es_error-is_error = gc_true.

  • Detailed message

MESSAGE e172(00) INTO cvi_ei_api=>gv_msgtext

WITH iv_tcode.

ls_bapiret2 = cvi_ei_api=>tool_fill_bapiret2( ).

APPEND ls_bapiret2 TO es_error-messages.

  • Exit at first error

RETURN.

ENDIF.

ENDMETHOD.

Thank you

Blanca Segovia

Read only

mvoros
Active Contributor
0 Likes
2,140

Hi,

you can try to use enhancement framework to implement a workaround. I would define new authorization object and I would add authorization check for this object at the beginning of the method authority_check_cust_transact using implicit enhancement point. If user has an authorization for this new Z object then I would exit from the method otherwise I would continue with original logic. So basically meaning of the new authorization object will be if user has this authorization then user can user class without having authorization for XD01. Your user administrator would would have to be careful with assigning this new authorization but it should work.

Cheers

Read only

0 Likes
2,140

Excellent solution.

Is working !

Thanks a lot.

Blanca Segovia

Read only

Former Member
0 Likes
2,140

Hi,

Could you please provide me sample program where CMD_EI_API ->MAINTAIN_BAPI. I tried but i was unable to maintain the Customer Masger.

Thanks,

JD Reddy

Read only

0 Likes
2,140

Hi

This is a small program to start with this method. I hope you serve

report zcreate_cliente.

data: wa_company_code_st type cmds_ei_company,

wa_company_code type cmds_ei_cmd_company,

wa_customer type cmds_ei_extern,

wa_customers type cmds_ei_main,

wa_address type bapiad1vl,

wa_addressx type bapiad1vlx,

wa_central_data type cmds_ei_vmd_central_data,

wa_central_datax type cmds_ei_vmd_central_data_xflag,

wa_error type cvis_message.

constants c_update type c value 'M'.

start-of-selection.

free: wa_customer, wa_company_code_st, wa_customer.

wa_company_code_st-task = c_update.

wa_company_code_st-data_key-bukrs = 'A105'.

wa_address-name = 'Nombre Cliente'.

wa_address-country = 'MX'.

wa_address-langu = 'E'.

wa_address-time_zone = 'UTC-6'.

wa_customer-central_data-address-postal-data = wa_address.

wa_customer-central_data-address-postal-datax = wa_addressx.

wa_customer-central_data-central-data-ktokd = '0200'.

wa_customer-central_data-central-datax-ktokd = 'X'.

append wa_company_code_st to wa_company_code-company.

wa_customer-header-object_instance-kunnr = '0300002832'.

wa_customer-header-object_task = c_update.

wa_customer-company_data = wa_company_code.

append wa_customer to wa_customers-customers.

call method cmd_ei_api=>maintain_bapi

exporting

is_master_data = wa_customers

importing

es_message_correct = wa_error.

if wa_error-is_error is initial.

commit work.

endif.

Regards,

Blanca Segovia

Read only

madhu_vadlamani
Active Contributor
0 Likes
2,140

HI Blanca,

I am trying to create a customer from external system into sap. I heard there is no standard bapi for this. By seeing your mail i understood it is possible through classes. Can you give me some idea how to create it.

Regards,

Madhu.

Read only

0 Likes
2,140

Hi

I used the method MAINTAIN_BAPI of the class CMD_EI_API.

The transaction to see the class is se24

You must map the data in the structure of the method and finally call the method like the last example.

I can send you an example about some specific data, please said me which data you need.

Other option is the LSMW.

http://sapbrainsonline.com/TOOLS/LSMW/SAP_LSMW_steps_introduction.html

Regards,

Blanca Segovia.

Read only

0 Likes
2,140

Hi Blanca,

I have to create a customer from external system . I tried to create bapi for customer creation. I think to use this class ( CMD_EI_API method MAINTAIN_BAPI ) in this bapi . Is it possible to work like this.

Regards,

Madhu.

Read only

0 Likes
2,140

Hi Madhu:

It is possible, using a function with Processing type: Remote-Enabled Module.

Regards,

Blanca Segovia.