Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3022

Re: Additional fields on Existing Json-/IWCOR/CX_DS_EP_PROPERTY_ERROR/ error

$
0
0

Hi Kiran,

 

Below logic will help you to covert ABAP to JSON .

 

DATA: lr_writer TYPE REF TO cl_sxml_string_writer,

        lrx_root TYPE REF TO cx_root,

        ls_bapiret TYPE bapiret2.

  TRY.

*     ABAP to JSON

      lr_writer = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json no_empty_elements = abap_true ).

      CALL TRANSFORMATION id

        SOURCE data = iv_data

        RESULT XML lr_writer

        OPTIONS initial_components = 'suppress'.

     ev_json = cl_abap_codepage=>convert_from( lr_writer->get_output( ) ).

    CATCH cx_root INTO lrx_root.

      ls_bapiret-type = 'E'.

      ls_bapiret-message = lrx_root->get_text( ).

      APPEND ls_bapiret TO et_messages.

  ENDTRY.

 

 

 

In the above logic iv_data would be your abap structure or table and ev_json would be response in json format.

 

please let me know if you have doubts.


Viewing all articles
Browse latest Browse all 3022


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>