2006 Aug 17 3:23 PM
Hi All,
I need to create trigger IDoc when deleting the shipment.
Is it possible to do that. Please repy me.
Is it possible to create the outbound IDoc using Z program. If yes please help me how to do it.
2006 Aug 17 3:35 PM
Hi,
You can triger a out bound Idoc usng a Z program . the FM used for that is MASTER_IDOC_DISTRIBUTE .
FORM ZSHP_PROCESSING USING RC
US_SCREEN.
tables: zshpmnt, nast,
vttk. " +DR1K975353
****data declarations
data: control_record_out like edidc.
data: int_edidd like edidd occurs 0 with header line,
int_comm_idocs like edidc occurs 0 with header line.
data: int_zshpmnt like zshpmnt occurs 0 with header line.
data: w_vttk_text4 like vttk-text4. " +DR1K975353
Begin of insertion for DR1K975353
clear w_vttk_text4.
select single text4 into w_vttk_text4 from vttk
where tknum EQ nast-objky.
End of insertion for DR1K975353
clear int_zshpmnt.
refresh int_zshpmnt.
clear control_record_out.
Build the Control Record of the idoc
control_record_out-mestyp = 'ZSHPMNT'.
control_record_out-idoctp = 'ZSHPMNT'.
control_record_out-rcvprt = 'LS'.
control_record_out-rcvprn = 'MQSISYS'.
Build Data Records
int_zshpmnt-zbol = nast-objky.
int_zshpmnt-zdate = sy-datum.
int_zshpmnt-ztext4 = w_vttk_text4. " +DR1K975353
int_edidd-segnam = 'ZSHPMNT'.
int_edidd-sdata = int_zshpmnt.
append int_edidd.
pass idoc to ale layer
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = control_record_out
OBJ_TYPE = ''
CHNUM = ''
TABLES
COMMUNICATION_IDOC_CONTROL = int_comm_idocs
MASTER_IDOC_DATA = int_edidd
EXCEPTIONS
ERROR_IN_IDOC_CONTROL = 1
ERROR_WRITING_IDOC_STATUS = 2
ERROR_IN_IDOC_DATA = 3
SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
OTHERS = 5
.
set return code
IF SY-SUBRC <> 0.
MESSAGE E000(ZOTC) WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
Message S000(ZOTC) with 'Idoc created.'.
RC = 0.
ENDIF.
ENDFORM.
Also refer to this link for more examples using MASTER_IDOC_DISTRIBUTE .
Regards,
Varun .
Message was edited by: varun sonu
Hi All,
I need to create trigger IDoc when deleting the shipment.
Is it possible to do that. Please repy me.
Is it possible to create the outbound IDoc using Z program. If yes please help me how to do it.
2006 Aug 17 3:35 PM
Hi,
You can triger a out bound Idoc usng a Z program . the FM used for that is MASTER_IDOC_DISTRIBUTE .
FORM ZSHP_PROCESSING USING RC
US_SCREEN.
tables: zshpmnt, nast,
vttk. " +DR1K975353
****data declarations
data: control_record_out like edidc.
data: int_edidd like edidd occurs 0 with header line,
int_comm_idocs like edidc occurs 0 with header line.
data: int_zshpmnt like zshpmnt occurs 0 with header line.
data: w_vttk_text4 like vttk-text4. " +DR1K975353
Begin of insertion for DR1K975353
clear w_vttk_text4.
select single text4 into w_vttk_text4 from vttk
where tknum EQ nast-objky.
End of insertion for DR1K975353
clear int_zshpmnt.
refresh int_zshpmnt.
clear control_record_out.
Build the Control Record of the idoc
control_record_out-mestyp = 'ZSHPMNT'.
control_record_out-idoctp = 'ZSHPMNT'.
control_record_out-rcvprt = 'LS'.
control_record_out-rcvprn = 'MQSISYS'.
Build Data Records
int_zshpmnt-zbol = nast-objky.
int_zshpmnt-zdate = sy-datum.
int_zshpmnt-ztext4 = w_vttk_text4. " +DR1K975353
int_edidd-segnam = 'ZSHPMNT'.
int_edidd-sdata = int_zshpmnt.
append int_edidd.
pass idoc to ale layer
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = control_record_out
OBJ_TYPE = ''
CHNUM = ''
TABLES
COMMUNICATION_IDOC_CONTROL = int_comm_idocs
MASTER_IDOC_DATA = int_edidd
EXCEPTIONS
ERROR_IN_IDOC_CONTROL = 1
ERROR_WRITING_IDOC_STATUS = 2
ERROR_IN_IDOC_DATA = 3
SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
OTHERS = 5
.
set return code
IF SY-SUBRC <> 0.
MESSAGE E000(ZOTC) WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
Message S000(ZOTC) with 'Idoc created.'.
RC = 0.
ENDIF.
ENDFORM.
Also refer to this link for more examples using MASTER_IDOC_DISTRIBUTE .
Regards,
Varun .
Message was edited by: varun sonu