Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

USER EXITS IN IDOC

Former Member
0 Kudos

How to use userexits in idocs

Thanks in advance.

6 REPLIES 6

ferry_lianto
Active Contributor
0 Kudos

Hi Nagini,

First you need to identify the FM module that being is used for inbound or outbound IDoc process. Then next step is to find custom exit available inside the corresponding FM to add your custom codes.

For example, function module IDOC_OUTPUT_ORDRSP is used to generate the IDoc type ORDERS05.

There is a last user exits that can be used to modify the EDIDD segments prior to generate IDoc ORDERS05.

Let's say you want to add quotation date to segment E1EDK03.


*- final customer-Function
CALL CUSTOMER-FUNCTION '003'
  EXPORTING
    DCONTROL_RECORD_OUT = CONTROL_RECORD_OUT
    DORDER_NUMBER       = ORDER_RESPONSE_NUMBER
    DXVBAK              = XVBAK
    DXHVBKD             = XHVBKD
  TABLES
    DXVBKD              = XVBKD
    DXVBPA              = XVBPA
    DXVBAP              = XVBAP
    DXVBEP              = XVBEP
    DIKOMV              = IKOMV
    DIKOMVD             = IKOMVD
    DINT_EDIDD          = INT_EDIDD
  EXCEPTIONS
    ERROR_MESSAGE_RECEIVED        = 1
    DATA_NOT_RELEVANT_FOR_SENDING = 2.

Then in user exits EXIT_SAPLVEDC_003, you can code like this.

data: wa_edidd   like edidd,       
      wa_e1edk03 like e1edk03.    

loop at dint_edidd.   
  if dint_edidd-segnam = 'E1EDK03'.     
    move dint_edidd-sdata to wa_e1edk03.     

    if wa_e1edk03-iddat = '013'.       
      exit.      
    else.        
      clear wa_edidd.            
      clear wa_e1edk03.        
      move dint_edidd to wa_edidd.       
      wa_e1edk03-iddat = '013'.       
      wa_e1edk03-datum = <quotation date>          
      move wa_e1edk03 to wa_edidd-sdata.       
      append wa_edidd-sdata to dint_edidd.     
    endif.   
  endif. 
endloop.

Hope this will help.

Regards,

Ferry Lianto

0 Kudos

Hi ferry,

Could you explain what is <b>dint_edidd</b> ?

ferry_lianto
Active Contributor
0 Kudos

Hi,

The dint_edidd is an internal table that hold the data records (segments) for corresponding idoc type.

Regards,

Ferry Lianto

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

This message was moderated.