Application Development 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: 

how to get joining date

Former Member
0 Kudos
280

hi all,

i am getting DOB like this,

types:BEGDA TYPE PA0002-BEGDA,

......

......

WA_OUTPUT-BEGDA = P0002-BEGDA.

...

append wa_output to it_output.

  clear: wa_output.

now i want date of joining from infotype p0041 and field is DAT01 i am doing same but its not working.in my alv anu suggestions???

7 REPLIES 7

Former Member
0 Kudos
70

Hi,

Try this.

   GET PERNR.

  PROVIDE FIELDS PERNR DAT01
    FROM P0041
    INTO GS_P0041
    VALID GV_FLAG
    BOUNDS BEGDA AND ENDDA
    WHERE PERNR EQ P_PERNR
   BETWEEN P_DATE1 AND P_DATE2.

    IF GV_FLAG = X.
      APPEND GS_P0041 TO GT_P0041.
    ENDIF.
  ENDPROVIDE.

Regards,

Danish

0 Kudos
70

any other approach?? i mean simple??

0 Kudos
70

Hi,

This is the obvious very simple and easy to use.

The other alternative is to fetch records directly from PA0041 table.

Regards,

Danish.

0 Kudos
70

thank you..i am trying it but error coming thats why i asked,

it saying gv_flag is unknown this is my coding plz make change here

REPORT  ZHCMEMPLOYEEDETAILS.

TABLES: pernr.

INFOTYPES: ..., 0041, ..

TYPES: BEGIN OF t_output,

  pernr       TYPE p0001-pernr,

  BEGDA TYPE PA0002-BEGDA,

anredtxt    TYPE t522t-atext,

  orgtx       TYPE t527x-orgtx,   "dept

  ausbitxt TYPE t518b-atext,

  dat01 TYPE pa0041-dat01,

  END OF t_output.

DATA: it_output TYPE STANDARD TABLE OF t_output INITIAL SIZE 0,

      wa_output TYPE t_output.

data: it_t518a type table of t518a,

            wa_t518a like line of it_t518a.

START-OF-SELECTION.

GET pernr.

  rp_provide_from_last p0000 space pn-begda pn-endda.

  rp_provide_from_last p0001 space pn-begda pn-endda.

  rp_provide_from_last p0002 space pn-begda pn-endda.

  rp_provide_from_last p0008 space pn-begda pn-endda.

  rp_provide_from_last p0014 space pn-begda pn-endda.

  rp_provide_from_last p0022 space pn-begda pn-endda.

  rp_provide_from_last p0041 space pn-begda pn-endda.

  wa_output-pernr = pernr-pernr.

  WA_OUTPUT-ABKRS = P0001-ABKRS.

  WA_OUTPUT-BEGDA = P0002-BEGDA.

* Personnel title

  SELECT SINGLE atext

    FROM t522t

    INTO wa_output-anredtxt

   WHERE sprsl EQ sy-langu AND

         anred EQ p0002-anred.

   select single atext

  from t518b

  into wa_output-ausbitxt

  where langu eq sy-langu

  and ausbi eq p0022-ausbi.

* First name

  wa_output-fname = p0002-vorna.

  wa_output-lname = p0002-nachn.

  SELECT SINGLE orgtx

    FROM t527x

    INTO wa_output-orgtx

   WHERE sprsl EQ sy-langu AND

         orgeh EQ p0001-orgeh AND

         endda GE sy-datum.

  append wa_output to it_output.

  clear: wa_output.

0 Kudos
70

Hi Sharma,

Please try out below sample code.

DATA: pernr LIKE pa0001-pernr,

       doj   LIKE sy-datum.

pernr = '00103413'.

CALL FUNCTION 'HR_ENTRY_DATE'

   EXPORTING

     persnr               = pernr

   IMPORTING

     entrydate            = doj

   EXCEPTIONS

     entry_date_not_found = 1

     pernr_not_assigned   = 2

     OTHERS               = 3.

WRITE: doj.

Regards,

Faisal

0 Kudos
70

hi faisal thanx but i am using this doj in my alv so it will not working,well leave it.i will manage it somhow,,,now i want twxt from infotype 8 that is basic pay..now you have to help me on this...i want it like this

basic 8000 vda 5000 fda 6000 hra 2000 in my alv how i do it??

i hope u understand what i am saying i am including again whole coding ...

REPORT  ZHCMEMPLOYEEDETAILS.

type-pools: slis.

TABLES: pernr.

INFOTYPES: 0000, 0001, 0002, 0022 , 0008, 0014, 0041 ,  0121.

TYPES: BEGIN OF t_output,

  pernr       TYPE p0001-pernr,

  BEGDA TYPE PA0002-BEGDA,

   ABKRS TYPE  PA0001-ABKRS,

  anredtxt    TYPE t522t-atext,

  fname       TYPE p0002-vorna,

  lname       TYPE p0002-nachn,   "last name

  orgtx       TYPE t527x-orgtx,   "dept

  ausbitxt TYPE t518b-atext,

  dat01 TYPE pa0041-dat01,

  END OF t_output.

DATA: it_output TYPE STANDARD TABLE OF t_output INITIAL SIZE 0,

      wa_output TYPE t_output.

      data: it_t518a type table of t518a,

            wa_t518a like line of it_t518a.

*ALV data declarations

data: fieldcatalog   type slis_t_fieldcat_alv with header line,

      gd_tab_group   type slis_t_sp_group_alv,

      gd_layout      type slis_layout_alv,

      gd_repid       like sy-repid,

      gt_events      type slis_t_event,

      gd_prntparams  type slis_print_alv,

      gd_count(6)    type n,

      gd_outtext(70) type c,

      gd_lines       type i.

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

*START-OF-SELECTION.

START-OF-SELECTION.

clear: gd_count.

GET pernr.

* Display indicator for employee count

  perform progress_indicator using gd_outtext. "UNCOMMENT IT FOR ALV

* Retrieve datd from infotypes

  rp_provide_from_last p0000 space pn-begda pn-endda.

  rp_provide_from_last p0001 space pn-begda pn-endda.

  rp_provide_from_last p0002 space pn-begda pn-endda.

  rp_provide_from_last p0008 space pn-begda pn-endda.

  rp_provide_from_last p0014 space pn-begda pn-endda.

  rp_provide_from_last p0022 space pn-begda pn-endda.

  rp_provide_from_last p0041 space pn-begda pn-endda.

  wa_output-pernr = pernr-pernr.

  WA_OUTPUT-ABKRS = P0001-ABKRS.

  WA_OUTPUT-BEGDA = P0002-BEGDA.

*  WA_OUTPUT-dat01 = P0041-DAT01.

* Personnel title

  SELECT SINGLE atext

    FROM t522t

    INTO wa_output-anredtxt

   WHERE sprsl EQ sy-langu AND

         anred EQ p0002-anred.

  select single atext

  from t518b

  into wa_output-ausbitxt

  where langu eq sy-langu

  and ausbi eq p0022-ausbi.

* First name

  wa_output-fname = p0002-vorna.

* Last name

  wa_output-lname = p0002-nachn.

* Organizational Unit text (dept)

  SELECT SINGLE orgtx

    FROM t527x

    INTO wa_output-orgtx

   WHERE sprsl EQ sy-langu AND

         orgeh EQ p0001-orgeh AND

         endda GE sy-datum.

  append wa_output to it_output.

  clear: wa_output.

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

END-OF-SELECTION.

describe table it_output lines gd_lines.

if gd_lines gt 0.

  perform build_fieldcatalog.

  perform build_layout.

  perform display_alv_report.

else.

  message i003(zp) with 'No records found'.

endif.

form progress_indicator using p_text.

  call function 'SAPGUI_PROGRESS_INDICATOR'

      exporting

*         PERCENTAGE = 0

           text       = p_text.

endform.                    " PROGRESS_INDICATOR

form build_fieldcatalog.

  fieldcatalog-fieldname   = 'PERNR'.

  fieldcatalog-seltext_m   = 'Personnel No.'.

  fieldcatalog-col_pos     = 0.

  fieldcatalog-outputlen   = 10.

*  fieldcatalog-emphasize   = 'X'.

*  fieldcatalog-key         = 'X'.

*  fieldcatalog-do_sum      = 'X'.

*  fieldcatalog-no_zero     = 'X'.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'ANREDTXT'.

  fieldcatalog-seltext_m   = 'Title'.

  fieldcatalog-col_pos     = 1.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'FNAME'.

  fieldcatalog-seltext_m   = 'First Name'.

  fieldcatalog-col_pos     = 2.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'LNAME'.

  fieldcatalog-seltext_m   = 'Last Name'.

  fieldcatalog-col_pos     = 3.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'ORGTX'.

  fieldcatalog-seltext_m   = 'Department'.

  fieldcatalog-col_pos     = 4.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

 

  fieldcatalog-fieldname   = 'AUSBITXT'.

  fieldcatalog-seltext_m   = 'QUALIFICATION'.

  fieldcatalog-col_pos     = 5.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'BEGDA'.

  fieldcatalog-seltext_m   = 'DOB'.

  fieldcatalog-col_pos     = 6.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

   fieldcatalog-fieldname   = 'DATO1'.

  fieldcatalog-seltext_m   = 'DATE OF JOIN'.

  fieldcatalog-col_pos     = 7.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

fieldcatalog-fieldname   = 'ABKRS'.

  fieldcatalog-seltext_m   = 'DOJ'.

  fieldcatalog-col_pos     = 8.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

endform.                    " BUILD_FIELDCATALOG

*&---------------------------------------------------------------------*

*&      Form  BUILD_LAYOUT

*&---------------------------------------------------------------------*

*       Build layout for ALV grid report

*----------------------------------------------------------------------*

form build_layout.

  gd_layout-no_input          = 'X'.

  gd_layout-colwidth_optimize = 'X'.

  gd_layout-totals_text       = 'Totals'(201).

  gd_layout-zebra             = 'X'.

endform.                    " BUILD_LAYOUT

form display_alv_report.

  gd_repid = sy-repid.

  call function 'REUSE_ALV_GRID_DISPLAY'

       exporting

            i_callback_program      = gd_repid

            is_layout               = gd_layout

            it_fieldcat             = fieldcatalog[]

            i_save                  = 'X'

       tables

            t_outtab                = it_output

       exceptions

            program_error           = 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.

endform.                    " DISPLAY_ALV_REPORT

0 Kudos
70

hi faisal thanx but i am using this doj in my alv so it will not working,well leave it.i will manage it somhow,,,now i want twxt from infotype 8 that is basic pay..now you have to help me on this...i want it like this

basic 8000 vda 5000 fda 6000 hra 2000 in my alv how i do it??

i hope u understand what i am saying i am including again whole coding ...

REPORT  ZHCMEMPLOYEEDETAILS.

type-pools: slis.

TABLES: pernr.

INFOTYPES: 0000, 0001, 0002, 0022 , 0008, 0014, 0041 ,  0121.

TYPES: BEGIN OF t_output,

  pernr       TYPE p0001-pernr,

  BEGDA TYPE PA0002-BEGDA,

   ABKRS TYPE  PA0001-ABKRS,

  anredtxt    TYPE t522t-atext,

  fname       TYPE p0002-vorna,

  lname       TYPE p0002-nachn,   "last name

  orgtx       TYPE t527x-orgtx,   "dept

  ausbitxt TYPE t518b-atext,

  dat01 TYPE pa0041-dat01,

  END OF t_output.

DATA: it_output TYPE STANDARD TABLE OF t_output INITIAL SIZE 0,

      wa_output TYPE t_output.

      data: it_t518a type table of t518a,

            wa_t518a like line of it_t518a.

*ALV data declarations

data: fieldcatalog   type slis_t_fieldcat_alv with header line,

      gd_tab_group   type slis_t_sp_group_alv,

      gd_layout      type slis_layout_alv,

      gd_repid       like sy-repid,

      gt_events      type slis_t_event,

      gd_prntparams  type slis_print_alv,

      gd_count(6)    type n,

      gd_outtext(70) type c,

      gd_lines       type i.

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

*START-OF-SELECTION.

START-OF-SELECTION.

clear: gd_count.

GET pernr.

* Display indicator for employee count

  perform progress_indicator using gd_outtext. "UNCOMMENT IT FOR ALV

* Retrieve datd from infotypes

  rp_provide_from_last p0000 space pn-begda pn-endda.

  rp_provide_from_last p0001 space pn-begda pn-endda.

  rp_provide_from_last p0002 space pn-begda pn-endda.

  rp_provide_from_last p0008 space pn-begda pn-endda.

  rp_provide_from_last p0014 space pn-begda pn-endda.

  rp_provide_from_last p0022 space pn-begda pn-endda.

  rp_provide_from_last p0041 space pn-begda pn-endda.

  wa_output-pernr = pernr-pernr.

  WA_OUTPUT-ABKRS = P0001-ABKRS.

  WA_OUTPUT-BEGDA = P0002-BEGDA.

*  WA_OUTPUT-dat01 = P0041-DAT01.

* Personnel title

  SELECT SINGLE atext

    FROM t522t

    INTO wa_output-anredtxt

   WHERE sprsl EQ sy-langu AND

         anred EQ p0002-anred.

  select single atext

  from t518b

  into wa_output-ausbitxt

  where langu eq sy-langu

  and ausbi eq p0022-ausbi.

* First name

  wa_output-fname = p0002-vorna.

* Last name

  wa_output-lname = p0002-nachn.

* Organizational Unit text (dept)

  SELECT SINGLE orgtx

    FROM t527x

    INTO wa_output-orgtx

   WHERE sprsl EQ sy-langu AND

         orgeh EQ p0001-orgeh AND

         endda GE sy-datum.

  append wa_output to it_output.

  clear: wa_output.

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

END-OF-SELECTION.

describe table it_output lines gd_lines.

if gd_lines gt 0.

  perform build_fieldcatalog.

  perform build_layout.

  perform display_alv_report.

else.

  message i003(zp) with 'No records found'.

endif.

form progress_indicator using p_text.

  call function 'SAPGUI_PROGRESS_INDICATOR'

      exporting

*         PERCENTAGE = 0

           text       = p_text.

endform.                    " PROGRESS_INDICATOR

form build_fieldcatalog.

  fieldcatalog-fieldname   = 'PERNR'.

  fieldcatalog-seltext_m   = 'Personnel No.'.

  fieldcatalog-col_pos     = 0.

  fieldcatalog-outputlen   = 10.

*  fieldcatalog-emphasize   = 'X'.

*  fieldcatalog-key         = 'X'.

*  fieldcatalog-do_sum      = 'X'.

*  fieldcatalog-no_zero     = 'X'.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'ANREDTXT'.

  fieldcatalog-seltext_m   = 'Title'.

  fieldcatalog-col_pos     = 1.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'FNAME'.

  fieldcatalog-seltext_m   = 'First Name'.

  fieldcatalog-col_pos     = 2.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'LNAME'.

  fieldcatalog-seltext_m   = 'Last Name'.

  fieldcatalog-col_pos     = 3.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'ORGTX'.

  fieldcatalog-seltext_m   = 'Department'.

  fieldcatalog-col_pos     = 4.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

 

  fieldcatalog-fieldname   = 'AUSBITXT'.

  fieldcatalog-seltext_m   = 'QUALIFICATION'.

  fieldcatalog-col_pos     = 5.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'BEGDA'.

  fieldcatalog-seltext_m   = 'DOB'.

  fieldcatalog-col_pos     = 6.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

   fieldcatalog-fieldname   = 'DATO1'.

  fieldcatalog-seltext_m   = 'DATE OF JOIN'.

  fieldcatalog-col_pos     = 7.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

fieldcatalog-fieldname   = 'ABKRS'.

  fieldcatalog-seltext_m   = 'DOJ'.

  fieldcatalog-col_pos     = 8.

  append fieldcatalog to fieldcatalog.

  clear  fieldcatalog.

endform.                    " BUILD_FIELDCATALOG

*&---------------------------------------------------------------------*

*&      Form  BUILD_LAYOUT

*&---------------------------------------------------------------------*

*       Build layout for ALV grid report

*----------------------------------------------------------------------*

form build_layout.

  gd_layout-no_input          = 'X'.

  gd_layout-colwidth_optimize = 'X'.

  gd_layout-totals_text       = 'Totals'(201).

  gd_layout-zebra             = 'X'.

endform.                    " BUILD_LAYOUT

form display_alv_report.

  gd_repid = sy-repid.

  call function 'REUSE_ALV_GRID_DISPLAY'

       exporting

            i_callback_program      = gd_repid

            is_layout               = gd_layout

            it_fieldcat             = fieldcatalog[]

            i_save                  = 'X'

       tables

            t_outtab                = it_output

       exceptions

            program_error           = 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.

endform.                    " DISPLAY_ALV_REPORT