Resumen: En mi blog anterior, expliqué cómo habilitar la barra de herramientas GOS en el documento de facturación de CRM en la pantalla SAP GUI. En este blog, captaré la necesidad de mostrar los datos de la barra de herramientas de GOS y los archivos adjuntos en PDF en la pantalla de interfaz de usuario web de CRM para mejorar la experiencia del usuario.
El primer paso es la mejora del componente BSP estándar BEABDH_BILLDOC, allí necesitamos agregar una nueva vista, digamos ZGOSATTACH con el nodo de valor (digamos ZGOSVAL) y atributos de la siguiente manera. (Esto es similar a cómo agregamos una vista personalizada en el componente estándar).
Que sería similar a la siguiente en la pantalla CRM Web-UI
Él próximo paso es a llenar el vista con datos, cuales es hecho en el método DO_ILIENDRE_CONTEXTO de el soycomplementación clase.
Él código retazo ese haría leer datos de específico facturación documentos SMO barra de herramientas y llenar cada campo en el mostrar en BOL capa es mostrado abajo.
* Structure to populate assignment view
TYPES: BEGIN OF x_gos_data,
brelguid TYPE os_guid, "Relationship Guid
instid_b TYPE sibfboriid, "Instance Ident. in BOR Compat. Persistent Object Referce
title TYPE iw_title, "Attachment Title
description TYPE bitm_descr, "Description (Like, Attachment, Note, URL)
value TYPE crm_rt_value, "Notes Content
created_by TYPE sgs_crname, "Attribute as Created By
creadate TYPE sgs_crdate, "Attribute as Created Date
creatime TYPE sgs_crtime, "Attribute as Created Time
END OF x_gos_data.
CONSTANTS : lc_appl_crmb TYPE bef_appl VALUE 'CRMB',
lc_catid_bo TYPE sibfcatid VALUE 'BO',
lc_rel_note TYPE oblreltype VALUE 'NOTE',
lc_rel_atta TYPE oblreltype VALUE 'ATTA',
lc_headno_ext TYPE name_komp VALUE 'HEADNO_EXT',
lc_objtype TYPE name_komp VALUE 'OBJTYPE',
lc_i TYPE char1 VALUE 'I',
lc_eq TYPE char2 VALUE 'EQ'.
DATA : lv_doc_data TYPE sofolenti1,
lo_ref_cuco TYPE REF TO cl_beabdh_b_cucobill_impl,
lo_ref_entity TYPE REF TO cl_crm_bol_entity,
lo_ref_struct TYPE REF TO x_gos_data,
li_obj_content TYPE STANDARD TABLE OF solisti1.
CALL METHOD super->do_init_context.
* Clear all the values from view initially
me->typed_context->zgosattach->collection_wrapper->clear( ).
DATA(lo_ref_core) = cl_crm_bol_core=>get_instance( ).
IF lo_ref_core IS BOUND.
TRY.
* Get Custom Controller to extract Billing Header details
lo_ref_cuco ?= get_custom_controller( 'BEABDH_BILLDOC/CuCoBill' ).
IF lo_ref_cuco IS BOUND.
* Extract current data from custom controller
lo_ref_entity ?= lo_ref_cuco->typed_context->bdheader->collection_wrapper->get_current( ).
IF lo_ref_entity IS BOUND.
* Get Billing Document and Object type
DATA(lv_billdocno) = lo_ref_entity->get_property_as_string( iv_attr_name = lc_headno_ext ).
DATA(lv_billobjtype) = lo_ref_entity->get_property_as_string( iv_attr_name = lc_objtype ).
IF lv_billdocno IS NOT INITIAL AND lv_billobjtype IS NOT INITIAL.
lv_billdocno = CONV bea_headno_ext( |{ lv_billdocno ALPHA = IN }| ).
* Populate
DATA(ls_object) = VALUE sibflporb( instid = lv_billdocno && lc_appl_crmb
typeid = lv_billobjtype
catid = lc_catid_bo ).
DATA(lt_relation_op) = VALUE obl_t_relt( ( sign = lc_i option = lc_eq low = lc_rel_note )
( sign = lc_i option = lc_eq low = lc_rel_atta ) ).
* Read the links against Billing Document to fetch all the GOS attachments
TRY.
CALL METHOD cl_binary_relation=>read_links
EXPORTING
is_object = ls_object
it_relation_options = lt_relation_op
IMPORTING
et_links = DATA(lt_links).
LOOP AT lt_links ASSIGNING FIELD-SYMBOL(<fs_links>).
CLEAR :lv_doc_data,
li_obj_content.
* Read the GOS attachments content and attributes to show in WebUI
DATA(lv_doc_id) = CONV so_entryid( <fs_links>-instid_b ).
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = lv_doc_id
IMPORTING
document_data = lv_doc_data
TABLES
object_content = li_obj_content
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
IF sy-subrc EQ 0.
* Populate work area to show all the details
DATA(ls_gos_data) = VALUE x_gos_data( brelguid = <fs_links>-brelguid
instid_b = <fs_links>-instid_b
title = lv_doc_data-obj_descr
description = <fs_links>-reltype
value = CONV crm_rt_value( li_obj_content[ 1 ] )
created_by = lv_doc_data-creat_fnam
creadate = lv_doc_data-creat_date
creatime = lv_doc_data-creat_time ).
IF <fs_links>-reltype = lc_rel_atta.
CLEAR ls_gos_data-value.
ENDIF.
TRY.
* Create the value node and add the the same in collection wrapper
CREATE DATA lo_ref_struct.
IF lo_ref_struct IS BOUND.
DATA(lo_ref_value_node) = NEW cl_bsp_wd_value_node( iv_data_ref = lo_ref_struct ).
IF lo_ref_value_node IS BOUND AND ls_gos_data IS NOT INITIAL.
lo_ref_value_node->set_properties( ls_gos_data ).
me->typed_context->zgosattach->collection_wrapper->add( lo_ref_value_node ).
ENDIF.
ENDIF.
CATCH cx_sy_create_data_error.
CLEAR ls_gos_data.
CONTINUE.
ENDTRY.
CLEAR ls_gos_data.
ENDIF.
ENDLOOP.
*Modify BOL layer to get reflected the details in WebUI
lo_ref_core->modify( ).
CATCH cx_obl_parameter_error
cx_obl_internal_error
cx_obl_model_error
cx_sy_create_data_error .
RETURN.
ENDTRY.
ENDIF.
ENDIF.
ENDIF.
CATCH cx_sy_move_cast_error.
RETURN.
ENDTRY.
ENDIF.
Como a resultado, todos el datos desde el SMO barra de herramientas voluntad ser lleno en y desplegado en el Pantalla de interfaz de usuario web como visto abajo.
Mi próxima publicación de blog tratará sobre cómo crear un hipervínculo a un archivo PDF específico y mostrar el documento PDF en una ventana emergente en la pantalla WebUI. Siga leyendo y déjenos un comentario si tiene alguna sugerencia o comentario para compartir.
Gracias de nuevo por leer el documento. Realmente aprecio tu tiempo.
Calle Eloy Gonzalo, 27
Madrid, Madrid.
Código Postal 28010
Paseo de la Reforma 26
Colonia Juárez, Cuauhtémoc
Ciudad de México 06600
Real Cariari
Autopista General Cañas,
San José, SJ 40104
Av. Jorge Basadre 349
San Isidro
Lima, LIM 15073