Abap Web Service , C# return list data
Merhaba,
Aşağıdaki örnekte list tipinde veri dönen c# servis metodunun abap tarafında kullanımını görebilirsiniz.
Servis Metodu aşağıdaki gibidir.
Abap kodu ise şu şekilde.
DATA proxy_test TYPE REF TO ztp_genel_wsco_web_service_soa.
DATA: exc TYPE REF TO cx_root.
DATA: msg TYPE string.
DATA : gv_group_id TYPE int4 VALUE 15,
gv_datum TYPE sy–datum,
gv_start_d TYPE string,
gv_end_d TYPE string,
it LIKE STANDARD TABLE OF ztp_work_order WITH HEADER LINE.
gv_datum = ( sy–datum – 2 ).
CONCATENATE
gv_datum+0(4) ‘.’
gv_datum+4(2) ‘.’
gv_datum+6(2)
INTO gv_start_d.
CONCATENATE
sy–datum+0(4) ‘.’
sy–datum+4(2) ‘.’
sy–datum+6(2)
INTO gv_end_d.
DATA : gv_zaman(30) TYPE c.” VALUE ‘2018-11-08T18:36:25.89’.
MODIFY ztp_work_order FROM it.
TRY.
“”””””””””””””””””””
CREATE OBJECT proxy_test
EXPORTING
logical_port_name = ‘DEFAULT’.
“”””””””””””””””
IF proxy_test IS NOT BOUND.
CREATE OBJECT proxy_test TYPE ztp_genel_wsco_web_service_soa.
ENDIF.
DATA : order_w TYPE
ztp_genel_wsorder_work_soap_ou–order_work_result.
DATA: input TYPE ztp_genel_wsorder_work_soap_in,
output TYPE ztp_genel_wsorder_work_soap_ou.
DATA: wa_result TYPE ztp_genel_wssp_xxx_get_order.
input–groupid = ’15’.
input–start_date = gv_start_d.
input–end_date = gv_end_d.
CALL METHOD proxy_test->order_work ” Service Method Name
EXPORTING
input = input
IMPORTING
output = output.
FORMAT INVERSE ON.
LOOP AT output–order_work_result–sp_xxx_get_order_works_resul
INTO wa_result.
WRITE :/ ‘Siparis’ , wa_result–aufnr,
‘Bitiş Tarihi ‘ , wa_result–erp_order_stop_time.
NEW-LINE NO-SCROLLING.
MOVE-CORRESPONDING wa_result TO it.
it–erp_order_work_m = wa_result–erp_order_work_meter.
it–erp_order_work_t = wa_result–erp_order_work_time.
it–erp_order_produc = wa_result–erp_order_product.
IF wa_result–erp_order_stop_time NE space.
CLEAR gv_zaman.
gv_zaman = wa_result–erp_order_stop_time.
CONCATENATE gv_zaman+0(4)
gv_zaman+5(2)
gv_zaman+8(2)
INTO it–stop_date.
CONCATENATE gv_zaman+11(2)
gv_zaman+14(2)
gv_zaman+17(2)
INTO it–stop_time.
ENDIF.
IF wa_result–erp_order_time NE space .
CLEAR gv_zaman.
gv_zaman = wa_result–erp_order_time.
CONCATENATE gv_zaman+0(4)
gv_zaman+5(2)
gv_zaman+8(2)
INTO it–start_date.
CONCATENATE gv_zaman+11(2)
gv_zaman+14(2)
gv_zaman+17(2)
INTO it–start_time.
ENDIF.
it–erp_order_start_ = wa_result–erp_order_start_meter.
it–erp_order_stop_m = wa_result–erp_order_stop_meter.
it–erp_order_live_m = wa_result–erp_order_live_meter.
it–erp_order_run_me = wa_result–erp_order_run_meter.
MODIFY ztp_work_order FROM it.
ENDLOOP.
CATCH cx_ai_system_fault INTO exc.
msg = exc->get_text( ).
WRITE:/ msg.
ENDTRY.