DATA(lo_structdescr) = CAST cl_abap_structdescr( cl_abap_structdescr=>describe_by_data( p_data = <dynamic_structure> ) ).
DATA(components) = lo_structdescr->get_components( ).
IF line_exists( components[ name = 'FIELD1' ] ).
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <dynamic_structure> TO FIELD-SYMBOL(<field1>).
"do stuff...
ENDIF.
Category: SAP
SAP
[SAP] Namensraum öffnen für Änderungen
Namensraum anlegen
Tcode: SE03
Editierbarkeit von Objekten eines Namensraumes zulassen
Tcode: SE03
Ggf. muss in der SE80 noch der Modifikationsassistant ausgeschaltet werden.
SE80 -> Bearbeitten -> Modifikationsoperationen -> Assistant ausschalten
[SAPUI5] Toogle Dark mode from Shell Header
There are several different types of buttons you can add to the Shell Header: https://sapui5.hana.ondemand.com/sdk/#/api/sap.ushell.renderers.fiori2.Renderer%23methods/Summary
For my test I choose the “addHeaderEndItem” Button. Add the fowlloing logic in the Component.js file to create the button and the logic for switching the theme:
_addHeaderButton: function () {
const oRenderer = sap.ushell.Container.getRenderer("fiori2");
oRenderer.addHeaderEndItem("sap.ushell.ui.shell.ShellHeadItem", {
id: "toogleTheme",
icon: "sap-icon://circle-task-2",
visible: "{device>/orientation/landscape}",
tooltip: "Switch Theme",
press: (oEvent) => {
const toogleButton = oEvent.getSource();
if (toogleButton.getIcon() === "sap-icon://circle-task-2") {
sap.ui.getCore().applyTheme("sap_fiori_3_dark");
toogleButton.setIcon("sap-icon://circle-task");
} else {
sap.ui.getCore().applyTheme("sap_fiori_3");
toogleButton.setIcon("sap-icon://circle-task-2");
}
}
}, true);
},
Afterwars you need call the method in the init() function of the component. No reload the app and you will find the new button in the top right corner. Pressing will switch the theme to dark or back to light theme.
[CAP] Add SQLite DB for development
# install SQLite
npm i sqlite3 -D
# create db, save configuration in package.json, stores mock data into db
cds deploy --to sqlite:db/my-app.db
# test cds deploy command with --dry. Displays ever table and view it creates
cds deploy --to sqlite:db/my-app.db --dry
# get and overview of your tables with .tables
sqlite3 db/my-app.db .tables
# open and view newly created db
sqlite3 db/my-app.db -cmd .dump
# and select single field with
SELECT field FROM mytable WHERE mykeyfield= "00505601194D1EE9B7BFC518B85";
# update a field with
UPDATE mytable SET field = "test" WHERE mykeyfield= "00505601194D1EE9B7BFC518B85";
[SAP] Archive
OAC0 – Content Repository pflege (extern oder lokale DB, dafür die Tabelle SDOKCONT1 als Vorlage nehmen)
OAC2 – Dokumentenarten
OAC3 – Verknüpfung der Dokumentenart zum Content Repository. Zuordnung Objektyp.
[ABAP] Provide values of a domain in a dropdown list on selection screen
PARAMETER p_test TYPE c OBLIGATORY AS LISTBOX VISIBLE LENGTH 32 DEFAULT 1.
INITIALIZATION.
cl_reca_ddic_doma=>get_values( EXPORTING id_name = 'Z_MYDOMAIN'
IMPORTING et_values = DATA(lt_rsdomaval) ).
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_TEST'
values = VALUE vrm_values( FOR dvalue IN lt_rsdomaval ( key = dvalue-domvalue_l
text = dvalue-ddtext ) ).
[ABAP] Check if class exists and is activated
" Check if class exists and is activated
IF cl_esh_ca_check=>is_active_class( 'ZCL_MYCLASS' ) = abap_true.
WRITE: 'Class exists'.
ENDIF.
[ABAP] Find fullname for sy-uname
Via Infotype
TRY.
DATA(lo_employee_api) = cl_hcmfab_employee_api=>get_instance( ).
DATA(lv_pernr) = lo_employee_api->get_employeenumber_from_user( sy-uname ).
DATA(lv_ename) = lo_employee_api->get_name( lv_pernr ).
CATCH cx_hcmfab_common.
ENDTRY.
or via SU01
DATA(lv_ename) = NEW cl_hreic_appl_utilities( )->get_user_name( sy-uname ).
[ABAP] Read personnel area with text
DATA p0001 TYPE p0001.
cl_hcmfab_utilities=>read_infotype_record( EXPORTING iv_pernr = pernr
iv_infty = '0001'
IMPORTING es_pnnnn = p0001 ).
DATA(personnel_area_id) = p0001-werks.
DATA(personnel_area_text) = cl_hr_t500p=>read( p0001-werks )-name1.
Or using the class CL_HCMFAB_EMPLOYEE_API.
DATA(lv_employee_details) = cl_hcmfab_employee_api=>get_instance( )->get_employee_details( iv_pernr = pernr
iv_application_id = if_hcmfab_constants=>gc_application_id-mypersonaldata ).
DATA(personnel_area_id) = lv_employee_details-personnel_area_id.
DATA(personnel_area_text) = lv_employee_details-personnel_area_text.