Skip to Content

How to restrict Standard/Custom Segment triggering from Multiple Times

Hi,

Find the piece of code below as per my requirement regarding adding Idoc Zsegments and fields.

Its working fine.

*Getting the Delivery Document Number and assigning it to the Where Clause

FIELD-SYMBOLS: <FS_EDIDD> TYPE EDIDD.

READ TABLE IDOC_DATA ASSIGNING <FS_EDIDD> WITH KEY SEGNAM = 'E1EDL20'.

IF <FS_EDIDD> IS ASSIGNED.

   LS_E1EDL20 = <FS_EDIDD>-SDATA.      "Delivery Document Number

ENDIF.

*1*Fetching the respective fields for IDoc: Delivery header

SELECT SINGLE VBELN LIFNR ZZASNNO ZZINVOIVE_NO ZZREASON FROM LIKP INTO LS_LIKP WHERE VBELN = LS_E1EDL20-VBELN.

CHECK SY-SUBRC = 0.

*1****************************************Delivery header******************************1

READ TABLE IDOC_DATA INTO ls_edidd WITH KEY segnam = 'E1EDL20'.   "Custom Segment Position

CHECK SY-SUBRC = 0.

lv_tabix = sy-tabix + 1.

CONCATENATE LS_LIKP-ZZASNNO+0(20) LS_LIKP-ZZINVOIVE_NO+0(10) LS_LIKP-ZZREASON+0(20) INTO lv_sdata1.

ls_edidd-sdata = lv_sdata1.

ls_edidd-segnam = co_E1EDL20.

INSERT ls_edidd INTO IDOC_DATA INDEX lv_tabix.

CHECK sy-subrc = 0.

CLEAR: LS_LIKP,

        lv_sdata1,

        ls_edidd.


Doubt: As Respective "Include -   zxtrku02" is triggering multiple times and so my "segment E1EDL20"/Zsegment ZE1EDL20.


How to restrict my standard segment E1EDL20 and its custom segment ZE1EDL20 from triggering mutiple times.

Kindly let me know ASAP.

Idoc Details:

Message Type: DESADV

Basic Type: DELVRY03

Outbound Process Code: DELV

Output Type: OPOD

Function Module - IDOC_OUTPUT_DELVRY

Customer Exit - customer-function '002'

FM Exit name - EXIT_SAPLV56K_002

Include -   zxtrku02

With Regards,

Sudhir.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 25, 2014 at 03:58 AM

    As standard segment E1EDL20 and its custom segment ZE1EDL20 triggering mutiple times, the following is the Idoc generated.

    Zsegment is adding multiple times. How to restrict it.

    With Regards,

    Sudhir.


    ID1.JPG (62.4 kB)
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Yarnagula Sudhir

      Hi Sudhir,

      As mentioned by you, the exit where its present varies and hence their nature varies.

      One exit is called when idoc_data is filled completely while other is called at every step while its being filled.

      As far as the logic is concerned, I would suggest you to check the behavior of your code in debugging and then rectify it. The exit will help you to insert Z segments as many times as per your requirement. Also you might take help from any senior technical consultant since now it only involves correct insertion of your code. Me writing the code again in forum would not be of much help.

      Regards,

      Aashika