Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

IDOC Execution

Former Member
0 Kudos

I created ZIdoc to send inspection lot data.. and created corresponding function module to populate idoc and created process code and message type. Now I want to send this data to receiver. How to execute or send the data to receiver system .Here there is no standalone program like BD10.

regards

shankar

7 REPLIES 7

Former Member
0 Kudos

hi Shankar,

you have 2 options for this(the way i have understud your question), 1 is in BD10 you can specify your Z message type and carry on with your work. the other option is you need to desingn your own selection screen similar to standard ones.

Regards:-

<b>Santosh</b>.

<b>P.S. mark Usefull answers</b>

0 Kudos

Ther is no user to execute the program .. i want it to be done automatically. as soon as user creates inspection lot it should populate idoc and it should go to receiver

vikrams_chavan
Explorer
0 Kudos

Hi ,

BD10 , BD12 , BD14 all these transactions are for master data transformation to receiver end ,Which provided by sap itself .

If ur sending idoc is related to any application ( va02 , va42 , me22 ) go for message control in parter profile AND maintain proper output type in NACE tcode .

if not then u have to create a report call there ur created F.M WHICH POPULATES IDOC .

With Regards ,

Vikram .

0 Kudos

Hi,

it can be done using the NACE transaction, create the output type and issue it, when you execute the transaction.

Regards

Vijay D T T.

Former Member
0 Kudos

Hi Shankar,

You have to create your own program chk out the code below and fill the required table and fields.Once you execute this program you can send your data easily to the target system.

report zxxx.

----


  • Parameters

----


*---Parameter for Object Key

PARAMETERS: P_ENUM LIKE Ztable-fieldname.

*---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 'Z1S_SEG1',

C_EMP_DETAILS_SEGMENT LIKE EDIDD-SEGNAM VALUE 'Z1S_SEG2'.

*---IDoc Type

DATA: C_REPORT_IDOC_TYPE LIKE EDIDC-IDOCTP VALUE 'ZS_IDOC'.

----


  • Data Declarations

----


*---Idoc Control Record

DATA: CONTROL_RECORD_OUT LIKE EDIDC.

*---Employee Header Data

DATA: FS_EMPHDR_DATA LIKE Z1S_SEG1.

*---Employee Details Data

DATA: FS_EMPDET_DATA LIKE Z1S_SEG2.

----


  • Database Tables

----


TABLES: Ztable.

----


  • Internal Tables

----


*---Internal table for application data

DATA: IT_EMP LIKE Ztable 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 Ztable

WHERE fieldname = P_ENUM.

IF SY-SUBRC NE 0 .

MESSAGE E001(ZMSGCLASS).

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 = ZTable-fieldname.

*--- 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-fieldname = Ztable-fieldname.

FS_EMPDET_DATA-fieldname = ztablefieldname.

FS_EMPDET_DATA-fieldname = Ztable-fieldname.

*--- 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(ZMSGCLASS).

ELSE.

LOOP AT IT_COMM_IDOCS.

WRITE: / 'IDOC GENERATED', IT_COMM_IDOCS-DOCNUM.

ENDLOOP.

COMMIT WORK.

ENDIF.

Reward points for the helpful answers

Regards,

Harini.S

Former Member
0 Kudos

Use function module MASTER_IDOC_DISTRIBUTE function module and pass the data.

This function module is the interface from the application to the ALE

layer on the outbound side. The application can pass an IDoc, the

so-called master IDoc, as an internal table using the parameters

MASTER_IDOC_CONTROL and MASTER_IDOC_DATA.

This IDoc is then converted into one or communcation IDocs and stored in

the ALE layer. IDocs for which no errors occurred are passed to

dispatch control.

In the table parameter COMMUNICATION_IDOC_CONTROL the header records

for the communication IDocs created are retturned. You can tell whether

processing was successful from the field STATUS.

A COMMIT WORK must be dispatched in the calling program, otherwise the

IDocs may not be dispatched.

Former Member
0 Kudos

Hi,

In case of your scenario, you`ll have to build your custom function module and process the same.

Reward if info is helpful.

Regards