Sort IDOC segment problem

Hi Idoc Experts!
Just want to know you opinion on how to sort the Idoc Internal  table shown below. I am trying to sort the internal table int_edidd by edatub after it has appended new entries.
      LOOP AT int_edidd INTO wa_int_edidd
        WHERE segnam(7) = 'E2EDP16'.
      ENDLOOP.
      IF sy-subrc = 0.
        MOVE wa_int_edidd-sdata TO e1edp16.
        IF delinquent_demand IS NOT INITIAL.                
          e1edp16-edatuv = sy-datlo.
          e1edp16-edatub = sy-datlo.
          e1edp16-ettyp  = ' '.                             
          e1edp16-wmeng = delinquent_demand.
          MOVE e1edp16 TO wa_int_edidd-sdata.
          wa_int_edidd-segnum = wa_int_edidd-segnum + 1.
          APPEND wa_int_edidd TO int_edidd.
        ENDIF.                                              
        IF delinquent_demand_f IS NOT INITIAL.              
          e1edp16-edatuv = sy-datlo.                        
          e1edp16-edatub = sy-datlo.                        
          e1edp16-ettyp  = 'F'.                             
          e1edp16-wmeng = delinquent_demand_f.              
          MOVE e1edp16 TO wa_int_edidd-sdata.               
          wa_int_edidd-segnum = wa_int_edidd-segnum + 1.    
          APPEND wa_int_edidd TO int_edidd.                 
        ENDIF.                                              
      ENDIF.
<b><u>E1EDP16 SEGMENT structure</u></b>
ETTYP          CHAR     1
PRGRS          CHAR     1
EDATUV          CHAR     8
EZEIT          CHAR     4
EDATUB          CHAR     8
ETVTF          CHAR     2
WMENG          CHAR     15
FZABR          CHAR     15
BSTAS          CHAR     1
WDATUV          CHAR     8
WZEIT          CHAR     4
WDATUB          CHAR     8
Best Regards,
   JP

Hi,
May be try this way.
INSERT Itab index 4.
      LOOP AT int_edidd INTO wa_int_edidd
        WHERE segnam(7) = 'E2EDP16'.
      ENDLOOP.
      v_tabix = sy-tabix.  "<<<<
      IF sy-subrc = 0.
        MOVE wa_int_edidd-sdata TO e1edp16.
        IF delinquent_demand IS NOT INITIAL.                
          e1edp16-edatuv = sy-datlo.
          e1edp16-edatub = sy-datlo.
          e1edp16-ettyp  = ' '.                             
          e1edp16-wmeng = delinquent_demand.
          MOVE e1edp16 TO wa_int_edidd-sdata.
          wa_int_edidd-segnum = wa_int_edidd-segnum + 1.
          insert int_edidd from wa_int_edidd index v_tabix. "<<<<
*          APPEND wa_int_edidd TO int_edidd.
        ENDIF.                                              
        IF delinquent_demand_f IS NOT INITIAL.              
          e1edp16-edatuv = sy-datlo.                        
          e1edp16-edatub = sy-datlo.                        
          e1edp16-ettyp  = 'F'.                             
          e1edp16-wmeng = delinquent_demand_f.              
          MOVE e1edp16 TO wa_int_edidd-sdata.               
          wa_int_edidd-segnum = wa_int_edidd-segnum + 1.    
          insert int_edidd from wa_int_edidd index v_tabix. "<<<<
*          APPEND wa_int_edidd TO int_edidd.                 
        ENDIF.                                              
      ENDIF.

Similar Messages

  • IDOC  segment problem !

    Can we have feilds from different tables in one segment ?
    Or a segment must have the fields from one particular  table only ?

    Hey thanks to co-operate.This is my code. ALL the BEZEI values  are not comming,support type values are not comming,
    Take your time and seld me back reply.
                                                         Thanks
    REPORT Z_CREDITMEMO_OUTBOUND MESSAGE-ID ZJOY .
    SELECTION-SCREEN BEGIN OF BLOCK BL1  WITH FRAME TITLE TEXT-BL1
    NO INTERVALS.
    PARAMETERS: S_VBELN LIKE LIKPUK-VBELN.
    PARAMETERS: P_MESTYP LIKE EDMSG-MSGTYP OBLIGATORY.
    PARAMETERS: P_LOGSYS LIKE TBDLST-LOGSYS.
    *PERFORM ARE_YOU_SURE.
    SELECTION-SCREEN END OF BLOCK BL1.
    *INTERNAL TABLE FOR  ITEM DATA
    ranges: r_matkl for vbap-matkl.
    r_matkl-sign = 'I'.
    r_matkl-option = 'BT'.
    r_matkl-low = '000000300'.
    r_matkl-high = '000000399'.
    append r_matkl.
    DATA: BEGIN OF I_ITEM OCCURS 0,
            VBELN    LIKE VBAP-VBELN,
            POSNR    LIKE VBAP-POSNR,
            MATNR    LIKE VBAP-MATNR,
            VKAUS    LIKE VBAP-VKAUS,
            SPART    LIKE VBAP-SPART,
            NETWR    LIKE VBAP-NETWR,
            WAERK    LIKE VBAP-WAERK,
            KWMENG   LIKE VBAP-KWMENG,
            KONDM    LIKE VBAP-KONDM,
            MVGR1    LIKE VBAP-MVGR1,
            MVGR2    LIKE VBAP-MVGR2,
            MVGR3    LIKE VBAP-MVGR3,
            MVGR4    LIKE VBAP-MVGR4,
            MVGR5    LIKE VBAP-MVGR5,
            KONDA    LIKE VBKD-KONDA,
            BSTDK    LIKE VBKD-BSTDK,
            BSTDK_E  LIKE VBKD-BSTDK_E,
            KDKG2    LIKE VBKD-KDKG2,
            BEZEI1   LIKE TVLVT-BEZEI,
            BEZEI2   LIKE TVM1T-BEZEI,
            BEZEI3   LIKE TVM2T-BEZEI,
            BEZEI4   LIKE TVM3T-BEZEI,
            BEZEI5   LIKE TVM4T-BEZEI,
            BEZEI6   LIKE TVM5T-BEZEI,
            VTEXT1   LIKE V_T178-VTEXT,
            VTEXT2   LIKE V_T188-VTEXT,
            VTEXT3   LIKE TVKGGT-VTEXT,
       END OF I_ITEM.
    *Declaring constants
    DATA:
    *SEGMENT NAMES
    C_SALES_ORDER_NUMBER               LIKE EDIDD-SEGNAM VALUE 'Z1SONUMBER',
    C_MATERIAL_DETAILS                 LIKE EDIDD-SEGNAM VALUE 'Z1MATERIAL',
    C_PRODUCT_LINE                     LIKE EDIDD-SEGNAM VALUE 'Z1MVGR1',
    C_PRODUCT_NAME                     LIKE EDIDD-SEGNAM VALUE 'Z1MVGR2',
    C_PRODUCT_VERSION_DETAILS          LIKE EDIDD-SEGNAM VALUE 'Z1MVGR3',
    C_PRODUCT_PLATFORM_DETAILS         LIKE EDIDD-SEGNAM VALUE 'Z1MVGR4',
    C_PRODUCT_APPSERVER_DETAILS        LIKE EDIDD-SEGNAM VALUE 'Z1MVGR5',
    C_COMPILER_CODE                    LIKE EDIDD-SEGNAM VALUE 'Z1KONDM',
    C_LANGUAGE_CODE                    LIKE EDIDD-SEGNAM VALUE 'Z1KONDA',
    C_RUNTIME_BANDCODE                 LIKE EDIDD-SEGNAM VALUE 'Z1VKAUS',
    C_SUPPORT                          LIKE EDIDD-SEGNAM VALUE 'Z1SUPPORT',
    C_AMOUNT                           LIKE EDIDD-SEGNAM VALUE 'Z1AMOUNT'.
    DATA :
    C_CREDIT_IDOITY            LIKE    EDIDC-IDOCTP VALUE 'ZIPGI_IDOC_TYPE'.
    *data declaration
    *idoc control record
    data : control_record_out like edidc.
    *other data declaration
    DATA:W_SALES_ORDER                LIKE  Z1SONUMBER.
    DATA:W_MATERIAL                   LIKE  Z1MATERIAL.
    DATA:W_MVGR1                      LIKE  Z1MVGR1.
    DATA:W_MVGR2                      LIKE  Z1MVGR2.
    DATA:W_MVGR3                      LIKE  Z1MVGR3.
    DATA:W_MVGR4                      LIKE  Z1MVGR4.
    DATA:W_MVGR5                      LIKE  Z1MVGR5.
    DATA:W_KONDM                      LIKE  Z1KONDM.
    DATA:W_KONDA                      LIKE  Z1KONDA.
    DATA:W_VKAUS                      LIKE  Z1VKAUS.
    DATA:W_SUPPORT                    LIKE  Z1SUPPORT.
    DATA:W_AMOUNT                     LIKE  Z1AMOUNT.
    *DECLARE TABLES
    TABLES : VBAP,VBKD,TVM1T,TVM2T,TVM3T,TVM4T,TVM5T,TVLVT,T178T,T188T,
    TVKGGT.
    *CREATING INTERNAL TABLES FOR THE DATABASE TABLES
    DATA:
    INT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE,
    IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE,
    IT_VBAP   LIKE VBAP  OCCURS 0 WITH HEADER LINE,
    IT_VBKD   LIKE VBKD  OCCURS 0 WITH HEADER LINE,
    IT_TVM1T  LIKE TVM1T OCCURS 0 WITH HEADER LINE,
    IT_TVM2T  LIKE TVM2T OCCURS 0 WITH HEADER LINE,
    IT_TVM3T  LIKE TVM3T OCCURS 0 WITH HEADER LINE,
    IT_TVM4T  LIKE TVM4T OCCURS 0 WITH HEADER LINE,
    IT_TVM5T  LIKE TVM5T OCCURS 0 WITH HEADER LINE,
    IT_TVLVT  LIKE TVLVT OCCURS 0 WITH HEADER LINE,
    IT_T178T  LIKE T178T OCCURS 0 WITH HEADER LINE,
    IT_TVKGGT LIKE TVKGGT OCCURS 0 WITH HEADER LINE,
    IT_T188T  LIKE T188T OCCURS 0 WITH HEADER LINE.
    SELECT APPLICATION DATA
    *POPULATING THE ITEM DATA
    break-point.
    SELECT
            VBAP~VBELN
            VBAP~POSNR
            VBAP~MATNR
            VBAP~VKAUS
            VBAP~SPART
            VBAP~NETWR
            VBAP~WAERK
            VBAP~KWMENG
            VBAP~KONDM
            VBAP~MVGR1
            VBAP~MVGR2
            VBAP~MVGR3
            VBAP~MVGR4
            VBAP~MVGR5
      FROM VBAP
      INTO CORRESPONDING FIELDS OF TABLE I_ITEM
      WHERE VBAP~VBELN EQ S_VBELN
      and vbap~matkl NOT IN r_matkl.
    LOOP AT I_ITEM.
      data: ITEMWORKAREA like line of I_ITEM.
    BREAK-POINT.
      select single
            KONDA
            BSTDK
            BSTDK_E
            KDKG2
       FROM VBKD INTO corresponding fields of ITEMWORKAREA
       WHERE vbkd~vbeln eq I_item-vbeln
       AND vbkd~posnr EQ '000'.
       select single
            KONDA
            BSTDK
            BSTDK_E
            KDKG2
       FROM VBKD INTO corresponding fields of ITEMWORKAREA
       WHERE vbkd~vbeln eq I_item-vbeln
       AND vbkd~posnr EQ I_item-posnr.
      select single
              bezei
      FROM tvm1t
      INTO ITEMWORKAREA-BEZEI2
      WHERE spras EQ sy-langu
      AND mvgr1 EQ I_ITEM-mvgr1.
      select single
              bezei
      FROM tvm2t
      INTO  ITEMWORKAREA-BEZEI3
      WHERE spras EQ sy-langu
      AND mvgr2 EQ I_ITEM-mvgr2.
      select single
              bezei
      FROM tvm3t
      INTO ITEMWORKAREA-BEZEI4
      WHERE spras EQ sy-langu
      AND mvgr3 EQ I_ITEM-mvgr3.
      select single
              bezei
      FROM tvm4t
      INTO  ITEMWORKAREA-BEZEI5
      WHERE spras EQ sy-langu
      AND mvgr4 EQ I_ITEM-mvgr4.
      select single
             bezei
      FROM tvm5t
      INTO  ITEMWORKAREA-BEZEI6
      WHERE spras EQ sy-langu
      AND mvgr5 EQ I_ITEM-mvgr5.
      SELECT SINGLE
             VTEXT
      FROM T178T
      INTO  ITEMWORKAREA-VTEXT1
      WHERE SPRAS EQ SY-LANGU
      AND KONDM EQ I_ITEM-KONDM.
      SELECT SINGLE
           VTEXT
      FROM T188T
      INTO ITEMWORKAREA-VTEXT2
      WHERE SPRAS EQ SY-LANGU
      AND KONDA EQ ITEMWORKAREA-KONDA.
      SELECT SINGLE
             bezei
      FROM TVLVT
      INTO ITEMWORKAREA-BEZEI1
      WHERE ABRVW = I_ITEM-VKAUS.
       SELECT SINGLE
             vtext
       FROM TVKGGT
       INTO  ITEMWORKAREA-VTEXT3
       WHERE KDKGR =  ITEMWORKAREA-kdkg2.
      ITEMWORKAREA-VBELN    = I_ITEM-VBELN.
      ITEMWORKAREA-POSNR    = I_ITEM-POSNR.
      ITEMWORKAREA-MATNR         = I_ITEM-MATNR.
      ITEMWORKAREA-VKAUS         = I_ITEM-VKAUS.
      ITEMWORKAREA-SPART         = I_ITEM-SPART.
      ITEMWORKAREA-NETWR         = I_ITEM-NETWR.
      ITEMWORKAREA-WAERK         = I_ITEM-WAERK.
      ITEMWORKAREA-KWMENG    = I_ITEM-KWMENG.
      ITEMWORKAREA-KONDM         = I_ITEM-KONDM.     
      ITEMWORKAREA-MVGR1         = I_ITEM-MVGR1.       
      ITEMWORKAREA-MVGR2         = I_ITEM-MVGR2.       
      ITEMWORKAREA-MVGR3         = I_ITEM-MVGR3.
      ITEMWORKAREA-MVGR4         = I_ITEM-MVGR4.       
      ITEMWORKAREA-MVGR5         = I_ITEM-MVGR5.
      modify I_ITEM from ITEMWORKAREA.
      CLEAR ITEMWORKAREA.
    ENDLOOP.
    Fill the control record Information.
    control_record_out-MESTYP  = P_MESTYP.
    control_record_out-IDOCTP  = C_CREDIT_IDOITY.
    control_record_out-RCVPRT  = 'LS'.
    control_record_out-RCVPRN  = P_LOGSYS.
    FILL THE DATA RECORD
    W_SALES_ORDER-VBELN                  = I_ITEM-VBELN.
    INT_EDIDD-SEGNAM                     = C_SALES_ORDER_NUMBER.
    INT_EDIDD-SDATA                      = W_SALES_ORDER-VBELN.
    APPEND INT_EDIDD.
    W_MATERIAL-MATNR                      = I_ITEM-MATNR.
    W_MATERIAL-SPART                      = I_ITEM-SPART.
    INT_EDIDD-SEGNAM                      = C_MATERIAL_DETAILS.
    INT_EDIDD-SDATA                       = W_MATERIAL.
    APPEND INT_EDIDD.
    W_MVGR1-MVGR1                         = I_ITEM-MVGR1.
    W_MVGR1-BEZEI                         = I_ITEM-BEZEI2.
    INT_EDIDD-SEGNAM                      = C_PRODUCT_LINE.
    INT_EDIDD-SDATA                       = W_MVGR1.
    APPEND INT_EDIDD.
    W_MVGR2-MVGR2                         = I_ITEM-MVGR2.
    W_MVGR2-BEZEI                         = I_ITEM-BEZEI3.
    INT_EDIDD-SEGNAM                      = C_PRODUCT_NAME.
    INT_EDIDD-SDATA                       = W_MVGR2.
    APPEND INT_EDIDD.
    W_MVGR3-MVGR3                         = I_ITEM-MVGR3.
    W_MVGR3-BEZEI                         = I_ITEM-BEZEI4.
    INT_EDIDD-SEGNAM                      = C_PRODUCT_VERSION_DETAILS.
    INT_EDIDD-SDATA                       = W_MVGR3-MVGR3.
    APPEND INT_EDIDD.
    W_MVGR4-MVGR4                         = I_ITEM-MVGR4.
    W_MVGR4-BEZEI                         = I_ITEM-BEZEI5.
    INT_EDIDD-SEGNAM                      = C_PRODUCT_PLATFORM_DETAILS .
    INT_EDIDD-SDATA                       = W_MVGR4.
    APPEND INT_EDIDD.
    W_MVGR5-MVGR5                         = I_ITEM-MVGR5.
    W_MVGR5-BEZEI                         = I_ITEM-BEZEI6.
    INT_EDIDD-SEGNAM                      = C_PRODUCT_APPSERVER_DETAILS.
    INT_EDIDD-SDATA                       = W_MVGR5.
    APPEND INT_EDIDD.
    W_KONDA-KONDA                         = I_ITEM-KONDA.
    W_KONDA-VTEXT                         = I_ITEM-VTEXT1.
    INT_EDIDD-SEGNAM                      = C_COMPILER_CODE.
    INT_EDIDD-SDATA                       = W_KONDA.
    APPEND INT_EDIDD.
    W_KONDM-KONDM                         = I_ITEM-KONDM.
    W_KONDM-VTEXT                         = I_ITEM-VTEXT2.
    INT_EDIDD-SEGNAM                      = C_LANGUAGE_CODE.
    INT_EDIDD-SDATA                       = W_KONDM.
    APPEND INT_EDIDD.
    W_VKAUS-VKAUS                         = I_ITEM-VKAUS.
    W_VKAUS-BEZEI                         = I_ITEM-BEZEI1.
    INT_EDIDD-SEGNAM                      = C_RUNTIME_BANDCODE .
    INT_EDIDD-SDATA                       = W_VKAUS.
    APPEND INT_EDIDD.
    W_SUPPORT-BSTDK                       = I_ITEM-BSTDK.
    W_SUPPORT-BSTDK_E                     = I_ITEM-BSTDK_E.
    W_SUPPORT-KDKG2                       = I_ITEM-KDKG2.
    W_SUPPORT-VTEXT                       = I_ITEM-VTEXT3.
    INT_EDIDD-SEGNAM                      = C_SUPPORT.
    INT_EDIDD-SDATA                       = W_SUPPORT.
    APPEND INT_EDIDD.
    W_AMOUNT-NETWR                        = I_ITEM-NETWR.
    W_AMOUNT-KWMENG                       = I_ITEM-KWMENG.
    W_AMOUNT-WAERK                        = I_ITEM-WAERK.
    INT_EDIDD-SEGNAM                      = C_AMOUNT.
    INT_EDIDD-SDATA                       = W_AMOUNT.
    APPEND INT_EDIDD.
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
       EXPORTING
         MASTER_IDOC_CONTROL                  = CONTROL_RECORD_OUT
       OBJ_TYPE                             = ''
       CHNUM                                = ''
       TABLES
         COMMUNICATION_IDOC_CONTROL           = IT_COMM_IDOCS
         MASTER_IDOC_DATA                     = INT_EDIDD
      EXCEPTIONS
        ERROR_IN_IDOC_CONTROL                = 1
        ERROR_WRITING_IDOC_STATUS            = 2
        ERROR_IN_IDOC_DATA                   = 3
        SENDING_LOGICAL_SYSTEM_UNKNOWN       = 4
        OTHERS                               = 5
    IF SY-SUBRC <> 0.
        MESSAGE E002 WITH I_ITEM-vbeln.
    ELSE.
      LOOP AT it_comm_idocs.
       WRITE: / 'IDOC GENERATED',IT_COMM_IDOCS-DOCNUM.
      ENDLOOP.
      COMMIT WORK.
    ENDIF.

  • Problem with creation of IDOC Segment Type

    Hi,
    I tried to create IDOC Segment Type Z1LFA1 but error
    prompted "Structure Z1LFA1 already exist.".
    I tried deleting it at se11  but prompted
    "You cannot edit object R3TR TABL Z1LFA1 with the
    standard editor"                          
    and at sm30-TADIR, but prompted
    with "Cannot delete object directory entry, object exists."
    How will go about this??
    Please help!
    Thanks!

    hi,
    yup, tried doing that on we31 but the segment does not exist yet.
    we're currently upgrading from 4.6 to ecc, I think the structure
    was tranferred to our ecc client but the idoc segment and idoc type were not. I'll just have to transport it then.
    Thanks!

  • Idoc Segment Cancel release error

    Hi all,
       I have problem in cancelling the release of an Idoc Segment. I have a requirement to add new fields to the segment. When I try to do Edit->Cancel Release it is throwing below error.
    "Error while resetting release of segment Z1PXXXX
    Message no. EA259"
    Could anyone tell me how to overcome this error or the root cause of this error?
    Many Thanks,
    Sri
    Edited by: Arunsri on Nov 10, 2009 8:37 AM

    Hello,
    The reason that you are getting these errors is that you cannot cancel
    the release of an extension made in previous version e.g. 4.6C. Instead you have to
    create a new extension.
    It is not possible to change a segment definition which is released in a
    lower release. This is a basic concept of our release strategy to
    guarantee compatibility between different releases.
    You must create a new segment definition for the new release e.g. 620 with a new segment
    field with the appropriate length. In transaction WE20, outbound parameters, you can specify
    the "segment release in IDoc type" for the communication. Please read the F1 help of this field for further
    information.
    For your own segments you can define a new version of the segment via
    transaction WE31 -> Add Version (Shift+F5).
    Please review your online help for more information on this and related topics.
    Hope this information helps.
    Regards,
    David

  • Any FM/methods to update idoc segments without changing idoc status

    Hi All,
    My requirement is a reprocessor program which fills up some fields in the idoc segment before posting. So, after updating the segments, the idoc status should remain as before.
    Is there any function modules or methods to update idoc fields in segments without changing the idoc status?
    I have tried the FMs EDI_DOCUMENT_OPEN_FOR_EDIT, EDI_CHANGE_DATA_SEGMENT and EDI_DOCUMENT_CLOSE_EDIT, but it changes the idoc status.
    Thanks,
    Arun Mohan

    As for FM to do this, i don't know if there are any, but i think you can go directly to the tables with the IDOC data and change them without triggering the changes in status like FM do. Still, i am not sure this is completely true, but you could give it a try. Also, i don't know if this is the best way to do it, because of those legal/audit questions mentioned by Thomas.
    Here is a sample code of a program we have to change a field in a segment of WPUUMS.
    *& Report  YRE00021INTPG
    REPORT  yre00021reppg.
    TABLES: edid4 ,
            edidc ,
            mean .
    * Variaveis Auxiliares
    DATA: t_edidc TYPE edidc OCCURS 0 WITH HEADER LINE.
    DATA: t_edid4 LIKE edid4 OCCURS 0 WITH HEADER LINE .
    DATA: BEGIN OF t_docs OCCURS 0,
            docnum LIKE edidc-docnum ,
          END OF t_docs.
    DATA: wa_e1wpu02 LIKE e1wpu02 .
    DATA: wa_e1wpu03 LIKE e1wpu03 .
    DATA: t_itedidd LIKE edi_dd40 OCCURS 0 WITH HEADER LINE ,
          t_itedidc LIKE edi_dc40 OCCURS 0 WITH HEADER LINE ,
          fw_itedidc LIKE edi_dc40 ,
          fw_itedidd LIKE edi_dc40 .
    DATA: l_matnr TYPE mara-matnr,
          l_tam TYPE i.
    DATA: l_idoc_number TYPE edidc-docnum.
    * Ecran de selecção
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_docnum FOR  edid4-docnum ,
                    s_credat FOR  edidc-credat DEFAULT sy-datum ,
                    s_cretim FOR  edidc-cretim .
    PARAMETER:      p_mestyp LIKE edidc-mestyp DEFAULT 'WPUUMS' ,
                    p_status LIKE edidc-status DEFAULT '51' .
    *SELECTION-SCREEN SKIP.
    *PARAMETER:      p_ean11 TYPE mean-ean11.
    SELECTION-SCREEN : END OF BLOCK b1.
    AT SELECTION-SCREEN.
      IF p_status <> '51'.
        MESSAGE e001(yre) WITH 'Apenas pode modificar IDOCS com erro'.
      ENDIF.
      IF p_mestyp <> 'WPUUMS'.
        MESSAGE e001(yre) WITH 'Apenas pode lançar WPUUMS'.
      ENDIF.
    *AT SELECTION-SCREEN ON p_ean11.
    *  SELECT SINGLE * FROM mean WHERE
    *    ean11 = p_ean11.
    *  IF sy-subrc <> 0.
    *    MESSAGE e001(yre) WITH 'Ean não existente'.
    *  ENDIF.
    START-OF-SELECTION.
      SELECT docnum INTO TABLE t_docs FROM edidc
                         WHERE status =  p_status
                         AND   mestyp =  p_mestyp
                         AND   docnum IN s_docnum
                         AND   credat IN s_credat
                         AND   cretim IN s_cretim .
      CHECK sy-subrc = 0 .
      LOOP AT t_docs.
        CLEAR : wa_e1wpu02.
        SELECT * FROM edidc INTO TABLE t_edidc
          WHERE docnum = t_docs-docnum.
        CHECK sy-subrc = 0.
        SELECT * FROM edid4 INTO TABLE t_edid4
                      WHERE docnum = t_docs-docnum AND
                            segnam = 'E1WPU02'.
        CHECK sy-subrc = 0.
        SORT t_edid4 BY segnum.
        LOOP AT t_edid4 .
          wa_e1wpu02 = t_edid4-sdata.
          WRITE wa_e1wpu02-artnr TO l_matnr NO-ZERO.
          CONDENSE l_matnr.
    *      l_tam = STRLEN( l_matnr ).
    *      IF l_tam <= 6.
            SELECT SINGLE ean11 INTO wa_e1wpu02-artnr FROM ytre00004 WHERE
              codcurto = l_matnr.
            IF sy-subrc = 0.
              WRITE : /1 'Código ', l_matnr, ' alterado para ', wa_e1wpu02-artnr.
            ELSE.
              WRITE : /1 'Código ', l_matnr, ' não encontrado na tabela de conversão'.
              CONTINUE.
            ENDIF.
    *        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    *          EXPORTING
    *            input  = p_ean11
    *          IMPORTING
    *            output = wa_e1wpu02-artnr.
    *      ENDIF.
          UPDATE edid4 SET   sdata   = wa_e1wpu02
                       WHERE docnum  = t_edid4-docnum
                       AND   counter = t_edid4-counter
                       AND   segnum  = t_edid4-segnum .
          IF sy-subrc <> 0 .
            ROLLBACK WORK .
            WRITE: / t_edid4-docnum .
          ELSE.
            COMMIT WORK.
          ENDIF.
        ENDLOOP.
      ENDLOOP.
    END-OF-SELECTION.

  • Idoc Segment Fields

    Hi,
    I am having a problem with the display of idoc segment fields. When i check the Idoc segment contents in WE02 it is displaying the fields which dont have the value in the DB table along with the fields which have the data. To avoid this what is the procedure. I dont want to display the fields in the content of segment which does not contains the data.
    Plz help me out.
    Regards
    Santosh

    Hi,
    U have to use for reduced message type...U need to filter the segments which  u don't want...In BD53 u need to create reduced message type....
    plz go through the below link..
    http://help.sap.com/saphelp_erp2005/helpdata/en/d3/06f6679aaf0e44b67ca6d6b58d91df/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/0b/2a6702507d11d18ee90000e8366fc2/content.htm
    Regards,
    Nagaraj

  • IDOC Segment mapping change

    Hi,
    How can i change the field attached to a IDOC segment.
    Actually we have this Invoice IDOC,in which the E1EDK03 012(Qualifier) is passing the IDOC creation date instead of Billing date.
    So i need to change this mapping to Billing date.
    Please help.

    Hi Salz,
    I just checked my version of SAP (4.7) and you should get an invoice date.  Check out the subroutine FILL_E1EDK03 in function module IDOC_OUTPUT_INVOIC.  The first section of this code creates an E1EDK03 segment with the invoice date (if there is an invoice date), with qualifyer 026.
    Is there a possibility that in fact you are getting an E1EDK03 segment with the invoice date, but you are also getting other E1EDK03 segments (such as the one you mention with qualifyer 012) and they are obscuring the one you are looking for?
    If there are definitely none being created then can I suggest that you debug the subroutine FILL_E1EDK03 in function module IDOC_OUTPUT_INVOIC to check what is happening.  You may need to change the timing of your output record to 1 and run the program RSNAST00 online to get the breakpoint to be hit correctly. 
    If, in your version, the code doesn't include this date, then you have an exit function module EXIT_SAPLVEDF_002 (called via the subroutine CUSTOMER_FUNCTION in function module IDOC_OUTPUT_INVOIC) where you can actually add your own segment data.  For example you an change the contents of an existing segment (as per your original request), or append your own E1EDK03 segment with your own data.  I would recommend adding your own segment rather than changing whats there.
    It is possible to extend idocs to add your own custom segments (eg Z1EDK03), but I wouldn't recommend it in your case, because in later versions of SAP the date is provided and by not creating a new segment (Z1EDK03) you will have no mapping changes to do when you upgrade.  You can just delete your userexit code.
    Hope that all makes sense and helps you with your problem.
    Cheers,
    Brad

  • Idoc Segment - Context Handling.

    Hi All,
    Can anyone suggest me a solution as  how to handle the below idoc context problem.. its a file to idoc scenario
    I have an Debmas idoc, in which It is possible for a customer to have more than one E1KNBKM segment, so we only want to map the first segment for that customer and then also we only want the information from the /GLB/XGT_EXTRA_17 segments that are child segments of E1KNBKM.
    -Anu

    What Ravi suggested was:
    SourceNode --> Index -->
                                --> equalS --> ifWithoutElse (Then SourceNode) --> TargetNode
    Constant(1) -->
    Index is similar to Count function (just that it is more reliabel when counting multiple node occurences)...the above will check if the occurence of SourceNode isthe first or not.
    Regards,
    Abhishek.

  • Issue of grouping IDOC segments in huge loads

    Hi All,
    My Scenario is File to IDoc. No problem in posting IDoc in R3. But when i see the Idoc structure in R3, all the data records are grouped in different segements as seen below:-
    This is how i see in we05.
    IDoc No (00000000001234)
    - Control Rec.
    - Segments 000001 to 001000
    - S01 Segment 000001 (Actual records)
    - S02 Segment 000002
    - S03 Segment 000003
    - Segments 001001 to 001001
    - S04 Segment 000004
    - S05 Segment 000005
    - S06 Segment 000006
    - Status Rec.
    I dont want the grouping of Idoc segments to take place. It should be under same data segment.
    Please provide me your valuable solutions to resolve the same.
    Note: This problem occurs only when processing huge records.
    Thanks in advance,

    Hi Sriram,
    It is the standard program flow of  transaction WE02 which checks the number of segments.if the count is more than 1000,it creates a another group and displays it for the sake of readability.
    Anyway it does not affect the inbound processing of the IDOC.
    Thank you.
    Regards,
    Karun.M

  • IDOC Status 26: EDI: Syntax error in IDoc (segment cannot be identified).

    Hi All,
    I have created IDOC extension for IDOC Basic type "PROACT01" and have followed all required necessary steps but getting IDOC
    Status 26. EDI: Syntax error in IDoc (segment cannot be identified). The exact error is:
    Please check Error Details and the details of the steps I followed for Setting up IDOC Extension:
    Error Detail :
    EDI: Syntax error in IDoc (segment cannot be identified)
    Message no. E0078
    Diagnosis
    The segment ZPROSEG does not occur at the current level of the basic type PROACT01 (extension PROACTEX).
    This error can have several reasons:
    The segment ZPROSEG is assigned to a group whose header segment does not occur.
    The segment ZPROSEG does not exist in the syntax description of the basic type PROACT01 (extension PROACTEX).
    The sequence of segments in the group in which the segment appears is incorrect.
    Previous errors ('mandatory' segment or group missing) may be due to this error.
    Procedure
    Please check the IDoc or the syntax description of the basic type PROACT01 (extension PROACTEX).
    Can you please look at this problem and suggest what is wrong with IDOC Extension/Custome Segment?
    Below is the Details of the Steps which I have followed:
    1. Tcode WE31 - Created new custom Segment ZPROSEG with 4 fields. Released segment.
    2. TCode WE30 - Created IDOC Extension PROACTEX for Basic Type PROACT01. Released IDOC extension.
         Here when I run syntax check warning appears "No predecessors exist".  I am not sure if its okay!!
    3. TCode WE82 - Added Extension PROACTEX in the Message Type PROACT with BASIC Type PROACT01.
    4. TCode WE20 - Added IDOC Extension PROACTEX in the predefined partner profile in WE20 transaction.
    5. Added the following code in the Customer Exit EXIT_SAPLWVMI_001 include ZXWVMIU01 .
    DATA segnam(27).
    READ TABLE dedidd WITH KEY segnam = 'ZPROSEG'.
    IF sy-subrc NE 0.
    LOOP AT dedidd WHERE segnam = 'E1EDP31'.
    CLEAR dedidd.
    dedidd-segnam = 'ZPROSEG'.
    zproseg-matnr = 'Mat1'.
    zproseg-lgort = '001'.
    zproseg-gernr = 'SNo1'.
    zproseg-labst = 2.
    dedidd-sdata = zproseg.
    APPEND dedidd.
    ENDLOOP.
    ENDIF.
    Finally ran  transaction WVM2 (Transfer of Stock & Sales Data) to generate IDOC, its creating IDOC but when checked IDOC in WE05 its getting Status Error "26".
    Looking forward for your reply.
    Many thanks in advance.

    Hello,
    Actually you are appending the Z segment instead of inserting into the correct position. So the segment is added at the last, so hierarchy of segments is collapsed.
    So get the index of the previous segment E1EDP31 and increase the index by 1 and INSERT the Z segment with that new index as below.
    LOOP AT dedidd WHERE segnam = 'E1EDP31'.
    lv_index = sy-tabix. " <<--
    ADD 1 TO lv_index. " <<--
    CLEAR dedidd.
    dedidd-segnam = 'ZPROSEG'.
    zproseg-matnr = 'Mat1'.
    zproseg-lgort = '001'.
    zproseg-gernr = 'SNo1'.
    zproseg-labst = 2.
    dedidd-sdata = zproseg.
    *APPEND dedidd.
    INSERT dedidd INDEX lv_index. " <<---
    ENDLOOP.
    Here actually we are insering the record inside the LOOP and it regenerates the index again. It is not actually a good practice.
    So the best practice is get the index and generate the segment inside the loop, store them into another internal table, come out the loop and insert the Z segments into DEDIDD by looping the new internal table.

  • IDOC Segment Definition received instead of Segment type

    Hello Folks,
    When i send a Z Idoc Segment from A to B System, It is successfull from A System, but in B System sometimes its erroringout because in the inbound idoc Segment Definition is coming instead of Segment type.
    For Example
    From A System I have sent Z1P0002 segment
            B System I have received Z2P0002000(Which is the segment definition for Segment type Z1P0002)
    Any inputs to above problem?

    Hi,
    The problem may be due to system B using a older release version of the IDoc. In those scenarios, even though your IDoc type is recognized, it may not be possible for the reciever to determine the right segment version of the reciever.
    There are options in the WE20 partner profile configuration, Field Segment release in IDoc type and Segment Appl. rel. which enable the partner system preventing from erroring out.
    BR/Yogesh
    Edited by: Yogesh Surender on Jun 1, 2009 12:34 PM

  • IDoc segment not reaching XI

    Hi,
    I have a peculiar problem where the values populated in an IDoc segment are not coming to XI, though the values are visible in the sender SAP system, they are not present in the IDoc XML generated in XI.
    Please help if someone faced a similar problem.
    Thanks
    Pushpinder

    Hi,
    Check if problems are raised on Cache of Design side of your IB.
    Environment - Cache Status Overview
    Then "Clear Data Cache".
    And try again.
    Regards,
    Giuseppe

  • Procedure to find mandatory field in an IDoc Segment

    Hi all,
    Please guide me to find mandatory field in an IDoc Segment.
    Ex: I went to MATMAS05 IDoc type. I know that E1MARAM and E1MAKTM are the mandatory segments for MATMAS05 IDoc Type.
    But, I would like to know what are the mandatory fields for E1MARAM or E1MAKTM segment.
    Please guide me to find mandatory field in an IDoc Segment (for the above example).
    Thanks,
    Sudarsan

    hi,  here I have a good suggestion to solve your problem.
    Assuem you are research which field is mandatory in your mastr data inbound. Let's suppost it's a material.  You already known how to create it in online t-code, which field should be filled, which view should be inputed.
    Then, configure you material related IDOC for outbound, make sure that system will send out a material IDOC to other partner system (it can be a dummy system)when you create it.
    Then check the sent IDOC, you can find out how SAP system fill the IDOC according to your input.
    You can get to know how to fill your IDOC in this way.

  • IDOC segment fields prefixing blank space with values

    Hi Experts,
    I am sending data through custom IDOC from SAP to XML which generates successfully but getting 2 problems in the data.
    its having 3 level idoc segments:
    SEGMENT1 with 1 field (field_name(20))
    SEGMENT2 with 3 fields, (code_g(20), field_name(20), value(20))
    SEGMENT3 with 4 fields, (code(20), field_name(20), Language(2) & text(20))
    When i check the idoc in WE02,
    1. i found that segment2-value field is prefixing some space along with the values.
        Eg: if the output is "0111" whihc is plant, in the output (WE02) it is giving "       0111"
    2. Segment3-language is no where in the output and text which should come as "011" is coming like "       EN011" means it is concatinating language field value and displaying it with the text field value with prefixing space.
    This is happening in PRD not in QA & DEV. I also checked the transport req and everything, Its same everywhere.
    Can anyone please help me on this.
    Regards,
    Nik

    Hi,
    This issue happnes when u are moving the data to iDOC segement with offset.
    to aviod this improper move instead of using offset statement use below mentioned code.
    decalare a structure as
    Data SEG1 type SEGMENT1 ,
            SEG2 type SEGMENT2,
           SEG3 type SEGMENT3.
    then while moving
    SEG2-code_g = 'XXXX'
    SEG2-field_name = 'YYYY'
    SEG3-value = 'ZZZZ'
    here u are moving the segment values to idoc data (SDATA) and then append it.
    move seg3 to idoc-sdata.
    then append it to idoc.
    hope this helps

  • Syntax error in IDoc segment

    Hi,
    when I make a syntax check on my Idoc segment '/FIT/E1FISFIINV'  I get the error message:
    Entries for segment '/FIT/E1FISFIINV' missing in the 'Segment structures' table.
    I can't delete the segment type as I get the error message Segment /FIT/E1FISFIINV does not exist yet when I try it.
    But I also can't create the segment type as I get the error message Structure /FIT/E1FISFIINV already exists
    I already looke in the tables EDISDEF and EDISEGMENT to check that the entries for the segement /FIT/E1FISFIINV do exist in these tables.
    Does anybody have an idea how to solve this problem?
    Thank you.
    Martin

    I want to create a new idoc type '/FIT/xxxxx' and therefore I want to create new segment types  '/FIT/xxx' for this.
    I copied the segment types from another system (older release) to that system but there seems to be a data inconsistency. which I am trying to fix.

Maybe you are looking for

  • How to modify warning/error messages in DM

    Hi, in most of the DM packages a pop-up is generated stating one should enter more variables or something in case one did not enter any selections for any of the dimensions (for example in a copy of move package ...). Does anyone has an idea, where t

  • Safari/Windows Media Player problem.

    I have a bit of a problem at the moment with viewing video content on some sites - when I click the link/button/whatever this message appears - "Safari can't display content on this page Some content on this page requires an Internet plug-in that Saf

  • Performance Issue with Search screen

    I am not sure to post on JSF or Hibernate forums. This one is for Performance Gurus I have a "Advance Search" screen built with JSF/Facelets/Ajax4JSF When i click on the link Advance Search it will take more than a minute to load the form. The screen

  • Can't drag & click on the track pad of the macbook pro; what to do?

    can't drag & click on the track pad of the macbook pro; what to do?

  • C410a won't print black from Office

    I've had this issue for a couple of days and replaced black ink (which didn't show was low anyway) but cannot print from any Office or Adobe.  I can print photos just fine.  Emails I need to print I just change the font to a dark blue and it prints f