Application Development 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: 

BAPI_GOODSMVT_CREATE and authority check

Former Member
0 Kudos

Hi!

I'm working with BAPI_GOODSMVT_CREATE and I want to do not execute authorization check about plant or to change the user used to generate the document (with SAP_ALL to bypass auth-check).

Do you know if it is possible?

Thanks,

Gianluca

5 REPLIES 5

Former Member
0 Kudos

Can you have a look at OSS note 402522 ? It talks about something similar. I don't have access now, so I can't check myself.

0 Kudos

Yes,

but this note show how solve a missing Authorization checks with BAPI.

My problem is how do not execute any authority check, or how change the user to use a SAP-ALL.

Thanks,

Gianluca

Former Member
0 Kudos

Hi simeone,

1. Posting data thru a BAPI

is the same as

doing data entry manually in that particular transaction.

2. So when that bapi is executed,

the authority-check (for the user who

is logged on and running the program/bapi)

will be done.

(We cannot bypass it)

3. Other wise for such transactions,

create another user id

with SAP_ALL authorisation.

regards,

amit m.

Former Member
0 Kudos

HI

The following is the BAPI_GOODSMVT_CREATE code, which may help you.

<b>DATA: gmove_header LIKE bapi2017_gm_head_01,

gmove_code LIKE bapi2017_gm_code.

DATA: BEGIN OF gmove_line OCCURS 0.

INCLUDE STRUCTURE bapi2017_gm_item_create.

DATA: END OF gmove_line.

DATA: headret LIKE bapi2017_gm_head_ret,

matdoc TYPE bapi2017_gm_head_ret-mat_doc,

docyear TYPE bapi2017_gm_head_ret-doc_year.

DATA: BEGIN OF return OCCURS 0.

INCLUDE STRUCTURE bapiret2.

DATA: END OF return.

DATA: wa_comp LIKE gt_comp.

SORT gt_comp ASCENDING BY bldat matnr.

LOOP AT gt_comp INTO wa_comp.

IF wa_comp-budat = '00000000'.

wa_comp-budat = sy-datum.

ENDIF.

IF wa_comp-bldat = '00000000'.

wa_comp-bldat = sy-datum.

ENDIF.

MOVE '06' TO gmove_code-gm_code.

CLEAR gmove_header.

MOVE wa_comp-bldat TO gmove_header-doc_date.

MOVE wa_comp-budat TO gmove_header-pstng_date.

MOVE wa_comp-matnr TO gmove_line-material.

MOVE wa_comp-werks TO gmove_line-plant.

MOVE wa_comp-lgort TO gmove_line-stge_loc.

MOVE wa_comp-bwart TO gmove_line-move_type.

MOVE wa_comp-erfmg TO gmove_line-entry_qnt.

MOVE wa_comp-erfme TO gmove_line-entry_uom.

MOVE wa_comp-aufnr TO gmove_line-orderid.

APPEND gmove_line.

AT END OF bldat.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = gmove_header

goodsmvt_code = gmove_code

IMPORTING

goodsmvt_headret = headret

materialdocument = matdoc

matdocumentyear = docyear

TABLES

goodsmvt_item = gmove_line

return = return.

COMMIT WORK AND WAIT.

ENDAT.

ENDLOOP.

MOVE matdoc TO zmatdoc.</b>

Regards

Prabhu

former_member188685
Active Contributor
0 Kudos

Hi,

it is not possible to By pass that check. or Try to give SAP_ALL authority to that user.

so that you can bypass it.

Regards

vijay