Skip to Content

Count of total target segments in a EDI (Including MHD and MTR segment)

Hi,

I am developing a IDOC to EDI scenario wherein I have a requirement to count the total numbers of target segments in the ouput EDI file and place this count value in a header field D_NOSG in the EDI S_MTR segment of parent segment DELHDR

The total number of segments in the output EDI is not constant. There is mapping logic for each segment. Each segment gets created based on a condition and few segments can occur multiple times also depending on certain input field value.

Can anyone please suggest how this can be handled in mapping.

Regards

Suchita

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Mar 30, 2017 at 06:26 PM

    Hi Suchita,

    Are you using the B2B add-on or some other option? We have a lot of ANSI x12 scenarios and place the value $B2B_SEG_COUNTER as a constant in the place where the dynamic segment count should be calculated. When the TransmissionNumberModule executes it does a count and replaces that constant with the proper value. I would assume it also works for the other EDI standards that are available in the add-on.

    Regards,

    Ryan Crosby

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 30, 2017 at 12:05 PM

    Hi Suchita,

    Maybe there is a simpler solution but the first thought that comes to my mind is to create an another mapping step. After your first message mapping, a target message will be created, so it will be easy to count the total number of segments during the second message mapping.

    Regards,

    Andrzej

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 30, 2017 at 06:13 PM

    Hi Suchita,

    Did you try counter function from Arithmatic functions?

    Thanks,

    Nishant

    Add comment
    10|10000 characters needed characters exceeded