Function module HR_INFOTYPE_OPERATION

1:23 AM

Function module HR_INFOTYPE_OPERATION to maintain SAP HR infotypes


The HR_INFOTYPE_OPERATION function module is used for the Maintenance of HR infotypes, such as inserting, changing, deleting data etc 

Parameters Explained
Here is a list of the fm's parameters and how they are used, obviously not all parameters will be used depending on what function you are performing i.e. insert, change, delet etc 

infty - Infotype being updated 

objectid - object id from infotype 

number - Personnel number 

validityend - validity end date 

validitybegin - validity begin date 

record - infotype record values to be updated, inserted etc (will be structure of infortyoe you are updating)

recordnumber - sequence nunber from infotype record you are updating 

Operation - describes what operation is to be performed 
COP = Copy 
DEL = Delete 
DIS = Display 
EDQ = Lock/unlock 
INS = Create 
LIS9 = Delimit 
MOD = Change 
INSS = Create for Actions is not converted to Change 

nocommit - commit yes('X') / no(' ') 

dialog_mode - dialog mode or not, default is '0'

Example coding for MOD operation
      CONSTANTS: change TYPE pspar-actio VALUE 'MOD'.

"This code is requred and locks the record ready for modification
CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
EXPORTING
number = p_pernr.


"loop at p0071 into p_p0071. "added to put code in context
validitybegin = p_record-begda.
validityend = p_record-endda.
p_record-endda = pn-begda - 1.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0071'
subtype = p_record-subty
objectid = P_record-objps
number = p_record-pernr "employeenumber
validityend = validityend
validitybegin = validitybegin
record = p_record
recordnumber = p_record-SEQNR
operation = change
nocommit = nocommit
dialog_mode = '0'
IMPORTING
return = return_struct
key = personaldatakey
EXCEPTIONS
OTHERS = 0.

"endloop.

"unlock record after modification
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = p_pernr.

Example coding for INS operation
      CONSTANTS: insert TYPE pspar-actio VALUE 'INS'.

"This code is requred and locks the record ready for modification
CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
EXPORTING
number = p_pernr.


validitybegin = p_record-begda.
validityend = p_record-endda.
p_record-pernr = p_pernr
p_record-begda = pn-begda.
p_record-endda = validityend.
p_record-subty = p_SUBTY. "subtype of new entry
p_record-SCREF = p_SUBTY. "subtype of new entry
"plus populate any other fields you need to update

CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0071'
subtype = p_record-subty
number = p_record-pernr "employeenumber
validityend = validityend
validitybegin = validitybegin
record = p_record
operation = insert
nocommit = nocommit
dialog_mode = '0'
IMPORTING
return = return_struct
key = personaldatakey
EXCEPTIONS
OTHERS = 0.

"unlock record after modification
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = p_pernr.

INS operation example coding for infotype 0105
Also see BAPI_EMPLCOMM_CREATE for <a style="color: rgb(0, 0, 255); ">updating infotype 0105</a>

CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
EXPORTING
number = p_pernr.

p_record-subty = p_subtype. "subtype of new entry
p_record-pernr = p_pernr.
p_record-SEQNR = '000'.
validityend = '99991231'.
validitybegin = sy-datum.
p_record-begda = sy-datum.
p_record-endda = '99991231'.
p_record-usrid = 'TESTUSR'.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0105'
subtype = p_record-subty
objectid = P_record-objps
number = p_record-pernr "employeenumber
validityend = validityend
validitybegin = validitybegin
record = p_record
operation = 'INS'
nocommit = nocommit
dialog_mode = '0'
IMPORTING
return = return_struct
key = personaldatakey
EXCEPTIONS
OTHERS = 0.
if sy-subrc eq 0.
* success
endif.

CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = p_pernr.

see BAPI_EMPLCOMM_CREATE if updating infotype 0105!! 

Check out sap documentation and pattern details for function module hr_infotype_operation on website se80.co.uk


Source = http://www.sapdev.co.uk/fmodules/fms_HR_INFOTYPE_OPERATION.htm

Read On 0 comments

SAP HR Infotypes

2:30 AM

SAP HR Infotypes





Infotypes are also called information types and are pre-defined
templates to enter sensible related information for an employee or
applicant. for eg an address infotype would have fields like street
& house no, city, pin code.This infotype is unique and is
represented by an infotype number eg address has infotype no 0006. There
other infotypes like


  1. 0000 – Actions (to capture employee movement info in the orgnization)
  2. 0001 – Organizational Assignment (to capture employee positioning in the organization)
  3. 0002 – Personal Data
  4. 0006 – Address
  5. 0007 – Planned Working Time (Store planned working hours for the employee.)
  6. 0008 – Basic Salary
  7. 0009 – Bank Details
  8. 0014 – Recurring Payment
  9. 0015 – Additional payment
  10. 0016 – Contract Elements
  11. 2006 – Absence Quotas

The above infotypes together in the same sequence form a part of the
Hiring Action.To make you understand this better just try and recollect
the contents of your offer letter which your organization might have
given you. It would possibly read “We are delighted to offer you the
position (IT 0001) of ______. You will belong to ______ department (IT
0001). Your joining date will be ______(IT0000 or IT0041)and you will be
paid a salary of ______ (IT 0008). You will be paid monthly allowances
______ (IT 0008 or IT 0014) and we are also offering you a joining bonus
of ______ (IT 0015). You will be eligible for annual leave of ______
days (IT 2006) and sick leave of ______ (IT 2006).You will be on a
probation for six months from the date of joining (probation date &
confirmation date in IT0016). Your working hours will be from ____ hrs
to ____ hrs beginning Monday to Friday (IT 0007) and we look forward to
your presence on date ______(IT 0016)……


I hope this gives you some idea of what an infotype is.


This must have raised a question in many
minds that “Hey ! I got the offer during my recruitment so how come this
is being referred to after hiring?” Well thats simple – this is because
all your relevant data that was captured during recruitment was
transferred to the the master (called HR master data)during the hiring
process.


So how was it captured in recruitment?


Well, this was captured using recruitment actions like shortlist
candidate, for interview, make offer, offer accepted till you join the
organization and sign the joining letter when your data actually gets
transferred from the Recruitment module to the Personnel Administration
module. Again this data was captured in recruitment infotypes.


So we can now get an idea that in SAP HR ,all data is captured in infotypes.


Question and Answer


1.What are info types ?


Infotypes, known as information types are units of human resources
information formed by grouping related data fields together. These are
represented in the sap hr system by a unique 4 digit number eg. Personal
Data (0002), Address (0006) etc. All customer infotypes fall in the
number range from 9000 to 9999. The fields in the infotype would vary
based on the country grouping for eg if any employee belongs to country
grouping 10 than he would have the SSN no field in the Personal Data
infotype which would not be seen in same infotype for country grouping
99.


*Infotype numbering in SAP HR sub module


  1. 0000-0999 Personal Administration (HR Master Data)
  2. 1000-1999 PD Infotypes ( OM etc)
  3. 2000-2999 Time Infotypes
  4. 4000-4999 Recruitment Infotypes

So whenever you are searching for a customer defined infotype make
sure your search is restricted between 9000 -9999. The infotypes
relevant to retroactive accounting for payroll and time infotypes are
defined in the

IMG . Personnel Administration–>Customizing
Procedures–>Infotypes–>Define fields relevant for retroactive
accounting–> Retroactive accounting relevance for payroll and time
per IT


Under this node you define for each infotype the following:- 1.Check
if no organizational assignment exists for the employee in
IT0001-Organizational Assignment and throw an error, warning or no
message.

So whenever you are searching for a customer defined infotype make sure
your search is restricted between 9000 -9999.The infotypes relevant to
retroactive accounting for payroll and time infotypes are defined in the

IMG . Personnel Administration–>Customizing
Procedures–>Infotypes–>Define fields relevant for retroactive
accounting–> Retroactive accounting relevance for payroll and time
per IT


Under this node you define for each infotype the following:-


1.Check if no organizational assignment exists for the employee in
IT0001-Organizational Assignment and throw an error, warning or no
message.


2.Maintenance of this infotype is permissible, permissible with
warning, or not permissible after the employee has left the organization
(employee in inactive status).


3.Entries in payroll past are permissible, not permissible or check for entries in the payroll past are infotype specific.


4.Infotype is not relevant for retroactive accounting, change in the
infotype triggers retroactive accounting or retroactive accounting is
field-dependent according to table T588G where the fields whose change
in values should trigger retroactive accounting are defined. Hence you
can see the significance of field triggers in retroactive accounting
where retroactive accounting for a given infotype can be restricted to
changes in the past to certain fields of the infotype.


If there is case that we need to specify certain info types for certain countries only, below are the IMG path you can maintain:


SPRO–>Personnel Administration–>Customizing Procedures–> Assign infotypes to countries


source

Read On 0 comments

Notes : CALL FUNCTION 'HR_READ_INFOTYPE'

2:16 AM

*INFOTYPE 0000(ACTION) FROM DATE JOINED ONWARDS:-

    CALL FUNCTION 'HR_READ_INFOTYPE'

      EXPORTING

        PERNR     = PERNR-PERNR

        INFTY     = '0000'

        BEGDA     =
'99991231'

        ENDDA     = '99991231'

      TABLES

        INFTY_TAB = I0000.
Read On 0 comments

Notes : Sample Program. To read Unix file and perform BDC functions

6:54 PM
REPORT  ZPYLBMA128 MESSAGE-ID 25 LINE-SIZE 500 LINE-COUNT 65 NO STANDARD PAGE HEADING..
INCLUDE ZPYLBMA128_VARIABLES.

"SELECTION SCREEN STARTS=========================
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREENSKIP 1.
PARAMETERS    : DSN LIKE FILENAME-FILEEXTERN DEFAULT '/home/HRD/UL/test zakat.prn'.
PARAMETERS    : MAPNAME DEFAULT SY-UNAME LIKE RPTAXXXX-MAP_NAME.
PARAMETERS    : TEST_RUN    TYPE C AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK B1.
"SELECTION SCREEN ENDS=========================

"INITIALIZATION STARTS=========================

INITIALIZATION.
  DSN+6(3) = SY-SYSID.
  REPNAME = SY-REPID.
"INITIALIZATION ENDS=========================

"AT SELECTION-SCREEN CHECKING STARTS=========================
AT SELECTION-SCREEN ON DSN.
  CLEAR: IDSN.
  TRY.
      OPEN DATASET DSN FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.   "UNI-CONV
      IF SY-SUBRC NE 0.
        MESSAGE E899(5A) WITH 'Error in opening file:'(E01) DSN.
      ENDIF.
    CATCH CX_SY_FILE_OPEN.
      CLOSE DATASET DSN.
      OPEN DATASET DSN FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.  "UNI-CONV
      IF SY-SUBRC NE 0.
        MESSAGE E899(5A) WITH 'DATA DOES NOT EXITS:'(E01) DSN.
      ENDIF.
  ENDTRY.

AT SELECTION-SCREEN.
  IF TEST_RUN NE 'X'.
    CALL FUNCTION 'HR_MAPNAME_VERIFY'
      EXPORTING
        MAPNAME    = MAPNAME
        REPORTNAME = REPNAME
      IMPORTING
        MAPNAME    = MAPNAME.
  ENDIF.
  "AT SELECTION-SCREEN CHECKING ENDS=========================
  "START-OF-SELECTION=========================

START-OF-SELECTION.
  "BDC OPEN GROUP
  IF TEST_RUN NE 'X'.
    CALL FUNCTION 'BDC_OPEN_GROUP'
      EXPORTING
        CLIENT = SY-MANDT
        GROUP  = MAPNAME
        KEEP   = 'X'
        USER   = SY-UNAME.
  ENDIF.

**TO READ DATA FROM UNIX FILE
  DO.
    READ DATASET DSN INTO IDSN.
    IF SY-SUBRC EQ 0.
      "WRITE IDSN-SUBTY LEFT-JUSTIFIED TO IDSN-SUBTY.
      CONDENSE IDSN-SUBTY.
      APPEND IDSN.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
  CLOSE DATASET DSN.

**TO PROCESS RECORD BY RECORD
  DESCRIBE TABLE IDSN LINES ILINE.
  CHECK ILINE > 0.

  CLEAR: ITAB[], ERRTAB[]."errtab AND  ERROR_FLAG ARE not used as there is no checking as yet!

  LOOP AT IDSN.

    CLEAR: ERRTAB.
    MOVE: IDSN-PERNR TO PERNR1.
    ADD 1 TO NUMREC.  "Current Record (Row) Number

****To validate PF No & IC/Passport No
    PERFORM VALIDATE_PERNR.

****To assign data to ITAB
    IF ERROR_FLAG <> 'X'.
      PERFORM ASSIGN_DATA.
    ENDIF.

    IF ERROR_FLAG <> 'X'.
      IF TEST_RUN NE 'X'.
        PERFORM FILL-DYNPROS.
      ENDIF.
******HASHING FOR ACCEPTED RECORDS
      ADD1        TO HEAD_COUNT,
           PERNR1   TO HASH_PERNR.
      APPEND ITAB.
    ELSE.
******HASHING FOR REJECTED RECORDS
      ADD1        TO HEAD_COUNT_RJ,
           PERNR1   TO HASH_PERNR_RJ.
    ENDIF.
****HASHING FOR ALL RECORDS
    ADD1        TO HEAD_COUNT_TT,
         PERNR1   TO HASH_PERNR_TT.

  ENDLOOP.

  "**Close BDC session
  IF TEST_RUN NE 'X'.
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    FORMAT COLOR COL_GROUP ON INTENSIFIED OFF.
    WRITE:/ 'Batch input session', MAPNAME, 'created'.
    FORMAT COLOR COL_GROUP OFF INTENSIFIED OFF.
    SKIP 2.
  ENDIF.

**PRINT HASHING SUMMARY
  PERFORM PRINT_HASHING_SUMMARY.

  WRITE:/ 'Record(s) with errors'.
  WRITE:/ '---------------------'.
  WRITE:/2(10'Record no.' , 14(60)'Error' , 76(10'PF No'88(11'Member Type'101(4'Wage Type',
            107(10'Start Date' , 119(8'End Date' , 129(14'Membership Fee' ,
            145(10'    Number' , 157(20'Unit' , 179(9'Payee Key'.
 WRITE:/2(10'----------' , 14(60)'-----' , 76(10'-----'88(11'-----------'101(4'---------',
            107(10'----------' , 119(8'--------' , 129(14'--------------' ,
            145(10'    ------' , 157(20'----' , 179(9'---------'.
  LOOP AT ERRTAB.
    WRITE:/2(10) ERRTAB-NUMREC , 14(60) ERRTAB-MESSG,  76(10) ERRTAB-PERNR, 88(11)  ITAB-SUBTY, 101(4)  ITAB-LGART,
            107(10) ITAB-BEGDA, 119(8) ITAB-ENDDA, 129(14) ITAB-BETRG,
            145(10) ITAB-ANZHL, 157(20) ITAB-ZEINH, 179(9) ITAB-EMFSL.
            "itab-icnum, "itab-mtgln.
  ENDLOOP.
END-OF-SELECTION.
"END-OF-SELECTION=========================


"======================REPORTS STARTS
**PRINT FOOTER
  PERFORM WRITE_FOOTER.
********************* REPORT HEADER *******************************
TOP-OF-PAGE.
  PAGENO = ' '.
  PERFORM WRITE_HEADER USING '0001' 'M' SY-DATUM
  SPACE '100213' ' HRIS, HRD' PAGENO.
  SKIP 2.
  INCLUDE ZPULRIA001.
"======================REPORTS ENDS
INCLUDE ZPYLBMA128_FORMS.
"--------------------------------------------------------------------------------------------------------------
"--------------------------------------------------------------------------------------------------------------
*&---------------------------------------------------------------------*
*&  Include           ZPYLBMA128_VARAIBLE
*&---------------------------------------------------------------------*

"DATA DECLARATION STARTS=========================
TABLES: PA0000,  "HR Master Record: Infotype 0000 (Actions)
        PA0001,  "HR Master Record: Infotype 0001 (Org. Assignment)
        PA0002,  "HR Master Record: Infotype 0002 (Personal Data)
        PA0185,  "HR Master Record: Infotype 0185 [Identification] (SG)
        T591S,   "Subtype Texts (for Member Type Text)
        T512T,   "Wage Type Texts
        T521B,   "Payee Keys
        T001,    "Company Codes
        SSCRFIELDS. "Fields on selection screens
** Table to hold all data row from flat file
DATABEGIN OF IDSN OCCURS 0,
        PERNR(08)   TYPE C,    "PF No.
        SUBTY(04)   TYPE C,    "Member Type (Sub-Type)
        LGART(04)   TYPE C,    "Wage Type
        BEGDA(08)   TYPE C,    "Start Date
        ENDDA(08)   TYPE C,    "End Date
        BETRG(13)   TYPE C,    "Membership Fee / Amount
        ANZHL(10)   TYPE C,    "Number
        ZEINH(20)   TYPE C,    "Unit
        EMFSL(08)   TYPE C,    "Payee Key
"        MTGLN(20)   TYPE C,    "Membership Number
"        ICNUM(30)   TYPE C,    "New IC
      END OF IDSN.
** Table to hold success data
DATABEGIN OF ITAB OCCURS 0,
        PERNR     LIKE P0000-PERNR,    "PF No.
        SUBTY     LIKE RP50G-SUBTY,    "Member Type (Sub-Type)
        LGART     LIKE P0057-LGART,    "Wage Type
        LGTXT     LIKE T512T-LGTXT,    "Wage Type Text*
        BEGDA(10TYPE C,              "Start Date
        ENDDA(10TYPE C,              "End Date
        BETRG     LIKE Q0057-BETRG,    "Membership Fee
        ANZHL     LIKE P0057-ANZHL,    "Number
        ZEINH     LIKE Q0057-EITXT,    "Unit

        EMFSL     LIKE P0057-EMFSL,    "Payee Key
        EMFNA     LIKE T521B-EMFNA,    "Payee Key Text*

"        STEXT     LIKE T591S-STEXT,    "Member Type Text
"        MTGLN     LIKE P0057-MTGLN,    "Membership Number
"        ICNUM     LIKE P0185-ICNUM,    "New IC
"        CNAME     LIKE P0002-CNAME,    "Staff Name
      END OF ITAB.
** Table to hold error data and error message
DATABEGIN OF ERRTAB OCCURS 0,
        NUMREC    TYPE I,
        MESSG(60TYPE C.
        INCLUDE STRUCTURE ITAB.
DATAEND OF ERRTAB.
* Table for Batch Input
DATABEGIN OF BDCDATA OCCURS 20.
        INCLUDE STRUCTURE BDCDATA.
DATAEND OF BDCDATA.
DATA: HEAD_COUNT    TYPE I,
      HEAD_COUNT_RJ TYPE I,
      HEAD_COUNT_TT TYPE I,
      HASH_PERNR    TYPE P,
      HASH_PERNR_RJ TYPE P,
      HASH_PERNR_TT TYPE P.
DATA: ILINE        TYPE I,
      NUMREC       TYPE I,            "Record (Row) Number
      ERROR_FLAG   TYPE C,            "Error Flag
"      BK_ICNUM(30) TYPE C,            "Unformatted IC Number
      PAGENO(1)    TYPE C,            "Page Number (Report)
"      TDATE(10)    TYPE C,            "To hold formatted date
      PERNR1       LIKE P0000-PERNR.  "Personnel Number
"      ICTYPE       LIKE P0185-ICTYP,  "Document Type
"      STARTDT      LIKE SY-DATUM.     "Hiring Start Date
DATA: REPNAME LIKE SY-REPID.
"DATA DECLARATION ENDS=========================

"--------------------------------------------------------------------------------------------------------------
"--------------------------------------------------------------------------------------------------------------
*&---------------------------------------------------------------------*
*&  Include           ZPYLBMA128_FORMS
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  assign_data
*&---------------------------------------------------------------------*
FORM ASSIGN_DATA.

  CLEAR ERROR_FLAG.

  MOVE-CORRESPONDING IDSN TO ITAB.

"**Retrieve Staff Name (Infotype 0002)
"  SELECT SINGLE * FROM PA0002 WHERE PERNR EQ ITAB-PERNR.
"  IF SY-SUBRC EQ 0.
"    ITAB-CNAME = PA0002-CNAME.                  "Store Staff Name
"    WRITE:/ PA0002-CNAME.
"  ELSE.
"    ERROR_FLAG = 'X'.
"    MOVE-CORRESPONDING IDSN TO ERRTAB.
"    ERRTAB-NUMREC = NUMREC.
"    ERRTAB-MESSG = 'Staff Name not found'.
"    APPEND ERRTAB. CLEAR ERRTAB.
"  ENDIF.

"**Retrieve Member Type Text
"  IF ERROR_FLAG NE 'X'.
"    SELECT SINGLE * FROM T591S WHERE SPRSL EQ 'EN'
"                                 AND INFTY = '0057'
"                                 AND SUBTY = ITAB-SUBTY.
"    IF SY-SUBRC EQ 0.
"      ITAB-STEXT = T591S-STEXT.
"    ELSE.
"      ERROR_FLAG = 'X'.
"      MOVE-CORRESPONDING IDSN TO ERRTAB.
"      ERRTAB-NUMREC = NUMREC.
"      ERRTAB-MESSG = 'Member Type not found'.
"      APPEND ERRTAB. CLEAR ERRTAB.
"    ENDIF.
"  ENDIF.

"**Wage Type Text
"  IF ERROR_FLAG NE 'X'.
"    SELECT SINGLE * FROM T512T WHERE SPRSL EQ 'EN'
"                                 AND MOLGA EQ '14'
"                                 AND LGART = ITAB-LGART.
"    IF SY-SUBRC EQ 0.
"      ITAB-LGTXT = T512T-LGTXT.
"    ELSE.
"      ERROR_FLAG = 'X'.
"      MOVE-CORRESPONDING IDSN TO ERRTAB.
"      ERRTAB-NUMREC = NUMREC.
"      ERRTAB-MESSG = 'Wage Type not found'.
"      APPEND ERRTAB. CLEAR ERRTAB.
"    ENDIF.
"  ENDIF.

"**Payee Key Text
"  IF ERROR_FLAG NE 'X'.

"    SELECT * FROM T521B INTO TABLE WA_T521B WHERE EMFSL EQ ITAB-EMFSL.

"    IF SY-SUBRC EQ 0.
"      SORT WA_T521B BY ENDDA DESCENDING.
"      LOOP AT WA_T521B.
"        ITAB-EMFNA = WA_T521B-EMFNA. EXIT.
"      ENDLOOP.
"    ELSE.
"      ERROR_FLAG = 'X'.
"      MOVE-CORRESPONDING IDSN TO ERRTAB.
"      ERRTAB-NUMREC = NUMREC.
"      ERRTAB-MESSG = 'Wage Type not found'.
"      APPEND ERRTAB. CLEAR ERRTAB.
"    ENDIF.
"  ENDIF.

ENDFORM.                    " assign_data
*&---------------------------------------------------------------------*
*&      Form  FILL-DYNPROS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM FILL-DYNPROS .
  PERFORM D1000.
  PERFORM D2000.
  CALL FUNCTION 'BDC_INSERT'
       EXPORTING
            TCODE     = 'PA30'
       TABLES
            DYNPROTAB = BDCDATA.

ENDFORM.                    " FILL-DYNPROS

FORM D1000.

  REFRESH BDCDATA.

  CLEAR BDCDATA.
  BDCDATA-PROGRAM  = 'SAPMP50A'.
  BDCDATA-DYNPRO   = '1000'.
  BDCDATA-DYNBEGIN = 'X'.
  APPEND BDCDATA.

**PF NO.
  CLEAR BDCDATA.
  BDCDATA-FNAM = 'RP50G-PERNR'.
  BDCDATA-FVAL = IDSN-PERNR.
  APPEND BDCDATA.

**INFOTYPE 0008
  CLEAR BDCDATA.
  BDCDATA-FNAM = 'RP50G-CHOIC'.
  BDCDATA-FVAL = '0057'.
  APPEND BDCDATA.

**SUBTYPE (Member Type)
  CLEAR BDCDATA.
  BDCDATA-FNAM = 'RP50G-SUBTY'.
  BDCDATA-FVAL = IDSN-SUBTY.
  APPEND BDCDATA.

  CLEAR BDCDATA.
  BDCDATA-FNAM = 'BDC_OKCODE'.
  BDCDATA-FVAL = '=INS'.
  APPEND BDCDATA.

ENDFORM.                    " d1000

*---------------------------------------------------------------------*
*       FORM  D2000
*---------------------------------------------------------------------*
FORM D2000.

  CLEAR BDCDATA.
  BDCDATA-PROGRAM  = 'MP005700'.
  BDCDATA-DYNPRO   = '2000'.
  BDCDATA-DYNBEGIN = 'X'.
  APPEND BDCDATA.

**START DATE
  CLEAR BDCDATA.
  BDCDATA-FNAM = 'P0057-BEGDA'.
  "WRITE IDSN-BEGDA TO BDCDATA-FVAL DD/MM/YYYY.
  CONCATENATE IDSN-BEGDA+6(2)  '.' IDSN-BEGDA+4(2'.'  IDSN-BEGDA+0(4INTO BDCDATA-FVAL.
  APPEND BDCDATA.

**END DATE
  CLEAR BDCDATA.
  BDCDATA-FNAM = 'P0057-ENDDA'.
  "WRITE IDSN-ENDDA TO BDCDATA-FVAL DD/MM/YYYY.
  CONCATENATE IDSN-ENDDA+6(2)  '.' IDSN-ENDDA+4(2'.'  IDSN-ENDDA+0(4INTO BDCDATA-FVAL.
  APPEND BDCDATA.

**Wage Type
  CLEAR BDCDATA.
  BDCDATA-FNAM = 'P0057-LGART'.
  BDCDATA-FVAL = IDSN-LGART.
  APPEND BDCDATA.

**Membership Fee
  CLEAR BDCDATA.
  BDCDATA-FNAM = 'Q0057-BETRG'.
  BDCDATA-FVAL = IDSN-BETRG.
  APPEND BDCDATA.

**Number
  CLEAR BDCDATA.
  BDCDATA-FNAM = 'P0057-ANZHL'.
  BDCDATA-FVAL = IDSN-ANZHL.
  APPEND BDCDATA.

**Unit
  CLEAR BDCDATA.
  BDCDATA-FNAM = 'Q0057-EITXT'.
  BDCDATA-FVAL = IDSN-ZEINH.
  APPEND BDCDATA.

**Payee Key
  CLEAR BDCDATA.
  BDCDATA-FNAM = 'P0057-EMFSL'.
  BDCDATA-FVAL = IDSN-EMFSL.
  APPEND BDCDATA.

"**Membership Number
"  CLEAR BDCDATA.
"  BDCDATA-FNAM = 'P0057-MTGLN'.
"  BDCDATA-FVAL = IDSN-MTGLN.
"  APPEND BDCDATA.

  CLEAR BDCDATA.
  BDCDATA-FNAM = 'BDC_OKCODE'.
  BDCDATA-FVAL = '=UPD'.
  APPEND BDCDATA.

ENDFORM.                    " d2000
*&---------------------------------------------------------------------*
*&      Form  print_hashing_summary
*&---------------------------------------------------------------------*
FORM PRINT_HASHING_SUMMARY.

  SKIP 3.
  WRITE: /20 'Accepted Records' COLOR COL_TOTAL,
          40 'Rejected Records' COLOR COL_TOTAL,
          60 '   Total Records' COLOR COL_TOTAL.
  WRITE: /20 '----------------'40 '----------------',
          60 '----------------'.
  WRITE: /02 'Head Count :',
          20(13) HEAD_COUNT,     40(13) HEAD_COUNT_RJ,
          60(13) HEAD_COUNT_TT.
  WRITE: /02 'Hash Pernr :',
          20(13) HASH_PERNR,     40(13) HASH_PERNR_RJ,
          60(13) HASH_PERNR_TT.
  SKIP 2.

ENDFORM.                    " print_hashing_summary
*&---------------------------------------------------------------------*
*&      Form  validate_pernr
*&---------------------------------------------------------------------*
FORM VALIDATE_PERNR.

  DATA: RETCD, RETCD1.

  ERROR_FLAG = SPACE.

**CHECK PERNR - PERSONNEL NUMBER
  PERFORM CHECK_PERNR USING PERNR1 RETCD.
  IF RETCD NE 0.
    ERROR_FLAG = 'X'.
    MOVE-CORRESPONDING IDSN TO ERRTAB.
    ERRTAB-NUMREC = NUMREC.
    ERRTAB-MESSG = 'PF number not found'.
    APPEND ERRTAB. CLEAR ERRTAB.
  ENDIF.

  CHECK RETCD EQ 0.

"  IF IDSN-ICNUM+6(1) EQ '-' AND IDSN-ICNUM+9(1) EQ '-'.
"****Subtype 'IC'
"    ICTYPE = '01'.
"    CONCATENATE IDSN-ICNUM+0(6) IDSN-ICNUM+7(2) IDSN-ICNUM+10(4)
"           INTO BK_ICNUM.
"  ELSE.
"****Subtype 'Passport'
"    ICTYPE = '02'.
"    MOVE IDSN-ICNUM TO BK_ICNUM.
"  ENDIF.

"  PERFORM VERIFY_DOCID USING PERNR1 ICTYPE BK_ICNUM RETCD1.
"  IF RETCD1 NE 0.
"    ERROR_FLAG = 'X'.
"    MOVE-CORRESPONDING IDSN TO ERRTAB.
"    ERRTAB-NUMREC = NUMREC.
"    ERRTAB-MESSG  = 'IC/Passport No. not found'.
"    APPEND ERRTAB. CLEAR ERRTAB.
"  ENDIF.

ENDFORM.                    " validate_pernr

FORM CHECK_PERNR USING PPERNR PRETCD.

**Check from Infortype 0000 (Action)
  SELECT * FROM PA0000 WHERE PERNR EQ PPERNR. EXITENDSELECT.
  PRETCD = SY-SUBRC.
  IF SY-SUBRC NE 0EXITENDIF.

**Check from Infotype 0001 (Organizational Assignment)
  SELECT * FROM PA0001 WHERE PERNR EQ PPERNR. EXITENDSELECT.
  PRETCD = SY-SUBRC.

ENDFORM.


"--------------------------------------------------------------------------------------------------------------
"--------------------------------------------------------------------------------------------------------------
***INCLUDE ZPULRIA001 .
*----------------------------------------------------------------------
* Report header
*----------------------------------------------------------------------
FORM WRITE_HEADER USING VALUE(RBUKRS) VALUE(RTYPE)  VALUE(RDATE)
                        VALUE(RTITL2) VALUE(RBRHCD) VALUE(RBRH)
                        RINDC.
DATA: CBUTXT(25), TITLEN TYPE I, OUTDATE(10), REPDATE(10).
DATA: BUKLEN TYPE I.
STATICS: CPAGNO(4).
  IF RINDC = 'X'. CPAGNO = 0. RINDC = SPACE. ENDIF.
  ADD 1 TO CPAGNO.
  IF RBUKRS = 'G'.
    CBUTXT = 'MAYBANK GROUP'.
  ELSE.
    PERFORM RE001 USING RBUKRS CBUTXT.
  ENDIF.
  CALL FUNCTION 'Z_CONV_DATE_TO_SLASH_FMT'
       EXPORTING
            IDATE     = SY-DATUM
            INDICATOR = '1'
       IMPORTING
            ODATE   = OUTDATE.
  CALL FUNCTION 'Z_CONV_DATE_TO_SLASH_FMT'
       EXPORTING
            IDATE   = RDATE
            INDICATOR = '1'
       IMPORTING
            ODATE   = REPDATE.

* Line 1
  TRANSLATE CBUTXT TO UPPER CASE.
  TRANSLATE SY-TITLE TO UPPER CASE.
  BUKLEN = STRLEN( CBUTXT ). BUKLEN = 32 - BUKLEN. BUKLEN = BUKLEN / 2.
  TITLEN = STRLEN( SY-TITLE ). TITLEN = 69 - TITLEN.TITLEN = TITLEN / 2.
  TITLEN = TITLEN + 34 - BUKLEN.
  WRITE:/1 '1',2 CBUTXT.
  WRITE AT TITLEN SY-TITLE.
* cpagno = sy-pagno. shift cpagno right deleting trailing space.
  SHIFT CPAGNO RIGHT DELETING TRAILING SPACE.
  WRITE:100 'RUN DATE  :'112 OUTDATE, 122 'PAGE:'127 CPAGNO.

* Line 2
  IF RTYPE = 'B'.
    WRITE:/2 'BRANCH'9 RBRHCD, 15 RBRH.
  ELSEIF RTYPE = 'P'.
    WRITE:/2 'P.AREA'  , 9 RBRHCD, 17 RBRH.
  ELSEIF RTYPE = 'R'.
    WRITE:/2 'REGION'  , 9 RBRHCD, 17 RBRH.
  ELSEIF RTYPE = 'N'WRITE /2 ' '.       "Blank - don't have to display
  ELSE.
    WRITE:/2 'DEPT'  , 9 RBRHCD, 17 RBRH.
  ENDIF.

  IF NOT RTITL2 IS INITIAL.
    BUKLEN = STRLEN( RBRH ). BUKLEN = 36 - BUKLEN. BUKLEN = BUKLEN / 2.
    TITLEN = STRLEN( RTITL2 ). TITLEN = 52 - TITLEN.TITLEN = TITLEN / 2.
    TITLEN = TITLEN + 50 - BUKLEN.
    WRITE AT TITLEN RTITL2.
    WRITE100 'REPORT NO :'115 SY-REPID.
    WRITE:/51 'REPORT DATE :'65 REPDATE.
  ELSE.
    WRITE51 'REPORT DATE :'65 REPDATE.
    WRITE100 'REPORT NO :'115 SY-REPID.
  ENDIF.
ENDFORM.

*----------------------------------------------------------------------
* Read T001 to get company description
*----------------------------------------------------------------------
FORM RE001 USING VALUE(TBUKRS) TBUTXT.
CLEAR: TBUTXT, T001.
SELECT SINGLE * FROM T001 WHERE BUKRS EQ TBUKRS.
IF SY-SUBRC EQ 0. TBUTXT = T001-BUTXT. ENDIF.
ENDFORM.

*----------------------------------------------------------------------
* Report footer
*----------------------------------------------------------------------
FORM WRITE_FOOTER.
  SKIP 2.
  WRITE:/2 '*** END OF REPORT ***'.
ENDFORM.
Read On 0 comments

message

Labels

NuffNang

Search google

Blog Archive

My Blog List

Twitter

Message

Followers