Skip to Content
0

BAPI_PR_CREATE doesnt allow change field CREATED_BY (EBAN-ERNAM)

Aug 04, 2017 at 07:34 PM

186

avatar image
Former Member

We have implemented the bapi BAPI_PR_CREATE to replace the old bapi BAPI_REQUISITION_CREATE, but the problem is that the field EBAN-ERNAM is not allow to modify, so as creator of PR is communication user (COMM_USER).

Is posible to change field CREATED_BY from bapi BAPI_PR_CREATE?

I try to use the badi me_process_req_cust~process_item with this code:


CALL METHOD im_item->get_data
RECEIVING
re_data = r_pos_solped.

r_pos_solped-ernam = 'SAPOSS'.

CALL METHOD im_item->set_data
EXPORTING
im_data = r_pos_solped.

but this code dosent work.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Jürgen L
Aug 04, 2017 at 08:37 PM
0

see OSS note 1765860 - PReq created by RFC user

it has source code for a BAdI to have a different CREATED_BY

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Aug 07, 2017 at 01:52 PM
0

Thanks Jürgen L,

I have tried with the instruction of note 1765860 - PReq created by RFC user but the code does not work :(

Any other idea?

Regards

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Aug 08, 2017 at 02:11 PM
0

Thank Jürgen L,

Your solution is ok, i have a problem because i make an update in item method insted header method.

The solution was:

lt_items = im_header->get_items( ).



    LOOP AT lt_items REFERENCE INTO lr_item.

      ls_item = lr_item->item->get_data( ).

      ls_itemx = lr_item->item->get_datax( ).

      IF ls_item-ernam NE 'USERX'.

        ls_item-ernam  = 'USERX'.

        ls_itemx-ernam = abap_true.

        lr_item->item->set_data( ls_item ).

        lr_item->item->set_datax( ls_itemx ).

      ENDIF.
    ENDLOOP.
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Jürgen L,

I have the same problem with EBAN-CREATED_BY field but with BAPI_PO_CREATE1 and EKKO-CREATED_BY. I need to change RFCUSER filled by default. Any idea?

Thanks a lot and best regards.
Marce.

0