2007 Jul 25 7:17 PM
Hi,
Can somebody tell me how to process the segments in a customer function (Exit)? I am developing an interface for incoming ORDERS05 (Sales Order).Before the Idoc is posted, I need to check whether the Ship-To Customer is a One time account. If somebody could give me the code, that would be appreciated.
Thanks,
Venkat.
2007 Jul 25 7:42 PM
You need to do it using the predefined SAP user exits.
You need to find, based on the message type you are dealing with, the corresponding function module used (for outbound or inbound processing). In this function module (ex: IDOC_INPUT_ORDER) you will find the function exit calls like this:
CALL CUSTOMER-FUNCTION '011'
EXPORTING
dxvbak = xvbak
docnum = idoc_contrl-docnum
TABLES
derrtab = errtab
dxvbap = xvbap
dxvbep = xvbep
dxvbadr = xvbadr
dxvbpa = xvbpa
dxvbuv = xvbuv
dedidc = idoc_contrl
dedidd = idoc_data
dxkomv = xkomv
dxvekp = xvekp
dyvekp = yvekp.
Create a enhancement project in CMOD, using the enhancement that contains the function exit (you can search for it in SMOD dropdown and entereing the function module in the component Additional search in SMOD).
Activate it and enter your code in there.
For specific examples, you will need to provide us the name of the message type or function module you are trying to "enhance".
This is simple example and you can write your own logic based on below example :
DATA: ZE1EDPT2 LIKE E1EDPT2.
LOOP AT IDOC_DATA.
CASE IDOC_DATA-SEGNAM.
WHEN 'E1EDPT2'.
MOVE IDOC_DATA-SDATA TO ZE1EDPT2.
ZE1EDPT2-TDLINE = <...>
ZE1EDPT2-TDFORMAT = <...>
MOVE ZE1EDPT2 TO IDOC_DATA-SDATA.
MODIFY IDOC_DATA.
WHEN <...>
OTHERS.
ENDCASE.
ENDLOOP.
Thanks
Seshu