Thursday, 29 March 2018

Mail Configuration









Process in CSS

CN43N
SBWP - SAP Inbox
SOST  to outlook.
SCOT - Mail Configuration.

Billing Type:
1. Time and Material Billing

  ex: Resource based  ( Employee Hourly based Billing ), No of transaction ( ex: No of calls attended)
  project managers bill the clients for actual work rather than estimated work.
  software industries or call centers .

2.Fixed price:

 a)Everymonth  amount is fixed  ( not based  on resource or transaction )
 b)Billing is fixed which is milestone.
   As each milestone is successfully reached, the customer is billed either a percentage of
   the entire project cost or simply a pre-defined amount. ( not based  on resource or transaction )
 
  Mile stone billing is part of PROJECT SYSTEMS MODULE integrated with SD.
  The fixed cost billing is preferable when both the client and the vendor are entering into a relationship for the first time

Client should be able to share his clear vision of the product with developers to ensure appropriate final results.

  SOW - Statement of work.
  Once quotation Finalized , SOW will be signed based on terms and conditions of contract.

  Whenever New SOW signed we need to do following steps in SAP.

  project Creation  Tcode CJ20N
  Material Creation Tcode MM01  ( not 18 digit only 6 digit material ).
  Maintain Pricing  for Material  based on condition Table VK11.
  Create SKF ( Satistical Key Figure )  in KK01
   Note1: Key Figure category Buttons a) if Fixed Val select, Then  we can not edit price.
                                      b) if Tot val select, Then  we can  edit.
   Note2:Key figure name is equal to Material Number.
 
  SKF and Material linking via Tcode odp1.
    Note1: SKF and Material must be equal ( Maximum digit is 6 ).

  SKF posting to WBS or we can say project via Tcode KB31
    Note1: BAPI_ACC_STAT_KEY_FIG_POST  is used for automation.
       BAPI_TRANSACTION_COMMIT,
   BAPI_TRANSACTION_ROLLBACK.
 
VA21 - Quotation Creation ( Service Quotation )
  It contains  material , Sales UOM, Purchase order Number ( SOW number ) , PO date , Ship to party , Sold to party , Account assignments,
  Pricing condition  and Scchedule lines.

  number range start with 2

VA22 : Quotation approval via workflow or manual . Once quotation approved we can not change.


VA41 -> Contract Creation  for Corresponding Quotation or without Quotation Create contract

number range start with 4



  Note1: BAPI_CONTRACT_CREATEFROMDATA. Here there is no Order quantity field . So inorder to create contract successfully,
         we should use below enhancement in FM SD_SALESDOCUMENT_CREATE.

*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1  ZVA41_UPDATE_ORDER_QTY.    "active version

DATA : MID3(4),
       GV_TCODE TYPE SY-TCODE.
IMPORT GV_TCODE TO GV_TCODE FROM MEMORY ID MID3.
CLEAR : MID3.

IF GV_TCODE = 'ZVA41'.
LOOP AT SALES_ITEMS_IN.
      SALES_SCHEDULES_IN-ITM_NUMBER = SALES_ITEMS_IN-ITM_NUMBER.
      SALES_SCHEDULES_IN-SCHED_LINE = SALES_ITEMS_IN-ITM_NUMBER.
      SALES_SCHEDULES_IN-REQ_QTY = SALES_ITEMS_IN-TARGET_QTY.
      APPEND SALES_SCHEDULES_IN.
ENDLOOP.

ENDIF.


ENDENHANCEMENT.

please also refer my timesheet submitted to csscorp .
 Note2 :In Upload program  we should write below one to make enhancement valid.

        gv_tcode = sy-tcode.
      EXPORT gv_tcode FROM gv_tcode TO MEMORY ID mid3.

KB31 - SKF posting to wbs.


DP91 ->  Billing Request for Contract  or we can use VA01 for Fixed bit.

  Note1: After SKF posting in KB31 Then only Billing request can create in DP91.

  Note2: Number range for skf posting document number start with 2.

  Note3: After Raise Billing Request we can view sale order in VA02


 VF01 : Billing Creation  with DP91 document number
 VF02 : Release Billing for accounting.


 Subcontract Process Implementattion:

 1.  configure new action for subcontract employee with new employee group and employee sub group
 and new payscale area and payscale type.


 2. New Service Master Creation in T-code AC02.

   via BDC.
 
   Activity Number = employee number
 
   Activity number is nothing but service number in service PO.
 
   Important parameters are Activity Number,Service category , Material group, Unit of measure (meins) and Valuation class.
 
 
 3. Create Service PO using ME21n T-code.

 Note: BAPI_PO_CREATE1 is main Bapi to create Service PO and also BAPI_TRANSACTION_COMMIT.

  Additional FMS:F4_FILENAME.
                 TEXT_CONVERT_XLS_TO_SAP.
                 CONVERSION_EXIT_ALPHA_INPUT to convert vendor,G/L, and costcenter.
                 CONVERT_DATE_TO_INTERNAL    to convert date.
REUSE_ALV_GRID_DISPLAY.

4. Create Service Sheet for corresponding service PO using ML81N.

  Additional FMS: BAPI_PO_GETDETAIL
                  BAPI_ENTRYSHEET_CREATE
  

Friday, 9 February 2018

SPLIT and Search and string length and concatenate Example and also date conversion



DATA lv_start_date TYPE sy-datum,
       lv_end_date   TYPE sy-datum.

DATA lv_sep1(3),lv_sep2(3),lv_sep3(3).
DATA lv_day(2),lv_month(2),lv_year(4).





 SEARCH gs_final-end_date FOR lv_sep1.
      IF sy-subrc 0.
        SPLIT gs_final-end_date AT '.' INTO lv_day lv_month lv_year.
        IF strlenlv_day 1.
          CONCATENATE '0' lv_day INTO lv_day.
        ENDIF.
        IF strlenlv_month 1.
          CONCATENATE '0' lv_month INTO lv_month.
        ENDIF.
      ENDIF.




 SEARCH gs_final-start_date FOR lv_sep2.
      IF sy-subrc 0.
        SPLIT gs_final-start_date AT '-' INTO lv_day lv_month lv_year.
      ENDIF.

      SEARCH gs_final-end_date FOR lv_sep3.
      IF sy-subrc 0.
        SPLIT gs_final-start_date AT '/' INTO lv_day lv_month lv_year.
      ENDIF.

      CONCATENATE lv_year lv_month lv_day INTO gs_final-start_date.
      MOVE gs_final-start_date TO lv_start_date.





Monday, 5 February 2018

Infotype 0008 and 21 and 16 in HR with Function Module exits


1.Go PA40 and find  program name  via system - status
2.Double click on program - after that Go to menu object directory find package name

In SE84 - Go under enhancements





*&---------------------------------------------------------------------*
*&  Include           ZXPARAU02
*&---------------------------------------------------------------------*

DATA ls_008 TYPE pa0008.

SELECT SINGLE FROM pa0008 INTO ls_008 WHERE pernr personnel_number
                                        AND   begda LE salary_as_of_date
                                        AND   endda GE salary_as_of_date.
IF sy-subrc 0.
  it0008_salary ls_008-ansal.
ENDIF.





*&---------------------------------------------------------------------*
*&  Include           ZXPADU01
*&---------------------------------------------------------------------*

IF innnn-infty '0021'.
  DATA ls_0021  TYPE p0021.

  FIELD-SYMBOLS <fs_0021> TYPE p0021.

  ASSIGN ls_0021 TO <fs_0021>.
  CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
    EXPORTING
      prelp innnn
    IMPORTING
      pnnnn <fs_0021>.
  IF <fs_0021> IS ASSIGNED.
    IF <fs_0021>-subty '11'.
      <fs_0021>-fasex 1.
      CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
        EXPORTING
          pnnnn <fs_0021>
        IMPORTING
          prelp innnn.
    ENDIF.
  ENDIF.

ELSEIF innnn-infty '0016'.

  DATA ls_0016  TYPE p0016.

  FIELD-SYMBOLS <fs_0016> TYPE p0016.

  ASSIGN ls_0016 TO <fs_0016>.
  CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
    EXPORTING
      prelp innnn
    IMPORTING
      pnnnn <fs_0016>.
  IF <fs_0016> IS ASSIGNED.
    <fs_0016>-cttyp '10'.
    <fs_0016>-prbzt 6.
    <fs_0016>-prbeh '012'.
    <fs_0016>-kdgfr space.
    <fs_0016>-kdgf2 space.
    CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
      EXPORTING
        pnnnn <fs_0016>
      IMPORTING
        prelp innnn.
  ENDIF.
ENDIF.




*
**&---------------------------------------------------------------------*
**&  Include           ZXPADU02
**&---------------------------------------------------------------------*
******* Validation for External Employee
******** Added by chellam - 08.05.2015 Req by Sivasankar
*DATA : lv_vendor TYPE ekko-lifnr,
*       lv_ebeln  TYPE ekpo-ebeln,
*       lv_ebelp  TYPE ekpo-ebelp,
*       lv_kostl  TYPE p0315-kostl,
*       lv_lstar  TYPE p0315-lstar,
*       lv_werks  TYPE ekpo-werks.
*CLEAR : lv_vendor , lv_ebeln , lv_ebelp,lv_kostl,lv_lstar,lv_werks.
*
*FIELD-SYMBOLS: <f0008> TYPE any.
*
*DATA: p0008     TYPE p0008,
*      gs_p0001 type pa0001,
*      gs_pa0002 TYPE pa0002.
**IF INNNN-INFTY = '0008'.
**  ASSIGN innnn to <f0008>.
***move innnn to p0008.
*
**endif.
**break testing.
*
**IF sy-uname = 'TESTABAP'.
*IF innnn-infty = '0315'.
**  IF I503-PERSK = 'Z3'.
**  IF INNNN-DATA1 IS NOT INITIAL.
**    LV_VENDOR = INNNN-DATA1+26(10).
**    LV_EBELN = INNNN-DATA1+36(10).
**    LV_EBELP = INNNN-DATA1+46(5).
**    IF LV_VENDOR IS INITIAL.
**      SET CURSOR FIELD 'P0315-LIFNR'.
**      MESSAGE 'Vendor Number Missing' TYPE 'E'.
**      EXIT.
**    ELSEIF LV_EBELN IS INITIAL.
**      SET CURSOR FIELD 'P0315-EBELN'.
**      MESSAGE 'Purchase Order Number Missing' TYPE 'E'.
**      EXIT.
**    ENDIF.
**  ENDIF.
**  ELSE
*  IF i503-persk <> 'Z3'.
**    BREAK TESTABAP.
*    IF innnn-data1 IS NOT INITIAL.
*      lv_kostl = innnn-data1+0(10).
*      lv_lstar = innnn-data1+10(5).
*      lv_werks = innnn-data1+22(4).
*      IF lv_kostl IS INITIAL.
*        SET CURSOR FIELD 'P0315-KOSTL'.
*        MESSAGE 'Cost Center Missing in Infotype 315' TYPE 'E'.
*        EXIT.
*      ELSEIF lv_lstar IS INITIAL.
*        SET CURSOR FIELD 'P0315-LSTAR'.
*        MESSAGE 'Activity Type Missing in Infotype 315' TYPE 'E'.
*        EXIT.
*      ELSEIF lv_werks IS INITIAL.
*        SET CURSOR FIELD 'P0315-WERKS'.
*        MESSAGE 'Plant is Missing in Infotype 315' TYPE 'E'.
*        EXIT.
*      ENDIF.
*    ENDIF.
*  ENDIF.
*ENDIF.
**ENDIF.
*
*IF innnn-infty = '0008' .
*
*  SELECT single * from pa0001 into gs_p0001 where pernr = innnn-pernr and begda le innnn-begda  and endda le innnn-endda.
*
*    if sy-subrc = 0.
*
*      if gs_p0001-bukrs+0(2) ne 'IN'.
*         EXIT.
*
*      endif.
*      endif.
*
****IF sy-ucomm = ' '.
*  DATA :lv_tpa   TYPE p DECIMALS 2,
*        lv_1004  TYPE p DECIMALS 2, "added by raviteja
*        lv_1008  TYPE p DECIMALS 2, "added by raviteja
*        lv_1000  TYPE p DECIMALS 2, "added by raviteja
*        lv_basic TYPE p DECIMALS 2,
*        lv_sumbb TYPE p DECIMALS 0,
*        cnt_wage TYPE i. "added by raviteja
*  DATA: gs_basicpay TYPE zhr_basic_amount.
*
*  DATA :gv_lgart TYPE p0008-lga01,
*        gv_betrg TYPE p0008-bet01.
*
*  FIELD-SYMBOLS: <fs_betrg> TYPE p0008-bet01,
*                 <fs_lgart> TYPE p0008-lga01.
*
*  DATA: lv_tpa1       TYPE p DECIMALS 2,
*        gv_tpa_change TYPE p DECIMALS 0,
*        flag          TYPE c. " FOR 1004 WAGE TYPE LGART NO INITIAL.
*
*
*  CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
*    EXPORTING
*      prelp = innnn
*    IMPORTING
*      pnnnn = p0008.
*
*  IF p0008-ansal IS NOT INITIAL.
********** addded by chellam - 02.06.2015
*    DATA: it_dynpread TYPE STANDARD TABLE OF dynpread,
*          wa_dynpread TYPE dynpread,
*          lv_repid    TYPE sy-repid,
*          lv_dynnr    TYPE sy-dynnr.
*
***********************************************************************************************
*    CLEAR : it_dynpread[].
*    lv_repid = 'MP000800'.
*    lv_dynnr = '0300'.
*    CALL FUNCTION 'DYNP_VALUES_READ'
*      EXPORTING
*        dyname     = lv_repid
*        dynumb     = lv_dynnr
*        request    = 'A'
*      TABLES
*        dynpfields = it_dynpread.
*
*    LOOP AT it_dynpread INTO wa_dynpread WHERE fieldname = 'Q0008-BETRG' AND stepl = 2
*                                               AND fieldvalue IS INITIAL.
*      show_data_again  = 'X'.
*    ENDLOOP.
*
*    CLEAR: lv_tpa. "added by raviteja
*
*    DO 10 TIMES VARYING gv_lgart FROM p0008-lga01 NEXT p0008-lga02
*          VARYING gv_betrg FROM p0008-bet01 NEXT p0008-bet02.
*      IF ( gv_lgart = '/TPA' ) AND ( p0008-ansal IS NOT INITIAL ).
*
*        IF p0008-trfgr+0(1)  = 'A'.
*          lv_tpa = p0008-ansal * 25 / 100.
*          EXIT.
*        ELSEIF  p0008-trfgr+0(1)  = 'B'.
*          lv_tpa = p0008-ansal * 20 / 100.
*          EXIT.
*        ELSEIF  p0008-trfgr+0(1)  = 'C'.
*          lv_tpa = p0008-ansal * 15 / 100.
*          EXIT.
*        ELSEIF  p0008-trfgr+0(1)  = 'D'.
*          lv_tpa = p0008-ansal * 10 / 100.
*          EXIT.
*        ELSEIF  p0008-trfgr+0(1)  = 'E'.
*          lv_tpa = p0008-ansal * 5 / 100.
*          EXIT.
*        ELSEIF  p0008-trfgr+0(1)  = 'F' or p0008-trfgr+0(3)  = 'CEO' or p0008-trfgr+0(3)  = 'EVP'.
*          lv_tpa = p0008-ansal. " No Variable pay
*        ENDIF.
*      ENDIF.
*    ENDDO.
*  ENDIF. " by raviteja
*
*
*  IF lv_tpa IS NOT INITIAL. " by raviteja
*
*    IF p0008-trfgr+0(1)  = 'F' or p0008-trfgr+0(3)  = 'CEO' or p0008-trfgr+0(3)  = 'EVP'.
*      lv_tpa = 0.  " No variable pay " by raviteja
*    ENDIF.
*    lv_tpa1 = ( p0008-ansal - lv_tpa ) / 12.
*
*****    CLEAR: gv_tpa_change.
*****    LOOP AT it_dynpread INTO wa_dynpread WHERE fieldname = 'Q0008-BETRG' AND stepl = 1.
*****      " AND fieldvalue IS INITIAL.
*****
*****      REPLACE ALL OCCURRENCES OF ',' IN wa_dynpread-fieldvalue WITH space.
*****      CONDENSE wa_dynpread-fieldvalue NO-GAPS.
*****
*****      MOVE wa_dynpread-fieldvalue TO gv_tpa_change.
*****
*****      IF lv_tpa1 <> gv_tpa_change.
*****
*****        show_data_again  = 'X'.
*****
*****      ENDIF.
*
**** show again action based on total value-Q0008-SUMBB
*    LOOP AT it_dynpread INTO wa_dynpread WHERE fieldname = 'Q0008-SUMBB' AND stepl = 0
*                                                               AND fieldvalue IS NOT INITIAL.
*
*      REPLACE ALL OCCURRENCES OF ',' IN wa_dynpread-fieldvalue WITH space.
*      CONDENSE wa_dynpread-fieldvalue NO-GAPS.
*      MOVE wa_dynpread-fieldvalue TO gv_tpa_change.
*      lv_sumbb = p0008-ansal / 12.
*      IF lv_sumbb <> gv_tpa_change.
*        show_data_again  = 'X'.
*      ENDIF.
*    ENDLOOP.
*
*    lv_1008 = ( lv_tpa / 12 ). "added by raviteja
*
*    lv_basic = ( lv_tpa1 * 30 ) / 100.
*
*    IF lv_basic < 3100.
*      lv_1004 = 620.
*
**** Fetching basic pay
*      SELECT SINGLE * FROM zhr_basic_amount INTO gs_basicpay WHERE lgart = '1000' AND endda = '99991231'.
*      IF sy-subrc = 0.
*        lv_1000 = gs_basicpay-betrg.
*      ENDIF.
*
*    ELSEIF lv_basic >= 3100 AND lv_basic <= 3500.
*      lv_1004 = ( lv_basic * 20 ) / 100.
*    ELSEIF lv_basic > lv_1004 AND lv_basic < 10000.
*      lv_1004 = 700.
*    ELSEIF lv_basic >= 10000.
*      lv_1004 = ' '.
***      p0008-lga06 = ' '.
*    ENDIF.
*
*    p0008-bet01 = lv_tpa1. "added by raviteja
*
***** fOR VARIABLE PAY
*    CLEAR cnt_wage.
*    DO 10 TIMES VARYING gv_lgart FROM p0008-lga01 NEXT p0008-lga02
*          VARYING gv_betrg FROM p0008-bet01 NEXT p0008-bet02.
*****      cnt_wage = cnt_wage + 1.
*
*      ASSIGN gv_lgart TO <fs_lgart>.
*      ASSIGN gv_betrg TO <fs_betrg>.
*      IF gv_lgart = '1008'.
*        IF lv_1008 IS NOT INITIAL.
*          <fs_betrg> = lv_1008.        "added by raviteja
*        ELSE.
*          <fs_lgart> = ' '.
*          <fs_betrg> = lv_1008.
*        ENDIF.
*****        EXIT.
*      ENDIF.
*      IF gv_lgart = '1004'.
*        IF lv_1004 IS NOT INITIAL.
*          <fs_betrg> = lv_1004.        "added by raviteja
*          flag = 'X'.
*****        EXIT.
*        ELSE.
*          <fs_lgart> = ' '.
*        ENDIF.
*      ENDIF.
*
*      IF gv_lgart = '1000'.
*        IF lv_1000 IS NOT INITIAL.
*          <fs_betrg> = lv_1000.        "added by raviteja
*****        EXIT.
*        ELSE.
*          <fs_betrg> = ' '.
*        ENDIF.
*      ENDIF.
*
*      IF lv_1004 IS NOT INITIAL.
*        IF gv_lgart IS INITIAL AND flag = ' '.
*          <fs_lgart> = '1004'.
*          <fs_betrg> = lv_1004.
*          EXIT.
*        ENDIF.
*      ENDIF.
*
*    ENDDO.
****endif.
****** Variable Compensation distribution **************************************
*    IF sy-ucomm = 'UPD'.
*
*      SUBMIT zhrcss_variable_compensation WITH pnppernr = p0008-pernr
*                                          WITH pnpbegda = p0008-begda
*                                          WITH pnpendda = p0008-endda
*                                          WITH p_ansal = p0008-ansal
*                                          WITH p_trfgr = p0008-trfgr
*                                          WITH p_trfst = p0008-trfst
*                                          WITH p_vrsal = lv_tpa
*                                           AND RETURN.
**********************************************************************************
*    ENDIF.
*    cl_hr_pnnnn_type_cast=>pnnnn_to_prelp(
*                    EXPORTING
*                      pnnnn  = p0008
*                    IMPORTING
*                      prelp  = innnn ).
*
*  ENDIF.
****  ENDIF.
*ENDIF.
*
*
********************,,BEGIN OF PRAMODH CHANGES FOR INFOTYPE 80 AND 2001 ************************************************************
*******FOR VALIDATING THE MATERNITY LEAVE MORE THAN 2 CHILDRENS
*
*
*IF innnn-infty = '0080' .
**  BREAK-POINT.
*
**  if sy-ucomm = 'INS'.
*
*  SELECT SINGLE * FROM pa0002 INTO gs_pa0002  WHERE pernr = innnn-pernr
*                                                   AND begda LE sy-datum
*                                                   AND  endda GE sy-datum.
*
*  IF ( sy-subrc = 0 ) AND ( gs_pa0002-anzkd GE 2 ).
*
*    MESSAGE 'You are not allowdd to Apply this Leave type ' TYPE 'E'.
*
**  ENDIF.
*
*  ENDIF.
*
**  BREAK-POINT.
*
*ENDIF.
*
*
*IF innnn-infty = '2001' .
**  BREAK-POINT.
*
**  if sy-ucomm = 'INS'.
*
*  RANGES r_awart FOR  p2001-awart. "for ladies
*  RANGES: m_awart FOR  p2001-awart, "for GENTS
*          n_awart FOR p2001-awart,
*          w_awart FOR p2001-awart,
*          wF_awart FOR p2001-awart .
*          .
*
*  r_awart-sign = 'I'.
*  r_awart-option = 'EQ'.
*  r_awart-low = '4040'.
*  APPEND r_awart.
*
*  r_awart-sign = 'I'.
*  r_awart-option = 'EQ'.
*  r_awart-low = '4060'.
*  APPEND r_awart.
*  r_awart-sign = 'I'.
*  r_awart-option = 'EQ'.
*  r_awart-low = '4070'.
*  APPEND r_awart.
*  r_awart-sign = 'I'.
*  r_awart-option = 'EQ'.
*  r_awart-low = '4080'.
*  APPEND r_awart.
*
*
*  m_awart-sign = 'I'.
*  m_awart-option = 'EQ'.
*  m_awart-low = '4050'.
*  APPEND m_awart.
*
*  n_awart-sign = 'I'.
*  n_awart-option = 'EQ'.
*  n_awart-low = '4030'.
*  APPEND n_awart.
*
****  range added by wilson
****FOR MALE***
*  w_awart-sign = 'I'.
*  w_awart-option = 'EQ'.
*  w_awart-low = '4630'.
*  APPEND w_awart.
*
*  w_awart-sign = 'I'.
*  w_awart-option = 'EQ'.
*  w_awart-low = '4820'.
*  APPEND w_awart.
*
*  w_awart-sign = 'I'.
*  w_awart-option = 'EQ'.
*  w_awart-low = '2830'.
*  APPEND w_awart.
*
****FOR FEMALE***
*   wF_awart-sign = 'I'.
*  wF_awart-option = 'EQ'.
*  wF_awart-low = '4825'.
*  APPEND wF_awart.
*
*   wF_awart-sign = 'I'.
*  wF_awart-option = 'EQ'.
*  wF_awart-low = '4830'.
*  APPEND wF_awart.
*
*   wF_awart-sign = 'I'.
*  wF_awart-option = 'EQ'.
*  wF_awart-low = '4835'.
*  APPEND wF_awart.
*
*   wF_awart-sign = 'I'.
*  wF_awart-option = 'EQ'.
*  wF_awart-low = '2825'.
*  APPEND wF_awart.
*
*    wF_awart-sign = 'I'.
*  wF_awart-option = 'EQ'.
*  wF_awart-low = '2835'.
*  APPEND wF_awart.
*
**************************** END OF CODE ADDED
*************begin of more than 2 childrens*************
*  SELECT SINGLE * FROM pa0002 INTO gs_pa0002  WHERE pernr = innnn-pernr
*                                                   AND begda LE sy-datum
*                                                   AND  endda GE sy-datum.
*
*  IF ( sy-subrc = 0 ) AND  (  innnn-subty IN r_awart ).
*
*    IF gs_pa0002-gesch NE 2.
*
*      MESSAGE 'Leave type not Allowed wrong Gender' TYPE 'E'.
*      EXIT.
*
*
*    ELSEIF  ( gs_pa0002-anzkd GE 2 ) .
*
*
*      MESSAGE 'You are not allowdd to Apply this Leave type ' TYPE 'E'.
*      EXIT.
*
*    ENDIF.
*
*  ELSEIF ( sy-subrc = 0 ) AND  (  innnn-subty IN m_awart ).
*
*    IF gs_pa0002-gesch NE 1.
*
*      MESSAGE 'Leave type not Allowed wrong Gender' TYPE 'E'.
*      EXIT.
*
*    ELSEIF  ( gs_pa0002-anzkd GE 2 ) .
*
*
*      MESSAGE 'You are not allowdd to Apply this Leave type ' TYPE 'E'.
*      EXIT.
*
*    ENDIF.
*
*
*  ELSEIF  ( sy-subrc = 0 ) AND  (  INNNN-SUBTY IN W_AWART ).
*
*     IF gs_pa0002-gesch NE 1.
*
*      MESSAGE 'Leave type not Allowed wrong Gender' TYPE 'E'.
*      EXIT.
*     ENDIF .
*
*  ELSEIF  ( sy-subrc = 0 ) AND  (  INNNN-SUBTY IN WF_AWART ).
*
*     IF gs_pa0002-gesch NE 2.
*
*      MESSAGE 'Leave type not Allowed wrong Gender' TYPE 'E'.
*      EXIT.
*     ENDIF .
*
*
*  ELSEIF (  innnn-subty IN n_awart ).
*    IF  ( gs_pa0002-gbdat+4(4) NE  innnn-begda+4(4) ) .
*
*      IF  ( ( gs_pa0002-famdt+4(4) NE  innnn-begda+4(4) ) ) .
*        MESSAGE: 'Please check your date of birth or marriage Date' TYPE 'E'.
*        EXIT.
*
*      ENDIF.
*    ENDIF.
*
*  ENDIF.
*
*ENDIF.
*
*
************************************END OF PRAMODH CHANGES*******************************************************


IF innnn-infty '0008'.
  DATA ls_0008  TYPE p0008,
         gv_ansal TYPE ansal_15,
         gt_lgart TYPE STANDARD TABLE OF zlgart.

  FIELD-SYMBOLS <fs_0008> TYPE p0008.

  ASSIGN ls_0008 TO <fs_0008>.
  CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
    EXPORTING
      prelp innnn
    IMPORTING
      pnnnn <fs_0008>.

  IF sy-subrc AND i001p-molga '10'.
    SELECT FROM zlgart INTO TABLE gt_lgart.
    READ TABLE gt_lgart TRANSPORTING NO FIELDS WITH KEY lgart <fs_0008>-lga01.
    IF sy-subrc 0.
      gv_ansal <fs_0008>-bet01 * 10 26.
      IF <fs_0008>-ansal NE gv_ansal.
        <fs_0008>-ansal gv_ansal.
        CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
          EXPORTING
            pnnnn <fs_0008>
          IMPORTING
            prelp innnn.
        show_data_again  'X'.
      ENDIF.
    ENDIF.
  ENDIF.
ENDIF.



*
**&---------------------------------------------------------------------*
**&  Include           ZXPADU02
**&---------------------------------------------------------------------*
******* Validation for External Employee
******** Added by chellam - 08.05.2015 Req by Sivasankar
*DATA : lv_vendor TYPE ekko-lifnr,
*       lv_ebeln  TYPE ekpo-ebeln,
*       lv_ebelp  TYPE ekpo-ebelp,
*       lv_kostl  TYPE p0315-kostl,
*       lv_lstar  TYPE p0315-lstar,
*       lv_werks  TYPE ekpo-werks.
*CLEAR : lv_vendor , lv_ebeln , lv_ebelp,lv_kostl,lv_lstar,lv_werks.
*
*FIELD-SYMBOLS: <f0008> TYPE any.
*
*DATA: p0008     TYPE p0008,
*      gs_p0001 type pa0001,
*      gs_pa0002 TYPE pa0002.
**IF INNNN-INFTY = '0008'.
**  ASSIGN innnn to <f0008>.
***move innnn to p0008.
*
**endif.
**break testing.
*
**IF sy-uname = 'TESTABAP'.
*IF innnn-infty = '0315'.
**  IF I503-PERSK = 'Z3'.
**  IF INNNN-DATA1 IS NOT INITIAL.
**    LV_VENDOR = INNNN-DATA1+26(10).
**    LV_EBELN = INNNN-DATA1+36(10).
**    LV_EBELP = INNNN-DATA1+46(5).
**    IF LV_VENDOR IS INITIAL.
**      SET CURSOR FIELD 'P0315-LIFNR'.
**      MESSAGE 'Vendor Number Missing' TYPE 'E'.
**      EXIT.
**    ELSEIF LV_EBELN IS INITIAL.
**      SET CURSOR FIELD 'P0315-EBELN'.
**      MESSAGE 'Purchase Order Number Missing' TYPE 'E'.
**      EXIT.
**    ENDIF.
**  ENDIF.
**  ELSE
*  IF i503-persk <> 'Z3'.
**    BREAK TESTABAP.
*    IF innnn-data1 IS NOT INITIAL.
*      lv_kostl = innnn-data1+0(10).
*      lv_lstar = innnn-data1+10(5).
*      lv_werks = innnn-data1+22(4).
*      IF lv_kostl IS INITIAL.
*        SET CURSOR FIELD 'P0315-KOSTL'.
*        MESSAGE 'Cost Center Missing in Infotype 315' TYPE 'E'.
*        EXIT.
*      ELSEIF lv_lstar IS INITIAL.
*        SET CURSOR FIELD 'P0315-LSTAR'.
*        MESSAGE 'Activity Type Missing in Infotype 315' TYPE 'E'.
*        EXIT.
*      ELSEIF lv_werks IS INITIAL.
*        SET CURSOR FIELD 'P0315-WERKS'.
*        MESSAGE 'Plant is Missing in Infotype 315' TYPE 'E'.
*        EXIT.
*      ENDIF.
*    ENDIF.
*  ENDIF.
*ENDIF.
**ENDIF.
*
*IF innnn-infty = '0008' .
*
*  SELECT single * from pa0001 into gs_p0001 where pernr = innnn-pernr and begda le innnn-begda  and endda le innnn-endda.
*
*    if sy-subrc = 0.
*
*      if gs_p0001-bukrs+0(2) ne 'IN'.
*         EXIT.
*
*      endif.
*      endif.
*
****IF sy-ucomm = ' '.
*  DATA :lv_tpa   TYPE p DECIMALS 2,
*        lv_1004  TYPE p DECIMALS 2, "added by raviteja
*        lv_1008  TYPE p DECIMALS 2, "added by raviteja
*        lv_1000  TYPE p DECIMALS 2, "added by raviteja
*        lv_basic TYPE p DECIMALS 2,
*        lv_sumbb TYPE p DECIMALS 0,
*        cnt_wage TYPE i. "added by raviteja
*  DATA: gs_basicpay TYPE zhr_basic_amount.
*
*  DATA :gv_lgart TYPE p0008-lga01,
*        gv_betrg TYPE p0008-bet01.
*
*  FIELD-SYMBOLS: <fs_betrg> TYPE p0008-bet01,
*                 <fs_lgart> TYPE p0008-lga01.
*
*  DATA: lv_tpa1       TYPE p DECIMALS 2,
*        gv_tpa_change TYPE p DECIMALS 0,
*        flag          TYPE c. " FOR 1004 WAGE TYPE LGART NO INITIAL.
*
*
*  CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
*    EXPORTING
*      prelp = innnn
*    IMPORTING
*      pnnnn = p0008.
*
*  IF p0008-ansal IS NOT INITIAL.
********** addded by chellam - 02.06.2015
*    DATA: it_dynpread TYPE STANDARD TABLE OF dynpread,
*          wa_dynpread TYPE dynpread,
*          lv_repid    TYPE sy-repid,
*          lv_dynnr    TYPE sy-dynnr.
*
***********************************************************************************************
*    CLEAR : it_dynpread[].
*    lv_repid = 'MP000800'.
*    lv_dynnr = '0300'.
*    CALL FUNCTION 'DYNP_VALUES_READ'
*      EXPORTING
*        dyname     = lv_repid
*        dynumb     = lv_dynnr
*        request    = 'A'
*      TABLES
*        dynpfields = it_dynpread.
*
*    LOOP AT it_dynpread INTO wa_dynpread WHERE fieldname = 'Q0008-BETRG' AND stepl = 2
*                                               AND fieldvalue IS INITIAL.
*      show_data_again  = 'X'.
*    ENDLOOP.
*
*    CLEAR: lv_tpa. "added by raviteja
*
*    DO 10 TIMES VARYING gv_lgart FROM p0008-lga01 NEXT p0008-lga02
*          VARYING gv_betrg FROM p0008-bet01 NEXT p0008-bet02.
*      IF ( gv_lgart = '/TPA' ) AND ( p0008-ansal IS NOT INITIAL ).
*
*        IF p0008-trfgr+0(1)  = 'A'.
*          lv_tpa = p0008-ansal * 25 / 100.
*          EXIT.
*        ELSEIF  p0008-trfgr+0(1)  = 'B'.
*          lv_tpa = p0008-ansal * 20 / 100.
*          EXIT.
*        ELSEIF  p0008-trfgr+0(1)  = 'C'.
*          lv_tpa = p0008-ansal * 15 / 100.
*          EXIT.
*        ELSEIF  p0008-trfgr+0(1)  = 'D'.
*          lv_tpa = p0008-ansal * 10 / 100.
*          EXIT.
*        ELSEIF  p0008-trfgr+0(1)  = 'E'.
*          lv_tpa = p0008-ansal * 5 / 100.
*          EXIT.
*        ELSEIF  p0008-trfgr+0(1)  = 'F' or p0008-trfgr+0(3)  = 'CEO' or p0008-trfgr+0(3)  = 'EVP'.
*          lv_tpa = p0008-ansal. " No Variable pay
*        ENDIF.
*      ENDIF.
*    ENDDO.
*  ENDIF. " by raviteja
*
*
*  IF lv_tpa IS NOT INITIAL. " by raviteja
*
*    IF p0008-trfgr+0(1)  = 'F' or p0008-trfgr+0(3)  = 'CEO' or p0008-trfgr+0(3)  = 'EVP'.
*      lv_tpa = 0.  " No variable pay " by raviteja
*    ENDIF.
*    lv_tpa1 = ( p0008-ansal - lv_tpa ) / 12.
*
*****    CLEAR: gv_tpa_change.
*****    LOOP AT it_dynpread INTO wa_dynpread WHERE fieldname = 'Q0008-BETRG' AND stepl = 1.
*****      " AND fieldvalue IS INITIAL.
*****
*****      REPLACE ALL OCCURRENCES OF ',' IN wa_dynpread-fieldvalue WITH space.
*****      CONDENSE wa_dynpread-fieldvalue NO-GAPS.
*****
*****      MOVE wa_dynpread-fieldvalue TO gv_tpa_change.
*****
*****      IF lv_tpa1 <> gv_tpa_change.
*****
*****        show_data_again  = 'X'.
*****
*****      ENDIF.
*
**** show again action based on total value-Q0008-SUMBB
*    LOOP AT it_dynpread INTO wa_dynpread WHERE fieldname = 'Q0008-SUMBB' AND stepl = 0
*                                                               AND fieldvalue IS NOT INITIAL.
*
*      REPLACE ALL OCCURRENCES OF ',' IN wa_dynpread-fieldvalue WITH space.
*      CONDENSE wa_dynpread-fieldvalue NO-GAPS.
*      MOVE wa_dynpread-fieldvalue TO gv_tpa_change.
*      lv_sumbb = p0008-ansal / 12.
*      IF lv_sumbb <> gv_tpa_change.
*        show_data_again  = 'X'.
*      ENDIF.
*    ENDLOOP.
*
*    lv_1008 = ( lv_tpa / 12 ). "added by raviteja
*
*    lv_basic = ( lv_tpa1 * 30 ) / 100.
*
*    IF lv_basic < 3100.
*      lv_1004 = 620.
*
**** Fetching basic pay
*      SELECT SINGLE * FROM zhr_basic_amount INTO gs_basicpay WHERE lgart = '1000' AND endda = '99991231'.
*      IF sy-subrc = 0.
*        lv_1000 = gs_basicpay-betrg.
*      ENDIF.
*
*    ELSEIF lv_basic >= 3100 AND lv_basic <= 3500.
*      lv_1004 = ( lv_basic * 20 ) / 100.
*    ELSEIF lv_basic > lv_1004 AND lv_basic < 10000.
*      lv_1004 = 700.
*    ELSEIF lv_basic >= 10000.
*      lv_1004 = ' '.
***      p0008-lga06 = ' '.
*    ENDIF.
*
*    p0008-bet01 = lv_tpa1. "added by raviteja
*
***** fOR VARIABLE PAY
*    CLEAR cnt_wage.
*    DO 10 TIMES VARYING gv_lgart FROM p0008-lga01 NEXT p0008-lga02
*          VARYING gv_betrg FROM p0008-bet01 NEXT p0008-bet02.
*****      cnt_wage = cnt_wage + 1.
*
*      ASSIGN gv_lgart TO <fs_lgart>.
*      ASSIGN gv_betrg TO <fs_betrg>.
*      IF gv_lgart = '1008'.
*        IF lv_1008 IS NOT INITIAL.
*          <fs_betrg> = lv_1008.        "added by raviteja
*        ELSE.
*          <fs_lgart> = ' '.
*          <fs_betrg> = lv_1008.
*        ENDIF.
*****        EXIT.
*      ENDIF.
*      IF gv_lgart = '1004'.
*        IF lv_1004 IS NOT INITIAL.
*          <fs_betrg> = lv_1004.        "added by raviteja
*          flag = 'X'.
*****        EXIT.
*        ELSE.
*          <fs_lgart> = ' '.
*        ENDIF.
*      ENDIF.
*
*      IF gv_lgart = '1000'.
*        IF lv_1000 IS NOT INITIAL.
*          <fs_betrg> = lv_1000.        "added by raviteja
*****        EXIT.
*        ELSE.
*          <fs_betrg> = ' '.
*        ENDIF.
*      ENDIF.
*
*      IF lv_1004 IS NOT INITIAL.
*        IF gv_lgart IS INITIAL AND flag = ' '.
*          <fs_lgart> = '1004'.
*          <fs_betrg> = lv_1004.
*          EXIT.
*        ENDIF.
*      ENDIF.
*
*    ENDDO.
****endif.
****** Variable Compensation distribution **************************************
*    IF sy-ucomm = 'UPD'.
*
*      SUBMIT zhrcss_variable_compensation WITH pnppernr = p0008-pernr
*                                          WITH pnpbegda = p0008-begda
*                                          WITH pnpendda = p0008-endda
*                                          WITH p_ansal = p0008-ansal
*                                          WITH p_trfgr = p0008-trfgr
*                                          WITH p_trfst = p0008-trfst
*                                          WITH p_vrsal = lv_tpa
*                                           AND RETURN.
**********************************************************************************
*    ENDIF.
*    cl_hr_pnnnn_type_cast=>pnnnn_to_prelp(
*                    EXPORTING
*                      pnnnn  = p0008
*                    IMPORTING
*                      prelp  = innnn ).
*
*  ENDIF.
****  ENDIF.
*ENDIF.
*
*
********************,,BEGIN OF PRAMODH CHANGES FOR INFOTYPE 80 AND 2001 ************************************************************
*******FOR VALIDATING THE MATERNITY LEAVE MORE THAN 2 CHILDRENS
*
*
*IF innnn-infty = '0080' .
**  BREAK-POINT.
*
**  if sy-ucomm = 'INS'.
*
*  SELECT SINGLE * FROM pa0002 INTO gs_pa0002  WHERE pernr = innnn-pernr
*                                                   AND begda LE sy-datum
*                                                   AND  endda GE sy-datum.
*
*  IF ( sy-subrc = 0 ) AND ( gs_pa0002-anzkd GE 2 ).
*
*    MESSAGE 'You are not allowdd to Apply this Leave type ' TYPE 'E'.
*
**  ENDIF.
*
*  ENDIF.
*
**  BREAK-POINT.
*
*ENDIF.
*
*
*IF innnn-infty = '2001' .
**  BREAK-POINT.
*
**  if sy-ucomm = 'INS'.
*
*  RANGES r_awart FOR  p2001-awart. "for ladies
*  RANGES: m_awart FOR  p2001-awart, "for GENTS
*          n_awart FOR p2001-awart,
*          w_awart FOR p2001-awart,
*          wF_awart FOR p2001-awart .
*          .
*
*  r_awart-sign = 'I'.
*  r_awart-option = 'EQ'.
*  r_awart-low = '4040'.
*  APPEND r_awart.
*
*  r_awart-sign = 'I'.
*  r_awart-option = 'EQ'.
*  r_awart-low = '4060'.
*  APPEND r_awart.
*  r_awart-sign = 'I'.
*  r_awart-option = 'EQ'.
*  r_awart-low = '4070'.
*  APPEND r_awart.
*  r_awart-sign = 'I'.
*  r_awart-option = 'EQ'.
*  r_awart-low = '4080'.
*  APPEND r_awart.
*
*
*  m_awart-sign = 'I'.
*  m_awart-option = 'EQ'.
*  m_awart-low = '4050'.
*  APPEND m_awart.
*
*  n_awart-sign = 'I'.
*  n_awart-option = 'EQ'.
*  n_awart-low = '4030'.
*  APPEND n_awart.
*
****  range added by wilson
****FOR MALE***
*  w_awart-sign = 'I'.
*  w_awart-option = 'EQ'.
*  w_awart-low = '4630'.
*  APPEND w_awart.
*
*  w_awart-sign = 'I'.
*  w_awart-option = 'EQ'.
*  w_awart-low = '4820'.
*  APPEND w_awart.
*
*  w_awart-sign = 'I'.
*  w_awart-option = 'EQ'.
*  w_awart-low = '2830'.
*  APPEND w_awart.
*
****FOR FEMALE***
*   wF_awart-sign = 'I'.
*  wF_awart-option = 'EQ'.
*  wF_awart-low = '4825'.
*  APPEND wF_awart.
*
*   wF_awart-sign = 'I'.
*  wF_awart-option = 'EQ'.
*  wF_awart-low = '4830'.
*  APPEND wF_awart.
*
*   wF_awart-sign = 'I'.
*  wF_awart-option = 'EQ'.
*  wF_awart-low = '4835'.
*  APPEND wF_awart.
*
*   wF_awart-sign = 'I'.
*  wF_awart-option = 'EQ'.
*  wF_awart-low = '2825'.
*  APPEND wF_awart.
*
*    wF_awart-sign = 'I'.
*  wF_awart-option = 'EQ'.
*  wF_awart-low = '2835'.
*  APPEND wF_awart.
*
**************************** END OF CODE ADDED
*************begin of more than 2 childrens*************
*  SELECT SINGLE * FROM pa0002 INTO gs_pa0002  WHERE pernr = innnn-pernr
*                                                   AND begda LE sy-datum
*                                                   AND  endda GE sy-datum.
*
*  IF ( sy-subrc = 0 ) AND  (  innnn-subty IN r_awart ).
*
*    IF gs_pa0002-gesch NE 2.
*
*      MESSAGE 'Leave type not Allowed wrong Gender' TYPE 'E'.
*      EXIT.
*
*
*    ELSEIF  ( gs_pa0002-anzkd GE 2 ) .
*
*
*      MESSAGE 'You are not allowdd to Apply this Leave type ' TYPE 'E'.
*      EXIT.
*
*    ENDIF.
*
*  ELSEIF ( sy-subrc = 0 ) AND  (  innnn-subty IN m_awart ).
*
*    IF gs_pa0002-gesch NE 1.
*
*      MESSAGE 'Leave type not Allowed wrong Gender' TYPE 'E'.
*      EXIT.
*
*    ELSEIF  ( gs_pa0002-anzkd GE 2 ) .
*
*
*      MESSAGE 'You are not allowdd to Apply this Leave type ' TYPE 'E'.
*      EXIT.
*
*    ENDIF.
*
*
*  ELSEIF  ( sy-subrc = 0 ) AND  (  INNNN-SUBTY IN W_AWART ).
*
*     IF gs_pa0002-gesch NE 1.
*
*      MESSAGE 'Leave type not Allowed wrong Gender' TYPE 'E'.
*      EXIT.
*     ENDIF .
*
*  ELSEIF  ( sy-subrc = 0 ) AND  (  INNNN-SUBTY IN WF_AWART ).
*
*     IF gs_pa0002-gesch NE 2.
*
*      MESSAGE 'Leave type not Allowed wrong Gender' TYPE 'E'.
*      EXIT.
*     ENDIF .
*
*
*  ELSEIF (  innnn-subty IN n_awart ).
*    IF  ( gs_pa0002-gbdat+4(4) NE  innnn-begda+4(4) ) .
*
*      IF  ( ( gs_pa0002-famdt+4(4) NE  innnn-begda+4(4) ) ) .
*        MESSAGE: 'Please check your date of birth or marriage Date' TYPE 'E'.
*        EXIT.
*
*      ENDIF.
*    ENDIF.
*
*  ENDIF.
*
*ENDIF.
*
*
************************************END OF PRAMODH CHANGES*******************************************************


IF innnn-infty '0008'.
  DATA ls_0008  TYPE p0008,
         gv_ansal TYPE ansal_15,
         gt_lgart TYPE STANDARD TABLE OF zlgart.

  FIELD-SYMBOLS <fs_0008> TYPE p0008.

  ASSIGN ls_0008 TO <fs_0008>.
  CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
    EXPORTING
      prelp innnn
    IMPORTING
      pnnnn <fs_0008>.

  IF sy-subrc AND i001p-molga '10'.
    SELECT FROM zlgart INTO TABLE gt_lgart.
    READ TABLE gt_lgart TRANSPORTING NO FIELDS WITH KEY lgart <fs_0008>-lga01.
    IF sy-subrc 0.
      gv_ansal <fs_0008>-bet01 * 10 26.
      IF <fs_0008>-ansal NE gv_ansal.
        <fs_0008>-ansal gv_ansal.
        CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
          EXPORTING
            pnnnn <fs_0008>
          IMPORTING
            prelp innnn.
        show_data_again  'X'.
      ENDIF.
    ENDIF.
  ENDIF.
ENDIF.