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

EDI: Syntax error in IDoc (mandatory group/segment missing)

Former Member
0 Likes
4,337

hi EDI/IDoc experts,

Need you help urgently. According to the requirement, i need populate a segement E1IDT01 of basic type PEXR2002 . I added the code , then run and generate an idoc , the new segment

E1IDT01 was populated, but Syntax error 26 happend. Error message as below. It also strange that i can see E1IDKU5 populate out as usual, but some others segment disappeared , i am sure that in my code ,i didn't changed any variable related to other segement . how can i fix this problem?

EDI: Syntax error in IDoc (mandatory group missing)

Message no. E0079

Diagnosis

The segment group E1IDKU5 has the attribute 'Mandatory' in the syntax description of the basic type PEXR2002 (customer enhancement ). However, the segment group is missing in the IDoc. The segment number logged in the status record identifies the item before which the segment group is missing.

Procedure

Please check the IDoc or the syntax description of the basic type PEXR2002 (customer enhancement ).

1 ACCEPTED SOLUTION
Read only

Former Member
2,643

Hi,

Where did u insert your code?

SAP Has give you the function module exits that would trigger for the payment run and generate the IDOC PEXR2002,

There are exits:

901: EXIT_SAPLIEDP_901

902: EXIT_SAPLIEDP_902

903: EXIT_SAPLIEDP_903

Use these to modify the IDOC data table (PEXR_EDIDD) before the IDOC is generated by the std payment run program

Hope this helps you

Regards

Shiva

5 REPLIES 5
Read only

Former Member
0 Likes
2,643

does anyone have any suggestion?

Read only

Former Member
2,644

Hi,

Where did u insert your code?

SAP Has give you the function module exits that would trigger for the payment run and generate the IDOC PEXR2002,

There are exits:

901: EXIT_SAPLIEDP_901

902: EXIT_SAPLIEDP_902

903: EXIT_SAPLIEDP_903

Use these to modify the IDOC data table (PEXR_EDIDD) before the IDOC is generated by the std payment run program

Hope this helps you

Regards

Shiva

Read only

0 Likes
2,643

hi Shiva,

Thanks for your reply

EXIT_SAPLIEDP_002

Edited by: Sue Su on Jun 22, 2009 4:44 AM

Read only

0 Likes
2,643

Hi Sue,

What might be happening is you are populating the mandatory segment of the IDOC and not passing the other segments in the exit and it might be overwriting those segments as null.

If you dont want to change other segments, then just pass them to exporting parameter same as they are imported.

Hope this helps.

Regards,

Manish

Read only

0 Likes
2,643

Hi all,

Thanks so much for your concern!

Finally ,this problem has been figured out .

Requirement is user want to use segment E1IDT01 in idoc to populate the long text they maintained in accounting document vendor item line (use FB01 to create accounting doc).

Why I made out " EDI: Syntax error in IDoc (mandatory group/segment missing)" this message out ,because I didn't fill data correctly. I missed to keep SY-TABIX in momory .

when we use Function module ,or do..enddo...or read table it_table. we should be careful that SY-TABIX is changed .So we can't just use MODIFY EDIDD_TABLE INDEX SY-TABIX in the last . we should define a local variable to keep SY-TABIX in memory and then use it to modify EDIDD_TABLE.

Follow is the final code.

...
IF SEGMENT_NAME = 'E1IDT01'.
TABLES :STXL.

* Define for long text getting
  DATA: LIT_TLINE  LIKE TLINE   OCCURS 0 WITH HEADER LINE.
  DATA: LV_STRING(2000)  TYPE C.                           
  DATA: LV_TDNAME TYPE THEAD-TDNAME,
        LV_ID     TYPE THEAD-TDID     VALUE '0001',
        LV_LANG   TYPE THEAD-TDSPRAS  VALUE 'E' ,
        LV_OBJ    TYPE THEAD-TDOBJECT VALUE 'DOC_ITEM'.

data:   LV_LINE   TYPE I,                " long Text lines
        LV_LEN    TYPE I,                " long Text length    
        LV_TABIX  LIKE SY-TABIX.                               

* Clear memory
  CLEAR:LV_TDNAME,
        LV_STRING,                                         
        LV_LINE,                                            
        LIT_TLINE, LIT_TLINE[],                           
        LV_LEN,                                             
        LV_TABIX.                                         

* Keep sy-tabix memory using a variable--This is the key point
  LV_TABIX = SY-TABIX.


* Combine TDNAME with company code + accounting doc + fiscal year + item number.
    CONCATENATE  REGUP_DATA-BUKRS REGUP_DATA-BELNR
                 REGUP_DATA-GJAHR REGUP_DATA-BUZEI INTO  LV_TDNAME.

* When vendor item has long text , read long text into lv_string
    SELECT SINGLE *
      FROM STXL
      WHERE TDOBJECT = LV_OBJ
        AND TDNAME   = LV_TDNAME
        AND TDID     = LV_ID
        AND TDSPRAS  = 'E'.

    IF SY-SUBRC = 0.

      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          CLIENT   = SY-MANDT
          ID       = LV_ID
          LANGUAGE = LV_LANG
          NAME     = LV_TDNAME
          OBJECT   = LV_OBJ
        TABLES
          LINES    = LIT_TLINE.

      IF NOT LIT_TLINE[] IS INITIAL.
        DESCRIBE  TABLE LIT_TLINE LINES LV_LINE.
        DO LV_LINE TIMES.
          READ TABLE LIT_TLINE INDEX SY-INDEX.
          CONCATENATE LV_STRING LIT_TLINE-TDLINE INTO LV_STRING.
        ENDDO.

        LV_LEN = STRLEN( LV_STRING ).
* Make sure we only need  less than 840 charicters
        IF LV_LEN > 840.
          LV_STRING = LV_STRING+0(840).
          LV_LEN    = 840.
        ENDIF.

* Populate Vendor item long text with segment E1IDT01 start from
* Fields TXT03 to TXT14.
         EDIDD_TABLE-SDATA+147(LV_LEN) = LV_STRING.

        MODIFY EDIDD_TABLE INDEX LV_TABIX.
      ENDIF.
    ENDIF.
  ENDIF.
...