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

Retrieve personal work schedule



 
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 13, 2007 1:22 pm    Post subject: Retrieve personal work schedule Reply with quote

The following code demonstrates how to retrieve personnel work schedule, the example below uses
the personnel work schedule to add n number of WORKING days to a particular date.

Simply add the below FORM into you code and call it using the usual PERFORM command:
PERFORM add_working_days_workschedule
USING ld_numdays
CHANGING gd_date.

Code:

*&---------------------------------------------------------------------*
*&      Form  ADD_WORKING_DAYS_WORKSCHEDULE
*&---------------------------------------------------------------------*
*       Add n number of working days to date, using employees work
*       schedule to calculate working days
*----------------------------------------------------------------------*
*      <-- P_DAYS     Number of days to add
*      <-- P_PAYDATE  Starting date
*----------------------------------------------------------------------*

FORM add_working_days_workschedule USING p_days
                       CHANGING p_paydate TYPE sy-datum.
  DATA: ld_count  TYPE i,
        ld_memid(30) TYPE c.

* Copied from rptpsh10
  DATA: psp LIKE ptpsp      OCCURS 0 WITH HEADER LINE.
  DATA: BEGIN OF hd OCCURS 0,
        pernr LIKE pernr-pernr,
        name(40),
        inv_menge LIKE pakey-seqnr,      "ALV copies only 20 columns!
        moabw LIKE t001p-moabw,                               "
        mover LIKE t001p-mover,          "ALV copies only 20 columns!
        datum LIKE psp-datum,
        kurzt LIKE t246-kurzt,
        tprog LIKE psp-tprog,
        varia LIKE psp-varia,
         ttext LIKE t550s-ttext,
        vtart LIKE p2003-vtart,
         vtext LIKE t556t-vtext,
        motpr LIKE psp-motpr,
        sobeg(8),
        soend(8),
        stdaz LIKE ptev_rep_h-stdaz,
        ftkla LIKE psp-ftkla,
        tagty LIKE psp-tagty,
         tatxt LIKE t553t-langt,
        zmodn LIKE psp-zmodn,
         ptext LIKE t551s-ztext,
        mofid LIKE t508a-mofid,
         ftext LIKE thoct-ltext,
        menge LIKE ptev_rep_h-itanz,
        alvmarker TYPE rp_xfeld,
        END OF hd.

  ld_count = p_days.

  CONCATENATE sy-uname sy-uzeit INTO ld_memid.

* Z version of 'personal work schedule' report, created to export data
* to memory rather than display it on screen
  SUBMIT zrptpsh10_list_to_memory    WITH pnppernr EQ pernr-pernr
                     WITH pnpbegda EQ p2001-begda
                     WITH pnpendda EQ p2001-endda
                     WITH pnpbegps EQ p2001-begda
                     WITH pnpendps EQ p2001-endda
                     WITH pnptimed EQ ' '
                     WITH rdclust  EQ 'X'
                     WITH p_memid  EQ ld_memid
                     AND  RETURN.

* import datd from memoory
  IMPORT hd FROM MEMORY ID ld_memid.

* Check if days are working days
  WHILE ld_count GT 0.
    READ TABLE hd WITH KEY datum = p_paydate.
    IF hd-tprog NE 'FREE'.  "FREE equals non working day
      p_paydate = p_paydate + 1.
      ld_count = ld_count - 1.
    ELSE.
      p_paydate = p_paydate + 1.
    ENDIF.
  ENDWHILE.
ENDFORM.                    " ADD_WORKING_DAYS_WORKSCHEDULE
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.