Skip to Content
avatar image
Former Member

BAPI_PR_CREATE doesnt allow change field CREATED_BY (EBAN-ERNAM)

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Aug 04, 2017 at 08:37 PM

    see OSS note 1765860 - PReq created by RFC user

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 07, 2017 at 01:52 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 08, 2017 at 02:11 PM

    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.
    Add comment
    10|10000 characters needed 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.