Application Development and Automation 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: 
Read only

IDOC

Former Member
0 Likes
1,116

Hi all

i have created one outbound custom idoc..i need to pass data from standard idoc to this custom idoc in SAP.then i need to pass this custom idoc to XI.for e.g when user creates Purchase Order, all the purchase order data should populate in to standard idoc,then it should go to custom idoc.how can we populate standard idoc as soon as user saves PO data.

regards

shankar

Hi all

i have created one outbound custom idoc..i need to pass data from standard idoc to this custom idoc in SAP.then i need to pass this custom idoc to XI.for e.g when user creates Purchase Order, all the purchase order data should populate in to standard idoc,then it should go to custom idoc.how can we populate standard idoc as soon as user saves PO data.

regards

shankar

7 REPLIES 7
Read only

Former Member
0 Likes
1,039

hi,

when u have a std idoc which serves your purpose there is no point in transfering the data to custom idoc again.and in your case u can write a user exit in the selection program of standard idoc.but this is adhoc.

Read only

0 Likes
1,039

hi nitha

thanx for ur input.my custom idoc has so many other fields

which is recquired for receiver. custom idoc is mandatory here. i can pass data from std idoc to custom idoc.. but how to populate standard idoc as soon as user saves the data

regards

Read only

0 Likes
1,039

for this no need to create another idoc we can extend the idoc and for the populating data into extended filedswe can write code in the appropriate user exits which u can find which will trigger.for more help finding on user eitxs i can help further.

Read only

Former Member
0 Likes
1,039

Hi ,

May be you are confused. If you wanna add some Zfields into basic which you cannot find , you can do this by extending PO IDOC and create new message type using WE81 and attach this using WE82.

Regards,

Raghav

Read only

0 Likes
1,039

thanx for the input..not only PO if user creates anything it should go as Zidoc format.since the xml format is like zidoc format in receiver

Read only

0 Likes
1,039

Hi,

if u want to add data in custom idoc.

try this.

find the appropriate userexit where u can find the idoc number which u has been created.

use the idoc number for trigerring the custom IDOC.

See the code Same.



*----------Select data for the idoc number.

  SELECT *
  FROM edid4
  INTO TABLE lit_idoc_data
  WHERE docnum = <Idoc Number>.

*------------Change Idoc data or add addtional Field

    LOOP AT lit_idoc_data.

      wa_idoc_new-segnam = lit_idoc_data-segnam.
      wa_idoc_new-sdata  = lit_idoc_data-sdata.


*-----U can write addtion logic or changing logic within
*-----perform.
      PERFORM change_add_idoc_data USING wa_idoc-segnam
                                  CHANGING wa_idoc-sdata.


*---output is lit_idoc_new

    ENDLOOP.


*----Fill Control Detail & Call master idoc Distribute

    wa_midcntrl-rcvpor = <Value>..
    wa_midcntrl-rcvprt = <Value>..
    wa_midcntrl-rcvprn = <Value>..
    wa_midcntrl-sndpor = <Value>..
    wa_midcntrl-sndprt = <Value>.
    wa_midcntrl-sndprn = <Value>..
    wa_midcntrl-mestyp = <Value>.
    wa_midcntrl-idoctp = <Value>.

    REFRESH : lit_midcntrl.

    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
      EXPORTING
        master_idoc_control            = wa_midcntrl
      TABLES
        communication_idoc_control     = litt_midcntrl
        master_idoc_data               = lit_idoc_new
      EXCEPTIONS
        error_in_idoc_control          = 1
        error_writing_idoc_status      = 2
        error_in_idoc_data             = 3
        sending_logical_system_unknown = 4
        OTHERS                         = 5.






within perform

logic can be like this


  CASE xv_segnam.

    WHEN <Segment1>.

*---------------  logic
append lit_idoc_new
    WHEN <Segment2>.

*---------------  logic
append lit_idoc_new
    WHEN <Segment3>.

*---------------  logic
append lit_idoc_new
ENDCASE.



Read only

0 Likes
1,039

Hi ,

If you wanna extend idoc follow these steps.

Configuration Steps:

1) Create New Segments (Tcode WE 31)

2) Extend IDOC (WE30)

3) Create New Message Type(WE81)

4) Assign IDOC to Message Type(WE82)

5) Assign Message Type To Process Code(WE41):

6) Assign Message Type to Model View(BD64):

7) Assign Message Type/IDOC to Partner Profile(WE20)

Development

1.Find appropriate USEREXIT

2.Create Project Using CMOD

3.Choose the Enhancement and the Exit FM

4. Write your code in the include.

PSEUDO CODE:

IF control_record_out-mestyp = 'ZORDRSP' AND control_record_out-idoctp = 'ORDERS05'

LOOP AT dint_edidd WHERE segnam = 'E1EDK01'

dint_edidd-segnam = 'Z1EDK35'. dint_edidd-sdata = wa_vbkd-bsark_e. INSERT dint_edidd INDEX v_tabix.

ENDLOOP.

Regards,

Raghav