DATA(l_full_time) = NEW cl_im_hrpbsusad01( )->if_ex_hrpbsusad01~check_employee_full_time( pernr = l_pernr begda = l_begda endda = l_endda ).
Category: Classes
[ABAP] Read cost center description
DATA(kostl_text) = NEW cl_hrpa_ui_convert_0859( )->get_txt_costcenter( iv_kokrs = lv_kokrs iv_kostl = lv_kostl iv_date = sy-datum ). # Class is using FUBA 'HRCA_COSTCENTER_GETDETAIL'
[ABAP] Download internal table as TXT or CSV
DATA: l_output_line TYPE ty_output, l_output_lines TYPE tt_output, l_csv_output TYPE truxs_t_text_data, l_txt_output TYPE TABLE OF string, PARAMETERS: p_alv RADIOBUTTON GROUP rb1 DEFAULT 'X' USER-COMMAND radio, p_csv RADIOBUTTON GROUP rb1, p_flcsv TYPE rlgrap-filename DEFAULT 'c:\temp\file.csv', p_txt RADIOBUTTON GROUP rb1, p_fltxt TYPE rlgrap-filename DEFAULT 'c:\temp\file.txt'. " fill table l_output_lines IF p_csv = abap_true. CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT' TABLES i_tab_sap_data = l_output_lines CHANGING i_tab_converted_data = l_csv_output. TRY. cl_gui_frontend_services=>gui_download( EXPORTING filename = CONV #( p_flcsv ) filetype = 'ASC' CHANGING data_tab = l_csv_output ). " Übergabetabelle CATCH cx_root INTO DATA(e_text). MESSAGE e_text->get_text( ) TYPE 'I'. ENDTRY. ELSEIF p_txt = abap_true. LOOP AT l_output_lines INTO l_output_line. CALL FUNCTION 'SO_STRUCT_TO_CHAR' EXPORTING ip_struct = l_output_line IMPORTING ep_string = l_string. APPEND l_string TO l_txt_output. ENDLOOP. TRY. cl_gui_frontend_services=>gui_download( EXPORTING filename = CONV #( p_fltxt ) filetype = 'ASC' CHANGING data_tab = l_txt_output ). " Übergabetabelle CATCH cx_root INTO e_text. MESSAGE e_text->get_text( ) TYPE 'I'. ENDTRY. ENDIF.
[ABAP] Read smartform textmodule
Oldschool:
DATA(ls_languages) = VALUE ssfrlang( langu1 = sy-langu ). DATA(lt_text_stream) = VALUE soli_tab( ). CALL FUNCTION 'SSFRT_READ_TEXTMODULE' EXPORTING i_textmodule = 'Z_SMARTFORM_TEXT' i_languages = ls_languages IMPORTING o_text = lt_text EXCEPTIONS error = 1 language_not_found = 2 OTHERS = 3. IF lt_text IS NOT INITIAL. CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT' EXPORTING language = sy-langu TABLES itf_text = lt_text text_stream = lt_object_content. ENDIF.
Newschool:
TRY. DATA(lr_form) = NEW cl_ssf_fb_smart_form( ). lr_form->load( im_formname = 'ZECOS_GM_ERROR' ). DATA(ls_varheader) = lr_form->varheader[ 1 ]. DATA(lr_node) = CAST cl_ssf_fb_node( ls_varheader-pagetree ). DATA(lr_text) = CAST cl_ssf_fb_text_item( lr_node->obj ). LOOP AT lr_text->text INTO DATA(ls_text). WRITE:/ ls_text-tdline. ENDLOOP. CATCH cx_ssf_fb. CATCH cx_sy_itab_line_not_found. ENDTRY.
[ABAP] Access leave request attributes
cl_pt_req_badi=>get_request( EXPORTING im_req_id = request_id IMPORTING ex_request = DATA(request) ). request->get_all_attribs( IMPORTING ex_attribs_struc = DATA(req_attribs) ). DATA(req_begda) = req_attribs-version-item_tab[ 10 ]-value.
Take a look in the item_tab to see the specific request values.

[ABAP] User <-> Employeenumber
Class:
CL_HCMFAB_EMPLOYEE_API
Methods:
GET_USERID_FROM_EMPLOYEENUMBER
GET_EMPLOYEENUMBER_FROM_USER

How to use the class:
TRY. DATA(lv_pernr) = cl_hcmfab_employee_api=>get_instance( )->get_employeenumber_from_user( sy-uname ) ) CATCH cx_hcmfab_common. ENDTRY.
[ABAP] Find employee subtitutes
cl_swl_substitution=>get_pers_substitutes( EXPORTING i_substituted_person = ls_substituted_person i_start_date = sy-datum i_end_date = sy-datum IMPORTING et_substitutes = DATA(lt_substitutes) EXCEPTIONS user_not_found = 1 " Benutzer existiert nicht plan_variant_not_found = 2 " Planvariante ist nicht gepflegt time_period_not_valid = 3 " Zeitraum ungültig no_personal_substitution = 4 " Es handelt sich um keine persönliche Vertretung OTHERS = 5 ).
[ABAP] commercial rounding
ls_pr00-kbetr = ROUND( val = ls_pr00-kbetr dec = 2 mode = cl_abap_math=>round_half_up ).
[ABAP] BAPI_PR_CREATE – extensionin
METHOD fill_extension_struc RETURNING value(rt_extin) TYPE bapiparex_t. APPEND INITIAL LINE TO rt_extin ASSIGNING FIELD-SYMBOL(<ls_extin>). <ls_extin>-structure = 'BAPI_TE_MEREQITEM'. CALL METHOD cl_abap_container_utilities=>fill_container_c EXPORTING im_value = is_bapi_te_mereqitem IMPORTING ex_container = <ls_extin>+30 EXCEPTIONS illegal_parameter_type = 1 OTHERS = 2. IF sy-subrc <> 0. CLEAR <ls_extin>. ENDIF. APPEND INITIAL LINE TO rt_extin ASSIGNING FIELD-SYMBOL(<ls_extinx>). <ls_extin>-structure = 'BAPI_TE_MEREQITEMX'. CALL METHOD cl_abap_container_utilities=>fill_container_c EXPORTING im_value = is_bapi_te_mereqitemx IMPORTING ex_container = <ls_extinx>+30 EXCEPTIONS illegal_parameter_type = 1 OTHERS = 2. IF sy-subrc <> 0. CLEAR <ls_extin>. ENDIF. ENDMETHOD.