Difference between revisions of "SAP BDS"

From SapWiki
 
Line 54: Line 54:
 
         classname      = co_bds_classname  "PICTURES
 
         classname      = co_bds_classname  "PICTURES
 
         classtype      = co_bds_classtype  "OT
 
         classtype      = co_bds_classtype  "OT
         object_key      = l_key
+
         object_key      = l_key             "HOTEL_5_STAR
 
       CHANGING
 
       CHANGING
 
         content        = lt_content
 
         content        = lt_content

Latest revision as of 23:44, 3 September 2024

BDSTESTOO - BDS: Programa de test p.métodos OO

ejemplo

Método                            GET_WITH_TABLE
Sistema lógico
Nombre de categoría               PICTURES
Tipo de clase                     OT
Mandante                          400
Clave                             HOTEL_5_STAR
  WHEN 'GET_WITH_TABLE'.
    REFRESH i_signature.
    CALL METHOD o_document_set->get_with_table
                             EXPORTING
                                 logical_system = i_logical_system
                                    classname = i_classname
                                    classtype = i_classtype
                                    client    = i_client
                                    object_key = i_object_key
                             CHANGING
                                    content = i_content
                                    signature = i_signature
                                    components = i_components
                             EXCEPTIONS
                                    OTHERS = 1.

  READ TABLE i_components INDEX 1 INTO ls_components.
  IF sy-subrc = 0.
    ld_out_len = ls_components-comp_size.
  ELSE.
    ld_out_len = 0.
  ENDIF.

  IF ld_out_len > 0.
    CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
      EXPORTING
        input_length         = ld_out_len
      IMPORTING
        buffer                = ed_file
      TABLES
        binary_tab            = i_content.
  endif.

BDSFIND_1 - Iniciar Business Document Navigator (trn. OAER)

Objetos

Paquete SBDS

Clases

  • CL_BDS_DOCUMENT_SET

ejemplo

    " load patient picture from BDS
    cl_bds_document_set=>get_with_table(
      EXPORTING
        classname       = co_bds_classname   "PICTURES
        classtype       = co_bds_classtype   "OT
        object_key      = l_key              "HOTEL_5_STAR
      CHANGING
        content         = lt_content
        components      = lt_components
      EXCEPTIONS
        error_kpro      = 1
        internal_error  = 2
        nothing_found   = 3
        no_content      = 4
        parameter_error = 5
        not_authorized  = 6
        not_allowed     = 7
        OTHERS          = 8  ).
    l_rc = sy-subrc.
    ls_msg-msgid = sy-msgid.
    ls_msg-msgno = sy-msgno.
    ls_msg-attr1 = sy-msgv1.
    ls_msg-attr2 = sy-msgv2.
    ls_msg-attr3 = sy-msgv3.
    ls_msg-attr4 = sy-msgv4.

    CASE l_rc.
      WHEN 0.         " image found
        " continue
      WHEN 3 OR 4.         " nothing found -> use fallback
        RETURN.
      WHEN 6.         " authorization missing
        RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
          EXPORTING
            http_status_code = /iwbep/cx_mgw_busi_exception=>gcs_http_status_codes-forbidden
            textid           = ls_msg.
      WHEN OTHERS.    " something else
        RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
          EXPORTING
            http_status_code = '500' " internal server error
            textid           = ls_msg.
    ENDCASE.

    READ TABLE lt_components INDEX 1 ASSIGNING FIELD-SYMBOL(<ls_component>).
    IF <ls_component> IS ASSIGNED.
      " set mime type
      es_stream-mime_type = <ls_component>-mimetype.

      " set stream data
      " convert binary data to xstring
      l_size = <ls_component>-comp_size.

      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = l_size
        IMPORTING
          buffer       = es_stream-value
        TABLES
          binary_tab   = lt_content
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.

      IF sy-subrc <> 0.
        CLEAR es_stream-value.
        CLEAR es_stream-mime_type.
      ENDIF.
    ENDIF.

Transacciones

  • SBDSV1 - Actualizar clases de documento (tabla BDS_LOCL)