FUNCTION Y_ISSUE_ROCO_IDOC.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(I_MODE) LIKE Z1ROCO-ZMODE
*" VALUE(I_ROUTE) LIKE Z1ROCO-ROUTE
*" VALUE(I_CUT_OFF) LIKE Z1ROCO-CUT_OFF OPTIONAL
*" VALUE(I_BEZEI) LIKE Z1ROCO-BEZEI OPTIONAL
*" VALUE(I_TROUTE_MON) LIKE Z1ROCO-TROUTE_MON OPTIONAL
*" VALUE(I_TROUTE_TUE) LIKE Z1ROCO-TROUTE_TUE OPTIONAL
*" VALUE(I_TROUTE_WED) LIKE Z1ROCO-TROUTE_WED OPTIONAL
*" VALUE(I_TROUTE_THU) LIKE Z1ROCO-TROUTE_THU OPTIONAL
*" VALUE(I_TROUTE_FRI) LIKE Z1ROCO-TROUTE_FRI OPTIONAL
*" VALUE(I_TROUTE_SAT) LIKE Z1ROCO-TROUTE_SAT OPTIONAL
*" VALUE(I_TROUTE_SUN) LIKE Z1ROCO-TROUTE_SUN OPTIONAL
*" VALUE(I_PGI_IND) LIKE Z1ROCO-PGI_IND OPTIONAL
*"----------------------------------------------------------------------
DATA: W_EDIDC LIKE EDIDC OCCURS 5 WITH HEADER LINE,
W_Z1ROCO LIKE EDIDC,
L_EDIDC LIKE EDIDC,
L_SEND_FLAG,
W_SDATA LIKE EDIDD-SDATA.
DATA: T_BDI_MODEL LIKE BDI_MODEL OCCURS 0 WITH HEADER LINE.
DATA: T_EDIDC LIKE EDIDC OCCURS 0 WITH HEADER LINE.
DATA: T_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE.
*- Call function module to determine if message is to be distributed
CALL FUNCTION 'ALE_MODEL_DETERMINE_IF_TO_SEND'
EXPORTING
MESSAGE_TYPE = 'ZZROCO'
IMPORTING
IDOC_MUST_BE_SENT = L_SEND_FLAG
EXCEPTIONS
OWN_SYSTEM_NOT_DEFINED = 1
OTHERS = 2.
*- Determine recipient systems
CALL FUNCTION 'ALE_MODEL_INFO_GET'
EXPORTING
MESSAGE_TYPE = 'ZZROCO'
* RECEIVING_SYSTEM = ' '
* SENDING_SYSTEM = ' '
* VALIDDATE = SY-DATUM
TABLES
MODEL_DATA = T_BDI_MODEL
EXCEPTIONS
NO_MODEL_INFO_FOUND = 1
OWN_SYSTEM_NOT_DEFINED = 2
OTHERS = 3.
* 3.2
*Call function 'L_IDOC_HEADER_CREATE'
* exporting
* i_mestyp = 'ZZROCO'
* i_mescod = ' '
* i_idoctp = 'ZSDROCO'
* i_rcvprn = 'Z_WMS'
* exceptions
* others = 1.
* 3.3
MOVE I_MODE TO Z1ROCO-ZMODE.
MOVE I_ROUTE TO Z1ROCO-ROUTE.
MOVE I_CUT_OFF TO Z1ROCO-CUT_OFF.
MOVE I_BEZEI TO Z1ROCO-BEZEI.
MOVE I_TROUTE_MON TO Z1ROCO-TROUTE_MON.
MOVE I_TROUTE_TUE TO Z1ROCO-TROUTE_TUE.
MOVE I_TROUTE_WED TO Z1ROCO-TROUTE_WED.
MOVE I_TROUTE_THU TO Z1ROCO-TROUTE_THU.
MOVE I_TROUTE_FRI TO Z1ROCO-TROUTE_FRI.
MOVE I_TROUTE_SAT TO Z1ROCO-TROUTE_SAT.
MOVE I_TROUTE_SUN TO Z1ROCO-TROUTE_SUN.
MOVE I_PGI_IND TO Z1ROCO-PGI_IND.
MOVE Z1ROCO TO: W_SDATA, T_EDIDD-SDATA.
MOVE 'Z1ROCO' TO T_EDIDD-SEGNAM.
APPEND T_EDIDD.
*call function 'L_IDOC_SEGMENT_CREATE'
* exporting
* i_segnam = 'Z1ROCO'
* i_sdata = w_sdata
* exceptions
* others = 1.
*call function 'L_IDOC_SEND'
* tables
* t_comm_idoc = w_edidc
* exceptions
* error_distribute_idoc = 1
* others = 2.
READ TABLE T_BDI_MODEL INDEX 1. " maximum 1 recipient
MOVE 'ZZROCO' TO L_EDIDC-MESTYP.
MOVE 'ZSDROCO' TO L_EDIDC-IDOCTP.
MOVE 'LS' TO L_EDIDC-RCVPRT.
MOVE T_BDI_MODEL-RCVSYSTEM TO L_EDIDC-RCVPRN.
*- Distribute the iDoc
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE' IN UPDATE TASK
EXPORTING
MASTER_IDOC_CONTROL = L_EDIDC
TABLES
COMMUNICATION_IDOC_CONTROL = W_EDIDC
MASTER_IDOC_DATA = T_EDIDD
EXCEPTIONS
ERROR_IN_IDOC_CONTROL = 01
ERROR_WRITING_IDOC_STATUS = 02
ERROR_IN_IDOC_DATA = 03
SENDING_LOGICAL_SYSTEM_UNKNOWN = 04.
COMMIT WORK.
*E_RESPONSE = SY-SUBRC.
ENDFUNCTION.
ABAP/4,ABAP report,Interactive Report Example,ALV grid Example,ALV list,IDOC,User Exit,RFC,Smartform,sapscript,ABAP Performance,Remote Function Module( RFC ),Function Module,ABAP Sample Code,ABAP tools,ALV report Generator,ABAP Interview Questions,BDC,BAPI,ALE,BADI,EDI,InternalTable,Data Structure,LSMW,Domain,DataElement,Basis and Administration,ABAP HR development,ABAPDebugger,BW,Exception Handling,Download FI, CO, MM, PP, SD, PM, PS, QM, SM, HR, BW, APO,ABAP Tutorial
Thursday, October 18, 2007
Subscribe to:
Post Comments (Atom)
Sample ABAP Code
- Sample ABAP Program to Upload table using new function GUI_UPLOAD
- Sample ABAP Program for Submitting report with selection table
- Sample ABAP Program for Sending SAP Mail
- Sample ABAP Program for Search Layout sets for given String
- Sample ABAP Program for Sapscript PerForm Module
- Sample ABAP Program for Create IDOC
- Sample ABAP Program for Output file to application server then send mail with Download details
- Sample ABAP Program for Module Pool Skeleton
- Sample ABAP Program for Module Pool containing screen loop processing
- Sample ABAP Program for MB1B Call Transaction
- Sample ABAP Program of Function Module to Convert Work Center into Personnel Number
- Sample ABAP Program of FTP Function Module
- Sample ABAP Program to EXPORT LIST TO MEMORY
- Sample ABAP Program to Execute Unix command from within SAP
- Sample ABAP Program to Get Output in EXCEL
- Sample ABAP Program to Implement EDI
- Sample Program to dynamically change upload/download program for any Table
- Sample ABAP Program to download table using new function GUI_DOWNLOAD
- Sample ABAP Program to Download file to Presentation Server
- Sample ABAP Program to display pop message to avoid abort
- Sample ABAP Program of ALV Grid
- Sample ABAP Program of Dialogue Module Pool
- Sample ABAP Program to DIALOGUE FLOW LOGIC
- Sample ABAP Program to Delete a file from the application server
- Sample ABAP Program to Compare to Unix or PC files and print differences
- Sample ABAP Program to Colour cells in ALV
- Sample ABAP Program to Calculate difference between date/times in hours
- Sample ABAP Program of BW User Exit
- Sample ABAP Program of ALV Grid control using OO methods
- Browse a file on the application server
No comments:
Post a Comment