03-02-2008 11:36 PM
Hi Friends
I am creating Inbound Idocs for delivery Confirmations
I used Message Type WHSCON and IDoc Type /AFS/DELVRY03
i extended /AFS/DELVRY03 and created Z/AFS/DELVRY03
and also Segment ZE1EDL37 with fields KSCHL and KBETR
i am able to fill the data in segment (ZE1EDL37)
but i am unable to put the same in Tables and transactions
i need logic to update the extended segment data in table
can any one have idea or send me code sample
Cheers
Anil
03-03-2008 7:16 AM
Hi Anil,
First get the Inbound function Module of your IDOC thru the Process code.
Then Check for the Call Customer Function,there you will find an exit to populate the data for your Zsegments,there you write the code for data poplation to your Zfields.
Thanks and Regards.
Note:Reward Points if you find useful.
03-03-2008 1:02 PM
Hi Swami
I know the FM its Idoc_Inbound_delvry
and i know the exit and KSCHL and KBETR stored in condition tablr KONV
i just need logic to update the custom segments data in tables and transaction
as soon as idoc is created this values should be displayed in Transaction n tables
Cheers
03-03-2008 1:17 PM
Here see the sample code for Extended Inbound Idocs
In this scenario, data in the Z1KNVVM segment is read and processed.
This user exit is called after the system has already updated the
customer master. Therefore data is updated in the SAP tables directly
----
TABLES: KNVV.
DATA: KNVVM LIKE E1KNVVM,
KNA1M LIKE E1KNA1M,
Z1KNVVM LIKE Z1KNVVM.
LOOP AT IDOC_DATA. " loop through all data records
CASE IDOC_DATA-SEGNAM.
WHEN 'E1KNA1M'. " has customer number in it
KNA1M = IDOC_DATA-SDATA.
WHEN 'E1KNVVM'. " has sales org dist ch and division
KNVVM = IDOC_DATA-SDATA.
WHEN 'Z1KNVVM'. " has custom data
Z1KNVVM = IDOC_DATA-SDATA.
Always a good idea to make sure we have a valid customer number
SELECT SINGLE * FROM KNVV WHERE KUNNR = KNA1M-KUNNR
AND VKORG = KNVVM-VKORG
AND VTWEG = KNVVM-VTWEG
AND SPART = KNVVM-SPART.
IF SY-SUBRC EQ 0. "customer was found
UPDATE KNVV SET
ZZDELPRTY = Z1KNVVM-ZZDELPRTY
ZZRANK = Z1KNVVM-ZZRANK
WHERE KUNNR = KNA1M-KUNNR AND
VKORG = KNVVM-VKORG AND
VTWEG = KNVVM-VTWEG AND
SPART = KNVVM-SPART.
ELSE.
The following lines of code will create a status record
with status 51, and a workflow is started
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '51'.
IDOC_STATUS-MSGTY = 'E'.
IDOC_STATUS-MSGID = 'ZE'.
IDOC_STATUS-MSGNO = '005'.
IDOC_STATUS-MSGV1 = KNA1M-KUNNR.
APPEND IDOC_STATUS.
WORKFLOW_RESULT = C_WF_RESULT_ERROR.
RETURN_VARIABLES-WF_PARAM = 'Error_IDOCs'.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
ENDCASE.
ENDLOOP.
Reward if helpful