Difference between revisions of "SAP ISH ABAP"
From SapWiki
Line 38: | Line 38: | ||
==Obtener binario/visualizar documento== | ==Obtener binario/visualizar documento== | ||
− | + | <nowiki>data l_base64 type string. | |
data lt_document type TABLE OF RN2PCRAW255. | data lt_document type TABLE OF RN2PCRAW255. | ||
data l_length type N2_BYTES. | data l_length type N2_BYTES. |
Revision as of 14:34, 13 July 2020
Obtener extensión de documento (tabla NDOC)
data: ls_appl_data type RN2DT_APPLICATION, ls_pcdta type N2DTDTA. SELECT SINGLE dtid, dtvers into @data(ls_ndoc) FROM ndoc WHERE dokar = @c_data-dokar AND doknr = @c_data-doknr AND dokvr = @c_data-dokvr AND doktl = @c_data-doktl. "#EC CI_SEL_NESTED CALL FUNCTION 'ISH_N2_READ_DOCUMENT_TYPE' EXPORTING ss_dtid = ls_ndoc-dtid ss_dtvers = ls_ndoc-dtvers ss_einri = c_data-einri SS_VCODE = 'DIS' IMPORTING * SS_N2DT = * SS_N2DTT = SS_PCDTA = ls_pcdta * SS_ERROR_PCDTA = * SS_DOCCATEGORY = * SS_DOCCATEGORY_PC = * SS_APPLICATION = SS_APPL_NEW = ls_appl_data * SS_FORMAT = EXCEPTIONS NOT_FOUND_OBJECT = 1 WRONG_VCODE = 2 OTHERS = 3 . IF sy-subrc = 0. * Implement suitable error handling here c_data-extension = ls_pcdta-PCFEXT. else. c_data-extension = 'DOC'. ENDIF.
Obtener binario/visualizar documento
data l_base64 type string. data lt_document type TABLE OF RN2PCRAW255. data l_length type N2_BYTES. data: lt_ndoc type STANDARD TABLE OF ndoc, ls_draw type DRAW. if i_bin = abap_true. "obtener binario de documenro (xstring) CALL FUNCTION 'ISH_N2_GET_CONTAINER_DOCUMENT' EXPORTING ss_dokar = c_data-dokar ss_doknr = c_data-doknr ss_dokvr = c_data-dokvr ss_doktl = c_data-doktl IMPORTING SS_FILE_LENGTH = l_length TABLES ss_dokument_content = lt_document EXCEPTIONS DOCUMENT_NOT_FOUND = 1 NO_RFC = 2 OTHERS = 3 . IF sy-subrc <> 0 or lt_document[] is INITIAL. return. ENDIF. CALL METHOD cl_faa_tenv_services=>convert_xtable_to_xstring EXPORTING it_xtable = lt_document IMPORTING ed_xstring = c_data-binfile EXCEPTIONS invalid_table = 1 others = 2 . IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. else. "visualizar documento SELECT * into TABLE lt_ndoc FROM ndoc WHERE dokar = c_data-dokar AND doknr = c_data-doknr AND dokvr = c_data-dokvr AND doktl = c_data-doktl. "#EC CI_SEL_NESTED if sy-subrc <> 0. return. endif. CALL FUNCTION 'ISH_N2_MEDICAL_DOCUMENT' EXPORTING * SS_BISDAT = ss_einri = c_data-einri SS_MODE = space * SS_VONDAT = ss_tcode = 'N203' * SS_SELKR = ' ' * SS_ENQUE = ' ' * SS_SET_SCREEN_FLAG = ' ' * SS_TITLE1 = ' ' * SS_TITLE2 = ' ' * SS_DOCLARCH = ' ' * SS_DKTXT = * SS_RAISE_BATCH = * IMPORTING * SS_OKCODE = * SS_TDWS = * SS_TDWST = * SS_CMD_ERROR = * SS_SAVED = TABLES SS_NDOC = lt_ndoc * SS_COMMANDS = CHANGING SS_DRAW = ls_draw EXCEPTIONS NO_DOCUMENT = 1 NO_INSERT = 2 CANCEL = 3 OTHERS = 4 . IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. endif.