01-20-2006 3:32 PM
Hi .
can any bady send me the bacics of Idoc development .
Thank's in advance
Shakif
01-20-2006 3:38 PM
01-20-2006 3:43 PM
Hi,
http://help.sap.com/saphelp_erp2005/helpdata/en/78/21758d51ce11d189570000e829fbbd/frameset.htm
Refer this link for creating IDOC
http://help.sap.com/saphelp_nw04/helpdata/en/78/2176ec51ce11d189570000e829fbbd/content.htm
REFER TO THESE THREADS
01-20-2006 4:55 PM
Create new segments -- WE31
Create new IDOCs -- WE30
Create a new message type -- WE81
Link message type with IDOC type -- WE82
<b>Outbound program LOGIC</b>
Select data from application tables
Fill data into IDOC
Pass IDOC to ALE layer
(Call function MASTER_IDOC_DISTRIBUTE)
Commit Work
REPORT zale_example.
Parameter for material number for getting related information
PARAMETER : s_matnr TYPE matnr.
Internal table for populating the control information for the IDOC
DATA : i_edidc TYPE STANDARD TABLE OF edidc INITIAL SIZE 0
WITH HEADER LINE.
Internal table for the communication control record
DATA : i_c_edidc TYPE STANDARD TABLE OF edidc INITIAL SIZE 0
WITH HEADER LINE.
Internal table for the populating the data record
DATA : i_edidd TYPE STANDARD TABLE OF edidd INITIAL SIZE 0
WITH HEADER LINE.
Structure for the storing material related information
DATA : struct_mara TYPE mara.
Structure for the storing the material description
DATA : struct_makt TYPE makt.
Structure for the segment to populate the record in the data record
DATA : struct_e1maram TYPE e1maram.
DATA : struct_e1maktm TYPE e1maktm.
Constants for the segment names.
DATA : c_e1maram TYPE edilsegtyp.
DATA : c_e1maktm TYPE edilsegtyp.
START-OF-SELECTION.
Get the application data from the tables MARA and MAKT
PERFORM get_app_data.
Populate the idoc.
PERFORM pop_idoc.
&----
*& Form GET_APP_DATA
&----
Get the Application data from the MARA and MAKT
----
FORM get_app_data .
Get the Material related information from the mara.
SELECT SINGLE *
FROM mara
INTO struct_mara
WHERE matnr = s_matnr.
Check for the sy-subrc value
IF sy-subrc NE 0.
Sy-subrc is not equal to zero go out of the program.
EXIT.
ENDIF.
Get the material description from the makt by using matnr
SELECT SINGLE *
FROM makt INTO struct_makt
WHERE matnr = s_matnr.
Check for the sy-subrc value
IF sy-subrc NE 0.
Sy-subrc is not equal to zero go out of the program.
EXIT.
ENDIF.
ENDFORM. " GET_APP_DATA
&----
*& Form MOVE_TO_E1MARAM
&----
populate the segment E!MARAM
----
FORM move_mara_to_e1maram .
Clear the segment
CLEAR struct_e1maram.
Pass the message type related information into the segment.
MOVE: "STRUCT_MARA-MSGFN TO STRUCT_E1MARAM-MSGFN,
struct_mara-matnr TO struct_e1maram-matnr,
struct_mara-ersda TO struct_e1maram-ersda,
struct_mara-ernam TO struct_e1maram-ernam,
struct_mara-meins TO struct_e1maram-meins.
Populate the internal table for the data record by passing the
Segment name and application data.
PERFORM pop_idoc_edidd USING c_e1maram struct_e1maram.
ENDFORM. " MOVE_TO_E1MARAM
&----
*& Form MOVE_MAKT_TO_E1MAKTM
&----
Populate the segment E1MAKTM
----
FORM move_makt_to_e1maktm .
Clear the segment
CLEAR struct_e1maktm.
Pass the message type related information into the segment.
MOVE : "STRUCT_MAKT-MSGFN TO STRUCT_E1MAKTM-MSGFN,
struct_makt-spras TO struct_e1maktm-spras,
struct_makt-maktx TO struct_e1maktm-maktx.
Populate the internal table for the data record by passing the
Segment name and application data.
PERFORM pop_idoc_edidd USING c_e1maktm struct_e1maktm.
ENDFORM. " MOVE_MAKT_TO_E1MAKTM
&----
*& Form POP_IDOC_EDIDD
&----
Populate the data record by passing the segement data
----
-->P_C_E1MAKTM segment name
-->P_STRUCT_E1MAKTM Application data
----
FORM pop_idoc_edidd USING p_c_e1maktm
p_struct_e1maktm.
Clear the work area for the data record internaltable I_edidd
CLEAR i_edidd.
Move the segment name
MOVE: p_c_e1maktm TO i_edidd-segnam,
Pass the application data
p_struct_e1maktm TO i_edidd-sdata.
Append the internaltable.
APPEND i_edidd.
ENDFORM. " POP_IDOC_EDIDD
&----
*& Form POP_IDOC
&----
Populate the Idoc with related information
----
FORM pop_idoc .
populate the control record
PERFORM pop_con_data.
populate the data record by first populating the header segment
PERFORM move_mara_to_e1maram.
Populate the data record by populate the data segment
PERFORM move_makt_to_e1maktm.
call the fM master idoc distribute for creating master idoc
PERFORM create_mat_idoc.
ENDFORM. " POP_IDOC
&----
*& Form POP_CON_DATA
&----
Populate the control record
----
FORM pop_con_data .
Variable for the logical system name
DATA: l_logsys TYPE edi_sndprn.
Get the logical system name.
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
own_logical_system = l_logsys
EXCEPTIONS
own_logical_system_not_defined = 1
OTHERS = 2.
Check for the sy-subrc value
IF sy-subrc NE 0.
Sy-subrc is not equal to zero go out of the program.
EXIT.
ENDIF.
Clear the work area of the control record
CLEAR i_edidc.
Move the partener type to the control record
MOVE : 'LS' TO i_edidc-sndprt,
Populate the sending system name
l_logsys TO i_edidc-sndprn,
Populate the type system partener used
'LS' TO i_edidc-rcvprt,
Populate the partner number
l_logsys TO i_edidc-rcvprn,
Populate message type
'MATMAS' TO i_edidc-mestyp,
Populate the idoc type.
'MATMAS03' TO i_edidc-idoctp.
Append the control record data.
APPEND i_edidc.
ENDFORM. " POP_CON_DATA
&----
*& Form CREATE_MAT_IDOC
&----
Call the FM MASTER_IDOC_DISTRIBUTE
----
FORM create_mat_idoc .
Call the FM MASTER_IDOC_DISTRIBUTE for passing the IDOC to ALE layer.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = i_edidc
TABLES
communication_idoc_control = i_c_edidc
master_idoc_data = i_edidd
EXCEPTIONS
error_in_idoc_control = 1
error_writing_idoc_status = 2
error_in_idoc_data = 3
sending_logical_system_unknown = 4
OTHERS = 5.
Check for the sy-subrc value
IF sy-subrc NE 0.
Sy-subrc is not equal to zero go out of the program.
EXIT.
ENDIF.
ENDFORM. " CREATE_MAT_IDOC
<b>Inbound program development</b>
Name: Z_IDOC_INPUT_<Msgtype>
FUNCTION MODULE
Interface:
<b>Import</b>Input_Method process in dialog or not?
Mass_Processing used for WF programming
<b>Export</b>
In_Update_Task Was update in update task used ?
Call_Transaction_done Was a Call Transaction used ?
Workflow_Result Workflow events for errors ?
Application_Variable Workflow parameter
<b>
Tables</b>
Idoc_Contrl one entry for each IDOC control record
Idoc_Data one entry for each IDOC data segment
Docnum IDOC number
Segnam Segment name
Sdata Segment data
Idoc_Status Status of the IDOC
Return_Variables created/changed application objects
Serialization_Info used for serialization check
<b>Exceptions</b>
Wrong_Function_called
<b>Logic:</b>
Check, if IDOC contains the correct message type; if not raise exception WRONG_FUNCTION_MODULE_CALLED
Initialize any global variables/tables.
Convert the character data in table IDOC_DATA to internal format in internal tables:
character -> numbers
ISO codes -> SAP codes
Check data
If O.k., post data
If Not: return error message to ALE
No Commit Work !
<b>Return variables for successfully processed IDOCs:</b>Workflow_Result: 0
Idoc_Status: 1 record with following fields
Docnum IDOC number
Status 53
Return_Variables: table must contain following entries:
Entry Wf_param Doc_number
1 Processed IDoc Idoc number
2 Appl_Objects Appl.Object number