Conforme post anterior, eu fiz um código para pegar o digest value do XML, ainda não testei no processo de contingência, se não funcionar, vou ter q procurar outra forma.
FORM f_digest_value USING fu_active TYPE j_1bnfe_active
CHANGING fc_digval TYPE string.
DATA: lo_download TYPE REF TO cl_j_1bnfe_xml_download,
lo_ixml TYPE REF TO if_ixml,
lo_stream_factory TYPE REF TO if_ixml_stream_factory,
lo_doc TYPE REF TO if_ixml_document,
lo_node_col TYPE REF TO if_ixml_node_collection,
lo_node TYPE REF TO if_ixml_node.
DATA: l_rfcdest TYPE rfcdest,
l_xnfeactive TYPE j_1bxnfeactive,
l_xml TYPE xstring,
l_key TYPE j_1b_nfe_access_key,
l_key44 TYPE j_1b_nfe_access_key_dtel44,
l_xml_cont TYPE j_1b_nfe_xml_content.
CONSTANTS lc_model_nfe TYPE j_1b_nfe_doctype VALUE 'NFE'.
"CONSTANTS lc_direct_in TYPE j_1b_nfe_direction VALUE 'INBD'.
CONSTANTS lc_direct_out TYPE j_1b_nfe_direction VALUE 'OUTB'.
CLEAR fc_digval.
MOVE-CORRESPONDING fu_active TO l_key.
l_key44 = l_key.
SELECT SINGLE ext_event, seqnum
INTO @DATA(ls_event)
FROM j_1bnfe_event
WHERE docnum EQ @fu_active-docnum.
CALL FUNCTION 'J_1B_NFE_CHECK_RFC_DESTINATION'
EXPORTING
i_bukrs = fu_active-bukrs
i_branch = fu_active-branch
i_model = fu_active-model
IMPORTING
e_rfcdest = l_rfcdest
e_xnfeactive = l_xnfeactive
EXCEPTIONS
rfc_error = 1
OTHERS = 2.
CREATE OBJECT lo_download
EXPORTING
iv_xml_key = l_key44
iv_rfc = l_rfcdest.
CALL METHOD lo_download->load_xml_content
EXPORTING
iv_docnum = fu_active-docnum
iv_event_type = ls_event-ext_event
iv_event_seqnum = ls_event-seqnum
iv_direction = lc_direct_out
iv_doctype = lc_model_nfe.
l_xml_cont = lo_download->get_xml_content( ).
*--------------------------------------------------------------------*
* Get DigestValue from lf_signature XML
*---------|----------------------------------------------------------*
lo_ixml = cl_ixml=>create( ).
lo_stream_factory = lo_ixml->create_stream_factory( ).
lo_doc = lo_ixml->create_document( ).
IF lo_ixml->create_parser(
document = lo_doc
stream_factory = lo_stream_factory
istream = lo_stream_factory->create_istream_xstring( string = l_xml_cont )
)->parse( ) <> 0.
RETURN.
ENDIF.
lo_node_col = lo_doc->get_elements_by_tag_name( name = 'DigestValue' ).
IF lo_node_col->get_length( ) > 0.
lo_node = lo_node_col->get_item( 0 ).
fc_digval = lo_node->get_value( ).
ENDIF.
ENDFORM.
Nenhum comentário:
Postar um comentário