Skip to content

feat: Calculate virtual elements for CDS view selection #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: catch calculation errors and propagate custom exception
  • Loading branch information
stockbal committed May 1, 2021
commit d24627d250d4c45d45c00351e7c6726243741bff
76 changes: 76 additions & 0 deletions src/cross/zdbbr_exception.msag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,83 @@
<MSGNR>071</MSGNR>
<TEXT>Navigation not possible without parameters</TEXT>
</T100>
<T100>
<SPRSL>E</SPRSL>
<ARBGB>ZDBBR_EXCEPTION</ARBGB>
<MSGNR>072</MSGNR>
<TEXT>Unexpected Error in Virtual Element Handler</TEXT>
</T100>
</T100>
<LONGTEXTS>
<item>
<DOKIL>
<ID>NA</ID>
<OBJECT>ZDBBR_EXCEPTION072</OBJECT>
<LANGU>E</LANGU>
<TYP>E</TYP>
<VERSION>0001</VERSION>
<MASTERLANG>X</MASTERLANG>
<TXTLINES>00007</TXTLINES>
</DOKIL>
<HEAD>
<TDOBJECT>DOKU</TDOBJECT>
<TDNAME>ZDBBR_EXCEPTION072</TDNAME>
<TDID>NA</TDID>
<TDSPRAS>E</TDSPRAS>
<TDFORM>S_DOCU_SHOW</TDFORM>
<TDSTYLE>S_DOCUS1</TDSTYLE>
<TDVERSION>00001</TDVERSION>
<TDLINESIZE>072</TDLINESIZE>
</HEAD>
<LINES>
<TLINE>
<TDFORMAT>U1</TDFORMAT>
<TDLINE>&amp;CAUSE&amp;</TDLINE>
</TLINE>
<TLINE>
<TDFORMAT>AS</TDFORMAT>
<TDLINE>This error occured because there was an unexpected problem in the</TDLINE>
</TLINE>
<TLINE>
<TDLINE>calculation of the virtual elements in the CDS View &amp;V1&amp;.</TDLINE>
</TLINE>
<TLINE>
<TDFORMAT>U1</TDFORMAT>
<TDLINE>&amp;SYSTEM_RESPONSE&amp;</TDLINE>
</TLINE>
<TLINE>
<TDFORMAT>U1</TDFORMAT>
<TDLINE>&amp;WHAT_TO_DO&amp;</TDLINE>
</TLINE>
<TLINE>
<TDFORMAT>B1</TDFORMAT>
<TDLINE>Check the exit classes defined in CDS View &amp;V1&amp;</TDLINE>
</TLINE>
<TLINE>
<TDFORMAT>B1</TDFORMAT>
<TDLINE>Uncheck the setting &lt;ZK&gt;Calculate Virtual Elements&lt;/&gt; in the settings of</TDLINE>
</TLINE>
<TLINE>
<TDLINE>DB Browser</TDLINE>
</TLINE>
<TLINE>
<TDFORMAT>B1</TDFORMAT>
<TDLINE>Check the setting &lt;ZK&gt;Ignore errors during Virtual Element calculation</TDLINE>
</TLINE>
<TLINE>
<TDFORMAT>=</TDFORMAT>
<TDLINE>&lt;/&gt; in the settings of DB Browser</TDLINE>
</TLINE>
<TLINE>
<TDFORMAT>U1</TDFORMAT>
<TDLINE>&amp;SYS_ADMIN&amp;</TDLINE>
</TLINE>
<TLINE>
<TDFORMAT>AS</TDFORMAT>
</TLINE>
</LINES>
</item>
</LONGTEXTS>
</asx:values>
</asx:abap>
</abapGit>
4 changes: 3 additions & 1 deletion src/ui/util/zcl_dbbr_cds_selection_util.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ CLASS zcl_dbbr_cds_selection_util DEFINITION
VALUE(ro_virtual_elem_handler) TYPE REF TO zcl_dbbr_virtual_elem_handler.

"! <p class="shorttext synchronized" lang="en">Mark fields that are needed for virtual element calculation</p>
METHODS mark_virtual_elem_requested.
METHODS mark_virtual_elem_requested
RAISING
zcx_dbbr_application_exc.
"! <p class="shorttext synchronized" lang="en">Event handler for when association gets chosen</p>
"! @parameter EV_CHOSEN_ENTITY_ID | <p class="shorttext synchronized" lang="en"></p>
"! @parameter EV_CHOSEN_ENTITY_TYPE | <p class="shorttext synchronized" lang="en"></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ CLASS lcl_sadl_exit_handler DEFINITION.
iv_entity_name TYPE zsat_cds_view_name,
adjust_requested
CHANGING
ct_requested_element TYPE stringtab,
ct_requested_element TYPE stringtab
RAISING
zcx_dbbr_application_exc,
calculate_elements
CHANGING
ct_data TYPE REF TO data
Expand All @@ -111,5 +113,5 @@ CLASS lcl_sadl_exit_handler DEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
DATA mo_sadl_exit_handler TYPE REF TO object.

DATA mv_entity_name TYPE zsat_cds_view_name.
ENDCLASS.
16 changes: 9 additions & 7 deletions src/ui/util/zcl_dbbr_virtual_elem_handler.clas.locals_imp.abap
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ENDCLASS.
CLASS lcl_sadl_exit_handler IMPLEMENTATION.

METHOD constructor.

mv_entity_name = iv_entity_name.
TRY.
DATA(lo_sadl_mdp_factory) = NEW lcl_sadl_mdp_factory( iv_entity_name ).

Expand Down Expand Up @@ -142,12 +142,11 @@ CLASS lcl_sadl_exit_handler IMPLEMENTATION.
CHANGING
ct_data_rows = <lt_data>.
CATCH cx_sy_ref_is_initial
cx_sy_dyn_call_error.
cx_sy_dyn_call_error ##needed.
" no SADL classes available
CATCH BEFORE UNWIND cx_root INTO DATA(lx_sadl_error) . "SADL exception raised
RAISE EXCEPTION TYPE zcx_dbbr_application_exc
EXPORTING
previous = lx_sadl_error.
CATCH cx_root INTO DATA(lx_sadl_error) . "SADL exception raised
MESSAGE e072(zdbbr_exception) WITH mv_entity_name INTO DATA(lv_err_msg) ##needed.
RAISE EXCEPTION TYPE zcx_dbbr_application_exc.
ENDTRY.

ENDMETHOD.
Expand All @@ -158,8 +157,11 @@ CLASS lcl_sadl_exit_handler IMPLEMENTATION.
CHANGING
ct_requested_element = ct_requested_element.
CATCH cx_sy_ref_is_initial
cx_sy_dyn_call_error.
cx_sy_dyn_call_error ##needed.
" no SADL classes available
CATCH cx_root INTO DATA(lx_sadl_error) . "SADL exception raised
MESSAGE e072(zdbbr_exception) WITH mv_entity_name INTO DATA(lv_err_msg) ##needed.
RAISE EXCEPTION TYPE zcx_dbbr_application_exc.
ENDTRY.
ENDMETHOD.

Expand Down