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

Similar Messages

  • How to assign Profit segment to the G/L account

    hi all,
    have anyone know how to assign Profit segment to the G/L account?
    rgds,
    Worached

    Hi,
       Select the
         1. Field Status Group for Profitability segment (T.Code : OBC4)
         2. Select the automatic account assignment (T.Code : OKB9)
         3. Select the PA Transfer Strcuture , direct posting from FI and MM.
      Hope this helps. Please assign points as way of thanks.
      Thanks
      Lakshmi Narayana

  • 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

  • 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 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.

  • 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.

  • Changing the content in an IDOC segment at runtime with EXIT_SAPLF050_006

    I am using IDOC FIDCC2 type. I have to change some values of the segment E1FISEG.
    In EXIT: EXIT_SAPLF050_006, I am making these changes, but after the execution.
    When the IDOC is generated, I noticed that the value of this field is not updated in the IDOC segment.
    I'll have something misconfigured?
    The code is as follows:
    CREATE OBJECT wa_obj.                                         "Creando el Objeto.
    BREAK dchirra.
    IF idoc_contrl-mescod EQ 'MPA'.                            "Chequeando Variante lógica de mensaje valida.
      LOOP AT idoc_data INTO e_idoc_data WHERE segnam = 'E1FISEG'.
        CLEAR: ze1fiseg, ze1finbu.                                  "Limpiando estructuras.
        MOVE e_idoc_data-sdata TO ze1fiseg.                         "Llenando estructura del Segmento.
        CALL METHOD wa_obj->get_data                                "Llamando a estractor del objeto.
          EXPORTING
            reserve    = ze1fiseg-reserve                           "- Campo RESERVE.
            estructura = 'E1FISEG'                                  "- Estructura
          CHANGING
            ze1finbu   = ze1finbu                                   "- Segmento ZE1FINBU.
            ze1fiseg   = ze1fiseg.                                  "- Segmento ZE1FISEG.
    Buscando Segmentos Hijos.-
        LOOP AT idoc_data INTO e_idoc_data2 WHERE segnam = 'E1FINBU' AND psgnum = e_idoc_data-segnum.
          MOVE e_idoc_data2-sdata TO ze1finbu.                      "Llenando estructura del Segmento.
          CALL METHOD wa_obj->get_data                              "Llamando a estractor del objeto.
            EXPORTING
              reserve    = ze1finbu-reserve                         "- Campo RESERVE.
              estructura = 'E1FINBU'                                "- Estructura
            CHANGING
              ze1finbu   = ze1finbu                                 "- Segmento ZE1FINBU.
              ze1fiseg   = ze1fiseg.                                "- Segmento ZE1FISEG.
          e_idoc_data2-sdata = ze1finbu.                            "Data Segmento.
          MODIFY idoc_data FROM e_idoc_data2.                       "Modificando data del IDOC
        ENDLOOP.
        e_idoc_data-sdata = ze1fiseg.                               "Data Segmento.
        MODIFY idoc_data FROM e_idoc_data.                          "Modificando data del IDOC
      ENDLOOP.
    ENDIF.

    IF idoc_contrl-mescod EQ 'MPA'
    is this condition is getting satisfied everytime since you are modifying only on this condition.
    I couldnot understand you comments as its not in English, however i tried understanding your logic,seems correct .
    Please check whether condition mentioned above is getting satisfied or not?
    Regards,
    Mayank

  • Chanding the content in an IDOC segment at runtime

    Hi Experts,
    I have funny issue with modification of the data in an IDOC segment. Below is the description of the issue:
         I am using the IDoc type FIDCC2.FIDCCP02. I have to populate the value for field 'KTOSL' of the
         segment E1FISEG. I wrote the logic in user exit EXIT_SAPLF050_006. It is getting triggered and the
         logic is updating the values in the IDOC_DATA internal table properly.
         When the IDoc is generated, I observed that the value for this field is not updated in IDoc Segment.
    Could you please suggest where I went wrong.
    Ramana

    Hi Neha,
    Thank you for the responce.
    We need not to fill all the 21 fields before the field KTOSL. Because I was using the work area to modify the internal table based on the index.
    One thing I can conclude is that we cannot change the values in the standard segments of a stanrd Idoc type. By the time you enter in the processing Functinal Module, the Idoc number would have been generated. So the modification we carry out are just updating the internal table which of no effect. The right way is that find the place where the values getting updated to the data base and change values as required. These changed values can be founf in the data base but not in the IDoc generated.
    Neha one more query for the clarification,could you ever delt with the down payment requests through IDocs. If so please share the details.
    Ramana

  • 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 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 assign dynamic image at runtime or on Button Action to a Image UI

    Hi,
         Please let me know is it possible to assign Dynamic Images to Image UI element in a Visual Composer applications. Using Image Manager it is possible, but in my case Image Source i.e URL comes from ABAP RFC, so is it possible to assign Image at runtime.
        Please do let me know is it possible or not, If yes please do share your opinions.
    I am able to show image using HTML Page by passing URL at runtime to HTML page but here, I cant control the Image width & height.
       I am checking for possibility of using some script to manage width & height.
       Thanks a Ton.
    Regards
    Tushar

    Hi,
         Any inputs for the Query? Atleast, If I get some hint, will do to proceed....
    Regards
    Tushar Shinde

  • 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

  • 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?

Maybe you are looking for

  • Performance tuning in SQL query using join of views

    Hi, Am trying to tune a query of the format select ........ from view1,view2 where view1.keyfield = view2.keyfield The base tables of the views view1 and view2 have indexes specified on 'keyfield'. However, when I do an explain plan of the query, Ful

  • Account generation workflow custom process  not visible in lov

    Hi guru, i have created a sample process in "Project Supplier Invoice Account Generation". but when i upload the work flow in data base by the concurrent program . i dont find the sample process in " account generation window" in GL. Please help guru

  • SIGSEGV signal (no mapping at the fault address) :  in _XmAddHashEntry

    I have ported a motif based program from Compaq Tru 64(in Tru 64 program is running without any problem) to Solaris 8. I have used Forte developer 6 C++ compiler. Program compiled & linked successsfull. But during runtime 'XmCreateMainWindow' method

  • Tcode: FAKP - Payment advice fast entry

    Hi Abapers, I have a requirement  to customise the standard tcode: FAKP. requirement includes: 1. I need to add 3 fields from table: AVIP to possible fields section of FAKP tcode. Fields to be added are: Payment ref. no(AVIP-KIDNO), Deduction Amount

  • Please add Forms/Reports in the Sample Code section

    Hi When we click on the Breadcrumb menu->Sample code http://www.oracle.com/technology/sample_code/index.html In the Sample Applications—Development Tools there is no link for Forms and Reports product. Please add these links there: http://www.oracle.