INBOUND IDOC REPROCESSING IN CUSTOM PROGRAM
Hello,
I have a custom program which displays the INBOUND IDoc data for the message type = ZSTLSP in the ALV format.
Requiremt is that I shall select a record and change one of the coulmn contents . A button 'Reprocess' will be
made available , when clicked it needs to reprocess the Idoc . The reprocessed idoc will be strored with the new values entered
and the original idoc will be stored with status 70.
Kindly let me know how to reporcess the IDoc in the custom program.
Note that If I try to cakk l standard program RBDAPP01 to reprocess the IDOCs using SUBMIT statement. We can pass the IDOC Number, Message type etc. while submitting the program but CANNNT pass the changed SDATA field.
Thanks in Advance!!
Senthil
I am able to change the value using FM IDOC_INPUT , but the changed values is not updateing in the databse.
Maybe I need to do commit. kindly let me know how to do commit in this scenario.
Senthil
Similar Messages
-
Idoc reprocessing in Custom program
I have a custom program which displays the IDoc data for the message type = ZSTLSP in the ALV format.
Requiremt is that I shall select a record and change one of the coulmn contents . A button 'Reprocess' will be
made available , when clicked it needs to reprocess the Idoc . The reprocessed idoc will be strored with the new values entered
and the original idoc will be stored with status 70.
Kindly let me know how to reporcess the IDoc in the custom program.
p.s.: Function module IDOC_INPUT does also reprocess ..but it does not disoplays the updated status.Hello,
You may call standard program RBDAPP01 to reprocess the IDOCs using SUBMIT statement. Pass the IDOC Number, Message type etc. while submitting the program.
Thanks,
Venu -
How to create Inbound Idocs in a ABAP program? Any function Module?
Hello Experts,
My requirement is : I have sales order data which I extracted from third party system in my internal tables. In the same box I need to create inbound Idocs and then consequently create sales orders.
I have used the function module IDOC_INBOUND_WRITE_TO_DB to create inbound Idocs from Sales Orders data in internal tables. I have populated all the data records with correct PSGNUM and HLEVEL values. My plan is to create inbound idocs with this function module and send those to IDOC_INPUT_ORDERS function module which creates Sales Orders.
If a sales order in the internal table in ABAP program contains only one item, then I am getting correct idocs. But if more than one item exists for a sales order then the line item segments which got repeated in Idoc are having PSGNUM and HLEVEL values as zero when I checked in WE02. As a result the hierarchy from the second item segment is getting disturbed and getting the status 60.
I populated T_EDIDD with data records from IDOC_INBOUND_WRITE_TO_DB.
To the function module IDOC_INPUT_ORDERS, T_EDIDC and T_EDIDD are the input. I observed that in T_EDIDD also the PSGNUM and HLEVEL values are blank.
I am getting Status 60 with message 'EDI: Syntax error in IDoc (segment cannot be identified)' for idocs which have more than one item.
I need to extract sales data from third party and create inbound idocs and create sales orders in one ABAP program only. I need to display corresponding Idoc numbers for the corresponding third party sales order number in a listoutput.
Can anybody please provide inputs?
Regards.Hi Anjali,
Thanks for the response.
I have passed the PSGNUM and HLEVEL values while populating the data records. Then I sent the data records and control record information to the function module IDOC_INBOUND_WRITE_TO_DB. Inside this function module there is code to clear the PSGNUM values and HLEVEL values.
for compatibility: clear administration data of data records
perform data_records_wipe
tables
t_data_records.
FORM DATA_RECORDS_WIPE
TABLES
T_DATA_RECORDS_IN STRUCTURE EDIDD.
LOOP AT T_DATA_RECORDS_IN.
CLEAR: T_DATA_RECORDS_IN-MANDT,
T_DATA_RECORDS_IN-DOCNUM,
T_DATA_RECORDS_IN-SEGNUM,
T_DATA_RECORDS_IN-PSGNUM,
T_DATA_RECORDS_IN-HLEVEL.
modify t_data_records_in.
ENDLOOP.
ENDFORM. " DATA_RECORDS_WIPE
This is the code which is clearing all the PSGNUM and HLEVEL values. After coming out of this function module we are getting the error idocs created with disturbed hierarchy.
I need to create INBOUND Idocs with the data in ABAP program.
Please let me know if any inputs? Is there any function module existing to create Inbound Idocs inside an ABAP program?
Regards -
Inbound idoc processing using custom FM to cancel sales orders
hello all,
I have a scenario where i need to create a customized function module which is assigned to custom message type. and this function module is triggered when inbound idoc comes, which will process idoc data for cancellation of sales orders. If an errror occurs than the error during cancellation has to be reflected back in the idoc status.
can anyone tell me how exactly i can log the status and reflect it back, how exactly can i do this
And what are all the objects i need to create to succusfully execute this scenario, i have created message type, function module, i am using orders05 do i need to create process code also.
Thanks,
krishnam raju.Hi Krishna,
Hope you are done with the Inbound function module creation. But, just creation of function module would not be enough, what u said that is like creation of Process code should also be done.
WE42 is the transaction code for inbound process code.
And while creation of the process code, we need to do few things like:
We need to create an entry of the inbound function module in BD51 transaction or so. And coming to updating of the status, open any of the inbound function module, you will observe that there is a standard subroutine which will update the IDOC_STATUS record. You can implement the same logic whenever you want to update an error message.
Thanks,
Adithya K -
User Exit for Inbound Idoc Processing of Customer Invoice
Hi all,
I have to extend a standard idoc 'WPUBON01' to include a segment with Header Text Ids to pass header text displayed in VF03.
Can you please share the exit name so as a call to function module save_text be made and the header text gets saved in the respective Header Text Ids.
Thanks in advance.
Radhika
Edited by: Radhika7 on Apr 21, 2011 9:55 AMHi Radhika,
Not sure of the actual business scenario of your requirement, anyways you can try the below customer exits, and if they dont work please provide more info on the scenario.
EXIT_SAPLWPUE_102 IDoc WPUBON01 Before Document is Posted
EXIT_SAPLWPUE_104 IDoc WPUBON01 Before Inbound Processing
EXIT_SAPLWPUE_109 IDoc WPUBON01 After Inbound Processing
EXIT_SAPLWPUE_110 IDoc WPUUMS01 Before Posting
My bet would be on EXIT*109 to be of any help.
Regards,
Chen -
Please send one exicuted program example of inbound idoc process
Dear Friends,
I am facing one problem to process inbound idoc process.Please example send anybody ?
I have faced problem in standalone process to do inbound idoc process.
iam waiting for your valuble response.
Definitly best answer will get best reward.
Regards.
Sridhar Menda.Hi Sridhar,
Here is a example of program for inbound idoc process.
Example Program to Process an IDoc
The Example Program to Process an IDoc shows how the fictitious message type XAMPLE, communicated with IDocs of type XAMPLE01, is processed using the inbound function module Idoc_Input_Xample. The IDoc type has a header segment, E1xhead, and any number of item segments E1xitem. The data from the IDoc is written to two database tables, XHEAD and XITEM respectively. XHEAD and XITEM contain the same field names as E1xhead and E1xitem respectively. The fields names and data types are shown in the following two tables:
Field Name in XHEAD
Docmnt_no
Date
Currency
Country
Description
Document number
Date
Currency
Country
Type in e1xhead
CHAR
CHAR
CHAR
CHAR
Type in XHEAD
NUMC
DATS
CUKY
CHAR
Field Name in XITEM
Item_no
Materialid
Descript
Unit
Quantity
Value
Ship_Inst
Description
Item number
Material number
Material description
Unit of measure
Quantity
Value
Shipping instructions
Type in e1xitem
CHAR
CHAR
CHAR
CHAR
CHAR
CHAR
CHAR
Type in xitem
NUMC
CHAR
CHAR
UNIT
QUAN
CURR
UNIT
The data on the database is assigned a new document number (field DOCMNT_NO) using number assignment. The field DOCMNT_NO is not stored in the newly created table XHEAD.
FUNCTION·IDOC_INPUT_XAMPLE.
*"Local·interface:
*"·······IMPORTING
*"·············VALUE(INPUT_METHOD)·LIKE··BDWFAP_PAR-INPUTMETHD
*"·············VALUE(MASS_PROCESSING)·LIKE··BDWFAP_PAR-MASS_PROC
*"·······EXPORTING
*"·············VALUE(WORKFLOW_RESULT)·LIKE··BDWF_PARAM-RESULT
*"·············VALUE(APPLICATION_VARIABLE)·LIKE··BDWF_PARAM-APPL_VAR
*"·············VALUE(IN_UPDATE_TASK)·LIKE··BDWFAP_PAR-UPDATETASK
*"·············VALUE(CALL_TRANSACTION_DONE)·LIKE··BDWFAP_PAR-CALLTRANS
*"·······TABLES
*"··············IDOC_CONTRL·STRUCTURE··EDIDC
*"··············IDOC_DATA·STRUCTURE··EDIDD
*"··············IDOC_STATUS·STRUCTURE··BDIDOCSTAT
*"··············RETURN_VARIABLES·STRUCTURE··BDWFRETVAR
*"··············SERIALIZATION_INFO·STRUCTURE··BDI_SER
*"·······EXCEPTIONS
*"··············WRONG_FUNCTION_CALLED
·05·July·1996·----
*·Example·function·module·for·processing·inbound·IDocs·for·ALE·or·EDI.
*·This·example·applies·for·processing
*···with····-··one·IDoc·at·a·time
*···without·-··serialization
*···········-··customer-exits
*···········-··calling·an·ALE-enabled·transaction
*···········-··mass·processing·(more·than·one·IDoc·at·a·time)
·Naming·conventions·----
*·Internal·tables·start·with·'t_'
*·Internal·field·strings·start·with·'f_'
*·>>·The·following·line·must·appear·in·the·global·part·of·your
*·>>·function·group:
*····include·mbdconwf.············"Report·containing·the·ALE·constants.
*·The·ALE·constants·start·with·'c_'.
··DATA:·SUBRC·LIKE·SY-SUBRC,
········OBJECT_NUMBER·LIKE·XHEAD-DOCMNT_NO.
*·Initialize·variables
··SUBRC·=·0.
*·Read·the·IDoc's·control·record
··READ·TABLE·IDOC_CONTRL·INDEX·1.
*·Process·the·IDoc·and·post·the·data·to·the·database
··PERFORM·IDOC_PROCESS_XAMPLE·TABLES···IDOC_DATA
·······································IDOC_STATUS
······························USING····IDOC_CONTRL
······························CHANGING·OBJECT_NUMBER
·······································SUBRC.
*·Fill·the·ALE·export·parameters
··CLEAR·IN_UPDATE_TASK.
··CLEAR·CALL_TRANSACTION_DONE.·········"Call·Transaction·is·not·used.
··IF·SUBRC·<>·0.·······················"Error·occurred
····WORKFLOW_RESULT·=·C_WF_RESULT_ERROR.
····RETURN_VARIABLES-WF_PARAM·=·C_WF_PAR_ERROR_IDOCS.
····RETURN_VARIABLES-DOC_NUMBER·=·IDOC_CONTRL-DOCNUM.
····APPEND·RETURN_VARIABLES.
··ELSE.································"IDoc·processed·successfully
····WORKFLOW_RESULT·=·C_WF_RESULT_OK.
····RETURN_VARIABLES-WF_PARAM·=·C_WF_PAR_PROCESSED_IDOCS.
····RETURN_VARIABLES-DOC_NUMBER·=·IDOC_CONTRL-DOCNUM.
····APPEND·RETURN_VARIABLES.
····RETURN_VARIABLES-WF_PARAM·=·C_WF_PAR_APPL_OBJECTS.
····RETURN_VARIABLES-DOC_NUMBER·=·OBJECT_NUMBER.
····APPEND·RETURN_VARIABLES.
··ELSE.
ENDFUNCTION.
·······FORM·IDOC_PROCESS_XAMPLE······································
··This·routine·creates·an·application·document·based·on·the·IDoc's···
··contents.·Object_Number·contains·the·new·document's·number.··········If·an·error·occurs,·subrc·is·non-zero,·t_idoc_status·is·filled.·······Note:·if·more·than·one·error·is·detected,·t_idoc_status·contains···
········more·than·one·status·record.·································
··-->··F_IDOC_CONTRL····IDoc·control·record··························
··-->··T_IDOC_DATA······IDoc·data·records····························
··<--··T_IDOC_STATUS····IDoc·status·records··························
··<--··OBJECT_NUMBER····Created·document's·number····················
··<--··SUBRC············Return·code··································
FORM·IDOC_PROCESS_XAMPLE
·······TABLES···T_IDOC_DATA····STRUCTURE·EDIDD
················T_IDOC_STATUS··STRUCTURE·BDIDOCSTAT
·······USING····F_IDOC_CONTRL··STRUCTURE·EDIDC
·······CHANGING·OBJECT_NUMBER··LIKE·XHEAD-DOCMNT_NO
················SUBRC··········LIKE·SY-SUBRC.
*·Internal·field·string·for·the·document·header.
··DATA:·F_XHEAD·LIKE·XHEAD.
*·Internal·table·for·the·document·items.
··DATA:·T_XITEM·LIKE·XITEM·OCCURS·0·WITH·HEADER·LINE.
*·Number·given·to·the·created·document·DOCUMENT_NUMBER·LIKE·F_XHEAD-DOCMNT_NO.
*·Move·the·data·in·the·IDoc·to·the·internal·structures/tables
*·f_xhead·and·t_xitem.
··PERFORM·IDOC_INTERPRET·TABLES···T_IDOC_DATA
··································T_XITEM
··································T_IDOC_STATUS
·························USING····F_IDOC_CONTRL
·························CHANGING·F_XHEAD
··································SUBRC.
*·Create·the·application·object·if·no·error·occurred·so·far.
··IF·SUBRC·=·0.
*···This·fictitious·function·module·creates·a·new·object·based·on·the
*···data·that·was·read·from·the·IDoc.·The·new·object's·ID·is·returned
*···in·the·parameter·'document_number'.
*···The·function·module·checks·that·the·data·is·correct,·and·raises
*···an·exception·if·an·error·is·detected.
····CALL·FUNCTION·'XAMPLE_OBJECT_CREATE'
·········EXPORTING
··············XHEAD···········=·F_XHEAD
·········IMPORTING
··············DOCUMENT_NUMBER·=·DOCUMENT_NUMBER
·········TABLES
··············XITEM···········=·T_XITEM
·········EXCEPTIONS
··············OTHERS··········=·1.
····IF·SY-SUBRC·<>·0.
······SUBRC·=·1.
*·····Put·the·error·message·into·'t_idoc_status'
······PERFORM·STATUS_FILL_SY_ERROR
················TABLES···T_IDOC_STATUS
················USING····T_IDOC_DATA
·························SY
·························''············"Field·name
·························'idoc_process_xample'.·········"Form·routine
····ELSE.
*·····Fill·the·remaining·export·parameters
······OBJECT_NUMBER·=·DOCUMENT_NUMBER.··········"New·document's·number
······t_idoc_status-docnum·=·f_idoc_contrl-docnum.
······t_idoc_status-status·=·c_idoc_status_ok.
······t_idoc_status-msgty··=·'S'.
······t_idoc_status-msgid··=·your_msgid.·"Global·variable.
······t_idoc_status-msgno··=·msgno_success."Global·variable.
······t_idoc_status-msgv1··=·object_number.
······APPEND·T_IDOC_STATUS.
····ENDIF.·····························"if·sy-subrc·<>·0.
··ENDIF.·····························"if·subrc·=·0.
ENDFORM.
·······FORM·IDOC_INTERPRET···········································
··This·routine·checks·that·the·correct·message·type·is·being·used,···
··and·then·converts·and·moves·the·data·from·the·IDoc·segments·to·the·
··internal·structure·f_xhead·and·internal·table·t_xitem.·············
··If·an·error·occurs,·t_idoc_status·is·filled·an·subrc·<>·0.·········
··-->··T_IDOC_STATUS·················································
··-->··T_XITEM·······················································
··-->··F_IDOC_DATA···················································
··-->··F_XHEAD·······················································
··-->··SUBRC·························································
FORM·IDOC_INTERPRET·TABLES···T_IDOC_DATA····STRUCTURE·EDIDD
·····························T_XITEM········STRUCTURE·XITEM
·····························T_IDOC_STATUS··STRUCTURE·BDIDOCSTAT
····················USING····F_IDOC_CONTRL··STRUCTURE·EDIDC
····················CHANGING·F_XHEAD········STRUCTURE·XHEAD
·····························SUBRC··········LIKE·SY-SUBRC.
*·Check·that·the·IDoc·contains·the·correct·message·type.
*··Note:·if·your·message·type·is·reducible,·check·field·'idoctp'
*·······(IDoc·type)·instead·of·'mestyp'.
··IF·F_IDOC_CONTRL-MESTYP·<>·'XAMPLE'.
····MESSAGE·ID······YOUR_MSGID···············"Global·variable
············TYPE····'E'
············NUMBER··MSGNO_WRONG_FUNCTION·····"Global·variable
············WITH····F_IDOC_CONTRL-MESTYP·····"message·type
····················'IDOC_INPUT_XAMPLE'······"Your·function·module.
····················F_IDOC_CONTRL-SNDPRT·····"Sender·partner·type
····················F_IDOC_CONTRL-SNDPRN·····"Sender·number.
············RAISING·WRONG_FUNCTION_CALLED.
··ENDIF.
*·Loop·through·the·IDoc's·segments·and·convert·the·data·from·the·IDoc
*·format·to·the·internal·format.
··LOOP·AT·T_IDOC_DATA·WHERE·DOCNUM·=·F_IDOC_CONTRL-DOCNUM.
····CASE·T_IDOC_DATA-SEGNAM.
······WHEN·'E1XHEAD'.
········PERFORM·E1XHEAD_PROCESS·TABLES···T_IDOC_STATUS
································USING····T_IDOC_DATA
································CHANGING·F_XHEAD
·········································SUBRC.
······WHEN·'E1XITEM'.
········PERFORM·E1XITEM_PROCESS·TABLES···T_XITEM
·········································T_IDOC_STATUS
································USING····F_XHEAD-CURRENCY
·········································T_IDOC_DATA
································CHANGING·SUBRC.
····ENDCASE.
··ENDLOOP.
ENDFORM.
·······FORM·E1XHEAD_PROCESS··········································
··This·routine·fills·'f_xhead'·out·of·segment·e1xhead.·················If·an·error·occurs,·subrc·is·non-zero,·t_idoc_status·is·filled.····*
··-->··F_IDOC_DATA·······IDoc·segment·containing·e1xhead·fields······
··<--··F_XHEAD···········Internal·structure·containing·doc.·header···
··<--··T_IDOC_STATUS·····Status·fields·for·error·handling············
··<--··SUBRC·············Return·code:·non-zero·if·an·error·occurred··
FORM·E1XHEAD_PROCESS·TABLES···T_IDOC_STATUS··STRUCTURE·BDIDOCSTAT
·····················USING····F_IDOC_DATA····STRUCTURE·EDIDD
·····················CHANGING·F_XHEAD········STRUCTURE·XHEAD
······························SUBRC··········LIKE·SY-SUBRC.
··DATA:·F_E1XHEAD·LIKE·E1XHEAD.
··F_E1XHEAD·=·F_IDOC_DATA-SDATA.
*·Process·fields·that·need·conversion·from·ISO-codes·to·SAP-codes
··PERFORM·E1XHEAD_CODES_ISO_TO_SAP
·········TABLES···T_IDOC_STATUS
·········USING····F_E1XHEAD
··················F_IDOC_DATA
·········CHANGING·F_XHEAD
··················SUBRC.
*·Process·fields·containing·dates·or·times
··PERFORM·E1XHEAD_DATE_TIME·USING····F_E1XHEAD
····························CHANGING·F_XHEAD.
ENDFORM.·······························"e1xhead_process
·······FORM·E1XITEM_PROCESS··········································
··This·routine·converts·the·data·in·the·segment·'e1xitem'·for········
··to·the·format·of·table·'t_xitem'·and·appends·it·to·the·table.········If·an·error·occurs,·subrc·is·non-zero,·t_idoc_status·is·filled.····*
··-->··F_IDOC_DATA······IDoc·segment·································
··<--··T_XITEM··········Document·items·to·be·updated·to·database·····
··<--··T_IDOC_STATUS····Status·fields·filled·if·an·error·occurred····
··<--··SUBRC············Return·code:·0·if·all·OK·····················
FORM·E1XITEM_PROCESS·TABLES···T_XITEM·······STRUCTURE·XITEM
······························T_IDOC_STATUS·STRUCTURE·BDIDOCSTAT
·····················USING····CURRENCY······LIKE·XHEAD-CURRENCY
······························F_IDOC_DATA···STRUCTURE·EDIDD
·····················CHANGING·SUBRC·········LIKE·SY-SUBRC.
··DATA:·F_E1XITEM·LIKE·E1XITEM.
··F_E1XITEM·=·F_IDOC_DATA-SDATA.
*·Fields·of·type·CHAR,·NUMC,·QUAN·need·no·conversion.
··T_XITEM-ITEM_NO····=·F_E1XITEM-ITEM_NO.
··T_XITEM-MATERIALID·=·F_E1XITEM-MATERIALID.
··T_XITEM-DESCRIPT···=·F_E1XITEM-DESCRIPT.
··T_XITEM-QUANTITY···=·F_E1XITEM-QUANTITY.
*·Process·fields·that·need·conversion·from·ISO-codes·to·SAP-codes
··PERFORM·E1XHEAD_CODES_ISO_TO_SAP
·········TABLES···T_IDOC_STATUS
·········USING····F_E1XHEAD
··················F_IDOC_DATA
·········CHANGING·F_XHEAD
··················SUBRC.
*·Process·fields·that·contain·monetary·values
··PERFORM·E1XITEM_VALUE_IDOC_TO_SAP·TABLES···T_IDOC_STATUS
····································USING····F_E1XITEM
·············································CURRENCY
·············································F_IDOC_DATA
····································CHANGING·T_XITEM
·············································SUBRC.
··APPEND·T_XITEM.
ENDFORM.
·······FORM·E1XHEAD_CODES_ISO_TO_SAP·································
··Converts·ISO-Codes·in·f_e1xhead·to·SAP-codes·in·f_xhead.·············f_idoc_data,·t_idoc_status·and·subrc·are·used·for·error·handling.··*
FORM·E1XHEAD_CODES_ISO_TO_SAP
·······TABLES···T_IDOC_STATUS·STRUCTURE·BDIDOCSTAT
·······USING····F_E1XHEAD·····STRUCTURE·E1XHEAD
················F_IDOC_DATA···STRUCTURE·EDIDD
·······CHANGING·F_XHEAD·······STRUCTURE·XHEAD
················SUBRC.
*·f_xhead-currency···Type·CUKY·=>·convert·ISO-Code·to·SAP-Code.
··PERFORM·CURRENCY_CODE_ISO_TO_SAP
·········TABLES···T_IDOC_STATUS
·········USING····F_E1XHEAD-CURRENCY
··················F_IDOC_DATA
··················'CURRENCY'
·········CHANGING·F_XHEAD-CURRENCY
··················SUBRC.
··CHECK·SUBRC·=·0.
*·f_xhead-country···Contains·a·country·=>·convert·from·ISO·to·SAP·code.
··PERFORM·COUNTRY_CODE_ISO_TO_SAP
·········TABLES···T_IDOC_STATUS
·········USING····F_E1XHEAD-COUNTRY
··················F_IDOC_DATA
··················'COUNTRY'
·········CHANGING·F_XHEAD-COUNTRY
··················SUBRC.
ENDFORM.
·······FORM·E1XITEM_CODES_ISO_TO_SAP·································
··Converts·ISO-Codes·in·f_e1xitem·to·SAP-codes·in·f_xitem············
··f_idoc_data,·t_idoc_status·and·subrc·are·used·for·error·handling.··
FORM·E1XITEM_CODES_ISO_TO_SAP
·······TABLES···T_IDOC_STATUS·STRUCTURE·BDIDOCSTAT
·······USING····F_E1XITEM·····STRUCTURE·E1XITEM
················F_IDOC_DATA···STRUCTURE·EDIDD
·······CHANGING·F_XITEM·······STRUCTURE·XITEM
················SUBRC·········LIKE·SY-SUBRC.
*·f_xitem-unit·······Type·UNIT·=>·convert·ISO-Code·to·SAP-Code.
··PERFORM·UNIT_OF_MEASURE_ISO_TO_SAP
·········TABLES···T_IDOC_STATUS
·········USING····F_E1XITEM-UNIT
··················F_IDOC_DATA
··················'unit'
·········CHANGING·F_XITEM-UNIT
··················SUBRC.
*·f_xitem-ship_inst··Contains·shipping·instructions·=>·ISO·to·SAP·code.
··PERFORM·SHIPPING_INSTRUCT_ISO_TO_SAP
·········TABLES···T_IDOC_STATUS
·········USING····F_E1XITEM-SHIP_INST
··················F_IDOC_DATA
··················'ship_inst'
·········CHANGING·F_XITEM-SHIP_INST
··················SUBRC.
ENDFORM.
·······FORM·E1XITEM_VALUE_IDOC_TO_SAP································
··Converts·fields·containing·monetary·values·in·f_e1xitem·to·········
··the·internal·representation·in·f_xitem.······························f_idoc_data,·t_idoc_status·and·subrc·are·used·for·error·handling.··*
FORM·E1XITEM_VALUE_IDOC_TO_SAP
·······TABLES···T_IDOC_STATUS·STRUCTURE·BDIDOCSTAT
·······USING····F_E1XITEM·····STRUCTURE·E1XITEM
················CURRENCY······LIKE·XHEAD-CURRENCY
················F_IDOC_DATA···STRUCTURE·EDIDD
·······CHANGING·F_XITEM·······STRUCTURE·XITEM
················SUBRC·········LIKE·SY-SUBRC.
*·f_xitem-value····Type·CURR·=>·convert·IDoc·amount·to·internal·amount.
*·N.B.·the·currency·code·used·here·must·be·the·SAP-internal·one,·not
*······the·one·contained·in·the·IDoc!
··CALL·FUNCTION·'CURRENCY_AMOUNT_IDOC_TO_SAP'
·······EXPORTING
············CURRENCY····=·CURRENCY
············IDOC_AMOUNT·=·F_E1XITEM-VALUE
·······IMPORTING
············SAP_AMOUNT··=·F_XITEM-VALUE
·······EXCEPTIONS
············OTHERS······=·1.
··IF·SY-SUBRC·<>·0.
····SUBRC·=·1.
*···Put·the·error·message·into·'t_idoc_status'
····PERFORM·STATUS_FILL_SY_ERROR
··············TABLES···T_IDOC_STATUS
··············USING····F_IDOC_DATA
·······················SY
·······················'value'·········"Field·name
·······················'e1xitem_value_idoc_to_sap'.······"Form·routine
··ENDIF.·······························"if·sy-subrc·<>·0.
ENDFORM.
·······FORM·E1XHEAD_DATE_TIME········································
··Moves·date·and·time·fields·in·f_e1xhead·to·the·fields·in·f_xhead.··
FORM·E1XHEAD_DATE_TIME·USING····F_E1XHEAD·STRUCTURE·E1XHEAD
·······················CHANGING·F_XHEAD·STRUCTURE·XHEAD.
*·f_xhead-date····Type·DATS·=>·initial·value·is·not·'blank'.
··IF·E1XHEAD-DATE·IS·INITIAL.
····CLEAR·F_XHEAD-DATE.
····F_XHEAD-DATE·=·F_E1XHEAD-DATE.
··ENDIF.
ENDFORM.
·······FORM·CURRENCY_CODE_ISO_TO_SAP·································
··Converts·ISO·currency·code·'iso_currency_code'·to·SAP·code·in······
··'sap_currency_code'················································
··f_idoc_data,·field_name,·t_idoc_status·and·subrc·are·used·for······
··for·error·handling.················································
FORM·CURRENCY_CODE_ISO_TO_SAP
·······TABLES···T_IDOC_STATUS·····STRUCTURE·BDIDOCSTAT
·······USING····ISO_CURRENCY_CODE·LIKE·TCURC-ISOCD
················F_IDOC_DATA·······STRUCTURE·EDIDD
················FIELD_NAME········LIKE·BDIDOCSTAT-SEGFLD
·······CHANGING·SAP_CURRENCY_CODE·LIKE·TCURC-WAERS
················SUBRC·············LIKE·SY-SUBRC.
··IF·ISO_CURRENCY_CODE·IS·INITIAL.
····CLEAR·SAP_CURRENCY_CODE.
··ELSE.
····CALL·FUNCTION·'CURRENCY_CODE_ISO_TO_SAP'
·········EXPORTING
··············ISO_CODE·=·ISO_CURRENCY_CODE
·········IMPORTING
··············SAP_CODE·=·SAP_CURRENCY_CODE
·········EXCEPTIONS
··············OTHERS···=·1.
····IF·SY-SUBRC·<>·0.
······SUBRC·=·1.
*·····Put·the·error·message·into·'t_idoc_status'
······PERFORM·STATUS_FILL_SY_ERROR
················TABLES···T_IDOC_STATUS
················USING····F_IDOC_DATA
·························SY
·························FIELD_NAME
·························'currency_code_iso_to_sap'.·····"Form·routine
··ENDIF.·····························"if·sy-subrc·<>·0.
··ENDIF.·······························"if·iso_currency_code·is·initial.
ENDFORM.
·······FORM·CURRENCY_CODE_ISO_TO_SAP·································
··Converts·ISO·currency·code·'iso_currency_code'·to·SAP·code·in······
··'sap_currency_code'················································
··f_idoc_data,·field_name,·t_idoc_status·and·subrc·are·used·for······
··for·error·handling.················································
FORM·COUNTRY_CODE_ISO_TO_SAP
·······TABLES···T_IDOC_STATUS····STRUCTURE·BDIDOCSTAT
·······USING····ISO_COUNTRY_CODE·LIKE·T005-INTCA
················F_IDOC_DATA······STRUCTURE·EDIDD
················FIELD_NAME·······LIKE·BDIDOCSTAT-SEGFLD
·······CHANGING·SAP_COUNTRY_CODE·LIKE·T005-LAND1
················SUBRC············LIKE·SY-SUBRC.
*·Only·convert·if·the·field·is·not·initial.
··IF·ISO_COUNTRY_CODE·IS·INITIAL.
····CLEAR·SAP_COUNTRY_CODE.
··ELSE.
····CALL·FUNCTION·'COUNTRY_CODE_ISO_TO_SAP'
·········EXPORTING
··············ISO_CODE·=·ISO_COUNTRY_CODE
·········IMPORTING
··············SAP_CODE·=·SAP_COUNTRY_CODE
·········EXCEPTIONS
··············OTHERS···=·1.
····IF·SY-SUBRC·<>·0.
······SUBRC·=·1.
*·····Put·the·error·message·into·'t_idoc_status'
······PERFORM·STATUS_FILL_SY_ERROR
················TABLES···T_IDOC_STATUS
················USING····F_IDOC_DATA
·························SY
·························FIELD_NAME
·························'country_code_iso_to_sap'.······"Form·routine
··ENDIF.·····························"if·sy-subrc·<>·0.
··ENDIF.·······························"if·iso_country_code·is·initial.
ENDFORM.
·······FORM·UNIT_OF_MEASURE_ISO_TO_SAP·······························
··Converts·ISO·unit·of·measure·code·'iso_unit_of_measure'·to·SAP·····
··code·in·'sap_unit_of_measure'.·····································
··f_idoc_data,·field_name,·t_idoc_status·and·subrc·are·used·for······
··for·error·handling.················································
FORM·UNIT_OF_MEASURE_ISO_TO_SAP
·······TABLES···T_IDOC_STATUS·······STRUCTURE·BDIDOCSTAT
·······USING····ISO_UNIT_OF_MEASURE·LIKE·T006-ISOCODE
················F_IDOC_DATA·········STRUCTURE·EDIDD
················FIELD_NAME··········LIKE·BDIDOCSTAT-SEGFLD
·······CHANGING·SAP_UNIT_OF_MEASURE·LIKE·T006-MSEHI
················SUBRC···············LIKE·SY-SUBRC.
*·Only·convert·the·field·if·it·is·not·empty.
··IF·ISO_UNIT_OF_MEASURE·IS·INITIAL.
····CLEAR·SAP_UNIT_OF_MEASURE.
··ELSE.
····CALL·FUNCTION·'UNIT_OF_MEASURE_ISO_TO_SAP'
·········EXPORTING
··············ISO_CODE·=·ISO_UNIT_OF_MEASURE
·········IMPORTING
··············SAP_CODE·=·SAP_UNIT_OF_MEASURE
·········EXCEPTIONS
··············OTHERS···=·1.
····IF·SY-SUBRC·<>·0.
······SUBRC·=·1.
*·····Put·the·error·message·into·'t_idoc_status'
······PERFORM·STATUS_FILL_SY_ERROR
················TABLES···T_IDOC_STATUS
················USING····F_IDOC_DATA
·························SY
·························FIELD_NAME
·························'unit_of_measure_iso_to_sap'.··"Form·routine
··ENDIF.·····························"if·sy-subrc·<>·0.
··ENDIF.··················"if·iso_unit_of_measure_code·is·initial.
ENDFORM.
·······FORM·SHIPPING_INSTRUCT_ISO_TO_SAP·····························
··Converts·ISO·package·code·'iso_package_type'·to·SAP·code·for·······
··purchasing·shipping·instructions·in·'sap_shipping_instructions'.···
··f_idoc_data,·field_name,·t_idoc_status·and·subrc·are·used·for······
··for·error·handling.················································
FORM·SHIPPING_INSTRUCT_ISO_TO_SAP
·······TABLES···T_IDOC_STATUS·············STRUCTURE·BDIDOCSTAT
·······USING····ISO_PACKAGE_TYPE··········LIKE·T027A-IVERS
················F_IDOC_DATA···············STRUCTURE·EDIDD
················FIELD_NAME················LIKE·BDIDOCSTAT-SEGFLD
·······CHANGING·SAP_SHIPPING_INSTRUCTIONS·LIKE·T027A-EVERS
················SUBRC·····················LIKE·SY-SUBRC.
*·Only·convert·the·field·if·it·is·not·empty.
··IF·ISO_PACKAGE_TYPE·IS·INITIAL.
····CLEAR·SAP_SHIPPING_INSTRUCTIONS.
··ELSE.
····CALL·FUNCTION·'ISO_TO_SAP_PACKAGE_TYPE_CODE'
·········EXPORTING
··············ISO_CODE·=·ISO_PACKAGE_TYPE
·········IMPORTING
··············SAP_CODE·=·SAP_SHIPPING_INSTRUCTIONS
·········EXCEPTIONS
··············OTHERS···=·1.
····IF·SY-SUBRC·<>·0.
······SUBRC·=·1.
*·····Put·the·error·message·into·'t_idoc_status'
······PERFORM·STATUS_FILL_SY_ERROR
················TABLES···T_IDOC_STATUS
················USING····F_IDOC_DATA
·························SY
·························FIELD_NAME
·························'shipping_instruct_iso_to_sap'.·"Form·rout.
··ENDIF.·····························"if·sy-subrc·<>·0.
··ENDIF.··················"if·iso_unit_of_measure_code·is·initial.
ENDFORM.
·······FORM·STATUS_FILL_SY_ERROR·····································
··Fills·the·structure·t_idoc_status·with·the·import·parameters·······
··plus·the·relevant·sy·fields.·······································
··-->··IDOC_NUMBER···········IDoc·number·····························
··-->··SEGNUM················Segment·number··························
··-->··SEGFLD················Field·in·segment························
··-->··ROUTID················Name·of·routine·························
··<--··T_IDOC_STATUS·········Status·fields···························
FORM·STATUS_FILL_SY_ERROR·TABLES···T_IDOC_STATUS·STRUCTURE·BDIDOCSTAT
··························USING····F_IDOC_DATA···STRUCTURE·EDIDD
···································VALUE(F_SY)···STRUCTURE·SY
···································SEGFLD········LIKE·BDIDOCSTAT-SEGFLD
···································ROUTID········LIKE·BDIDOCSTAT-ROUTID.
··t_idoc_status-docnum·=·f_idoc_data-docnum.
··t_idoc_status-status·=·c_idoc_status_error.
··t_idoc_status-msgty··=·f_sy-msgty.
··t_idoc_status-msgid··=·f_sy-msgid.
··T_IDOC_STATUS-MSGNO··=·F_SY-MSGNO.
··t_idoc_status-msgv1··=·f_sy-msgv1.
··t_idoc_status-msgv2··=·f_sy-msgv2.
··t_idoc_status-msgv3··=·f_sy-msgv3.
··t_idoc_status-msgv4··=·f_sy-msgv4.
··t_idoc_status-segnum·=·f_idoc_data-segnum.
··t_idoc_status-segfld·=·segfld.
··t_idoc_status-repid··=·f_sy-repid.
··t_idoc_status-routid·=·routid.
··APPEND·T_IDOC_STATUS.
ENDFORM.
Also Check out these docs.
http://help.sap.com/saphelp_nw04/helpdata/en/dc/6b7ee143d711d1893e0000e8323c4f/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/1a/178ad32d3011d3bc3500105a6588b2/frameset.htm
Dont forget to reward pts, if it helps ;>)
Regards,
Rakesh. -
I have developed a File to IDOC interface in PI/XI. The file I pick up will contain a list of invoices from a vendor system ,
that I convert into ACLPAY IDOCs and post invoices.
When the IDOCs are posted into our SAP system some of the IDOCs fail and some of them are successful.
At the end of a business day the user will execute txn we05 to see the status of the IDOCs that came in for that day.
If any of the IDOCs failed the user would use WE19 to correct the data and reprocess the IDOC again.
The problem is the old IDOC that came in still has a error status and the new IDOC created by modifying the old IDOC doesnu2019t have any reference to the older IDOC.
Is there a way to see if and IDOC was created by reprocessing an already existing IDOC?
Or is there a better method to handle my scenario?
Thanks
SivaHi siva,
there are different programs and t-codes available to reprocess the error Idocs
with out creating new idocs.
Program RBDMANI2 for status 51 & 52
Program RBDAPP01 for status 64 ,66
Program RBDAGAIE for status 32 and 69 (Edited IDocs)
Program RBDSYNER for status 26
BALE - ALE Distribution Administration
WE05 - IDoc overview
BD87 - Inbound IDoc reprocessing
BD88 - Outbound IDoc reprocessing
BDM2 - IDoc Trace
BDM7 - IDoc Audit Analysis
BD21 - Create IDocs from change pointers
SM58 - Schedule RFC Failures
Basic config for Distributed data:
BD64: Maintain a Distributed Model
BD82: Generate Partner Profile
BD64: Distribute the distribution Model
Programs
RBDMIDOC - Creating IDoc Type from Change Pointers
RSEOUT00 - Process all selected IDocs (EDI)
RBDAPP01 - Inbound Processing of IDocs Ready for Transfer
RSARFCEX - Execute Calls Not Yet Executed
RBDMOIND - Status Conversion with Successful tRFC Execution
RBDMANIN - Start error handling for non-posted IDocs
RBDSTATE - Send Audit Confirmations
FOr testing you can use WE19.
Program RSEOUT00 for status 30
re-process IDocs failing in 29 status, use program RBDAGAIN.
transactions WEINBQUEUE and WEOUTQUEUE to control the individual queues
Prabhudas -
HI,
I have to design an Inbound IDoc for create an Sales Order from a plain file
The Idoc I use is ORDERS05
Can anybody help me with some easy example???
I have some problem when I tried to match the fields in the segments of the Idoc and the fields in the transaction VA01....Hi,
Please check this links for inbound IDOC ORDERS05 data mapping.
http://www.erpgenie.com/sapgenie/docs/sapedi/ordersin.xls
http://www.erpgenie.com/sapgenie/docs/sapedi/ordedi.xls
http://www.erpgenie.com/sapgenie/docs/sapedi/ordi1.doc
If the above links do not work for you, then please try to use WE19 (IDoc testing tool) for data mapping and simulate the inbound sales order. You can also use this tool for testing purposes as well.
Once done, then you can try to process your inbound IDoc file using standard program RSEINB00 to read the file and generate IDoc(s). Please ensure all your ALE and IDoc configuration are done such as distrribution model (BD64), partner profile (WE20), IDoc Port Processing (WE21) and so on.
Hope this will help to start with.
Regards,
Ferry Lianto -
IDOC generation from ABAP program
Hi
I have to object in which I have to Z program which will generate the idoc and pass it to PI system. Can anyone guide me in how to generate IDOC through ABAP custom program. Just need a little guidance in how to create IDOC from an ABAP report.
Any help would be greatly acknowledged.
Thanks!!Hi I tried to use the program as suggested by Buddhika and Glen, but found error over the statement below:
i_data-sdata = header_segment_data.
Highlighted below in code snap. These two fields are not mutually convertible.
Any suggestions on this. -
Inbound idoc program name...
Hi all,
i have one inbound idoc.From the data in the idoc some custom table was getting updated thrugh some program.So how to find the program name which will do that.i have only the idoc no with me....
thanks in advance.......
Regards,
Rakesh.........GO TO WE19
Give the idoc number
Press F8
Then Press 'Standard Inbound'
Note down the function module
Press Cancel
Press 'Inbound Function Module'
Give the Function mudule name which you get from the previous step
Check 'Call in Debug Mode'
Select in Foreground
Debug the same and it will lead to the place where you are uploading the same. -
Custom inbound Idoc error handling/ Workflow
Dear Experts,
I have a requirement where in I created a custom inbound idoc, but now i need to handle the errors in the workflow and notify the users thru workflow on an error.
Can some one please provide me a step by step guide on how to create a organizational unit, position and assign users to the position... and any other steps that need to be configured to notify the user on the error.
I'm pretty new to all these organizational uints and workflow related stuff. Any step by step would really be helpful.
Thanks for your time.
-Amit.
Moderator message: sorry, these forums cannot replace proper training, if there is step by step guides out there, then please use the search functions.
Edited by: Thomas Zloch on Oct 31, 2010 11:50 AMVittal,
1. If your requirement is for a SAP Standard Basic Message type and a Z extension: Then you simply have to find out the 'Standard Task' associated with basic type. You shouldn't worry about extensions. The standard task will be triggered at input error.
2. If your requirement is for a Z basic type i.e. you have created a customer IDOC for a custom processing: There are many dependencies on how you can achieve this. Firstly, you need to know how you're are processing this Z_IDOC. Are you using a standard FM or custom workflow or custom FM? There should be some triggering event within the processing of this Z_IDOC which will raise a certain flag when the error you want to capture happens (or when there is a generic error). You can configure this event in binding objects to trigger a workflow task. If you take a look at any standard tasks, you'll get an idea how the triggering event happens.
Once the workflow task (you can use custom task or use a standard task i.e. by triggering a standard event within the IDOC processing program) is triggered, you can either send it to SAP inbox, e-mail, trigger another processing etc. This is altogether another story.
So bottomline: For custom IDOC processing, you need to trigger an event when error happens. This can be a custom event or a standard event. This event should be linked to a task (custom/standard - check in SWETYPV). Bind all of these in PFTC. Once the task is triggered, you can do whatever you want to do with it. -
Inbound Idoc customer number conversion
I am new to EDI and have a question to ask you both about inbound IDOC's. We have customers sending remittance advices through EDI. The customer numbers in them are their own customer numbers. In SAP, we maintain different customer numbers. Where do the mapping of the customer numbers take place -- In the EDI subsytem itself or in SAP? If in SAP, can you let me know the procedure to do this.
Any help will be appreciated and points awarded.
Thanks,
Nile.Hey Fren,
1. Data Mapping
Within the framework of SAP EDI, the conversion of a business document in IDoc format to an EDI standard format (and vice versa) is the most important task performed by a subsystem. This process is resource intensive and, hence, is better done at the subsystem level than within SAP. The following conversions and translations are carried out by the subsystem.
Creating a control record for each inbound IDoc.
An inbound IDoc must have a control record. The EDI subsystem builds the control record using the information stored in its local repository or from the SAP repository.
Removing the control record during the outbound process.
The control record in the IDoc file is used by the subsystem for housekeeping functions, such as locating the trading partner profile. The data on the control record is not needed for translating the content of the EDI documents.
Translating data from IDoc format to EDI format.
For an outbound transaction, the EDI subsystem converts data in the IDoc format to a suitable EDI format.
Translating data from EDI format to IDoc format.
For an inbound transaction, the EDI subsystem converts data in the standard EDI format to IDoc format.
Bundling and unbundling IDocs.
If several IDocs are passed to the EDI subsystem in one file, the subsystem separates them into individual documents. Similarly, on the inbound process the subsystem can bundle multiple IDocs into a single file to improve performance.
2 Maintaining the Partner Profile
A partner is defined as the business partner with whom you conduct business and exchange EDI documents. These partners are not necessarily the same as the partners in the partner profile of SAP. However, the concept is quite similar. In SAP, the partner profile maintains parameters specific to the IDoc process, and in the subsystem the partner profile maintains parameters specific to the EDI process. Some typical attributes in a partner profile are
· A unique partner number
· The partner type (Customer, Vendor)
· The standard used (EDIFACT, ANSI X12, and so on)
· The version of the EDI standard
· The EDI message exchanged (850, 860, ORDERS, ORDCHG)
· A functional acknowledgment flag
3 Triggering the Inbound Process
After receiving an inbound EDI transmission and creating an IDoc file, the subsystem is often responsible for triggering the inbound process. SAP provides a program named startrfc to start any RFC−enabled function module from the operating system level. For the EDI process, the subsystem uses the startrfc program to
trigger the function module EDI_DATA_INCOMING. Chapter 6, "Configuring Basic EDI Components," provides the complete details and parameters of the startrfc progam.
4 Reporting Process Status to SAP
In an outbound process, after an IDoc has been transferred from SAP to the subsystem, SAP loses control over the process. However, SAP maintains visibility into the process by requiring the subsystem to report on the status of the process. SAP provides a file interface for the subsystem to send a status report at every milestone.
I hope you got some idea from this process.....
<REMOVED BY MODERATOR>
Warm Regards,
Abhi...
Edited by: Alvaro Tejada Galindo on Apr 25, 2008 4:36 PM -
I am trying to update customer master data using inbound IDOC technique,I am getting Error code 51
Fill all required fields SAPMF02D 0111 ADDR1_DATA-NAME1.But in Data record NAME1 is holding value.
Pls tell me How to reprocess IDOC ..
If Possible Pls Explain me step wiseHi,
You can use transaction BD87 to reprocess the IDoc, but that will not help I think. You can put a break-point in Function module IDOC_INPUT_DEBITOR, reprocess the IDoc with BD87 and when the breakpoint is hit set field input_method to "A". You can then see exactly where in the BDC the error is generated.
Regards,
John. -
Re-process SAME IDOC no in a custome program without it generation another
Hi
I have an incomming idoc which depending on some condition i i put the idoc in staus 52 so that another program will be able to re-process is later on. I put the idoc in a custom table.
A custom program will come and pick the idoc in the custom table to be reprocess . what FM can i use to make the custom program reprocess the same idoc with generation a new one
thank a lot for helpingCan't you use BD87 to do it...! or use IDOC_INPUT and in passing parameter UNPROCESSED_IDOCS give yor idoc numbers you want to reporcess...!
hope it helps
Edited by: Anup Deshmukh on Mar 4, 2010 7:34 AM -
Exact inbound Idoc or RFC for BP based on ROLE/Customer/Vendor ?
Hi ,
I need a inbound IDOC or RFC for Business partner in BP transaction posting based on Customer master or vendor master Role ...Hi Frederic,
I need to post data in to BP transaction(customer master data and vendor master) role using BODS via IDOC. Required IDOC's for posting.
Maybe you are looking for
-
How do I add the scripts to be executed in a perticulat order?
Hi all, I my application I have to scripts in order: Script 1 is started. When it ends, it calls a script, the script name is picked from the Databank file and that is executed. Please help me doing this?
-
New Broadband worked for a day 8 days ago and BT s...
Hi This is on behalf of my mum. She had BT total broadband and telephone line installed on the 22/3/2011 she moved from virginmedia and took her number with her. The broadband worked for half a day and has not worked since. The Internet light is cons
-
I would like to automate the installation of FireFox to an alternate directory.
I am trying to automate the installation of FireFox to my servers drive "F:" but I have not found a way to script this option. Typical Windows installations would use the INSTALLDIR= option, but this does not work. I have seen several different spins
-
Hi, I have Crystal Reports XI Release 2. Every time I start the IDE, I get the dialog "Please wait while windows configures crystal reports XI release 2". It takes a while for this dialog to go away. does anyone have this issue? Is it possible to
-
Unicode conversion on Informix
Hello All, We are doing unicode conversion on SAP ECC 5.0 system running on Informix database. We want to use the table split method. In the table split preparation step, we give the file with the large tables and the number of splits the file is as