Skip to Content
0
Former Member
Sep 26, 2005 at 12:52 PM

Problem while Extending the HR IDOCS

700 Views

Hi All,

We are working on IDOC's for payroll and we use transaction pfal for it

Now , the message type we use is HRMD_A and the coressponding Basic IDOC type is HRMD_A06 ( both are system defined)

However , we have added custom fields in infotype 0001, which are not being captured by standard IDOC

Hence , we need to extend IDOC HRMD_A06 , for which we did following :

Step 1 :(we31)

We created new segment Z1P0001 , containing custom fields from infotype 0001

Step 2 :(we30)

We created an extension of IDOC HRMD_A06 by name HRMD_A06EX to include this segement as child segment of E1P0001

Step 3 :(we30)

Then we created an extended IDOC by name ZHRMD_A06EX having base type as HRMD_A06 and extension as HRMD_A06EX

Step 4 :(we81)

We added an entry against message type HRMD_A , with base type : HRMD_A06 , extension : HRMD_A06EX , version : 640

Step4 :(we20)

Now , we made changes to partner profile by adding entry for message type HRMD_A with base IDOC type as HRMD_A06 and extension as HRMD_A06EX

Step 5:

Then we also wrote a user-exit to populate the custom fields

Enhancement : RHALE001

User Exit : EXIT_SAPLRHA0_001 (HR-CA: ALE Outbound Processing With Receiver Determination )

INCLUDE ZXHALU01 .

Code of include

&----


*& Include ZXHALU01

&----


DATA : P0001 LIKE E1P0001,

BEGIN OF Z1P0001 OCCURS 0,

ZZDESG LIKE Z1P0001-ZZDESG,

ZZDEPB LIKE Z1P0001-ZZDEPB,

ZZLOCN LIKE Z1P0001-ZZLOCN,

ZZDEPT LIKE Z1P0001-ZZDEPT,

END OF Z1P0001.

LOOP AT T_IDOC_DATA.

CASE T_IDOC_DATA-SEGNAM.

WHEN 'E1P0001'. " has PERNR in it

MOVE T_IDOC_DATA-SDATA TO P0001.

V_SUBRC = SY-TABIX .

EXIT.

ENDCASE.

ENDLOOP.

  • Select data from the user-defined fields

SELECT SINGLE * FROM PA0001 WHERE PERNR = P0001-PERNR .

.

  • set the IDoc extension name for control record

F_IDOC_CONTROL-CIMTYP = 'ZHRMD_A06EX'.

  • clear and fill extended segment with user-defined fields

CLEAR Z1P0001.

  • copy custom fields to the extended segment.

MOVE-CORRESPONDING PA0001 TO Z1P0001. "field names must be same

  • condense all fields of extended segment

CONDENSE: Z1P0001-ZZDESG,

Z1P0001-ZZDEPB,

Z1P0001-ZZLOCN,

Z1P0001-ZZDEPT.

V_SUBRC = V_SUBRC + 1 .

MOVE 'Z1P0001' TO T_IDOC_DATA-SEGNAM .

MOVE Z1P0001 TO T_IDOC_DATA-SDATA.

INSERT T_IDOC_DATA INDEX V_SUBRC . "please note this statement

Now when we execute pfal

In this case , we are inserting the Z-Segment , which defeats the use of extending IDOC type

We believe that since , we have extended IDOCS , we sholud automatically get the Z-segment and purpose of user-exit should be only to move data to Z-segment

Please suggest us alternate solution so that we automatically get the extended IDOC type and in user-exit we directly move data

Also please validate the above steps

Awaiting a response

Shikha Jain