Google Search - Blog...........

Upload The Over Time Report In HR ABAP Using FM HR_MAINTAIN_MASTERDATA.

REPORT zhr_overtime_upload_report.

TYPES: BEGIN OF ty_prop_values.
INCLUDE STRUCTURE pprop.
TYPES: END OF ty_prop_values.

TYPES: BEGIN OF ty_mod_values.
INCLUDE STRUCTURE pskey.
TYPES: END OF ty_mod_values.

DATA: it_prop_values TYPE TABLE OF ty_prop_values WITH HEADER LINE,
it_mod_values TYPE TABLE OF ty_mod_values WITH HEADER LINE,
it_return TYPE bapireturn .

DATA: return LIKE bapireturn1.
DATA itab TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE.

TYPES: BEGIN OF ty_upload,
pernr TYPE char8,
begda TYPE char10,
lgart TYPE char4,
ANZHL TYPE char9,
END OF ty_upload.

DATA: it_upload TYPE TABLE OF ty_upload WITH HEADER LINE.


PARAMETERS: p_file TYPE rlgrap-filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
IMPORTING
file_name = p_file.


START-OF-SELECTION.


PERFORM get_data.

PERFORM upload_data.

*&---------------------------------------------------------------------*
*& Form UPLOAD_DATA
*----------------------------------------------------------------------*
FORM upload_data .

DATA: l_pernr TYPE pspar-pernr,
l_date type char10.

delete adjacent duplicates from it_upload comparing pernr .

LOOP AT it_upload.

* it_prop_values-infty = '2010'.
it_prop_values-fname = 'PA2010-SUBTY'.
it_prop_values-fval = '2010'.
APPEND it_prop_values.

it_prop_values-fname = 'PA2010-PERNR'.
it_prop_values-fval = it_upload-pernr.
APPEND it_prop_values.

REPLACE ALL OCCURRENCES OF '.' IN it_upload-begda WITH space.
condense : it_upload-begda.

it_prop_values-fname = 'PA2010-BEGDA'.
it_prop_values-fval = it_upload-begda.
APPEND it_prop_values.

it_prop_values-fname = 'PA2010-ENDDA'.
it_prop_values-fval = it_upload-begda.
APPEND it_prop_values.

it_prop_values-fname = 'PA2010-AEDTM'.
it_prop_values-fval = sy-datum.
APPEND it_prop_values.

it_prop_values-fname = 'PA2010-UNAME'.
it_prop_values-fval = sy-uname.
APPEND it_prop_values.

it_prop_values-fname = 'PA2010-ANZHL'.
it_prop_values-fval = it_upload-ANZHL.
APPEND it_prop_values.

it_prop_values-fname = 'PA2010-LGART'.
it_prop_values-fval = it_upload-lgart..
APPEND it_prop_values.

l_pernr = it_upload-pernr.

CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'
EXPORTING
pernr = l_pernr
actio = 'INS'
tclas = 'A'
begda = sy-datum
endda = '99991231'
dialog_mode = '0'
luw_mode = '1'
no_existence_check = 'X'
no_enqueue = ' '
IMPORTING
return = it_return
TABLES
proposed_values = it_prop_values
modified_keys = it_mod_values.

ENDLOOP.

ENDFORM. " UPLOAD_DATA
*&---------------------------------------------------------------------*
*& Form GET_DATA
*----------------------------------------------------------------------*
FORM get_data .


CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 10000
i_end_row = 65535
TABLES
intern = itab.

DELETE itab WHERE row = 1.



LOOP AT itab .

CASE: itab-col.

WHEN '0001'.
it_upload-pernr = itab-value.
WHEN '0002'.
it_upload-begda = itab-value.
WHEN '0003'.
it_upload-lgart = itab-value.
WHEN '0004'.
it_upload-ANZHL = itab-value.
ENDCASE.

AT END OF row.
APPEND it_upload.
ENDAT.

ENDLOOP.

ENDFORM. " GET_DATA


ALSO READ:

- Displaying Off-Cycle Report In HR ABAP.

- Loans Detail Report In HR ABAP.

- Gosi Calculation Report In HR ABAP.

- Employee Pay Details Report In HR ABAP.

- Employee Existence Check Report.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


No comments:

Post a Comment