‎2007 Jul 23 8:45 AM
Hii All-
I am trying to fill up infotype 6 (addresses), subtyp 1 (permanent address) of an employee. This employee is already created but there is no address infotype details. I am trying to use HR_MAINTAIN_MASTERDATA function module for this? but how to proceed? can anybody send me sample code for this? iam getting errors to fill all the entries in BAPIRETURN even though i have entered all details?
Tx
‎2007 Jul 23 9:13 AM
You have to fill internal table PROPOSED_VALUES for all infotypes you want to maintain..
Structure of proposed_values table is of type PPROP
INFTY INFTY
FNAME PROP_FNAME
FVAL PROP_FVAL
SEQNR SEQNP
You have to take care of all mandatory fields yourself.
each record should contain
INFTY = '0006'
FNAME ='STRAS'
FVAL = '123 Street'
append proposed_values. etc..
You can fill any number of fields you want to fill and any number of infotypes you want to maintain.
for each infotype, you have to fill itab like above given example..
Other parameters: you need to take care of are
PERNR,
ACTIO = should be INS in your case..
BEGDA,
ENDDA
Follow in this way..
Reward if useful
Regards
Prax
‎2007 Jul 23 10:00 AM
Hi shakir,
1. this is the full coding. (for another infotype)
<b> (But same kind will work for infotype 0006.)</b>
2. just copy paste in new program.
3. U can change the pernr and amount values as per requirement.
4.
Report abc.
*----
Data
DATA : P0015 LIKE P0015.
DATA : RETURN LIKE BAPIRETURN1.
DATA : KEY LIKE BAPIPAKEY.
DATA : RETURNE LIKE BAPIRETURN1 .
*----
Values (Change as per Requirement)
P0015-PERNR = '1'.
P0015-BEGDA = '2061101'.
P0015-ENDDA = '2061101'.
P0015-LGART = '3075'.
P0015-PREAS = '01'.
P0015-WAERS = 'INR'.
P0015-BETRG = '2500'.
*----- First Enqu
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = p0015-pernr
IMPORTING
RETURN = RETURNE.
*----
Update
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0015'
NUMBER = P0015-PERNR
SUBTYPE = P0015-SUBTY
OBJECTID = P0015-OBJPS
LOCKINDICATOR = P0015-SPRPS
VALIDITYEND = P0015-ENDDA
VALIDITYBEGIN = P0015-BEGDA
RECORDNUMBER = P0015-SEQNR
RECORD = P0015
OPERATION = 'INS'
TCLAS = 'A'
DIALOG_MODE = '0'
IMPORTING
RETURN = RETURN
KEY = KEY.
IF RETURN IS NOT INITIAL.
WRITE 😕 'Error Occurred'.
ENDIF.
*----
Dequeue
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = P0015-PERNR
.
regards,
amit m.
‎2007 Jul 23 10:43 AM
Thanks to all of u.
Amit-Can you tell me what values u have taken for date?? is there any conversion routines for date or is it simply yyyymmdd format?
Iam trying to use the same for 0006 infotype. please clarify this.
and in my case, the pernr has no values for fields like SEQNR, SPRPS, etc. Shud I leave this blank?
tx
‎2007 Jul 23 10:45 AM
Hi again,
1. it simply yyyymmdd format?
Yes, its simply YYYYMMDD format
(for all dates in sap)
2.SEQNR, SPRPS, etc. Shud I leave this blank?
Yes, U can leave those fields blank. No problem. it will work.
regards,
amit m.
‎2007 Jul 23 11:20 AM
Hii Amit-
I am getting errors. The return parameter says "FIll in all required fields".
I am trying to change the first name or insertng new field value like birthplace which was blank ealier..the code is
&----
*& Report ZTESTFM1
*&
&----
*&
*&
&----
REPORT ZTESTFM1.
DATA : P0002 LIKE P0002.
DATA : RETURN LIKE BAPIRETURN1.
DATA : KEY LIKE BAPIPAKEY.
DATA : RETURNE LIKE BAPIRETURN1 .
*----
Values (Change as per Requirement)
P0002-PERNR = '1'.
P0002-BEGDA = '20070101'.
P0002-ENDDA = '99991231'.
P0002-VORNA = 'AZIZ'.
*----- First Enqu
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = P0002-pernr
IMPORTING
RETURN = RETURNE.
*----
Update
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0002'
NUMBER = P0002-PERNR
*SUBTYPE = P0002-SUBTY
*OBJECTID = P0002-OBJPS
*LOCKINDICATOR = P0002-SPRPS
VALIDITYEND = P0002-ENDDA
VALIDITYBEGIN = P0002-BEGDA
*RECORDNUMBER = P0002-SEQNR
RECORD = P0002
OPERATION = 'MOD'
TCLAS = 'A'
DIALOG_MODE = '0'
IMPORTING
RETURN = RETURN
KEY = KEY.
IF RETURN IS NOT INITIAL.
WRITE 😕 'Error Occurred'.
ENDIF.
*----
Dequeue
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = P0002-PERNR
.
help me out
‎2007 Jul 23 10:47 AM
Hi,
Why don't you try this using PA30? if there are more number of employee create BDC for PA0006 with subtype '1' and do the updation.