Extra sub segment E1EDP05 for Idoc Type ORDERS05
It’s a cliche about how to extend an IDoc. One document from Lakshmi Narayana Neeli explained this very detailed almost cover everything needed to enhance an outbound IDoc.
So when one requirement needs to show only one extra price from the sales order item’s specific price condition (which has a statistics flag), I jump into the solution by extension of IDoc type ORDERS05 directly with inserting the new customized segment under item segment E1EDP01.
SD10 is the standard Process code for Sales order confirmation used by outbound Idoc ORDERS05 in my case. The processing flow is very clear and well organized inside the Function module “IDOC_OUTPUT_ORDRSP”. It’ll be quicker to find correct user-exit by CMOD (refer to this page 21 if you’re not familiar with it), but take this FM as a start point to is an excellent experience to understand standard Idoc data filling process which will increase efficiency no matter Idoc debugging or write your own Idoc data filling logic.
1.Routine ‘fill_idoc_inttab’ is a data filling procedure that contains all Idoc-segments;
2. ‘fill_item_segment’ is data filling for all item levels segment which type like EDEDP*
3. ‘fill_e1edp01′ is data filling for segment type E1DP01
which is the parent level of item price condition. If I use customize segments like the first screenshot, just add code to populate customize segment field at EXIT_SAPLVEDC_002 which inside routine ‘customer_function ‘ contains the CUSTOMER-FUNCTION ‘002’.
4, ‘fill_item_cond’ is data filling for price conditions at the item level which I want to enhance. And ‘fill_e1edp05′ obvious is for filling data for sub-segment e1edp05.
5. The extra item price condition needs to be added inside routine ‘get_item_prices’ instead of ‘fill_e1edp05′.
Because ‘fill_e1edp05′ just fill the data structure of segments with system filtered item price conditions. My extra item price condition is not there, need using CUSTOMER-FUNCTION ‘008’ inside ‘GET_ITEM_PRICES’ which provide user exits EXIT_SAPLVEDC_008 to add extra price conditions.
Just add code to fetch item price condition from DIKOMV with the order number, item number, and specific condition type name; then append to table dikomvd which contains all item price conditions against IKOMVD at ‘GET_ITEM_PRICES’.
if edidc-mestyp eq 'ZIDOC_TYPE'. "your Idoc type read table dikomv with key knumv = dxvbak-knumv kposn = dxvbap-posnr kschl = 'ZXXX'. "your item price condition type if sy-subrc = 0. move-corresponding dikomv to dikomvd. dikomvd-kwert = dikomv-kbetr. append dikomvd. clear dikomvd. endif. endif.
6. One point that needs to pay attention to is the skip condition before populate data into e1edp05.
The item price condition skips logic is:
- condition type must be not statistical
- condition type is active status
- condition value is not zero
My extra price condition needs to be added at Idoc ORDERS05 is statistical which is for reference purposes only and will not impact any price calculation that’s why the standard code has above skip logic by default when send Sales order out by outbound Idoc .
As it’s not wise to change standard code at this include LVEDCF0F, we just need to remove the statistical flag for our extra price condition inside EXIT_SAPLVEDC_008 by clear this statistical flag.
if edidc-mestyp eq 'ZIDOC_TYPE'. "your Idoc type read table dikomv with key knumv = dxvbak-knumv kposn = dxvbap-posnr kschl = 'ZXXX'. "your item price condition type if sy-subrc = 0. move-corresponding dikomv to dikomvd. dikomvd-kwert = dikomv-kbetr. clear dikomvd-KSTAT. "remove statistical flag here! append dikomvd. clear dikomvd. endif. endif.
Fortunately, this IKOMVD table is Price Determination Communication–Condition Record for Printing : ) It’s been refreshed per sales order item at IDoc data filling process which shouldn’t impact any price determination procedure after we remove its statistical flag.
Finally, I get this extra condition value at sub-segment E1EP05 under E1EDP01 without Idoc extension. It’s much clear to go through this standard Idoc data filling steps than modify the found user-exit directly for me. Just need to do this once to familiar with this procedure, but sometimes I’ll forget that’s why I record this for myself 😀
thanks for an article!
You may also think of standard configuration options to get pricing conditions into IDOC segment E1EDP05. You can bring them through configuration of Pricnd procedure (V/08). When you are in, you can use field "Print Type" and set 'X' or 'S' values to transfer condition value to E1EDP05.
Definitely, this depends on hwo you use pricing procedures, specific pricing condition that you need and may have a side-affect in outputs issued from your SD documents (if you use anything standard - this configuration will also bring a condition to your printout form).
However, makes sense to conddier this option as in many situations it will give you the desired IDOC segment
1. The setting of Print ID for conditions items = 'X' at the pricing procedure V/08
2. The place to check whether allow to display one condition type or not at E1EP05:
3. The code line to check this print setting :