I have a requirement to remove certain PO line item idoc segments based on some conditions, before the idoc is created.
I am writing the code inside IDOC_OUTPUT_ORDCHG function module (using enhancement spot).
The problem here is that I am unable to get the segment hierarchy (PO line item has a lot of idoc segments linked to each other). (The hierarchy fields PSGNUM and SEGNUM in the internal table INT_EDIDD are not filled.) I need to remove all segments related to a PO line item. For example, if PO line item 2 is not required, I need to remove all the segments related to it.
I know the PO line item detail to be removed from the idoc, but unable to find all the related line item segments, as some of them don't even have PO line item as its field.
Please suggest how to solve this issue.