How to populate IDOC segments...

Hello Experts,
I was just tasked to add new fields in an IDOC segment. My question is, how do I populate
those newly created fields? The data will be coming from a purchase order.
Thank you guys and take care!

Hi,
U cannot edit the existing segment u have to create a zsegment with the fields and then under the main segment u have to add this new segment..also u have create a extended idoc in ur case...then only u can add this new segment..also once u  create  a segment u have to release it...
u have to write the code in the userexit only...
check the sample code which i have done for my requirement for sales order..
*&  Include           ZXVEDU02
Program:        Function Module:EXIT_SAPLVEDC_002     Creation Date: 12-04-2006          *
Program Type  : Outbound IDOC Enhancement                                                *
Program Description:OutBound IDOC Enhancement                                            *
Modification ID:001                                                                      *
Date         : 25-05-2006                                                                *
Description  : 1.The sales organization master data needs to be sent as supplier party
                 details.New segment ZZSALORG is created and attached to the parent
                 segment E1EDK01
               2.Data required to be sent are:
                  1.NAME1- Sales organization name
                  2.STRAS- Address
                  3.TELFX- Fax number
                  4.TELF1- phone number.
               3.ZZSALORG is filled with the above information.
Modification ID:002                                                                      *
Date         : 09-06-2006                                                                *
Description  : A new field zstceg added to the segment zzdochdr and it was populated     *
                by selecting stceg field from Kna1 table                                 *
Modification ID:001                                                                      *
Date         : 15-06-2006                                                                *
Description  : 1.New segment ZZE1EDP01 is created and attached to the parent segment E1EDP01
               2.Data required to be sent are:
                  1.POSEX- Item number
                  2.UEBTO- Overdelivery tolerance
                  3.UNTTO- Underdelivery tolerance
               3.ZZE1EDP01 is filled with the above information.
*-- Data Declaration--
*-- Constant Declaration--
CONSTANTS: c_1(1)          TYPE c VALUE '1',
           c_langu         LIKE t005t-spras VALUE 'E',
           c_parvw         LIKE vbpa-parvw VALUE 'RG',
           c_e1edk01(7)    TYPE c VALUE 'E1EDK01',
           c_e1edk02(7)    TYPE c VALUE 'E1EDK02',
           c_e1edk17(7)    TYPE c VALUE 'E1EDK17',
           c_e1edka1(7)    TYPE c VALUE 'E1EDKA1',
           c_e1edk14(7)    TYPE c VALUE 'E1EDK14',
           c_004(3)        TYPE c VALUE '004',
           c_001(3)        TYPE c VALUE '001',
           c_002(3)        TYPE c VALUE '002',
           c_re(2)         TYPE c VALUE 'RE',
           c_we(2)         TYPE c VALUE 'WE',
           c_ag(2)         TYPE c VALUE 'AG',
           c_0010(4)       TYPE c VALUE '0010',
           c_zzdochdr(8)   TYPE c VALUE 'ZZDOCHDR',
           c_ze1edk02(8)   TYPE c VALUE 'ZE1EDK02',
           c_zze1edk17(9)  TYPE c VALUE 'ZZE1EDK17',
           c_zze1edka1(9)  TYPE c VALUE 'ZZE1EDKA1',
           c_pe(2)         TYPE c VALUE 'PE',
           c_y(1)          TYPE c VALUE 'Y',
           c_zze1email(9)  TYPE c VALUE 'ZZE1EMAIL',
           c_zzsalorg(8)   TYPE c VALUE 'ZZSALORG',
           c_zze1edp01(9)  TYPE c VALUE 'ZZE1EDP01',
           c_e1edp01(7)   TYPE c VALUE 'E1EDP01'.
*-- Variables Declaration--
DATA: lv_vbeln   LIKE vbak-vbeln,
      lv_country LIKE t005t-landx,
      lv_text1   LIKE t042z-text1,
      lv_vzskz   LIKE knb1-vzskz,
      lv_inco    LIKE tinct-bezei,
      lv_cadnr   LIKE akkp-cadnr,
      lv_pernr   LIKE pa0105-pernr,
      lv_parvw   LIKE tpar-parvw,
      lv_adrnr   LIKE tvko-adrnr,
      lv_zinso   LIKE t056z-zinso,
Begin of Mod-002
      lv_stceg   TYPE stceg.
End of Mod-002
Begin of MOD-003
     lv_min_tol TYPE KWMENG,
     lv_max_tol TYPE KWMENG.
End Of MOD-003
TYPES:BEGIN OF t_vbfa,
        vbelv LIKE vbfa-vbeln,
        erdat TYPE erdat,
      END OF t_vbfa.
DATA: i_akkp TYPE akkp.
*-- WorkArea Declaration--
DATA : wa_zdochdr   TYPE  zzdochdr,
       wa_ze1edk02  TYPE  zze1edk02,
       wa_ze1edk17  TYPE  zze1edk17,
       wa_zze1email TYPE  zze1email,
       wa_zzsalorg  TYPE  zzsalorg,
       wa_zze1edp01 TYPE  zze1edp01,
       wa_e1edk02   TYPE  e1edk02,
       wa_e1edk17   TYPE  e1edk17,
       wa_e1edka1   TYPE  e1edka1,
       wa_e1edk01   TYPE  e1edk01,
       wa_e1edp01   TYPE  e1edp01,
       wa_adrc      TYPE  adrc,
       wa_pa0105    TYPE  pa0105,
       wa_zze1edka1 TYPE  zze1edka1,
       wa_zzdochdr  TYPE  zzdochdr,
       wa_vbfa      TYPE  t_vbfa,
       wa_vbpa      TYPE  vbpa.
*-- Move data to ZZDOCHDR Segment--
CASE int_edidd-segnam.
  WHEN c_e1edk01.
    MOVE int_edidd-sdata TO wa_e1edk01.
*--Begin of MOD001+(Modification ID 001)--
*-- Filling of ZZSALORG segment--
    SELECT SINGLE adrnr
    FROM tvko
    INTO lv_adrnr
   WHERE vkorg EQ dxvbak-vkorg.
    IF sy-subrc EQ 0.
      SELECT SINGLE *
               FROM adrc
               INTO wa_adrc
              WHERE addrnumber EQ lv_adrnr.
      wa_zzsalorg-salorg  = dxvbak-vkorg.
      wa_zzsalorg-name1   = wa_adrc-name1.
      wa_zzsalorg-name2   = wa_adrc-name2.
      wa_zzsalorg-stras   = wa_adrc-street.
      wa_zzsalorg-telf1   = wa_adrc-tel_number.
      wa_zzsalorg-telfx   = wa_adrc-fax_number.
      wa_zzsalorg-land1   = wa_adrc-country.
      wa_zzsalorg-strs2   = wa_adrc-str_suppl1.
      wa_zzsalorg-street2 = wa_adrc-str_suppl2.
      wa_zzsalorg-street3 = wa_adrc-str_suppl3.
      wa_zzsalorg-ort01   = wa_adrc-city1.
      wa_zzsalorg-pstlz   = wa_adrc-post_code1.
      wa_zzsalorg-regio   = wa_adrc-region.
      int_edidd-segnam = c_zzsalorg.
      CLEAR int_edidd-sdata.
      MOVE wa_zzsalorg TO int_edidd-sdata.
      APPEND int_edidd.
      CLEAR: wa_adrc,
             wa_zzsalorg.
    ENDIF.
*--End of MOD001+(Modification ID 001)--
    SELECT SINGLE text1
             FROM t042z
             INTO lv_text1
             WHERE land1 EQ dxvbpa-land1
               AND zlsch EQ dxvbkd-zlsch.
    READ TABLE dxvbpa INTO wa_vbpa WITH KEY vbeln = dxvbpa-vbeln
                                      parvw = c_parvw.
    IF sy-subrc EQ 0.
Begin of Mod-002
      SELECT SINGLE stceg
      FROM kna1
      INTO lv_stceg
       WHERE kunnr = wa_vbpa-kunnr.
End of Mod-002
      SELECT SINGLE vzskz
               FROM knb1
               INTO lv_vzskz
               WHERE kunnr EQ wa_vbpa-kunnr
                 AND bukrs EQ dxvbak-bukrs_vf.
      IF sy-subrc EQ 0.
        SELECT SINGLE zinso
                 FROM t056z
                 INTO lv_zinso
                 WHERE vzskz EQ lv_vzskz
                   AND waers EQ wa_e1edk01-curcy.
        wa_zzdochdr-zdoctitle  = dobject-objky.
        wa_zzdochdr-zdate      = dobject-erdat.
        wa_zzdochdr-zmestyp    = dobject-kschl.
        wa_zzdochdr-zmedium    = dobject-nacha.
        wa_zzdochdr-zlang      = dobject-spras.
        wa_zzdochdr-zttype     = dxvbkd-kdkg1.
        wa_zzdochdr-zpaymethod = dxvbkd-zlsch.
        wa_zzdochdr-zpaytext   = lv_text1.
        wa_zzdochdr-zintonpymt = lv_zinso.
Begin of Mod-002
        wa_zzdochdr-zstceg     = lv_stceg.
End of Mod-002
        int_edidd-segnam = c_zzdochdr.
        CLEAR int_edidd-sdata.
        MOVE wa_zzdochdr TO int_edidd-sdata.
        APPEND int_edidd.
        CLEAR : wa_zzdochdr.
      ENDIF.
    ENDIF.
*-- Move data to ZZE1EDK02 Segment--
  WHEN c_e1edk02.
    MOVE int_edidd-sdata TO wa_e1edk02.
    IF wa_e1edk02-qualf EQ c_004.
      SELECT SINGLE vbelv FROM vbfa INTO wa_vbfa
                         WHERE vbeln EQ lv_vbeln
                         AND   vbtyp_v EQ 'B'.
      IF sy-subrc EQ 0.
        SELECT SINGLE erdat FROM vbak INTO wa_vbfa
        WHERE vbeln EQ wa_vbfa-vbelv.
        int_edidd-segnam = c_ze1edk02.
        CLEAR int_edidd-sdata.
        MOVE wa_vbfa TO int_edidd-sdata.
        APPEND int_edidd.
        CLEAR wa_vbfa.
      ENDIF.
    ENDIF.                                  " IF ended for "IF wa_e1edk02-qualf = '004'" condition.
**-- Move data to ZZE1EDK17 Segment--
  WHEN c_e1edk17.
    MOVE int_edidd-sdata TO wa_e1edk17.
    IF NOT dxvbkd-lcnum IS INITIAL.
      SELECT SINGLE inco1
                    inco2
               FROM akkp
               INTO i_akkp
              WHERE lcnum EQ dxvbkd-lcnum.
      IF sy-subrc EQ 0.
        IF wa_e1edk17-qualf EQ c_001.
          wa_ze1edk17-lkond = i_akkp-inco1.
          wa_ze1edk17-qualf = wa_e1edk17-qualf.
          SELECT SINGLE bezei
                   FROM tinct
                   INTO lv_inco
                  WHERE spras EQ 'E'
                    AND inco1 EQ i_akkp-inco1.
          IF sy-subrc EQ 0.
            wa_ze1edk17-lktext = lv_inco.
          ENDIF.
        ELSEIF wa_e1edk17-qualf EQ c_002.
          wa_ze1edk17-qualf = wa_e1edk17-qualf.
          wa_ze1edk17-lktext = i_akkp-inco2.
        ELSE.
        ENDIF.
        int_edidd-segnam = c_zze1edk17.
        CLEAR int_edidd-sdata.
        MOVE wa_ze1edk17 TO int_edidd-sdata.
        APPEND int_edidd.
        CLEAR wa_ze1edk17.
      ENDIF.
    ENDIF.                                       " IF ended for not initial condition.
*--Move data to zze1edka1 Segment--
  WHEN c_e1edka1.
    MOVE int_edidd-sdata TO wa_e1edka1.
*--Checking the wa_e1edka1-parvw field for 'RE'--
    IF wa_e1edka1-parvw EQ c_re.
      IF NOT dxvbkd-lcnum IS INITIAL.
        SELECT SINGLE cadnr
         FROM akkp
         INTO lv_cadnr
        WHERE lcnum EQ dxvbkd-lcnum.
        IF sy-subrc EQ 0.
          SELECT SINGLE *
                   FROM adrc
                   INTO wa_adrc
                  WHERE addrnumber EQ lv_cadnr.
          wa_zze1edka1-parvw = wa_e1edka1-parvw.
          wa_zze1edka1-partn = wa_e1edka1-partn.
          wa_zze1edka1-land1 = wa_adrc-country.
          wa_zze1edka1-name1 = wa_adrc-name1.
          wa_zze1edka1-name2 = wa_adrc-name2.
          wa_zze1edka1-stras = wa_adrc-street.
          wa_zze1edka1-strs2 = wa_adrc-str_suppl1.
          wa_zze1edka1-ort01 = wa_adrc-city1.
          wa_zze1edka1-pstlz = wa_adrc-post_code1.
          wa_zze1edka1-regio = wa_adrc-region.
          int_edidd-segnam = c_zze1edka1.
          CLEAR int_edidd-sdata.
          MOVE wa_zze1edka1 TO int_edidd-sdata.
          APPEND int_edidd.
          CLEAR: wa_adrc,
                 wa_zze1edka1.
        ENDIF.
      ENDIF.
    ENDIF.                                               " IF ended for "IF wa_e1edka1-parvw EQ 'RE'" condition.
*--Checking the wa_e1edka1-parvw field for 'WE'--
    IF wa_e1edka1-parvw EQ c_we.
      IF NOT dxvbkd-lcnum IS INITIAL.
        SELECT SINGLE cadnr
          FROM akkp
          INTO lv_cadnr
         WHERE lcnum EQ dxvbkd-lcnum.
        IF sy-subrc EQ 0.
          SELECT SINGLE *
                   FROM adrc
                   INTO wa_adrc
                  WHERE addrnumber EQ lv_cadnr.
          wa_zze1edka1-parvw = wa_e1edka1-parvw.
          wa_zze1edka1-partn = wa_e1edka1-partn.
          wa_zze1edka1-land1 = wa_adrc-country.
          wa_zze1edka1-name1 = wa_adrc-name1.
          wa_zze1edka1-name2 = wa_adrc-name2.
          wa_zze1edka1-stras = wa_adrc-street.
          wa_zze1edka1-strs2 = wa_adrc-str_suppl1.
          wa_zze1edka1-ort01 = wa_adrc-city1.
          wa_zze1edka1-pstlz = wa_adrc-post_code1.
          wa_zze1edka1-regio = wa_adrc-region.
          int_edidd-segnam = c_zze1edka1.
          CLEAR int_edidd-sdata.
          MOVE wa_zze1edka1 TO int_edidd-sdata.
          APPEND int_edidd.
          CLEAR: wa_adrc,
                 wa_zze1edka1.
        ENDIF.
      ENDIF.
    ENDIF.                                             " IF ended for "IF wa_e1edka1-parvw EQ 'WE'" condition.
*--Checking the wa_e1edka1-parvw field for 'AG'--
    IF wa_e1edka1-parvw EQ c_ag.
      IF NOT dxvbkd-lcnum IS INITIAL.
        SELECT SINGLE cadnr
          FROM akkp
          INTO lv_cadnr
         WHERE lcnum EQ dxvbkd-lcnum.
        IF sy-subrc EQ 0.
          SELECT SINGLE *
                   FROM adrc
                   INTO wa_adrc
                  WHERE addrnumber EQ lv_cadnr.
          wa_zze1edka1-parvw = wa_e1edka1-parvw.
          wa_zze1edka1-partn = wa_e1edka1-partn.
          wa_zze1edka1-land1 = wa_adrc-country.
          wa_zze1edka1-name1 = wa_adrc-name1.
          wa_zze1edka1-name2 = wa_adrc-name2.
          wa_zze1edka1-stras = wa_adrc-street.
          wa_zze1edka1-strs2 = wa_adrc-str_suppl1.
          wa_zze1edka1-ort01 = wa_adrc-city1.
          wa_zze1edka1-pstlz = wa_adrc-post_code1.
          wa_zze1edka1-regio = wa_adrc-region.
          int_edidd-segnam = c_zze1edka1.
          CLEAR int_edidd-sdata.
          MOVE wa_zze1edka1 TO int_edidd-sdata.
          APPEND int_edidd.
          CLEAR: wa_adrc,
                 wa_zze1edka1.
        ENDIF.
      ENDIF.                                       " IF ended for "IF NOT dxvbkd-lcnum IS INITIAL" condition.
    ENDIF.                                         " IF ended for "IF wa_e1edka1-parvw EQ c_ag" condition.
*--Checking the wa_e1edka1-parvw field for 'Y'--
    IF wa_e1edka1-parvw+0(1) EQ c_y.
      SELECT SINGLE parvw
              FROM  tpar
              INTO  lv_parvw
              WHERE parvw EQ wa_e1edka1-parvw
                AND nrart EQ c_pe.
      IF sy-subrc EQ 0.
        SELECT SINGLE pernr
          FROM vbpa
          INTO lv_pernr
          WHERE vbeln EQ dxvbpa-vbeln
          AND   parvw EQ lv_parvw.
        IF sy-subrc EQ 0.
          SELECT SINGLE usrid_long
           FROM pa0105
           INTO wa_pa0105-usrid_long
           WHERE  pernr EQ lv_pernr
             AND usrty EQ c_0010.    " communication type email
          wa_zze1email-zparvw  = wa_e1edka1-parvw.
          wa_zze1email-zname   = wa_e1edka1-name1.
          wa_zze1email-zemail  = wa_pa0105-usrid_long.
          int_edidd-segnam = c_zze1email.
          CLEAR int_edidd-sdata.
          MOVE wa_zze1email TO int_edidd-sdata.
          APPEND int_edidd.
          CLEAR: wa_adrc,
                 wa_zze1email,
                 wa_pa0105.
        ENDIF.
      ENDIF.
    ENDIF.                              " IF ended for "IF wa_e1edka1-parvw EQ 'Y'" condition.
*--Begin of MOD003 (Modification ID 003)--
*-- Move data to ZZE1EDP01 Segment--
  WHEN c_e1edp01.
    MOVE int_edidd-sdata TO wa_e1edp01.
    wa_zze1edp01-posex = wa_e1edp01-posex.
     wa_zze1edp01-uebto = dxvbap-kwmeng + ( dxvbap-kwmeng * dxvbap-uebto / 100 ).
     wa_zze1edp01-untto = dxvbap-kwmeng - ( dxvbap-kwmeng  * dxvbap-untto / 100 ).
    wa_zze1edp01-uebto = dxvbap-uebto.
    wa_zze1edp01-untto = dxvbap-untto.
    int_edidd-segnam = c_zze1edp01.
    CLEAR int_edidd-sdata.
    MOVE wa_zze1edp01 TO int_edidd-sdata.
    APPEND int_edidd.
    CLEAR: wa_zze1edp01.
*--End of MOD003 (Modification ID 003)--
  WHEN OTHERS.
ENDCASE.
Regards,
Nagaraj

Similar Messages

  • How to map idoc segment field E1IDB02-FIIKONTO with BSEG-ESRNR.

    Hi,
    I have searched for lot of threads in the forum , and also i tried myself but i am not able to map this fields segment with my logic, so please anyone kindly contribute in mapping idoc segment field  with the logic given below:
    idoc type :PAYEXT  outbound idoc.
    message type: PEXR2002
    This is my logic: i need to populate the ISR number(BSEG-ESRNR  ) in idoc segment field( E1IDB02-FIIKONTO)
    DATA : str1 TYPE string,
          len1  TYPE i,
          len2  TYPE i,
          str2  TYPE string,
          str3  TYPE string.
    str1 = '01-1234-4'. ---> BSEG-ESRNR  "ISR Subscriber Number
    REPLACE FIRST OCCURRENCE OF '-' IN str1 WITH '_'.
    REPLACE ALL OCCURRENCES OF  '-' IN str1 WITH space.
    CONDENSE str1.
    len1 = STRLEN( str1 ).
    IF len1 LT '9'.
    len2 = '9' - len1.
    CASE len2.
       WHEN '1'.
         REPLACE ALL OCCURRENCES OF '_' IN str1 WITH '00'.
       WHEN '2'.
         REPLACE ALL OCCURRENCES OF '_' IN str1 WITH '000'.
       WHEN '3'.
         REPLACE ALL OCCURRENCES OF '_' IN str1 WITH '0000'.
       WHEN '4'.
         REPLACE ALL OCCURRENCES OF '_' IN str1 WITH '000000'.
       WHEN OTHERS.
    ENDCASE.
    ELSEIF len1 EQ '9'.
    REPLACE ALL OCCURRENCES OF '_' IN str1 WITH '0'.
    ELSEIF len1 GT '9'.
    REPLACE ALL OCCURRENCES OF '_' IN str1 WITH space.
    CONDENSE str1.
    ENDIF.
    Thanks in Advance.

    Resolved.

  • How to assign idoc segment at runtime ??

    Hi ,
    I have a ztable which is maintained via sm30.
    The field1 is a key field and other fields are idocsegment name , idoc field , field value .
    Field1 = key field
    idoc segment name (field2)
    idoc field (field3)
    field value(field4)
    How do i update idoc segment and particular field with field4 at runtime .
    segment name , field and value changes with the matching key field.
      loop at it_edidd into wa_edidd
       where segnam = wa_ztable-idoc_segment.
    wa_seg = wa_edidd-sdata.
    how to assign the field at runtime ?????????????????????????
    how to change the value of field ?????????????????????????
       update edid4 set   sdata =  wa_seg
                          where docnum  = wa_edidd-docnum
                          and   segnum  = wa_edidd-segnum
                          and   segnam = wa_edidd-segnam.
       if sy-subrc <> 0 .
         rollback work .
         write: / wa_edidd-docnum .
       else.
         commit work.
       endif.
      endloop.
    Please help me with the above code .
    Regards,
    Rachel

    Hello Rachel
    You could do this the following way:
    DATA: ls_edidd    TYPE edidd,
               ld_idx         TYPE i.
    FIELD-SYMBOLS:
      <ls_segment>         TYPE any,
      <ld_field>                TYPE any.
    LOOP AT it_edidd INTO ls_eddid
                                 WHERE ( segnam = wa_ztable-idoc_segment ).
      ld_idx = syst-tabix.
      ASSIGN ls_edidd-sdata TO <ls_segment> CASTING TYPE (ls_edidd-segnam).  " <<<
      ASSIGN COMPONENT wa_ztable-field3 OF STRUCTURE <ls_segment>
                                      TO <ld_field>.
      <ld_field> = wa_ztable-field4.
      MODIFY it_edidd FROM ls_edidd INDEX ld_idx.
    ENDLOOP.
    However, be aware that your logic might fail in case of repetitive segments.
    Regards
      Uwe

  • How to Read Idoc - Segment fields values and status messages

    Hi,
      I am having one requirement as i want to read the segments along with the field values and also i want to read all the status messages.
    first i read the idoc data from EDIDS and segments data from EDID4 and the staus messges from T100. but still i am not getting all the status messages.
    is there any other table which contains the information of IDOC segments and field values and also the status messages.
    Regards,
    Kumar

    You need to use
    V_MSGNO = EDIDS-STAMNO.
    CALL FUNCTION 'MESSAGE_PREPARE'
      EXPORTING
        MSG_ID   = EDIDS-STAMID
        MSG_NO   = V_MSGNO
        MSG_VAR1 = EDIDS-STAPA1
        MSG_VAR2 = EDIDS-STAPA2
        MSG_VAR3 = EDIDS-STAPA3
        MSG_VAR4 = EDIDS-STAPA4
      IMPORTING
        MSG_TEXT = V_TEXT.
    WRITE: / V_TEXT.

  • RE: How to change Idoc segment data

    Hi folks,
    I have a requirement where in I have a Inbound DELIN Idoc in the SAP system. When I am reprocessing the same Idoc through WE19 by changing the delivery schedule and then changing the E1EDP16-WMENG value in runtime while debugging, the same is getting updated in correponding SDSA but when the new Idoc is getting triggered, only previous old Idoc value is getting reflected.
    Kindly suggest!!!!
    Vishal.

    No I dont want to change the value in WE19.... In runtime I am changing the value of schedule Line quantity and the same is getting update in SDSA also but when a new idoc is getting created that value is not getting reflected in that Idoc segment field.
    Kindly suggest.

  • How to find IDOC Segment Exit

    Dear All,
    I am new to IDOCs. Can someone tell me how to find exit for a segment in IDOC.
    Regards,
    Anurag

    Hi,
       There is no segment exit. If you want populate data and for that there is no corresponding fields in the standard segment, then create the new ZSEGMENT in WE31 with your fields and data element.
    Now if u want to send data in those fields through idoc then
    1) Go to we30 - Select the radio button extension and then add segments which you created to populate the values.
    2) Link the idoc type with message type and add extension ( that u created in WE30)
    3) In we20 add the message type used in outbound
    4) Identify the suitable user exit and write the code in outbound system (sending system) to populate data in idoc
    5) identify the suitable user exit and write code in inbound system to post data from idoc to the database table.
    Now replicate data and check whether your are able to insert data in custom fields.

  • How to map idoc segments to multiple output structures

    Dear experts,
    On Pi I need to map segments from an Idoc to 2 different outputstructures. My scenario is as follows:
    incoming Idoc on PI -> if segment eq 'X' then map to outputstructure '1'; if segment eq 'Y' then map to outputstructure '2'
    Idoc structure is as follows:
    - 1 header segment
    - 1..n detail segments (which I need to map to outputstructure 1)
    - 1 summarisation segment (which I need to map to outputstructure 2)
    Output needs to be a .txt file.
    I would like to use the graphical message mapping on PI, how can I map the Idoc to multiple output structures?
    Thanks in advance,
    William

    Hi
    You can do 1:n multimapping
    in message mapping in messages tab ..add both the structures in target tab and do the mapping
    and in operation mapping add both the message interface on the target side
    PLease go through this blog
    /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible

  • How to map IDoc segment with qualifiers

    Hi everyone!
    I have the following problem: In an IDoc of type DESADV01 there can be several segments of type E2EDS01. Each segment has a different qualifier, which is the value of the field SUMID in this case. My target structure (type EDIFACT) now has several segments, each again with a sort of qualifier. Now I have to map the values of certain source segments to the respective target segments.
    Exaple (in XML format):
    Source
      <E1EDS01 SEGMENT="1">
        <SUMID>021</SUMID>
        <SUMME>0000000001.000</SUMME>
        <SUNIT>KGM</SUNIT>
      </E1EDS01>
      <E1EDS01 SEGMENT="1">
        <SUMID>022</SUMID>
        <SUMME>0000000001.000</SUMME>
        <SUNIT>KGM</SUNIT>
      </E1EDS01>
    Target
      <S_MEA>
        <C_C502>
          <D_6313>N</D_6313>
        </C_C502>
        <C_C174>
          <D_6411>KGM</D_6411>
          <D_6314>1</D_6314>
        </C_C174>
      </S_MEA>
      <S_MEA>
        <C_C502>
          <D_6313>G</D_6313>
        </C_C502>
        <C_C174>
          <D_6411>KGM</D_6411>
          <D_6314>1</D_6314>
        </C_C174>
      </S_MEA>
    (i have omitted several details here, but I'm only interested in the general procedure anyway).
    So in general the source segment with qualifier "021" should be mapped to a target structure with qualifier "N" etc.
    How can this be done using standard XI mapping techniques?
    Regards, Joerg

    Hi everyone!
    Thanks for your input data - unfortunately this wasn't quite what I was looking for. However I thik I solved my original problem and I just wanted to share this solution with you - maybe it helps others, maybe some of you have suggestions what I could do differently.
    To sum up the requirement: There can be multiple input segments, each with a certain qualifier. These input segments have to be mapped to the target segments, respectively - however, the qualifiers change. There can be several segments with qualifiers that do not match the requirement, and required segments might be missing.
    So here's what I came up with:
    Use the qualifier of the source segments as an input to a <b>FixValues</b> function. In this function, map the desired qualifiers to the value <b>true</b>, use <b>false</b> as the default value. Map the output of the <b>FixValues</b> function to a <b>createIf</b> function and use this to create the desired output segment. This way, for each of the required segments, one target segment will be created. All other segments (with unwanted qualifiers) will be removed.
    So far, this technique worked for me - do you have improvements/suggestions?
    Regards, Joerg

  • How to get IDOC segment occurence

    Hi All,
      I am trying out IDOC to File scenario and facing a problem due to repetition of segments in IDOC.
    Requirement is to repeat the field in output file base on the segment occurance.
    i am trying to map the record set of target file structure to the most repeating segmetn in the Souce IDOC so that i can get the repetion.
    Is there any way to identify which segments repeats the most of times?
    can we map a segment to target record set in  where in we count all the segment occurance and get the most repeating segment and map it to target in udf itself.
    is there any direct function whcih can be used in UDF to map one segment to a recordset?
    Regards,
    Anika

    1. use the wiki logic on each repeating node
    2. that will give you the counts for each repeating node
    3. now write a node with each count as input
    4. check which is the maximum
    5. then use a logic as below
    assume that max_occurance variable contains the maximum repeating nodes count
    then
    for(int i = 0; i < max_occurance; i++)
    result.addValue("");
    use that UDFs output and it will create that many occurances on the target side

  • How to extend idocs

    hi gurus
          this is phaneendra i know how to extend the idoc
          ie we31, we30, we82,we57..........ie segment creation,
          adding it to basic idoc type and linking it
           but what exactly i want is coding for extended idoc
           in outbound and inbound ie in the customer exits what
           we have to write
    can any body send me the code required for this in inbound and
    in outbound  dont send that present in arvind nagpal book that already i know
    best regards
    phaneendra punukollu
    <removed_by_moderator>
    Edited by: Julius Bussche on Jul 27, 2008 8:18 PM

    Hi Phaneendra.
    I would like to suggest a few references,
    [SDN - Reference for Extending an existing IDOC|How to extend an existing IDOC!;
    [SDN - Reference - Extending IDOC step by step|How to extend an IDOC step by step;
    [SDN - Reference for populating segments of IDOC|How to populate IDOC segments...;
    [SDN - Reference for Problem while Extending the HR IDOCS|Problem while Extending the  HR IDOCS;
    [SDN - Reference for Segments getting suppressed in Extended Idoc for Customer (change pointes) |Segments getting suppressed in Extended Idoc for Customer( change pointes);
    [SDN - Reference for Setting attributes for segment types in IDOCS|Setting attributes for segment types in IDOCS;
    Hope that's usefull.
    Good Luck & Regards.
    Harsh Dave

  • Repeating IDOC segments

    Hi,
    Can anyone explain why and which is a better option among
    Repeating an IDOC segment to populate some additional data or extending a segment to populate the data.
    I would like to populate supplier code in E2DRM1 segment- Partner_ID field of IDOC type QALITY02. The SAP's standard populates ADRNR number from the KNA1 table (in transaction code QC20). But in transaction QC22, I dont see this segment. How to populate this segment?
    I appreciate your response.
    Shiva

    Hi Shiva,
    The best way is to use repeating existing segment (if still available) to populate the supplier code through custom user exits in process code/function module.
    If the above is not available then extended the standard IDoc would be the next option. Extended the IDoc will involve above task and also additional setup in the configuration as well i.e. partner profile (WE20) and etc.
    Hope this will help.
    Regards,
    Ferry Lianto

  • Delete idoc segments

    Hi all,
    I need to delete the idoc segments for some condition based on the table KNVV value. It is basic type is DEBMAS05.
    I have used a wrapper FM ZIDOC_INPUT_DEBITOR as i could not find a user exit in IDOC_INPUT_DEBITOR.
    In test run we19, in debuggin i see the incorrect records/segments are getting deleted from IDOC_DATA which is the way i have coded. However when i see the generated idoc number i can see all the segments and the incorrect segments are not getting deleted. Let me know how to delete idoc segments through code.
    Note : I have tried in BD59 to reduce the idoc segment, but the condition for our requirnment cannot be possible in BD59.
      LOOP AT idoc_data.
        CASE idoc_data-segnam.
          WHEN 'E1KNA1M'.
            gwa_deb_hdr = idoc_data-sdata.
          WHEN 'E1KNVVM'.
            gwa_deb_sale = idoc_data-sdata.
          WHEN 'E1KNMB1'.
            gwa_deb_comp = idoc_data-sdata.
           APPEND gwa_aex_item TO gt_aex_item.
        ENDCASE.
       IF gwa_deb_hdr+0(3) = '004'.
          IF sy-tabix > 1.
        SELECT SINGLE kunnr vkorg vtweg INTO (lv_kunnr, lv_vkorg, lv_vtweg)
                FROM knvv
                WHERE kunnr = gwa_deb_hdr+3(10)
                   AND vkorg = gwa_deb_sale+3(4)
                   AND vtweg = gwa_deb_sale+6(2).
            IF sy-subrc NE 0.
              DELETE idoc_data INDEX sy-tabix.
            ENDIF.
          ENDIF.
       ENDIF.
      ENDLOOP
    Thanks,
    Senthil

    Just want to know.
    If the standard idoc segmets cannot be deleted through code or this doesnot work as i ran in test run we19?

  • How to add new segment to IDOC in BADI CRMXIF_ORDER_R3_MAP

    Hi All,
    I am creating a DMR in ECC when a service order is created in CRM.
    I am using Basic Type ORDERS05. This Basic Type does not have the segment E1CUCFG populated when it comes to the BADI.
    I want to populate this segment and attach to my IDOC.
    How can i do this?
    Is there any FM which will create the segments?
    Kindly help.
    Thanks in advance.
    Edited by: shanthi v on Mar 29, 2011 3:42 AM

    I have dropped the IDOC solution. I created a enhancement in FM - CRM_SERVICE_BILLING_FILTER which helped me to create DMR as per my need.

  • How to pass item payment term through Idoc segment E1EDP18

    We use ORDERS idoc to create sales orders and our customers want to replace the default payment term at item level. I found segment E1EDP18 for this purpose but I don't exactly know how to use it, like where to put the payment term key. Can any one expain with the help of a clear  example how to indicate the payment term there ?
    Below is a exerpt of the incoming idoc file I used for testing. In this test I put the paymentt term 0010 in but the information sent in idoc segment is just ignored.
    E1EDP01                     10         625.00
        E1EDP05                        ZD64
        E1EDP05                        ZD66
        E1EDP19                     00269020000
        E1EDP18                     0020010
    Many thanks

    Hi,
             SAP program IDOC_INPUT_ORDERS is not using the item level payment terms sent in IDOC segment P18 to fill the sales order so you need user exit to do this. The program is moving the item level information to an internal table xe1edp18 when the data is parsed from IDOC so you can use this to populate the screen information in the user exit 'CALL CUSTOMER-FUNCTION '002' (IDOC_INPUT_ORDERS).
    Let me explain the process from EDI to SAP.
    1) EDI 850 will have ITD segment at item level (Example ITD013  *2     *        *10 *        *30 *          *        *) you can ask your EDI team to map them to P18 segment as it has the number of days and also the percentage for cash discount. P18 has 3 qualifiers so you can map 3 different temrs (For example the above sample is 1 Term is 2% in 10 days and Term 2 is net 30 days)
    2) During IDOC parsing the program is already filling internal table xe1edp18.
    3) In the user exit CUSTOMER-FUNCTION '002' you need to search for the SAP payment terms with the number of days and percentage (This is available in the table T052). Once you find the SAP terms key, you need to populate it for each item. You need to do this after the program filled the item billing data.
    Dynpro item business data billin details -
        PERFORM VA01_DYNPRO_POSITION_PDE3 USING XVBAP-POSNR.
    *-Zusätzliche Daten für Dynpros vorsehen (Kundenerweiterungen)----
    *-additional data's for new dynpro fields (customer exit)----
        SY-SUBRC = 0.
        PERFORM CUSTOMER_FUNCTION_DYNPRO.  -- THis is the user exit call
    Hope this is useful.
    Ram

  • In exit EXIT_SAPLKD01_001 populate custom segment of idoc ext. cremas05

    Hi,
       I am using EXIT_SAPLKD01_001 where I need to populate 2 custom segments for idoc extension cremas05.
    I have created a function module separately where I have populated the 2 structures that is of same type as the segment structure.
    In the exit I have called the function module where the structures are populated.
    Now my question is how to populate the custom segments from the function module structures directly in the exit.
    Thanks and Regards
    P

    Hi
    Now I'm able to do this.... closing the thread.

Maybe you are looking for