Skip to Content
0
Former Member
Apr 22, 2009 at 12:45 PM

CREATE/UPDATE Infotype Records

128 Views

Hi,

Am using the following code to insert records into InfoType PA0001 ,its not creating a new record and giving this Dump ....Any suggestion or Examples on this Please ...

Dump :

The source field is too short.

In the running program "SAPLHRMM" a field should have been assigned to a field

symbol, which is shorter than the type of the field symbol.

This is not possible.

It is a statement of the form ASSIGN f TO <fs> CASTING...

or ASSIGN f TO <fs> with a field symbol that was created with the

STRUCTURE addition.

*******************my code *************************

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(EMPNO) TYPE PERSNO

*"----


DATA: RETURN LIKE BAPIRETURN1.

DATA: P0001 TYPE P0001.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

NUMBER = EMPNO

IMPORTING

RETURN = RETURN.

IF NOT RETURN IS INITIAL.

WRITE: / EMPNO, 'Enqueue failed'.

EXIT.

ENDIF.

DATA: WA_PA0001 TYPE PA0001.

SELECT SINGLE * FROM PA0001 INTO WA_PA0001

WHERE PERNR = EMPNO

AND ENDDA = '99991231'.

WA_PA0001-ENDDA = '20090422'.

*CHANGE THE EXISTING RECORD FROM PA0001.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

INFTY = '0001'

NUMBER = EMPNO

  • SUBTYPE = WA_PA0001-SUBTY

  • OBJECTID =

  • LOCKINDICATOR =

VALIDITYEND = WA_PA0001-ENDDA

VALIDITYBEGIN = WA_PA0001-BEGDA

RECORDNUMBER = '01'

RECORD = WA_PA0001

OPERATION = 'INS'

  • TCLAS = 'A'

DIALOG_MODE = '0'

NOCOMMIT = '1'

  • VIEW_IDENTIFIER =

  • SECONDARY_RECORD =

IMPORTING

RETURN = RETURN

  • KEY =

.

IF return-id NE space.

WRITE: / EMPNO,

20 'Create was unsuccessful',

return-id,

return-message+0(40).

ELSE.

WRITE: / EMPNO,

20 'Create was successful',

return-id,

return-message+0(40).

ENDIF.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

NUMBER = EMPNO

IMPORTING

RETURN = RETURN

.

Thanks,

Kumar