Skip to Content
0
May 14, 2008 at 12:38 AM

Help with RFC sender, Program And RFC Destination

190 Views

Hi!!

my scenary is asynchronous

RFC Sender -> SAP-XI -> Oracle reciever

I have a problem with abap, especially rfc, program and rfc destination. The connection with SAP-XI exist and SAP-XI receive the message but the message is empty.

1. In my program on the line

CALL FUNCTION 'ZBAPI_SD_PED_ORD_SERVIC' DESTINATION 'ZXI_ENVIAR_PED_ORD_SERVIC'

catch an error system_failure = 2 and it dont execute the rfc ZBAPI_SD_PED_ORD_SERVIC

2. I rewrite my program, that line to

CALL FUNCTION 'ZBAPI_SD_PED_ORD_SERVIC' STARTING NEW TASK 'NEW' DESTINATION 'ZXI_ENVIAR_PED_ORD_SERVIC'

catch an error communication_failure = 1 but the rfc ZBAPI_SD_PED_ORD_SERVIC is executed but no send to SAP-XI

3. I rewrite my program, that line to

CALL FUNCTION 'ZBAPI_SD_PED_ORD_SERVIC' IN BACKGROUND TASK DESTINATION 'ZXI_ENVIAR_PED_ORD_SERVIC'

No error but it dont execute the rfc ZBAPI_SD_PED_ORD_SERVIC and the message in SAP-XI is empty, display the tables but not the row. i check the table PED_ORDEN and RETURN but the controls fields dont are afected.

What is my Error?

Where am i making a mistake?

RFC

FUNCTION zbapi_sd_ped_ord_servic.
*"---------------------------------------
*"Interfase local
*"  TABLES
*"      PED_ORDEN STRUCTURE  ZSD_RFC_T04
*"      RETURN STRUCTURE  ZSD_RFC_R06
*"---------------------------------------
  TABLES: zsd_ped_orden, zsd_rfc_r01.
  
  DATA: tb_ped_orden LIKE zsd_ped_orden  OCCURS 0 WITH HEADER LINE,
  			tb_rfc_orden_error LIKE zsd_rfc_r01 OCCURS 0 WITH HEADER LINE.

*Get Pedido by Ordenes

  SELECT  *  INTO CORRESPONDING FIELDS OF TABLE tb_ped_orden
		FROM zsd_ped_orden
		WHERE estatus  EQ  space.
  
  LOOP AT tb_ped_orden.
    MOVE-CORRESPONDING tb_ped_orden TO ped_orden.
    APPEND ped_orden.
    tb_ped_orden-estatus = 'X'.
    tb_ped_orden-fecha_actualiz = sy-datum.
    tb_ped_orden-hora_actualiz = sy-uzeit.
    MODIFY tb_ped_orden.
  ENDLOOP.  
  MODIFY  zsd_ped_orden FROM TABLE tb_ped_orden.
  COMMIT WORK.

*Errors in Ordenes

  SELECT  *  INTO CORRESPONDING FIELDS OF TABLE tb_rfc_orden_error
		FROM zsd_rfc_r01
		WHERE estatus  EQ  space.

  LOOP AT tb_rfc_orden_error.
    MOVE-CORRESPONDING tb_rfc_orden_error TO return.
    APPEND  return.
    tb_rfc_orden_error-estatus = 'X'.
    tb_rfc_orden_error-fecha_actualiz = sy-datum.
    tb_rfc_orden_error-hora_actualiz = sy-uzeit.
    MODIFY tb_rfc_orden_error.
  ENDLOOP.
  MODIFY  zsd_rfc_r01 FROM TABLE tb_rfc_orden_error.
  COMMIT WORK.

ENDFUNCTION.

PROGRAM

REPORT  ZBAPI_SD_PED_ORD_SERVIC.

DATA: ped_orden LIKE ZSD_RFC_T04 OCCURS 0 WITH HEADER LINE,
      return LIKE ZSD_RFC_R06 OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'ZBAPI_SD_PED_ORD_SERVIC' DESTINATION 'ZXI_ENVIAR_PED_ORD_SERVIC'
	TABLES
		ped_orden             = ped_orden
		return                = return
  EXCEPTIONS
    communication_failure = 1
    system_failure        = 2
    OTHERS                = 3.
IF sy-subrc <> 0.
  MESSAGE 'error' type 'I'.
ENDIF.

COMMIT WORK.

RFC DESTINATION

RFC Destination: ZXI_ENVIAR_PED_ORD_SERVIC
Connection TYpe: TCP/IP Connection
Register Server Program: ZBAPI_SD_PED_ORD_SERVIC
Gateway host: host00
Gateway service: sapgw00