Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Jigang_Zhang张吉刚
Active Contributor
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.


The new item sub-segment means structure changes of whole Idoc, and the Idoc receiver side not willing to do the adaptation for sure 😞 Then they notice that if the new extra price follows the sub-segment type E1EDP05 will be acceptable. So just find where to enhance this standard sub-segment will do.


 

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 😄

3 Comments