Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Why does the NOCOMMIT parameter not work in HR_INFOTYPE_OPERATION?

Good day, everyone.

I am trying to load legacy address data into the SAP system (Infotype 0006 -- Addresses). To do this, I'm using the FM HR_INFOTYPE_OPERATION.

It seems to work -- when the call to the FM has no return table, the address is successfully updated. I check with t-code PA20 to verify that the new address was added, and I've also used SE11 to go into the PA0006 table and look at the individual records.

Here's the problem: My code is based off of an example I found where the user is asked via a simple selection screen (one item only, a checkbox) if this is a TEST RUN ONLY. It defaults to checked. This is the value for "p_test" that you see assigned to the NOCOMMIT parameter in my FM call. So, unless the user changes (unchecks) the value, it will have a value of 'X', and my understand is that with NOCOMMIT = 'X' (true) then NO COMMIT will be done. But I'm finding that's not true -- apparently a commit is still being done because I'm seeing the address information updated in the PA0006 table.

Even if I uncheck the box, just to see how things go, it still updates the table. So either way, it updates, and that makes me believe that NOCOMMIT doesn't work whether I have it as 'X' or blank. I tried going into the FM with debugger, but I got lost pretty quickly.

I figure I can't be the first one running into this strange issue, so here it is. Can anyone provide any information? My code is below. As you can see, I enqueue the person, update the Address record, then dequeue the person.

Points awarded for all helpful answers, as always. Thank you so much!

  • Lock the Employee record before update.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = wa_legacy_address-pernr

IMPORTING

return = wa_msg_return.

IF NOT wa_msg_return IS INITIAL.

ADD 1 TO w_tot_addr_errored.

MOVE wa_msg_return-message TO w_message.

PERFORM write_dataset

USING w_message.

CONTINUE.

ENDIF.

  • Call the SAP function to load the legacy address data into

  • Infotype 0006.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0006'

number = wa_legacy_address-pernr

subtype = wa_legacy_address-anssa

validityend = wa_legacy_address-endda

validitybegin = wa_legacy_address-begda

record = p0006

operation = 'INS'

nocommit = p_test

IMPORTING

return = wa_msg_return.

IF NOT wa_msg_return IS INITIAL.

ADD 1 TO w_tot_addr_errored.

MOVE wa_msg_return-message TO w_message.

PERFORM write_dataset

USING w_message.

ELSE.

ADD 1 TO w_tot_addr_posted.

MOVE 'Posted successfully' TO w_message.

PERFORM write_dataset

USING w_message.

ENDIF.

  • Unlock the Employee record after update.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = wa_legacy_address-pernr.

Tags:
Not what you were looking for? View more on this topic or Ask a question