2006 Jun 12 2:04 PM
Hi ABAP guru's,
I have a RF based Programming Specification which states that "The functionality to send a Batch,HU and GR idoc to POMS is required after the sucessful GR".I have worked on RF based programming before but do not have much idea regarding IDOC's.Could anyone provide me pointers on how to acheive this/point me to certain FM's which would be able to generate the required IDoc's.
I would be greatly thankful to your suggestions.
Thanks,
Rajiv C
2006 Jun 12 3:38 PM
To generate IDoc's
Please refer this Function Module, you need to pass in Control record and the data record segment values.
call function 'IDOC_INBOUND_ASYNCHRONOUS'
DESTINATION <LOGDESTINATION>
tables
idoc_control_rec_40 = i_edidc
idoc_data_rec_40 = i_edidd.
edi_dc - Control record for the interface to the EDI subsystem
edi_dd - Data record for the interface to the EDI subsystem
edi_ds - Status record for interface to EDI subsystem
To generate IDoc's
Please refer this Function Module, you need to pass in Control record and the data record segment values.
call function 'IDOC_INBOUND_ASYNCHRONOUS'
DESTINATION <LOGDESTINATION>
tables
idoc_control_rec_40 = i_edidc
idoc_data_rec_40 = i_edidd.
edi_dc - Control record for the interface to the EDI subsystem
edi_dd - Data record for the interface to the EDI subsystem
edi_ds - Status record for interface to EDI subsystem
2006 Jun 12 3:38 PM
To generate IDoc's
Please refer this Function Module, you need to pass in Control record and the data record segment values.
call function 'IDOC_INBOUND_ASYNCHRONOUS'
DESTINATION <LOGDESTINATION>
tables
idoc_control_rec_40 = i_edidc
idoc_data_rec_40 = i_edidd.
edi_dc - Control record for the interface to the EDI subsystem
edi_dd - Data record for the interface to the EDI subsystem
edi_ds - Status record for interface to EDI subsystem
2006 Jun 13 4:01 PM
Hi,
You need transaction WEDI, which collects EDI/IDoc functions.
Look under 'Documentation -> Process Codes' and search in the Outbound messages for a Process code that could fulfil your requirement. The Process ID you find there is in fact a FM, which can be called from a report.
Once you've create your message, you need to setup a port, which is the destination, and a partner, that defines the message-type you are sending to this port. Find function for this under 'Administration'. For outbound IDocs, a distribution Model is also necessary. This kind of info needs to be specified in the control record of your IDoc.
good luck,
Peter
2006 Jun 14 2:08 PM
Hi Peter,
I had found out that when we do the GR using MIGO ,the corresponding IDOCs are generated via a user exit.
As such,i would not need to implement this functionality in my program.
Thank you very much for outlining the process to used for generating IDOCS.
Thanks,
Rajiv C
2006 Jun 14 2:29 PM
2006 Jun 14 2:47 PM
Hi Rajiv Chandran ,
Check out this sample program for Generatng an IDOC from ABAP Program
REPORT Z_IDOC_SAMPLE
MESSAGE-ID ZLKPL_MSGCLASS
LINE-COUNT 65(5)
LINE-SIZE 132.
&----
*& Report Z_IDOC_SAMPLE *
*
----
REPORT:Z_IDOC_SAMPLE
This report creates an IDOC and fills it with application data
The control, data, status records are filled and distributed
over the ALE Interface
----
----
Parameters
----
*---Parameter for Object Key
PARAMETERS: P_ENUM LIKE ZAK_EMPLIST-ENUMBER.
*---Parameter for Message type
PARAMETERS: P_MESTYP LIKE EDMSG-MSGTYP OBLIGATORY.
*---Parameter for Destination System
PARAMETERS: P_LOGSYS LIKE TBDLST-LOGSYS.
----
Constants
----
*---Segment Names
DATA: C_EMP_HEADER_SEGMENT LIKE EDIDD-SEGNAM VALUE 'Z1EMPHD',
C_EMP_DETAILS_SEGMENT LIKE EDIDD-SEGNAM VALUE 'Z1EMPDT'.
*---IDoc Type
DATA: C_REPORT_IDOC_TYPE LIKE EDIDC-IDOCTP VALUE 'ZREP01'.
----
Data Declarations
----
*---Idoc Control Record
DATA: CONTROL_RECORD_OUT LIKE EDIDC.
*---Employee Header Data
DATA: FS_EMPHDR_DATA LIKE Z1EMPHD.
*---Employee Details Data
DATA: FS_EMPDET_DATA LIKE Z1EMPDT.
----
Database Tables
----
TABLES: ZAK_EMPLIST.
----
Internal Tables
----
*---Internal table for application data
DATA: IT_EMP LIKE ZAK_EMPLIST OCCURS 0 WITH HEADER LINE.
*---Internal table for Data Records
DATA: IT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE.
*---Internal table for Communication Idocs generated
DATA: IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE.
----
Select Applcation Data
----
SELECT * FROM ZAK_EMPLIST
WHERE ENUMBER = P_ENUM.
IF SY-SUBRC NE 0 .
MESSAGE E001(ZLKPL_MSGCLASS).
EXIT.
ENDIF.
----
Build Control records
----
CONTROL_RECORD_OUT-MESTYP = P_MESTYP.
CONTROL_RECORD_OUT-IDOCTP = C_REPORT_IDOC_TYPE.
CONTROL_RECORD_OUT-RCVPRT = 'LS'.
CONTROL_RECORD_OUT-RCVPRN = P_LOGSYS.
----
Build Data records
----
*--- Employee Header data
FS_EMPHDR_DATA-ENUMBER = ZAK_EMPLIST-ENUMBER.
*--- Fill the administrative information for the record
IT_EDIDD-SEGNAM = C_EMP_HEADER_SEGMENT.
IT_EDIDD-SDATA = FS_EMPHDR_DATA.
*--- Append the data
APPEND IT_EDIDD.
*--- Employee Details
FS_EMPDET_DATA-ENAME = ZAK_EMPLIST-ENAME.
FS_EMPDET_DATA-EPHONE = ZAK_EMPLIST-EPHONE.
FS_EMPDET_DATA-EDEPT = ZAK_EMPLIST-EDEPT.
*--- Fill the administrative information for the record
IT_EDIDD-SEGNAM = C_EMP_DETAILS_SEGMENT.
IT_EDIDD-SDATA = FS_EMPDET_DATA.
*--- Append the data
APPEND IT_EDIDD.
ENDSELECT.
----
Pass Control to the ALE Interface -- IDoc Exporting
----
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = CONTROL_RECORD_OUT
TABLES
COMMUNICATION_IDOC_CONTROL = IT_COMM_IDOCS
MASTER_IDOC_DATA = IT_EDIDD
EXCEPTIONS
ERROR_IN_IDOC_CONTROL = 1
ERROR_WRITING_IDOC_STATUS = 2
ERROR_IN_IDOC_DATA = 3
SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
OTHERS = 5
.
IF SY-SUBRC NE 0.
MESSAGE E001(ZLKPL_MSGCLASS).
ELSE.
LOOP AT IT_COMM_IDOCS.
WRITE: / 'IDOC GENERATED', IT_COMM_IDOCS-DOCNUM.
ENDLOOP.
COMMIT WORK.
ENDIF.
Good Luck and Reward me for the same !!!
Thanks
Ashok
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |