Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Features in ABAP HR

Former Member
0 Likes
825

Hi,

I would like to know what are the features in ABAP HR and how to use them in the program.

I have a custom feature YEMPG and have to use it in my program for some validation on employee type.

Sample code would be appretiated.

reagrds,

Hi,

I would like to know what are the features in ABAP HR and how to use them in the program.

I have a custom feature YEMPG and have to use it in my program for some validation on employee type.

Sample code would be appretiated.

reagrds,

2 REPLIES 2
Read only

Former Member
0 Likes
688

*.......................................................................

*: Report: ZDOWNEMPDATA :

*: :

*: Author: www.SAPDev.co.uk :

*: :

*: Date : 2004 :

*: :

*: Description: Downloads employee data to TAB delimited flat files :

*: :

*:.....................................................................:

*.......................................................................

*: Report: ZDOWNEMPDATA :

*: :

*: Author: www.SAPDev.co.uk :

*: :

*: Date : 2004 :

*: :

*: Description: Downloads employee data to TAB delimited flat files :

*: :

*:.....................................................................:

REPORT zdownempdata .

INFOTYPES: 0000, 0001, 0007, 0008, 0121, 0615.

NODES: pernr.

TABLES: t001p.

TYPES: BEGIN OF t_employee,

  • INCLUDE STRUCTURE hrms_biw_io_occupancy.

begda TYPE begda,

endda TYPE endda,

pernr TYPE pernr_d,

rfpnr TYPE rfpnr,

bukrs TYPE bukrs,

werks TYPE persa,

btrtl TYPE btrtl,

persg TYPE persg,

persk TYPE persk,

orgeh TYPE orgeh,

stell TYPE stell,

plans TYPE plans,

kokrs TYPE mast_coar,

kostl TYPE mast_cctr,

abkrs TYPE abkrs,

molga TYPE molga,

trfar TYPE trfar,

trfgb TYPE trfgb,

trfkz TYPE trfkz,

trfgr TYPE trfgr,

trfst TYPE trfst,

bsgrd TYPE bsgrd,

ansal TYPE ansal_15,

ancur TYPE ancur,

empct TYPE empct,

stat2 TYPE stat2,

ncsdate TYPE hiredate,

sltyp TYPE p_sltyp,

slreg TYPE p_slreg,

slgrp TYPE p_slgrp,

sllev TYPE p_sllvl,

ansvh TYPE ansvh,

vdsk1 TYPE vdsk1,

sname TYPE smnam,

END OF t_employee.

DATA: it_employee TYPE STANDARD TABLE OF t_employee INITIAL SIZE 0,

wa_employee TYPE t_employee.

TYPES: BEGIN OF t_emptexts,

  • INCLUDE STRUCTURE hrms_bw_txt_employee.

DATEFROM TYPE RSDATEFROM,

DATETO TYPE RSDATETO,

PERNR TYPE PERSNO,

TXTMD TYPE EMNAM,

END OF t_emptexts.

DATA: it_emptexts TYPE STANDARD TABLE OF t_emptexts INITIAL SIZE 0,

wa_emptexts TYPE t_emptexts.

TYPES: BEGIN OF t_contract,

  • INCLUDE STRUCTURE pa0615.

pernr TYPE p0615-pernr,

begda TYPE p0615-begda,

endda TYPE p0615-endda,

aedtm TYPE p0615-aedtm,

ctype TYPE p0615-ctype,

cbeg TYPE p0615-cbeg,

cend TYPE p0615-cend,

END OF t_contract.

DATA: it_contract TYPE STANDARD TABLE OF t_contract INITIAL SIZE 0,

wa_contract TYPE t_contract.

DATA: it_tabemp TYPE filetable,

gd_subrcemp TYPE i,

it_tabempt TYPE filetable,

gd_subrcempt TYPE i,

it_tabcont TYPE filetable,

gd_subrccont TYPE i.

DATA: gd_downfile TYPE string.

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.

PARAMETERS: p_emp LIKE rlgrap-filename,

p_empt LIKE rlgrap-filename,

p_cont LIKE rlgrap-filename.

SELECTION-SCREEN END OF BLOCK block1.

***********************************************************************

*at selection-screen

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_emp.

REFRESH: it_tabemp.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

window_title = 'Select File'

default_filename = '*.xls'

initial_directory = 'C:\'

multiselection = ' ' "No multiple selection

CHANGING

file_table = it_tabemp

rc = gd_subrcemp.

LOOP AT it_tabemp INTO p_emp.

ENDLOOP.

***********************************************************************

*at selection-screen

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_empt.

REFRESH: it_tabemp.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

window_title = 'Select File'

default_filename = '*.xls'

initial_directory = 'C:\'

multiselection = ' ' "No multiple selection

CHANGING

file_table = it_tabempt

rc = gd_subrcempt.

LOOP AT it_tabempt INTO p_empt.

ENDLOOP.

***********************************************************************

*at selection-screen

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_cont.

REFRESH: it_tabcont.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

window_title = 'Select File'

default_filename = '*.xls'

initial_directory = 'C:\'

multiselection = ' ' "No multiple selection

CHANGING

file_table = it_tabcont

rc = gd_subrccont.

LOOP AT it_tabcont INTO p_cont.

ENDLOOP.

************************************************************************

*START-OF-SELECTION.

START-OF-SELECTION.

GET pernr.

  • Selecting the latest infotype record

rp_provide_from_last p0000 space pn-begda pn-endda.

rp_provide_from_last p0001 space pn-begda pn-endda.

rp_provide_from_last p0007 space pn-begda pn-endda.

rp_provide_from_last p0008 space pn-begda pn-endda.

rp_provide_from_last p0121 space pn-begda pn-endda.

rp_provide_from_last p0615 space pn-begda pn-endda.

MOVE-CORRESPONDING p0001 TO wa_employee.

wa_employee-rfpnr = p0121-rfp01. "?????

MOVE-CORRESPONDING p0007 TO wa_employee.

MOVE-CORRESPONDING p0008 TO wa_employee.

MOVE-CORRESPONDING p0000 TO wa_employee.

SELECT SINGLE molga

FROM t001p

INTO wa_employee-molga

WHERE werks EQ p0001-werks AND

btrtl EQ p0001-btrtl.

SELECT SINGLE trfkz

FROM t503

INTO wa_employee-trfkz

WHERE persg EQ p0001-persg AND

persk EQ p0001-persk.

CALL FUNCTION 'HR_ENTRY_DATE'

EXPORTING

persnr = pernr-pernr

  • RCLAS =

  • BEGDA = '18000101'

  • ENDDA = '99991231'

  • VARKY =

IMPORTING

entrydate = wa_employee-ncsdate

  • TABLES

  • ENTRY_DATES =

EXCEPTIONS

ENTRY_DATE_NOT_FOUND = 1

PERNR_NOT_ASSIGNED = 2

OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • append employee data

APPEND wa_employee TO it_employee.

CLEAR: wa_employee.

wa_emptexts-datefrom = p0001-begda.

wa_emptexts-dateto = p0001-endda.

wa_emptexts-pernr = p0001-pernr.

wa_emptexts-txtmd = p0001-ename.

  • append employee texts data

APPEND wa_emptexts TO it_emptexts.

CLEAR: wa_emptexts.

MOVE-CORRESPONDING p0615 TO wa_contract.

  • append employee contract data

APPEND wa_contract TO it_contract.

CLEAR: wa_contract.

************************************************************************

*END-OF-SELECTION.

END-OF-SELECTION.

  • download employee data

IF NOT p_emp IS INITIAL.

gd_downfile = p_emp.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = gd_downfile

filetype = 'ASC'

write_field_separator = 'X'

TABLES

data_tab = it_employee.

IF sy-subrc EQ 0.

WRITE:/ 'Employee file downloaded to',

gd_downfile.

ELSE.

WRITE:/ 'There was an error downloading Employee file to',

gd_downfile.

ENDIF.

ENDIF.

  • download employee texts data

IF NOT p_empt IS INITIAL.

gd_downfile = p_empt.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = gd_downfile

filetype = 'ASC'

write_field_separator = 'X'

TABLES

data_tab = it_emptexts.

IF sy-subrc EQ 0.

WRITE:/ 'Employee text file downloaded to',

gd_downfile.

ELSE.

WRITE:/ 'There was an error downloading Employee text file to',

gd_downfile.

ENDIF.

ENDIF.

  • download contract data

IF NOT p_cont IS INITIAL.

gd_downfile = p_cont.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = gd_downfile

filetype = 'ASC'

write_field_separator = 'X'

TABLES

data_tab = it_contract.

IF sy-subrc EQ 0.

WRITE:/ 'Employee contract file downloaded to',

gd_downfile.

ELSE.

WRITE:/ 'There was an error downloading Employee contract file to',

gd_downfile.

ENDIF.

ENDIF.

Or you can refer to these too:

http://www.saptechnical.com/Tutorials/HRABAP/HRABAPMain.htm

reward if helpful

regars,

preet

Read only

Former Member
0 Likes
688

Hi,

Use the Following Code.

It will be Use ful..

DATA: BEGIN OF feature_string,

display_mode,

separator,

variant LIKE vari-variant,

END OF feature_string.

DATA: struc LIKE pme01,

status(1).

struc-molga = '40'.

struc-werks = psyst-werks.

struc-persk = psyst-persk.

struc-btrtl = psyst-btrtl.

CALL FUNCTION 'HR_FEATURE_BACKFIELD'

EXPORTING

feature = 'TARIF'

struc_content = struc

kind_of_error = space

IMPORTING

back = feature_string

CHANGING

status = status

EXCEPTIONS

dummy = 1

error_operation = 2

no_backvalue = 3

feature_not_generated = 4

invalid_sign_in_funid = 5

field_in_report_tab_in_pe03 = 6

OTHERS = 7.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4

RAISING feature_error.

  • ELSEIF feature_string-display_mode EQ '1'.

  • CHECK feature_string-separator EQ '/'.

  • CHECK NOT feature_string-variant IS INITIAL.

ENDIF.

IF sy-subrc = 0.

p9008-trfar = feature_string+0(2).

p9008-trfgb = feature_string+3(4).

ENDIF.

Reward points if helpful.

Regards,

N.