08-09-2007 7:36 AM
How to write abap programs in idocs. Please give step by step procedure......and if u can provide the screen shots it would be great........
Thanks in advance..
08-09-2007 7:41 AM
Hi,
plz have a look at the below code..This code is for inbound idoc.
FUNCTION zsd_idoc_input_order_change.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" REFERENCE(WORKFLOW_RESULT) LIKE BDWFAP_PAR-RESULT
*" REFERENCE(APPLICATION_VARIABLE) LIKE BDWFAP_PAR-APPL_VAR
*" REFERENCE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" REFERENCE(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
*"----
Work areas for the idoc tables.
DATA: wa_data TYPE edidd.
status = '53'. "initial
Read the control data information of idoc.
READ TABLE idoc_contrl INTO gwa_control WITH KEY mestyp = 'ZORDRPLY'.
IF sy-subrc EQ 0.
Extract the data from the segments.
LOOP AT idoc_data INTO wa_data "LOOP AT idoc_data
WHERE docnum = idoc_contrl-docnum.
CASE wa_data-segnam. " CASE gwa_data-segnam
WHEN 'Z1SCSK'. "Header data
MOVE wa_data-sdata TO gwa_z1scsk.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gwa_z1scsk
IMPORTING
output = gv_vbeln.
WHEN 'Z1SCSP'. "Item data
MOVE wa_data-sdata TO gwa_z1scsp.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gwa_z1scsp-posnr
IMPORTING
output = gv_posnr.
gwa_z1scsp-posnr = gv_posnr.
APPEND gwa_z1scsp TO i_z1scsp.
ENDCASE. " CASE gwa_data-segnam
ENDLOOP. "LOOP AT idoc_data
Update the sales order
PERFORM order_change.
ELSE.
Begin of Mod-001
status = '51'.
bapi_retn_info-type = 'E'.
bapi_retn_info-id = 'ZSDM'.
bapi_retn_info-number = '028'.
bapi_retn_info-message_v1 = 'Wrong'.
bapi_retn_info-message_v2 = 'Message'.
bapi_retn_info-message_v3 = 'Type'.
RAISE wrong_function_called.
ENDIF. " IF sy-subrc EQ 0
***********************************************************************
*Start wf
*----
PERFORM wf_start
USING
idoc_contrl-docnum
gv_vbeln
CHANGING
bapi_retn_info.
*----
*end of starting of wf
***********************************************************************
*set status
*----
IF status = '53'.
bapi_retn_info-type = 'S'.
bapi_retn_info-id = 'ZSDM'.
bapi_retn_info-number = '028'.
bapi_retn_info-message_v1 = gv_vbeln.
bapi_retn_info-message_v2 = 'Changed.'.
bapi_retn_info-message_v3 = 'Succcessfully'.
ENDIF.
PERFORM idoc_status_ord_change
TABLES idoc_data
idoc_status
return_variables
USING idoc_contrl
bapi_retn_info
status
workflow_result.
End of Mod-001
ENDFUNCTION.
FORM idoc_status_ord_change
TABLES idoc_data STRUCTURE edidd
idoc_status STRUCTURE bdidocstat
r_variables STRUCTURE bdwfretvar
USING idoc_contrl LIKE edidc
value(retn_info) LIKE bapiret2
status LIKE bdidocstat-status
wf_result LIKE bdwf_param-result.
CLEAR idoc_status.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-msgty = retn_info-type.
idoc_status-msgid = retn_info-id.
idoc_status-msgno = retn_info-number.
idoc_status-appl_log = retn_info-log_no.
idoc_status-msgv1 = retn_info-message_v1.
idoc_status-msgv2 = retn_info-message_v2.
idoc_status-msgv3 = retn_info-message_v3.
idoc_status-msgv4 = retn_info-message_v4.
idoc_status-repid = sy-repid.
idoc_status-status = status.
APPEND idoc_status.
IF idoc_status-status = '51'.
wf_result = '99999'.
r_variables-wf_param = 'Error_IDOCs'.
r_variables-doc_number = idoc_contrl-docnum.
READ TABLE r_variables FROM r_variables.
IF sy-subrc <> 0.
APPEND r_variables.
ENDIF.
ELSEIF idoc_status-status = '53'.
CLEAR wf_result.
r_variables-wf_param = 'Processed_IDOCs'.
r_variables-doc_number = idoc_contrl-docnum.
READ TABLE r_variables FROM r_variables.
IF sy-subrc <> 0.
APPEND r_variables.
ENDIF.
ENDIF.
ENDFORM. "idoc_status_ord_change
----
***INCLUDE LZSD_FS007_ORDERCHANGEF01 .
----
&----
*& Form order_change
&----
This Form is used for updating the DB tables(vbap,vbep) *
----
FORM order_change .
Declaration of internal tables.
DATA : i_vbap TYPE STANDARD TABLE OF vbap,
i_vbep TYPE STANDARD TABLE OF vbep.
Declaration of workareas.
DATA : wa_vbap TYPE vbap,
wa_vbep TYPE vbep.
Declaration of constants.
CONSTANTS : lc_sno(3) TYPE c VALUE '039',
lc_ino(3) TYPE c VALUE '040',
lc_msg(4) TYPE c VALUE 'ZSD',
lc_emsgty(1) TYPE c VALUE 'E',
lc_smsgty(1) TYPE c VALUE 'S',
lc_estatus(2) TYPE c VALUE '51',
lc_sstatus(2) TYPE c VALUE '53'.
Declaration of variable.
DATA : lv_index TYPE syindex,
lv_zzproddt TYPE sydatum.
Fetch the data from vbap
SELECT * FROM vbap INTO TABLE i_vbap
WHERE vbeln EQ gv_vbeln.
IF NOT i_vbap IS INITIAL.
Fetch the data from vbep
SELECT * FROM vbep INTO TABLE i_vbep
FOR ALL ENTRIES IN i_vbap
WHERE vbeln EQ i_vbap-vbeln
AND posnr EQ i_vbap-posnr.
Modify production option date (zzproopdt) of i_vbap
and production date(zzproddt) & original production date(zzoprodt)
of i_vbep with the data sent by SCS.
lv_index = 1.
LOOP AT i_z1scsp INTO gwa_z1scsp.
LOOP AT i_vbap INTO wa_vbap WHERE posnr = gwa_z1scsp-posnr.
IF sy-subrc EQ 0 .
Copies the date value in gwa_z1scsp-zzproopdt to wa_vbap-zzproopdt,
if valid date is there in gwa_z1scsp-zzproopdt
PERFORM validate_date USING gwa_z1scsp-zzproopdt
wa_vbap-zzproopdt.
IF NOT wa_vbap-zzproopdt IS INITIAL.
MODIFY i_vbap FROM wa_vbap TRANSPORTING zzproopdt.
ENDIF.
Copies the date value in gwa_z1scsp-zzproddt to lv_zzproddt,
if valid date is there in gwa_z1scsp-zzproddt
PERFORM validate_date USING gwa_z1scsp-zzproddt
lv_zzproddt.
If gwa_z1scsp-zzproddt is not initial then only update in VBEP.
IF NOT lv_zzproddt IS INITIAL.
LOOP AT i_vbep INTO wa_vbep FROM lv_index.
IF wa_vbep-posnr GT wa_vbap-posnr.
lv_index = sy-tabix.
EXIT.
ELSEIF wa_vbep-posnr EQ wa_vbap-posnr.
wa_vbep-zzproddt = lv_zzproddt.
Update Original Production date only when its initial.
IF wa_vbep-zzoprodt IS INITIAL.
wa_vbep-zzoprodt = wa_vbep-zzproddt.
ENDIF.
MODIFY i_vbep FROM wa_vbep TRANSPORTING zzproddt zzoprodt.
ENDIF.
CLEAR wa_vbep.
ENDLOOP.
ENDIF.
ELSE.
Begin of Mod-001
status = lc_estatus.
bapi_retn_info-type = lc_emsgty.
bapi_retn_info-id = lc_msg.
bapi_retn_info-number = lc_ino.
bapi_retn_info-message_v1 = gwa_z1scsp-posnr.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 4.
status = lc_estatus.
bapi_retn_info-type = lc_emsgty.
bapi_retn_info-id = lc_msg.
bapi_retn_info-number = lc_ino.
bapi_retn_info-message_v1 = gwa_z1scsp-posnr.
ENDIF.
CLEAR: wa_vbap, gwa_z1scsp.
ENDLOOP.
ELSE.
status = lc_estatus.
bapi_retn_info-type = lc_emsgty.
bapi_retn_info-id = lc_msg.
bapi_retn_info-number = lc_sno.
bapi_retn_info-message_v1 = gv_vbeln.
EXIT.
End of Mod-001
ENDIF.
Update the DB tables
UPDATE vbap FROM TABLE i_vbap.
UPDATE vbep FROM TABLE i_vbep.
ENDFORM. " order_change
&----
*& Form VALIDATE_DATE
&----
Converts the date into DATS format and check if it is valid,
if valid returns date in p_date_dats else clear it.
----
-->p_date_c8 Date in Char format send by SCS
-->p_date_dats Date in DATS format.
----
FORM validate_date USING p_date_c8 TYPE char8
p_date_dats TYPE dats.
CLEAR p_date_dats.
p_date_dats = p_date_c8.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = p_date_dats
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
check sy-subrc NE 0.
CLEAR p_date_dats.
ENDFORM. " VALIDATE_DATE
&----
*& Form wf_start
&----
text
----
-->P_IDOC_CONTROL_DOCNUM text
-->P_GV_VBELN text
<--P_BAPI_RETN_INFO text
----
FORM wf_start USING p_idoc_control_docnum
p_gv_vbeln
CHANGING p_bapi_retn_info TYPE bapiret2.
INCLUDE <cntn01>.
DATA: agents LIKE swhactor OCCURS 1 WITH HEADER LINE,
process_type TYPE char1,
idoc_no TYPE edidc-docnum,
creator LIKE swwwihead-wi_creator.
swc_container wi_container.
swc_create_container wi_container.
swc_set_element wi_container 'Document_no' p_gv_vbeln.
swc_set_element wi_container 'Process_type' '1'.
swc_set_element wi_container 'Idoc_no' p_idoc_control_docnum.
CALL FUNCTION 'SWW_WI_START_SIMPLE'
EXPORTING
creator = creator
task = 'WS90200019'
TABLES
agents = agents
wi_container = wi_container
EXCEPTIONS
id_not_created = 1
read_failed = 2
immediate_start_not_possible = 3
execution_failed = 4
invalid_status = 5
OTHERS = 6.
IF sy-subrc <> 0.
p_bapi_retn_info-type = 'E'.
p_bapi_retn_info-id = sy-msgid.
p_bapi_retn_info-number = sy-msgno.
p_bapi_retn_info-message_v1 = sy-msgv1.
p_bapi_retn_info-message_v2 = sy-msgv2.
p_bapi_retn_info-message_v3 = sy-msgv3.
p_bapi_retn_info-message_v4 = sy-msgv4.
ENDIF.
ENDFORM. " wf_start
reward points if u find useful.
Regards,
Nagaraj
08-09-2007 7:39 AM
Hi,
please refer the following link it might be helpful to you
http://help.sap.com/saphelp_nw04/helpdata/en/0b/2a6095507d11d18ee90000e8366fc2/content.htm
http://www.sapbrainsonline.com/TUTORIALS/TECHNICAL/IDOC_tutorial.html
********please reward points if the information is helpful to you***********
08-09-2007 7:41 AM
Hi,
plz have a look at the below code..This code is for inbound idoc.
FUNCTION zsd_idoc_input_order_change.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" REFERENCE(WORKFLOW_RESULT) LIKE BDWFAP_PAR-RESULT
*" REFERENCE(APPLICATION_VARIABLE) LIKE BDWFAP_PAR-APPL_VAR
*" REFERENCE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" REFERENCE(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
*"----
Work areas for the idoc tables.
DATA: wa_data TYPE edidd.
status = '53'. "initial
Read the control data information of idoc.
READ TABLE idoc_contrl INTO gwa_control WITH KEY mestyp = 'ZORDRPLY'.
IF sy-subrc EQ 0.
Extract the data from the segments.
LOOP AT idoc_data INTO wa_data "LOOP AT idoc_data
WHERE docnum = idoc_contrl-docnum.
CASE wa_data-segnam. " CASE gwa_data-segnam
WHEN 'Z1SCSK'. "Header data
MOVE wa_data-sdata TO gwa_z1scsk.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gwa_z1scsk
IMPORTING
output = gv_vbeln.
WHEN 'Z1SCSP'. "Item data
MOVE wa_data-sdata TO gwa_z1scsp.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gwa_z1scsp-posnr
IMPORTING
output = gv_posnr.
gwa_z1scsp-posnr = gv_posnr.
APPEND gwa_z1scsp TO i_z1scsp.
ENDCASE. " CASE gwa_data-segnam
ENDLOOP. "LOOP AT idoc_data
Update the sales order
PERFORM order_change.
ELSE.
Begin of Mod-001
status = '51'.
bapi_retn_info-type = 'E'.
bapi_retn_info-id = 'ZSDM'.
bapi_retn_info-number = '028'.
bapi_retn_info-message_v1 = 'Wrong'.
bapi_retn_info-message_v2 = 'Message'.
bapi_retn_info-message_v3 = 'Type'.
RAISE wrong_function_called.
ENDIF. " IF sy-subrc EQ 0
***********************************************************************
*Start wf
*----
PERFORM wf_start
USING
idoc_contrl-docnum
gv_vbeln
CHANGING
bapi_retn_info.
*----
*end of starting of wf
***********************************************************************
*set status
*----
IF status = '53'.
bapi_retn_info-type = 'S'.
bapi_retn_info-id = 'ZSDM'.
bapi_retn_info-number = '028'.
bapi_retn_info-message_v1 = gv_vbeln.
bapi_retn_info-message_v2 = 'Changed.'.
bapi_retn_info-message_v3 = 'Succcessfully'.
ENDIF.
PERFORM idoc_status_ord_change
TABLES idoc_data
idoc_status
return_variables
USING idoc_contrl
bapi_retn_info
status
workflow_result.
End of Mod-001
ENDFUNCTION.
FORM idoc_status_ord_change
TABLES idoc_data STRUCTURE edidd
idoc_status STRUCTURE bdidocstat
r_variables STRUCTURE bdwfretvar
USING idoc_contrl LIKE edidc
value(retn_info) LIKE bapiret2
status LIKE bdidocstat-status
wf_result LIKE bdwf_param-result.
CLEAR idoc_status.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-msgty = retn_info-type.
idoc_status-msgid = retn_info-id.
idoc_status-msgno = retn_info-number.
idoc_status-appl_log = retn_info-log_no.
idoc_status-msgv1 = retn_info-message_v1.
idoc_status-msgv2 = retn_info-message_v2.
idoc_status-msgv3 = retn_info-message_v3.
idoc_status-msgv4 = retn_info-message_v4.
idoc_status-repid = sy-repid.
idoc_status-status = status.
APPEND idoc_status.
IF idoc_status-status = '51'.
wf_result = '99999'.
r_variables-wf_param = 'Error_IDOCs'.
r_variables-doc_number = idoc_contrl-docnum.
READ TABLE r_variables FROM r_variables.
IF sy-subrc <> 0.
APPEND r_variables.
ENDIF.
ELSEIF idoc_status-status = '53'.
CLEAR wf_result.
r_variables-wf_param = 'Processed_IDOCs'.
r_variables-doc_number = idoc_contrl-docnum.
READ TABLE r_variables FROM r_variables.
IF sy-subrc <> 0.
APPEND r_variables.
ENDIF.
ENDIF.
ENDFORM. "idoc_status_ord_change
----
***INCLUDE LZSD_FS007_ORDERCHANGEF01 .
----
&----
*& Form order_change
&----
This Form is used for updating the DB tables(vbap,vbep) *
----
FORM order_change .
Declaration of internal tables.
DATA : i_vbap TYPE STANDARD TABLE OF vbap,
i_vbep TYPE STANDARD TABLE OF vbep.
Declaration of workareas.
DATA : wa_vbap TYPE vbap,
wa_vbep TYPE vbep.
Declaration of constants.
CONSTANTS : lc_sno(3) TYPE c VALUE '039',
lc_ino(3) TYPE c VALUE '040',
lc_msg(4) TYPE c VALUE 'ZSD',
lc_emsgty(1) TYPE c VALUE 'E',
lc_smsgty(1) TYPE c VALUE 'S',
lc_estatus(2) TYPE c VALUE '51',
lc_sstatus(2) TYPE c VALUE '53'.
Declaration of variable.
DATA : lv_index TYPE syindex,
lv_zzproddt TYPE sydatum.
Fetch the data from vbap
SELECT * FROM vbap INTO TABLE i_vbap
WHERE vbeln EQ gv_vbeln.
IF NOT i_vbap IS INITIAL.
Fetch the data from vbep
SELECT * FROM vbep INTO TABLE i_vbep
FOR ALL ENTRIES IN i_vbap
WHERE vbeln EQ i_vbap-vbeln
AND posnr EQ i_vbap-posnr.
Modify production option date (zzproopdt) of i_vbap
and production date(zzproddt) & original production date(zzoprodt)
of i_vbep with the data sent by SCS.
lv_index = 1.
LOOP AT i_z1scsp INTO gwa_z1scsp.
LOOP AT i_vbap INTO wa_vbap WHERE posnr = gwa_z1scsp-posnr.
IF sy-subrc EQ 0 .
Copies the date value in gwa_z1scsp-zzproopdt to wa_vbap-zzproopdt,
if valid date is there in gwa_z1scsp-zzproopdt
PERFORM validate_date USING gwa_z1scsp-zzproopdt
wa_vbap-zzproopdt.
IF NOT wa_vbap-zzproopdt IS INITIAL.
MODIFY i_vbap FROM wa_vbap TRANSPORTING zzproopdt.
ENDIF.
Copies the date value in gwa_z1scsp-zzproddt to lv_zzproddt,
if valid date is there in gwa_z1scsp-zzproddt
PERFORM validate_date USING gwa_z1scsp-zzproddt
lv_zzproddt.
If gwa_z1scsp-zzproddt is not initial then only update in VBEP.
IF NOT lv_zzproddt IS INITIAL.
LOOP AT i_vbep INTO wa_vbep FROM lv_index.
IF wa_vbep-posnr GT wa_vbap-posnr.
lv_index = sy-tabix.
EXIT.
ELSEIF wa_vbep-posnr EQ wa_vbap-posnr.
wa_vbep-zzproddt = lv_zzproddt.
Update Original Production date only when its initial.
IF wa_vbep-zzoprodt IS INITIAL.
wa_vbep-zzoprodt = wa_vbep-zzproddt.
ENDIF.
MODIFY i_vbep FROM wa_vbep TRANSPORTING zzproddt zzoprodt.
ENDIF.
CLEAR wa_vbep.
ENDLOOP.
ENDIF.
ELSE.
Begin of Mod-001
status = lc_estatus.
bapi_retn_info-type = lc_emsgty.
bapi_retn_info-id = lc_msg.
bapi_retn_info-number = lc_ino.
bapi_retn_info-message_v1 = gwa_z1scsp-posnr.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 4.
status = lc_estatus.
bapi_retn_info-type = lc_emsgty.
bapi_retn_info-id = lc_msg.
bapi_retn_info-number = lc_ino.
bapi_retn_info-message_v1 = gwa_z1scsp-posnr.
ENDIF.
CLEAR: wa_vbap, gwa_z1scsp.
ENDLOOP.
ELSE.
status = lc_estatus.
bapi_retn_info-type = lc_emsgty.
bapi_retn_info-id = lc_msg.
bapi_retn_info-number = lc_sno.
bapi_retn_info-message_v1 = gv_vbeln.
EXIT.
End of Mod-001
ENDIF.
Update the DB tables
UPDATE vbap FROM TABLE i_vbap.
UPDATE vbep FROM TABLE i_vbep.
ENDFORM. " order_change
&----
*& Form VALIDATE_DATE
&----
Converts the date into DATS format and check if it is valid,
if valid returns date in p_date_dats else clear it.
----
-->p_date_c8 Date in Char format send by SCS
-->p_date_dats Date in DATS format.
----
FORM validate_date USING p_date_c8 TYPE char8
p_date_dats TYPE dats.
CLEAR p_date_dats.
p_date_dats = p_date_c8.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = p_date_dats
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
check sy-subrc NE 0.
CLEAR p_date_dats.
ENDFORM. " VALIDATE_DATE
&----
*& Form wf_start
&----
text
----
-->P_IDOC_CONTROL_DOCNUM text
-->P_GV_VBELN text
<--P_BAPI_RETN_INFO text
----
FORM wf_start USING p_idoc_control_docnum
p_gv_vbeln
CHANGING p_bapi_retn_info TYPE bapiret2.
INCLUDE <cntn01>.
DATA: agents LIKE swhactor OCCURS 1 WITH HEADER LINE,
process_type TYPE char1,
idoc_no TYPE edidc-docnum,
creator LIKE swwwihead-wi_creator.
swc_container wi_container.
swc_create_container wi_container.
swc_set_element wi_container 'Document_no' p_gv_vbeln.
swc_set_element wi_container 'Process_type' '1'.
swc_set_element wi_container 'Idoc_no' p_idoc_control_docnum.
CALL FUNCTION 'SWW_WI_START_SIMPLE'
EXPORTING
creator = creator
task = 'WS90200019'
TABLES
agents = agents
wi_container = wi_container
EXCEPTIONS
id_not_created = 1
read_failed = 2
immediate_start_not_possible = 3
execution_failed = 4
invalid_status = 5
OTHERS = 6.
IF sy-subrc <> 0.
p_bapi_retn_info-type = 'E'.
p_bapi_retn_info-id = sy-msgid.
p_bapi_retn_info-number = sy-msgno.
p_bapi_retn_info-message_v1 = sy-msgv1.
p_bapi_retn_info-message_v2 = sy-msgv2.
p_bapi_retn_info-message_v3 = sy-msgv3.
p_bapi_retn_info-message_v4 = sy-msgv4.
ENDIF.
ENDFORM. " wf_start
reward points if u find useful.
Regards,
Nagaraj
08-09-2007 7:47 AM
Hi Naga,
The way code is written differs for Inbound IDoc processing and Outbound IDoc processing.
For inbound, you usually write a function module to read the IDocs and post it in SAP.
The IDocs contain different segments and it is stored in EDID4 table.
The structure contains segment name, data of all the fields in the segment and hierarchy fields.
You have to retrieve the IDoc using the IDoc number, which is stored in EDIDC (IDoc Control data)table and that is the key for comparison between EDIDC and EDID4.
Before you start writing the code, it is necessary to learn the basic concepts of IDoc. You read the details you can move to your internal tables and then post using any BAPI or BDC.
For outbound, you have to collect your data from the SAP tables and then populate the IDOC structure depending on the IDOC type used. Then populate the control record with IDoc type, message type, partner number etc and then call MASTER_IDOC_DISTRIBUTE function module.
It would be good if are very specific so that SDN guys can reply your query easily.
Regards,
Yogesh
08-09-2007 7:48 AM
Hi,
Welcome to SDN.
Go through the link for basics related to IDOCs:
http://help.sap.com/saphelp_nw04/helpdata/en/0b/2a6cdd507d11d18ee90000e8366fc2/plain.htm
Regards