Posts

Showing posts from June, 2022

ALV reort using CL_SALV_TABLE

Image
 REPORT ztest_pr.  TABLES: afko.  TYPES: BEGIN OF ty_final,           aufnr TYPE afko-aufnr,           matnr TYPE resb-matnr,           auart TYPE aufk-auart,           abjnr TYPE aufk-objnr,           aufpl TYPE afvc-aufpl,           aplzl TYPE afvc-aplzl,           vornr TYPE afvc-vornr,           arbid TYPE afvc-arbid,           steus TYPE afvc-steus,           objnr TYPE afvc-objnr,           stext TYPE bsvx-sttxt,         END OF ty_final.  DATA: lt_final TYPE TABLE OF ty_final,              ls_final TYPE ty_final.  DATA: lv_stext LIKE bsvx-sttxt.   SELECT-OPTIONS: s_aufnr FOR afko-aufnr. ******************************************************** * Class Definition ********************************************************  CLASS lc_salv DEFINITION.    PUBLIC SECTION.      METHODS: fetch_data,               create_salv_obj RAISING cx_static_check ,               display_toolbar,               set_layout,               set_column_attr RAISING cx_static_check,               event_handle_

Exception handing in OData

Image
SAP provided below 2 Interfaces and 2 Classes to handle the exceptions in OData. /IWBEP/IF_MESSAGE_CONTAINER /IWBEP/IF_MGW_CONTEXT /IWBEP/CX_MGW_BUSI_EXCEPTION /IWBEP/CX_MGW_TECH_EXCEPTION     Example: DATA(lo_msg_container) = mo_context->get_message_container( ). SELECT SINGLE * FROM qals INTO @DATA(ls_qals) WHERE prueflos EQ @iv_prueflos.  IF sy-subrc NE 0. METOD 1: Just raise an exception but don't handle it (no parameters)          RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception.  The output will be as follows: Method 2: Using Message Container raising and handling the exceptions using the interface reference as importing parameter.       lo_msg_container->add_message_text_only(         EXPORTING           iv_msg_type = 'E'           iv_msg_text = |Inspection Lot { iv_prueflos } is invalid| ).       RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception         EXPORTING           message_container = lo_msg_container.     ENDIF. Method 3: BUSINESS_ERROR Raising and