2013 Oct 04 1:55 PM
Hi,
I want to validate my input data for PA40 before my Call Transaction. The issue occurs because as I go inside the t-code, the internal commits happen creating the Infotypes. I want to capture error of say third screen, but a commit is happening before that. Please let me know how can I avoid that commit because I want to validate data only, not save it.
Thanks in advance.
Hi,
I want to validate my input data for PA40 before my Call Transaction. The issue occurs because as I go inside the t-code, the internal commits happen creating the Infotypes. I want to capture error of say third screen, but a commit is happening before that. Please let me know how can I avoid that commit because I want to validate data only, not save it.
Thanks in advance.
2013 Oct 04 2:28 PM
Bhavya,
Search in SAP HCM forum you will get lots of helpful replies.
Also, we don't write BDC etc.on PA40. It should always use PA30.
Instead you can use HR_MAINTAIN_MASTERDATA with LUW_MODE as SPACE to avoid data commit and check your results.
You can get lots of details on this if you search in google.
Regards,
Amit
2013 Oct 04 5:33 PM
Hi Bhavya,
As Amit suggested you can use HR_MAINTAIN_MASTERDATA instead of BDC. You can check the sample code below:
DATA: t_return TYPE bapireturn1,
t_values TYPE STANDARD TABLE OF pprop, "Internal table for Hr_maintain_masterdata
wa_values LIKE LINE OF t_values. "Work area for Hr_maintain_masterdata
DATA: operation TYPE pspar-actio.
DATA: ls_return TYPE bapireturn1.
operation = 'INS'.
CLEAR wa_values.
wa_values-infty = '0040'.
wa_values-fname = 'P0040-BEGDA'.
wa_values-fval = is_data-begda.
APPEND wa_values TO t_values.
CLEAR wa_values.
wa_values-infty = '0040'.
wa_values-fname = 'P0040-ENDDA'.
wa_values-fval = is_data-endda.
APPEND wa_values TO t_values.
CLEAR wa_values.
wa_values-infty = '0040'.
wa_values-fname = 'P0040-LEIHG'. " Object on loan
wa_values-fval = is_data-reqtp.
APPEND wa_values TO t_values.
CLEAR wa_values.
wa_values-infty = '0040'.
wa_values-fname = 'P0040-ANZKL'. " Number
wa_values-fval = '1'.
APPEND wa_values TO t_values.
CLEAR wa_values.
wa_values-infty = '0040'.
wa_values-fname = 'Q0040-EITXT'. " Unit
wa_values-fval = 'Pieces'.
APPEND wa_values TO t_values.
* CLEAR wa_values.
* wa_values-infty = '0040'.
* wa_values-fname = 'P0040-ZEINH'. " Unit
* wa_values-fval = '20'.
* APPEND wa_values TO t_values.
CLEAR wa_values.
wa_values-infty = '0040'.
wa_values-fname = 'RP50M-TEXT1'.
WRITE is_data-amont TO wa_values-fval.
CONDENSE wa_values-fval.
APPEND wa_values TO t_values.
CLEAR wa_values.
wa_values-infty = '0040'.
wa_values-fname = 'RP50M-TEXT2'.
wa_values-fval = i_text1.
APPEND wa_values TO t_values.
CLEAR wa_values.
wa_values-infty = '0040'.
wa_values-fname = 'RP50M-TEXT3'.
wa_values-fval = i_text2.
APPEND wa_values TO t_values.
CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'.
CALL FUNCTION 'HR_INITIALIZE_BUFFER'
EXPORTING
tclas = 'A'
pernr = is_data-pernr.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = is_data-pernr
* IMPORTING
* RETURN =
.
CALL FUNCTION 'HR_MAINTAIN_MASTERDATA' "Function module for uploading Master data
EXPORTING
pernr = is_data-pernr
actio = operation
tclas = 'A'
begda = is_data-begda
endda = '99991231'
dialog_mode = '0'
no_existence_check = space
no_enqueue = space
IMPORTING
return1 = t_return
TABLES
proposed_values = t_values
.
IF t_return-type = 'E'.
e_error = abap_true.
e_msg = t_return-message.
ENDIF.
You can call this FM in a loop for mass upload.
2013 Oct 07 8:53 AM
Hi Ajay,
How do I decide my Infotype when I go through PA40.
For example you have given
wa_values-infty = '0040'.everywhere in your code.
2013 Oct 07 9:02 AM
Hi Bhavya,
The function module HR_MAINTAIN_MASTERDATA updates master data through dialog module. You can see this if you check the source code of the FM. All you have to do is mention the infotype number, screen field name and field value which you want to update.
In my case I wanted to update infotype '0040' which is objects on loan. For infotype '0040' I am updating several fields in the infotype as mentioned in the sample code.
Similarly you can also update infotypes you need. You can update multiple infotypes and multiple records for the same infotype also. For eg. if you want to update the Education infotype '0022', You can append multiple records of '0022' entries.
Hope its clear for you.
Let me know if you need any help.
Thanks,
Ajay Bose
2013 Oct 07 10:51 AM
Thanks for the response Ajay.
Can you please tell me in brief whether there is there any HR table that could tell me the Infotype for a selected "Personnel Action" in PA40.
2013 Oct 07 11:24 AM
Hi Bhavya,
The infotype for Actions is '0000'. If you click on F4 help of field infotype in PA30 you will get the numbers and names.
Thanks,
Ajay Bose
2015 Jan 29 10:28 AM
Hi Ajay,
By proceeding the similar way, I am not getting the errors if I pass any.
E.g. I am passing wrong value for field Other Title (i.e. P0002-NAMZU) in Personal Data in PA30.
How do I overcome this trouble?
2013 Oct 07 6:22 AM
Hi,
Use "'HR_INFOTYPE_OPERATION'" with NOCOMMIT = 'X' ,
also Check this Note 615511 - Long runtimes with
'HR_INFOTYPE_OPERATION' or 'HR_MAINTAIN_MASTERDATA' for HR infotypes
if you go with "HR_MAINTAIN_MASTERDATA" FM it always "Commit" due to
because LU_MODE is One Character Field in Import Parameter in above FM , So if you send what ever value send like space,0,1,2 etc.....it always satisfy the above "IF" Condition .
if "LUW_MODE"=1 then
So, my point of view if you go with "HR_MAINTAIN_MASTERDATA" FM then Create a Z - Copy and Change this Condition as per your requirement .
Regard's
Smruti
2013 Oct 08 10:38 AM
Hi,
I suppose the issue mentioned by you for calling of FM "HR_MAINTAIN_MASTERDATA" does not occur if I pass "LUW_MODE=2" at the time of calling this FM.
Let me know if I am missing something else.
2013 Oct 08 11:49 AM
Yeah you are right , it is my mistake "NA" not 'NE' , then you can pass any value other then "LUW_MODE" =1 ,easily bypass Commit Work ...
Regard's
Smruti
2013 Oct 07 8:24 AM
Hi Bhavya,
You can set flags to trace the error on 3rd screen.
As well use HR_INFOTYPE_OPERATION with nocommit = 'X'.
Refer below code:
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '4000'
number = pernr
validityend = '99991231'
validitybegin = wa_4000-begda
record = wa_4000
operation = 'INS'
tclas = 'B'
dialog_mode = '0'
nocommit = 'X'
IMPORTING
return = return
.
Use 'BAPI_TRANSACTION_COMMIT' , if all infotypes are updated.
IF return is initial.
clear : lv_update_infotypes.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = '5'
IMPORTING
RETURN = return1
ENDIF.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |