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_PR_CREATE doesnt allow change field CREATED_BY (EBAN-ERNAM)

0 Kudos

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.

1 ACCEPTED SOLUTION

JL23
Active Contributor

see OSS note 1765860 - PReq created by RFC user

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

4 REPLIES 4

JL23
Active Contributor

see OSS note 1765860 - PReq created by RFC user

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

0 Kudos

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

0 Kudos

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.

0 Kudos

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.