cancel
Showing results for 
Search instead for 
Did you mean: 

Error in updating infotype 0581 through a web dynpro application

Former Member
0 Kudos

I am using a method in which function module HR_INFOTYPE_OPERATION is there.

Through a normal SAP report i am able to insert/update records in infotype 0581 but with web dynpro application its giving dump.

The error is raised from the set_context method. Its raising exception CX_HRPA_VIOLATED_PRECONDITION and while excuting web dynpro application, its giving precondition violation.

The value of the a_context should be initial but in case of going through webdynpro but it is not initial.

I have searched in many places but unable to find any solution on this...................

Accepted Solutions (0)

Answers (4)

Answers (4)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Based on the context node value, if it is expected to be 0 or more, make sure the cardinality is set as 0.n in node properties.

Abhijeet-K
Active Participant
0 Kudos

Hi Harshit,

Firstly, this is not Web Dynpro ABAP error. It should be in General ABAP. I would recommend you to move it there.

Coming to the issue, perhaps, you are calling the update in a loop, while keeping the locks and HR buffers unclean. Ideal way to call HR_INFOTYPE_OPERATION is as follows:

  • Business Logic
  • For each distinct employee
    • Refresh buffers. Use BUFFER_REFRESH_ALL.
    • Enqueue employee. If found locked, proceed to next employee.
    • For all available records to be updated
      • Do the business operations on read data
      • Call HR_INFOTYPE_OPERATION, with appropriate operation mode with 'NOCOMMIT' set.
      • Read return. If failure is reported, roll back work (using BAPI_TRANSACTION_ROLLBACK), dequeue employee and proceed to next employee, optionally logging error. If successful, optionally log success.
      • Commit Work. Use BAPI_TRANSACTION_COMMIT.
    • Dequeue employee
    • For safety sake, call BUFFER_REFRESH_ALL yet again.
  • Business Logic

This ensures no conditions are violated.

Former Member
0 Kudos

Hi Abhijeet,

Actually from report i am able to update or insert record in 581 for any pernr, but while using it in my webdynpro application its giving error, so i posted it here.

This exception raised in a method set_context, checked some notes also but got nothing

And i have used all the FM u told, but still getting the same error....

I have changed the operation also, INS then LIS9 and MOD, but its not working for any of it.

Abhijeet-K
Active Participant
0 Kudos

Hi Harshit,

If identical code in an executable report is working, try calling the report with SUBMIT, in the web dynpro method. Ensure that the SUBMIT call is written within a FM.

Former Member
0 Kudos

Hi Sushiptha,

There is a discussion in the link u sent me but it lacks providing any solution for that problem.

I am still searching for a solution to sort out that issue.

Anyways thanks for reply.

Regards,

Harshit

Former Member
0 Kudos

Hi Harshit,

Follow the below link it will help u

http://scn.sap.com/thread/1399877

Regards,

Sushiptha