data(lo_c) = zcl_jsocrypt=>factory( conv string( p_key ) ).
Tuesday, December 22, 2015
ABAP Zeichenketten Templates (String expressions)
WRITE / |Date (ISO) { lv_date DATE = ISO }|.
WRITE / |Integer { lv_i NUMBER = USER }|.
Monday, December 21, 2015
ORDKEY and ORDMAP on database again!
In very early releases of SAP APO the tables /SAPAPO/ORDKEY and /SAPAPO/ORDMAP were moved from database to liveCache.
From the perspective of an ABAP developer this step was undone in very new SAP releases on HANA.
In those Releases you can browse the contents of /SAPAPO/ORDKEY and /SAPAPO/ORDMAP again in SE16 - like in APO 2.0.
The following code works:
select * from /sapapo/ordkey
" connection (om_lc_name)
into table lt_ordkey where ordno = p_ordno and simid = '000'.
" connection (om_lc_name)
into table lt_ordkey where ordno = p_ordno and simid = '000'.
even without the connection to LCA.
Back to the roots with HANA
Tuesday, December 8, 2015
transactional events on commit work / on rollback work
report zjso_transaction_events.
class lcl_oo_transaction definition.
public section.
class-data mo_transaction type ref to if_os_transaction.
class-methods on_finished for event finished of if_os_transaction.
class-methods on_save_prepared for event save_prepared of if_os_transaction.
class-methods on_save_requested for event save_requested of if_os_transaction.
class-methods init_transaction.
endclass.
start-of-selection.
lcl_oo_transaction=>init_transaction( ).
write / 'commit work'.
commit work. " all three events are raised
uline.
commit work. " new transaction, no initialialzation, no handling
lcl_oo_transaction=>init_transaction( ).
write / 'rollback work'.
rollback work. " only event finished is raised
uline.
class lcl_oo_transaction implementation.
method on_finished.
write / 'on_finished'.
endmethod.
method on_save_prepared.
write / 'on_save_prepared'.
endmethod.
method on_save_requested.
write / 'on_save_requested'.
endmethod.
method init_transaction.
mo_transaction = cl_os_system=>get_transaction_manager( )->get_current_transaction( ).
set handler on_finished for mo_transaction.
set handler on_save_prepared for mo_transaction.
set handler on_save_requested for mo_transaction.
endmethod.
endclass.
class lcl_oo_transaction definition.
public section.
class-data mo_transaction type ref to if_os_transaction.
class-methods on_finished for event finished of if_os_transaction.
class-methods on_save_prepared for event save_prepared of if_os_transaction.
class-methods on_save_requested for event save_requested of if_os_transaction.
class-methods init_transaction.
endclass.
start-of-selection.
lcl_oo_transaction=>init_transaction( ).
write / 'commit work'.
commit work. " all three events are raised
uline.
commit work. " new transaction, no initialialzation, no handling
lcl_oo_transaction=>init_transaction( ).
write / 'rollback work'.
rollback work. " only event finished is raised
uline.
class lcl_oo_transaction implementation.
method on_finished.
write / 'on_finished'.
endmethod.
method on_save_prepared.
write / 'on_save_prepared'.
endmethod.
method on_save_requested.
write / 'on_save_requested'.
endmethod.
method init_transaction.
mo_transaction = cl_os_system=>get_transaction_manager( )->get_current_transaction( ).
set handler on_finished for mo_transaction.
set handler on_save_prepared for mo_transaction.
set handler on_save_requested for mo_transaction.
endmethod.
endclass.
SALV handle Exceptions
data lt_makt type standard table of makt.
data lo_salv type ref to cl_salv_table.
select * from makt into corresponding fields of table lt_makt
where matnr = iv_matnr.
try.
" setup SALV
cl_salv_table=>factory(
importing r_salv_table = lo_salv
changing t_table = lt_makt
).
" prepare SALV
lo_salv->get_functions( )->set_all( ). " activate toolbar
lo_salv->get_columns( )->get_column( 'MANDT' )->set_technical( ).
lo_salv->get_columns( )->get_column( 'SPRAS' )->set_output_length( 8 ).
lo_salv->get_columns( )->get_column( 'MAKTGX' )->set_visible( abap_false ).
lo_salv->get_sorts( )->add_sort( 'MATNR' ).
lo_salv->get_sorts( )->add_sort( 'SPRAS' ).
" Display SALV
lo_salv->display( ).
catch
cx_salv_msg
cx_salv_not_found
cx_salv_data_error
cx_salv_existing into data(lo_x).
message lo_x type 'E'.
endtry.
data lo_salv type ref to cl_salv_table.
select * from makt into corresponding fields of table lt_makt
where matnr = iv_matnr.
try.
" setup SALV
cl_salv_table=>factory(
importing r_salv_table = lo_salv
changing t_table = lt_makt
).
" prepare SALV
lo_salv->get_functions( )->set_all( ). " activate toolbar
lo_salv->get_columns( )->get_column( 'MANDT' )->set_technical( ).
lo_salv->get_columns( )->get_column( 'SPRAS' )->set_output_length( 8 ).
lo_salv->get_columns( )->get_column( 'MAKTGX' )->set_visible( abap_false ).
lo_salv->get_sorts( )->add_sort( 'MATNR' ).
lo_salv->get_sorts( )->add_sort( 'SPRAS' ).
" Display SALV
lo_salv->display( ).
catch
cx_salv_msg
cx_salv_not_found
cx_salv_data_error
cx_salv_existing into data(lo_x).
message lo_x type 'E'.
endtry.
Friday, December 4, 2015
SALV with toolbar
data lo_salv type ref to cl_salv_table.
try.
cl_salv_table=>factory(
importing r_salv_table = lo_salv
changing t_table = [...]
).
lo_salv->get_functions( )->set_all( ). " activate toolbar
lo_salv->get_columns( )->set_optimize( 'X' ).
lo_salv->get_columns( )->get_column( columnname = 'MANDT' )->set_technical( ).
lo_salv->display( ).
catch cx_salv_msg.
write / 'SALV kann nicht dargestellt werden'(002).
catch cx_salv_not_found.
write / 'SALV kann nicht dargestellt werden'(002).
endtry.
Subscribe to:
Posts (Atom)
SAP ABAP: Determine Timezone for Plant
DATA: lt_tzone TYPE STANDARD TABLE OF tznzone WITH DEFAULT KEY, l_tzone TYPE tznzone. " get time zone for plant ...
-
Sometimes the backend doesn't return the selected rows of an SALV. For my case get_metadata( ) was the solution: go_salv-> get_met...
-
GUIDs or UUIDs can be created with the class cl_system_uuid . try . data (lv_uuid) = cl_system_uuid => if_system_uuid_static...
-
AA PR-AUF(E) Prozessauftrag (eröffnet) AB PR-AUF(F) Prozessauftrag (freigegeben) AC FE...