Some things are just so essential that there must be hundreds of people fighting the same or similar problem at the same time. If all these went to SDN and tell the other about their findings and “lessons learnt”, world would be much brighter and people would be happier and less overworked. One of these things are HR Qualifications.
Well, maybe they`re not THAT essential as I think, but I have been fighting them often over the years. That`s why I decided to write this blog. To create some knowledge available for everybody so the effort that is wasted because everybody has to reinvent his or her wheel. I also mentioned that several times before but let me say it once again: I use SDN blogs to persist my own knowledge, which I cannot exercise every week or every month and have to reinvent some parts of the wheel over time too.
Side note: if you`re interested in this article, you might be interested in another one about HR-PD on Apraisal BADIs too. Check it here: Challenge yourself (HR-PD Appraisal BADIs).
In OOQA menu: View > Additional data on (CTRL+F6) displays the scale ID and scale description text next to every qualification group in the catalog.
My program below is not the only option. That would be funny, wouldn’t it.
One might use other ways like LSMW or the transactions OODT/ OOMV. But sometimes you don`t have the necessary skills to use the tools or there are others reasons not to use them.
The program expects two input files: first one for qualifications or qualification groups (depends on the PARAMETER on the selection screen), the second one for scale texts, if you want to override the existing (so DO NOT want the inheritance).
Format of the file one:
Format of the file two:
Note: second file can be empty, then no texts are changed and objects are created with INHERITED = 'X', since there is nothing to use for replacement.
I hope this will give the newcomers a rough idea about the topic and the coding can cut your own effort into half, hopefully even less. Share your hints and knowledge on “basic problems” too, remember that 99% of the customer will not use HANA or mobile in the next year, but they`re using ERP for years. So that`s the scalable way of helping people. If you help one to cope with the “typical problem” and that problem is typical for hundreds of people, than the benefit is some hundreds multiplied by an hour… wow, that would make me happy. Cheers Otto
REPORT zquali_tree.
PARAMETERS: p_plvar TYPE plvar DEFAULT '01'.
PARAMETERS: p_qk RADIOBUTTON GROUP rad1, "upload q. groups
p_q RADIOBUTTON GROUP rad1 DEFAULT 'X'. "qualifications
TYPES: BEGIN OF tt_class,
stext TYPE hrp1000-stext,
short TYPE hrp1000-short,
vobjid TYPE hrp1000-objid,
scale_id TYPE t77sk-scale_id,
values TYPE hap_t_pt1048,
END OF tt_class.
DATA lt_classes TYPE TABLE OF tt_class.
TYPES: BEGIN OF tt_rating,
stext TYPE hrp1000-stext,
rating TYPE rating,
tline TYPE hrline79,
END OF tt_rating.
DATA lt_ratings TYPE TABLE OF tt_rating.
TYPE-POOLS: truxs.
*************************************************************
*************************************************************
DATA lt_filetable TYPE filetable.
DATA ls_file LIKE LINE OF lt_filetable.
DATA lt_raw_data TYPE truxs_t_text_data.
DATA lv_file TYPE rlgrap-filename.
DATA lv_rc TYPE i.
DEFINE upload_file.
clear: lt_filetable[], lv_rc, lv_file.
call method cl_gui_frontend_services=>file_open_dialog
changing
file_table = lt_filetable
rc = lv_rc
exceptions
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
read table lt_filetable into ls_file index 1.
if sy-subrc ne 0.
message 'Cancelled by the user' type 'S'.
exit.
endif.
lv_file = ls_file-filename.
call function 'TEXT_CONVERT_XLS_TO_SAP'
exporting
i_tab_raw_data = lt_raw_data
i_filename = lv_file
tables
i_tab_converted_data = &1
exceptions
conversion_failed = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
END-OF-DEFINITION.
*************************************************************
*************************************************************
upload_file lt_classes.
upload_file lt_ratings.
*************************************************************
*************************************************************
DATA lv_error TYPE c.
FIELD-SYMBOLS <fs_stup> LIKE LINE OF lt_ratings.
FIELD-SYMBOLS <fs_cls> LIKE LINE OF lt_classes.
LOOP AT lt_ratings ASSIGNING <fs_stup>.
READ TABLE lt_classes ASSIGNING <fs_cls> WITH KEY stext = <fs_stup>-stext.
IF sy-subrc NE 0.
lv_error = 'X'.
RETURN.
ELSE.
*** we can put the information into the VALUES tab
DATA ls_line LIKE LINE OF <fs_cls>-values.
ls_line-tline = <fs_stup>-tline.
ls_line-rating = <fs_stup>-rating.
APPEND ls_line TO <fs_cls>-values.
ENDIF.
ENDLOOP.
IF lv_error EQ 'X'.
MESSAGE 'Error in input data, correct it and try again' TYPE 'I'.
EXIT.
ENDIF.
*************************************************************
*************************************************************
DATA lv_objid TYPE hrp1000-objid.
FIELD-SYMBOLS <fs_class> LIKE LINE OF lt_classes.
LOOP AT lt_classes ASSIGNING <fs_class>.
IF p_qk IS NOT INITIAL.
DATA lv_inherited TYPE char1.
*** if there are texts in the input file, use them to override
*** the existing ones, so do not use the inheritance
IF <fs_class>-values[] IS INITIAL.
lv_inherited = 'X'.
ELSE.
lv_inherited = ''.
ENDIF.
CALL FUNCTION 'RHPE_Q_CLASS_CREATE'
EXPORTING
plvar = p_plvar
short = <fs_class>-short
stext = <fs_class>-stext
vobjid = <fs_class>-vobjid
scale_id = <fs_class>-scale_id
inherited_1048 = lv_inherited
IMPORTING
objid = lv_objid
TABLES
descr_pt1048 = <fs_class>-values
EXCEPTIONS
no_authorization = 1
error_during_insert = 2
begda_greater_endda = 3
wrong_destination = 4
wrong_date_format = 5
scale_required = 6
description_required = 7
time_not_valid = 8
error_ext_number = 9
undefined = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE: / 'QK ', <fs_class>-stext, ' created ', lv_objid.
ENDIF.
ELSE.
IF <fs_class>-values[] IS INITIAL.
lv_inherited = 'X'.
ELSE.
lv_inherited = ''.
ENDIF.
CALL FUNCTION 'RHPE_QUALI_CREATE'
EXPORTING
plvar = '01'
short = <fs_class>-short
stext = <fs_class>-stext
votype = 'QK'
vobjid = <fs_class>-vobjid
nyears = 0
nmonths = 0
inherited_1048 = lv_inherited
IMPORTING
objid = lv_objid
TABLES
descr_pt1048 = <fs_class>-values
EXCEPTIONS
no_authorization = 1
error_during_insert = 2
begda_greater_endda = 3
object_not_found = 4
wrong_otype = 5
wrong_destination = 6
wrong_date_format = 7
scale_required = 8
description_required = 9
time_not_valid = 10
error_ext_number = 11
undefined = 12
OTHERS = 13.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE: / 'Q ', <fs_class>-stext, ' created ', lv_objid.
ENDIF.
ENDIF.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
5 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 |