Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Sending the enhanced Infotype 0002 outside SAP via an IDOC

Former Member
0 Kudos

Hello Friends,

We have added couple of Z fields to the standard 0002 Iinfotype table PA0002.

I can see the custom fields in the trans : PA30 screen for infotype 002.

Now, we want to send these custom fields value outside SAP via an IDOC.

Here are the steps I followed :

  • I created a Z Segment in an extended idoc with the structure PA0002.

  • I went in transaction PM01 for Infotype 0002 and added the above created Z segment as a 2nd IDOC segment.

  • In transaction PA30 for 002, I made changes to the custom field value for a person 12039.

  • Created an idoc via BD21.

  • IDOC generated with the Z Segment but it doesn't contain any Z custom fields.

Which step am I missing here? Do I have to have a user-exit or BADI to achieve this OR can it be done without writing any code?

Basically I

I will really appreciate your help.

Regards,

Pooja Pandey

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Pooja,

you need to manually add custom fields to segment in we30 and add that segment to basic type in we31.

you can use user exit EXIT_SAPLRHA0_001 to fill the custom segment

check the subroutines perform fill_segment_**********in fm RH_MASTER_IDOC_DISTRIBUTE_HRMD for the format to fill segments

Thanks

Bala Duvvuri

14 REPLIES 14

Former Member
0 Kudos

HI,

  • In transaction PA30 for 002, I made changes to the custom field value for a person 12039.

===> Please check and confim after channges to the custom fields data is stored in table: PA0002 or not?

Regards

Sudheer

Former Member
0 Kudos

Pooja,

you need to manually add custom fields to segment in we30 and add that segment to basic type in we31.

you can use user exit EXIT_SAPLRHA0_001 to fill the custom segment

check the subroutines perform fill_segment_**********in fm RH_MASTER_IDOC_DISTRIBUTE_HRMD for the format to fill segments

Thanks

Bala Duvvuri

0 Kudos

Hi Bala,

Thanks for your response.

The custom fields are added to the table PA0002. (https://wiki.sdn.sap.com/wiki/display/Snippets/Enhance%20Infotypes%20using%20PM01%20in%20ECC%206.0)

I haven't Manually added the custom fields to segment, instead,i have referenced DDIC structure: PA0002 to the custom segment Z1P0002

Can I avoid changing any Userexit or BADI to fill the custom fields ( of PA0002 table ) in IDOC?

I was checking into SDN forums and some expert replied that we can populate custom fields of an enhanced infotype(0002)

in IDOC seg without writing any ABAP code.

Amit's response on :

===================================================================================================

Hi Sudheer,

After I make changes to the Screen's Custom fields in transaction PA30, the data gets to the table PA0002.

So, the issue is mainly to fetch these Zfields from the PA002 table and populate them in the Zsegment Z1P0002.

====================================================================================================

Regards,

Pooja Pandey

0 Kudos

Pooja,

have you done all the steps mentioned by Amit in the other thread

Thanks

Bala Duvvuri

0 Kudos

Hi Bala,

I have performed all the step except the last step, which says :

"and you should made settings in table T777D: infotype 0001->IDOC segment: Z1P0001.

When I entered Z1P0002 as an IDOC segment in T777D, the BD21 doesnt recognize any changes done on screen PA30 and hence no idocs get generated.

So I entered Z1P0002 as a 2nd IDOC segment and kept E1P0002 as an IDOC segment for infotype 0002 as shown: http://img526.imageshack.us/img526/681/pm01.png

Regards,

Pooja

0 Kudos

Pooja,

check the table BDCP2 whether change pointers are getting created when you make changes in IT0002 custom fields

Thanks

Bala Duvvuri

Edited by: Bala Duvvuri on May 19, 2010 10:19 AM

0 Kudos

Hi Bala,

In PM01 (T777D),

if I specify the IDOC segment as Z1P0002, change pointer entry are not getting created in BDCP2 (http://img188.imageshack.us/img188/6735/fullscreencapture519201.jpg)

but

if I specify the IDOC segment as E1P0002 and 2nd IDOC segment as Z1P0002, change pointer entry are getting created in BDCP2. ( http://img526.imageshack.us/img526/681/pm01.png)

Pooja

0 Kudos

Pooja,

may be you need to debug and see what is the issue

try to use tcode PFAL and check how is it behaving

Thanks

Bala Duvvuri

0 Kudos

Thanks Bala.

Any inputs from experts on populating the custom fields of a standard infotype(0002) in a custom segment without writing any ABAp code?

0 Kudos

Pooja,

2nd segment in T777d for IT 002 is E1Q0002 by default.did u you change 2nd or 3rd to put your custom segment,i guess it should be 3rd segment

Thanks

Bala Duvvuri

0 Kudos

Tried putting E1Q0002 as 2nd Seg and Z1P0002 as 3rd Seg, but no success.

Actually I got an error as " EDI: Syntax error in IDoc (segment cannot be identified)" because Z1P0002 is under E1P0002.

IDOC segment level :

---E1PITYP

----


E1P0002

----


Z1P0002

----


E1Q0002

Regards,

Pooja Pandey

0 Kudos

Seems that its not possible to achieve the populating of Custom fields of PA0002 into the idoc Z segment with any abap code.

I came across the note "SAP Note 105148 - HR-CA-ALE: Additional infotypes for distribution " and followed the steps given on Page 4.

1. What applies to HRMD_A, also applies to HRMD_ABA.
2. If you enhance a segment of an infotype, for which a conversion routine
exists (CONVERT_Pxxxx_TO_E1Pxxxxx, where xxxx is the infotype; for example,
CONVERT_P0002_TO_E1P0002), you need to create your own conversion routine
and call EXIT_SAPLRHAL_003 "HR-CA: ALE outbound processing: Conversion
Infotype/Seg" from the customer exit.
For example:
- If the infotype is defined for several IDoc segments, you should define
all segments as Z segments.
- Copy function module CONVERT_P0002_TO_E1P0002 into
Z_CONVERT_P0002_TO_Z1P0002 and ensure that the new Z segment is defined and
used instead of the old E segment.
- This Z function module should return parameter CONVERTED with X.
- Create the following (or similar) source code in customer exit
EXIT_SAPLRHAL_003 (transaction SMOD/CMOD)
CONSTANTS: c_0002(4) TYPE c VALUE '0002'.
IF INFTY_NAME = c_0002.
CALL FUNCTION 'Z_CONVERT_P0002_TO_Z1P0002'
EXPORTING pnnnn_data = pnnnn_data
IMPORTING converted = converted
subrc = subrc
TABLES error_tab = error_message
CHANGING sdata_data = sdata_data
EXCEPTIONS OTHERS = 0.
ENDIF.
- Check whether you have already implemented Note 1005257.

But I still get an empty Z1p0002 segment in my idoc...

Any inputs?

Will really appreciate your help.

Thanks,

Pooja Pandey

0 Kudos

Pooja,

you need to fill each field manually.

check this code i am filling ZHCMS_PI_SEMENT

data: sgmnt_e1pityp type e1pityp.

field-symbols: <wplog> type any.

field-symbols: <wplog1> type any.

data: ixxxx type e1pityp, iyyyy type e1plogi,sgmnt_hcms_pi type zhcms_pi_segment,wa_idoc_data_x type edidd, ls_idoc_data type edidd.

data: lv_p0001 type standard table of p0001 ,lv_p0002 type standard table of p0002 ,lv_p0007 type standard table of p0007 .

data: lv_p0521 type standard table of p0521 ,lv_p0710 type standard table of p0710 ,lv_p2001 type standard table of p2001 .

data: ls_p0001 type p0001,ls_p0002 type p0002,ls_p0007 type p0007 ,ls_p0521 type p0521 ,ls_p0710 type p0710 ,ls_p2001 type p2001 .

data: row_index type sy-tabix,del_index type sy-tabix.

data: lcx_root type ref to cx_root.

  • fILL THE E1PITYP

try.

            • Keep the segments which have changed date greater than last run date in update mode

read table idoc_data into wa_idoc_data_x with key segnam = 'E1PITYP'.

assign wa_idoc_data_x-sdata to <wplog> casting type e1pityp.

ixxxx = <wplog>.

loop at idoc_data into wa_idoc_data_x where segnam = 'E1PLOGI'.

row_index = sy-tabix + 1.

assign wa_idoc_data_x-sdata to <wplog1> casting type e1plogi.

iyyyy = <wplog1>.

sgmnt_e1pityp-plvar = ixxxx-plvar.

sgmnt_e1pityp-otype = ixxxx-otype.

sgmnt_e1pityp-objid = iyyyy-objid.

sgmnt_e1pityp-infty = '0001'.

sgmnt_e1pityp-begda = ixxxx-begda.

sgmnt_e1pityp-endda = ixxxx-endda.

clear ls_idoc_data.

ls_idoc_data-segnam = 'E1PITYP'.

ls_idoc_data-sdata = sgmnt_e1pityp.

insert ls_idoc_data into idoc_data index row_index.

  • APPEND t_idoc_data .

  • Get the ZZSWISSREID

sort lv_p0001 by begda descending.

read table lv_p0001 into ls_p0001 index 1.

sgmnt_hcms_pi-zzswissreid = ls_p0001-zzswissreid.

  • Get the custom data from IT0002

sort lv_p0002 by begda descending.

read table lv_p0002 into ls_p0002 index 1.

sgmnt_hcms_pi-zzglobalid = ls_p0002-zzglobalid.

sgmnt_hcms_pi-zzsource_id = ls_p0002-zzsource_id.

sgmnt_hcms_pi-zzlegacy_emp_id = ls_p0002-zzlegacy_emp_id.

ls_idoc_data-segnam = 'ZHCMS_PI_SEGMENT' .

ls_idoc_data-sdata = sgmnt_hcms_pi.

row_index = row_index + 1.

insert ls_idoc_data into idoc_data[] index row_index.

clear : lv_p2001[] , lv_p0001[] , lv_p0002[] , lv_p0710[] ,lv_p0007[], lv_p0521[], ls_p2001 , ls_p0001 , ls_p0002 , ls_p0710 ,ls_p0007, ls_p0521 .

  • APPEND t_idoc_data.

endloop.

Thanks

Bala Duvvuri

0 Kudos

I am able to get the custom fields of the table PA0002 in my IDOC after implementing the note.

While following the steps of the note, i missed following step.: "-

This Z function module should return parameter CONVERTED with X

." Once its was there... everything work as expected.

Thanks all for you help and time.

Regards,

Pooja Pandey