Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Steven Meyer <108885656+meyertst-aws@users.noreply.github.com>
  • Loading branch information
Laren-AWS and meyertst-aws authored Oct 4, 2023
1 parent cc7f747 commit c348a7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions sap-abap/services/dyn/zcl_aws1_dyn_actions.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ CLASS ZCL_AWS1_DYN_ACTIONS IMPLEMENTATION.
iv_max_wait_time = 200
iv_tablename = iv_table_name ).
MESSAGE 'DynamoDB Table' && iv_table_name && 'created.' TYPE 'I'.
" This exception can happen if the table already exists
" This exception can happen if the table already exists.
CATCH /aws1/cx_dynresourceinuseex INTO DATA(lo_resourceinuseex).
DATA(lv_error) = |"{ lo_resourceinuseex->av_err_code }" - { lo_resourceinuseex->av_err_msg }|.
MESSAGE lv_error TYPE 'E'.
Expand Down Expand Up @@ -218,7 +218,7 @@ CLASS ZCL_AWS1_DYN_ACTIONS IMPLEMENTATION.
" snippet-start:[dyn.abapv1.list_tables]
TRY.
oo_result = lo_dyn->listtables( ).
" You can loop over the oo_result to get table properties like this
" You can loop over the oo_result to get table properties like this.
LOOP AT oo_result->get_tablenames( ) INTO DATA(lo_table_name).
DATA(lv_tablename) = lo_table_name->get_value( ).
ENDLOOP.
Expand Down Expand Up @@ -280,7 +280,7 @@ CLASS ZCL_AWS1_DYN_ACTIONS IMPLEMENTATION.
iv_tablename = iv_table_name
it_keyconditions = lt_key_conditions ).
DATA(lt_items) = oo_result->get_items( ).
"You can loop over the results to get item attributes
"You can loop over the results to get item attributes.
LOOP AT lt_items INTO DATA(lt_item).
DATA(lo_title) = lt_item[ key = 'title' ]-value.
DATA(lo_year) = lt_item[ key = 'year' ]-value.
Expand Down
14 changes: 7 additions & 7 deletions sap-abap/services/dyn/zcl_aws1_dyn_scenario.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CLASS ZCL_AWS1_DYN_SCENARIO IMPLEMENTATION.
CONSTANTS cv_pfl TYPE /aws1/rt_profile_id VALUE 'ZCODE_DEMO'.

" snippet-start:[dyn.abapv1.getting_started_with_tables]
" Create an Amazon Dynamo DB table
" Create an Amazon Dynamo DB table.

TRY.
DATA(lo_session) = /aws1/cl_rt_session_aws=>create( cv_pfl ).
Expand Down Expand Up @@ -72,7 +72,7 @@ CLASS ZCL_AWS1_DYN_SCENARIO IMPLEMENTATION.
MESSAGE 'The table does not exist' TYPE 'E'.
ENDTRY.

" Put items into the table
" Put items into the table.
TRY.
DATA(lo_resp_putitem) = lo_dyn->putitem(
iv_tablename = iv_table_name
Expand Down Expand Up @@ -114,7 +114,7 @@ CLASS ZCL_AWS1_DYN_SCENARIO IMPLEMENTATION.
MESSAGE 'Another transaction is using the item' TYPE 'E'.
ENDTRY.

" Get item from table
" Get item from table.
TRY.
DATA(lo_resp_getitem) = lo_dyn->getitem(
iv_tablename = iv_table_name
Expand All @@ -135,7 +135,7 @@ CLASS ZCL_AWS1_DYN_SCENARIO IMPLEMENTATION.
MESSAGE 'The table or index does not exist' TYPE 'E'.
ENDTRY.

" Query item from table
" Query item from table.
TRY.
DATA(lt_attributelist) = VALUE /aws1/cl_dynattributevalue=>tt_attributevaluelist(
( NEW /aws1/cl_dynattributevalue( iv_n = '1975' ) ) ).
Expand All @@ -161,7 +161,7 @@ CLASS ZCL_AWS1_DYN_SCENARIO IMPLEMENTATION.
MESSAGE 'The table or index does not exist' TYPE 'E'.
ENDTRY.

" Scan items from table
" Scan items from table.
TRY.
DATA(lo_scan_result) = lo_dyn->scan( iv_tablename = iv_table_name ).
lt_items = lo_scan_result->get_items( ).
Expand All @@ -177,7 +177,7 @@ CLASS ZCL_AWS1_DYN_SCENARIO IMPLEMENTATION.
MESSAGE 'The table or index does not exist' TYPE 'E'.
ENDTRY.

" Update items from table
" Update items from table.
TRY.
DATA(lt_attributeupdates) = VALUE /aws1/cl_dynattrvalueupdate=>tt_attributeupdates(
( VALUE /aws1/cl_dynattrvalueupdate=>ts_attributeupdates_maprow(
Expand All @@ -202,7 +202,7 @@ CLASS ZCL_AWS1_DYN_SCENARIO IMPLEMENTATION.
MESSAGE 'Another transaction is using the item' TYPE 'E'.
ENDTRY.

" Delete table
" Delete table.
TRY.
lo_dyn->deletetable( iv_tablename = iv_table_name ).
lo_dyn->get_waiter( )->tablenotexists(
Expand Down

0 comments on commit c348a7c

Please sign in to comment.