Somehow I always forget the syntax for this….
TYPES: BEGIN OF ty_test.
INCLUDE TYPE z_table.
TYPES: my_new_field TYPE string,
END OF ty_test.
Somehow I always forget the syntax for this….
TYPES: BEGIN OF ty_test.
INCLUDE TYPE z_table.
TYPES: my_new_field TYPE string,
END OF ty_test.
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.
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
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 ) ).
" Check if class exists and is activated
IF cl_esh_ca_check=>is_active_class( 'ZCL_MYCLASS' ) = abap_true.
WRITE: 'Class exists'.
ENDIF.
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 ).
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.
REPORT ztest.
TABLES pa0002.
*-----------------------------------------------------------------------
* Selection screen
*-----------------------------------------------------------------------
PARAMETERS: p_radio1 RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND rad. "set s_pernr visible
PARAMETERS: p_radio2 RADIOBUTTON GROUP rad1. "set s_pernr invisible
SELECT-OPTIONS : s_pernr FOR pa0002-pernr MODIF ID 100.
*----------------------------------------------------------------------
* AT SELECTION-SCREEN
*----------------------------------------------------------------------
AT SELECTION-SCREEN OUTPUT. " PBO
LOOP AT SCREEN.
CASE screen-group1.
WHEN '100'.
screen-invisible = COND #( WHEN p_radio1 = abap_true THEN 0 ELSE 1 ).
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
METHOD get_entitykey_from_uri.
" Pattern: Entity\((.*)\),
DATA(pattern) = iv_entity && `\((.*)\)`.
TRY.
DATA(matcher) = cl_abap_matcher=>create( pattern = pattern
text = iv_uri
ignore_case = abap_true ).
CATCH cx_sy_invalid_regex.
ENDTRY.
TRY.
DATA(lt_matches) = matcher->find_all( ).
ASSIGN lt_matches[ 1 ] TO FIELD-SYMBOL(<s>).
rv_entity_key = substring( val = iv_uri off = <s>-offset len = <s>-length ).
CATCH cx_sy_no_current_match.
ENDTRY.
ENDMETHOD.
PARAMETER p_list TYPE c AS LISTBOX VISIBLE LENGTH 32. "Add OBLIGATORY to get rid of the empty line. Use DEFAULT to set the inital selection.
INITIALIZATION.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_LIST'
values = VALUE vrm_values( ( key = '1' text = 'Case 1' )
( key = '2' text = 'Case 2' )
( key = '3' text = 'Case 3' ) )
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
AT SELECTION-SCREEN ON p_list.
DATA(dynprofields) = VALUE dynpread_tabtype( ( fieldname = 'P_LIST' ) ).
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
translate_to_upper = 'X'
TABLES
dynpfields = dynprofields. "find your selected value in column fieldvalue or directly in p_list