SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Get data from infotype 0008



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Oct 27, 2007 2:20 pm    Post subject: Get data from infotype 0008 Reply with quote

Code:

REPORT  ZGILL3   message-id rp
                             line-size 250
                             line-count 65.
 
*eject
*&---------------------------------------------------------------------*
*& Tables and Infotypes                                                *
*&                                                                     *
*&---------------------------------------------------------------------*
tables: pernr.
 
infotypes: 0000,
           0001,
           0008.
 
*eject
*&---------------------------------------------------------------------*
*& Constants                                                           *
*&                                                                     *
*&---------------------------------------------------------------------*
constants: c_1(1)       type c               value '1'   ,
           c_3(1)       type c               value '3'   ,
           c_i(1)       type c               value 'I'   ,
           c_x(1)       type c               value 'X'   ,
           c_eq(2)      type c               value 'EQ'  .
*           c_pl03       like p0001-werks     value 'PL03'.
 
 
 
*eject
*&---------------------------------------------------------------------*
*& Internal tables                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*
* Internal Table for Output
data: begin of t_output occurs 0    ,
       pernr like pernr-pernr       ,
       lgart1   type LGART,
       betrg1   type PAD_AMT7S,
       lgart2   type LGART,
       betrg2   type PAD_AMT7S,
       lgart3   type LGART,
       betrg3   type PAD_AMT7S,
       lgart4   type LGART,
       betrg4   type PAD_AMT7S.
 
data: end of t_output           .
 
data: lgart type lgart,
      betrg type PAD_AMT7S.
data: count type i.
*eject
*&---------------------------------------------------------------------*
*& Initialization                                                      *
*&                                                                     *
*&---------------------------------------------------------------------*
Initialization.
* Initialize Selection-Screen values
  perform init_selction_screen.
 
*eject
*&---------------------------------------------------------------------*
*& Start-of Selection                                                  *
*&                                                                     *
*&---------------------------------------------------------------------*
Start-of-selection.
 
get pernr.
 
  clear t_output.
 
* Read Infotype 0
  rp-provide-from-last p0000 space pn-begda pn-endda.
  check pnp-sw-found eq c_1.
* Check if employee is active
  check p0000-stat2 in pnpstat2.      "pernr Active
 
* Read Infotype 1
  rp-provide-from-last p0001 space pn-begda pn-endda.
  check pnp-sw-found eq c_1.
 
* Check if emp belongs to Active Group
  check p0001-persg in pnppersg.
 
* Read Infotype 8
  rp-provide-from-last p0008 space pn-begda pn-endda.
  check pnp-sw-found eq c_1.
  sort p0008 by endda descending.
 
describe table p0008 lines count.
* Gather latest  wagetypes
clear t_output.
read table p0008 index 1.
if sy-subrc eq 0.
    move pernr-pernr to t_output-pernr.
    DO 40 TIMES VARYING LGART FROM P0008-LGA01 NEXT P0008-LGA02
                VARYING BETRG FROM P0008-BET01 NEXT P0008-BET02.
 
    if LGART = '1000'.
     move: lgart to t_output-lgart1,
           betrg to t_output-betrg1.
    append t_output.
 
    endif.
 
    if LGART = '1011'.
     move: lgart to t_output-lgart2,
           betrg to t_output-betrg2.
    append t_output.
 
    endif.
 
    if LGART = '1020' .
         move: lgart to t_output-lgart3,
           betrg to t_output-betrg3.
    append t_output.
 
    endif.
 
if LGART = '1030' .
     move: lgart to t_output-lgart4,
           betrg to t_output-betrg4.
    append t_output.
 
    endif.
 
ENDDO.
endif.
 
clear: t_output,
       p0008.
* Gather earliest  wagetypes
read table p0008 index count.
if sy-subrc eq 0.
    move pernr-pernr to t_output-pernr.
    DO 40 TIMES VARYING LGART FROM P0008-LGA01 NEXT P0008-LGA02
                VARYING BETRG FROM P0008-BET01 NEXT P0008-BET02.
 
    if LGART = '1000'.
     move: lgart to t_output-lgart1,
           betrg to t_output-betrg1.
    append t_output.
 
    endif.
 
    if LGART = '1011'.
     move: lgart to t_output-lgart2,
           betrg to t_output-betrg2.
    append t_output.
 
    endif.
 
    if LGART = '1020' .
         move: lgart to t_output-lgart3,
           betrg to t_output-betrg3.
    append t_output.
 
    endif.
 
if LGART = '1030' .
     move: lgart to t_output-lgart4,
           betrg to t_output-betrg4.
    append t_output.
 
    endif.
 
ENDDO.
endif.
 
 
*eject
*&---------------------------------------------------------------------*
*& End-of Selection                                                    *
*&                                                                     *
*&---------------------------------------------------------------------*
end-of-selection.
 
loop at t_output.
 
write:/ 'Employee',
      /20 t_output-pernr color 2.
 write:/ '1000', t_output-betrg1,
       / '1011', t_output-betrg2,
       / '1020', t_output-betrg3,
       / '1030', t_output-betrg3.
 
endloop.
 
 
*eject
*&---------------------------------------------------------------------*
*&      Form  init_selction_screen
*&---------------------------------------------------------------------*
*Description:
*----------------------------------------------------------------------*
FORM init_selction_screen .
 
  refresh: pnpwerks,
           pnppersg,
           pnpstat2.
  clear:   pnpwerks,
           pnppersg,
           pnpstat2.
 
*  pnpwerks-sign   = c_i.
*  pnpwerks-option = c_EQ.
*  pnpwerks-low    = c_pl03.
*  append pnpwerks.
 
  pnppersg-sign   = c_i.
  pnppersg-option = c_EQ.
  pnppersg-low    = c_1.
  append pnppersg.
 
  pnpstat2-sign   = c_i.
  pnpstat2-option = c_EQ.
  pnpstat2-low    = c_3.
  append pnpstat2.
 
 
ENDFORM.                    " init_selction_screen


Code:
FORM get_p0008_detail tables gt_bapi_wagetypes structure bapip0008p
                      USING p0008 LIKE p0008.
 DATA ld_amount_external LIKE  bapicurr-bapicurr.
 DATA lt_return LIKE TABLE OF bapireturn1 WITH HEADER LINE.
 CLEAR gt_bapi_wagetypes[].
 CALL FUNCTION 'BAPI_BASICPAY_GETDETAIL'
      EXPORTING
           employeenumber = p0008-pernr
           subtype        = p0008-subty
           objectid       = p0008-objps
           lockindicator  = p0008-sprps
           validitybegin  = p0008-begda
           validityend    = p0008-endda
           recordnumber   = p0008-seqnr
      IMPORTING
           return         = lt_return
      TABLES
           wagetypes      = gt_bapi_wagetypes.
endform.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.