on 06-23-2015 7:04 PM
Hi all,
I have a scenario where when a field, say <type>, contains a blank value from an ABAP proxy, the XI output is not producing an empty tag because the proxy cant send a blank value and thats xml's way of staying light by not producing a bunch of empty tags. But that is our goal is to produce an empty tag when <type> is blank. Therefore, we have decided to pass the value 'blank' to XI when there is no value found in the field. How would one create the mapping inside of XI to produce an empty tag when the value is 'blank' and if not 'blank' produce whatever the value may be?
Thanks!
Why not using node function mapWithDefault? This will create an empty tag, when the source field is missing. So you need not pass a value in ABAP proxy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
As you are saying the fields left blank do not get passed to PI . The request payload XML does not have blank value tag in it .
For this purpose we need to use if_wsprotocol_payloadinterface protocol ,
Actually With protocols, you can use additional runtime services.
The different runtime supports different protocols.
In our Proxy service .
Every Structure has an extra field of type PRXCTRLTAB .
we need to append our Blank value fields with initial value .
You Only need to include Bold font code in your existing code rest of the code are for understanding purpose .
Use Below Code To send Blank XML tag through Proxy :-
****************************************Beginning Of Code *********************************
DATA
lo_service TYPE REF TO ZNAVCO_EMPLOYEE_DETAILS . "The object
declaration for the proxy ABAP object .
DATA lt_inputs TYPE ZNAVDT_DETAILS_OUTBOUND_TAB . "internal table of
Data structure
data ls_input TYPE ZNAVDT_DETAILS_OUTBOUND_STR . "work area of Data Structure
data ls_record TYPE ZNAVMT_DETAILS_OUTBOUND_STR. " the output parameter for the proxy
DATA lo_payload_protocol TYPE REF TO if_wsprotocol_payload. "payload Interface
*DATA lt_controller TYPE PRXCTRLTAB. " Controller Tab
DATA ls_controller TYPE PRXCTRL. " Controller Structure
CREATE OBJECT lo_service .
lo_payload_protocol ?= lo_service->get_protocol( if_wsprotocol=>payload ). " get proxy Protocol
CALL METHOD lo_payload_protocol->set_extended_xml_handling( abap_true ). "Active Extended XML handling .
ls_controller-field =
'EMP_LOCATION'. "field has blank value
ls_controller-value = sai_ctrl_initial. " This will send initial value
append ls_controller to ls_input-controller.
ls_controller-field =
'EMP_BANK_AC_NO'. "field has blank value
ls_controller-value = sai_ctrl_initial. " This will send initial value
append ls_controller to ls_input-controller.
ls_input-NAME = 'NAVNEET' . “Normal firlds having data
ls_input-DOJ = '10.01.2019' .
append ls_input to lt_inputs .
clear ls_input .
ls_controller-field = 'EMP_BANK_AC_NO'. "field has blank
value
ls_controller-value = sai_ctrl_initial. " This will send initial value
append ls_controller to ls_input-controller.
ls_input-NAME = 'Anand'
ls_input-DOJ = '12.05.2016' .
ls_input-emp_location = 'India' .
append ls_input to lt_inputs .
ls_record -mt_sender_emp_details_templ-record = lt_inputs .
TRY.
lo_service->send_employee_data( output = ls_record ).
CATCH cx_root INTO Data(lr_excep).
MESSAGE lr_excep->get_text( ) TYPE 'E'.
ENDTRY.
************************************* End of Code ****************************************
Remember One thing :-
Thanks and Regards
Navneet Anand .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, thank you for your answer. It works fine while sending a request, but I get exception SOAP:1027 SRT: Serialization / Deserialization failed and a success message from service. Here's screenshot from SRT_UTIL:
In SE80 in service definition datatype for field "relationNumber" is STRING. Should it be INT4 or INT8?
Hi Ryan,
You can produce a blank output in an ABAP proxy by using extended xml handling.
Activating Extended XML Handling - ABAP Web Services - SAP Library
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.