Skip to Content
author's profile photo Former Member
Former Member

Z Table is not updating

Hi Friends,

We have developed one program for Medicla claim. All the calculations going fine and when we are going for debug all the values are correct.

But the values not getting updated in Ztable. Some times it is updateing and some times it is not.

Will somebody please help me on this issue

Kumar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 07:24 AM

    Hi

    before modifyinf any database table we need to LOCK and after modifying we need to UNLOCK it

    like thsi

    constants: lc_tabname TYPE rstable-tabname VALUE 'FKKVKP' . "FKKVKP

    CALL FUNCTION 'ENQUEUE_E_TABLE'

    EXPORTING

    tabname = lc_tabname

    EXCEPTIONS

    foreign_lock = 1

    system_failure = 2

    OTHERS = 3.

    IF sy-subrc EQ 0.

    modify dbtable from itab.

    endif.

    perform unlock_table.

    FORM unlock_table using uc_tabname type rstable-tabname .

    CALL FUNCTION 'DEQUEUE_E_TABLE'

    EXPORTING

    TABNAME = uc_tabname .

    ENDFORM. " unlock_table

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 07:28 AM

    Hi Naren,

    I have tried that also, but still it is not updating the table

    Is there any other thing we need to check

    Kumar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 07:28 AM

    if you don't mind paste ur code here i will tell u what changes you need to do in that

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 07:31 AM

    &----


    *& Report ZHR_MEDICALREIMB_PROG

    *&

    &----


    *&

    *&

    &----


    REPORT ZHR_MEDICALREIMB_PROG.

    TABLES: PERNR,ZPY_MEDICAL_PAY.

    INFOTYPES: 0001, 0008, 9010, 0015, 0000.

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

    • Types

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

    TYPES: BEGIN OF T_ZPY_MEDICAL_PAY.

    INCLUDE STRUCTURE ZPY_MEDICAL_PAY.

    TYPES: END OF T_ZPY_MEDICAL_PAY.

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

    • Internal Table

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

    DATA: GIT_ZPY_MEDICAL_PAY TYPE STANDARD TABLE OF T_ZPY_MEDICAL_PAY.

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

    • Work Area

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

    DATA: GWA_ZPY_MEDICAL_PAY TYPE T_ZPY_MEDICAL_PAY.

    DATA:WA_P0008 TYPE PA0008.

    DATA:LGA01 LIKE P0008-LGA01,

    BET01 LIKE P0008-BET01,

    BAS LIKE P0008-BET01,

    DEA LIKE P0008-BET01,

    SWG LIKE P0008-BET01,

    PIS LIKE P0008-BET01,

    SPA LIKE P0008-BET01,

    CCA LIKE P0008-BET01,

    CEA LIKE P0008-BET01,

    TOT LIKE P0008-BET01,

    TOT1 LIKE P0008-BET01,

    TOTAL LIKE P0008-BET01,

    VME LIKE P0008-BET01,

    FMREA LIKE P0008-BET01,

    MDAYS TYPE /OSP/DT_DAY,

    NODAYS TYPE P DECIMALS 2,

    NODAYS1 TYPE P DECIMALS 2,

    CAL1 LIKE P0008-BET01,

    AMOUNT LIKE P0008-BET01,

    CAL2 LIKE P0008-BET01,

    AMOUNT1 LIKE P0008-BET01.

    DATA: G_BEGDA TYPE D,

    G_ENDDA TYPE D.

    TYPES: BEGIN OF T_FMR,

    PERNR TYPE PERSNO,

    SUBTY TYPE SUBTY,

    ENDDA TYPE ENDDA,

    BEGDA TYPE BEGDA,

    CLAIM_TYPE TYPE P9010-CLAIM_TYPE,

    BILL_AMOUNT TYPE P9010-BILL_AMOUNT,

    END OF T_FMR.

    DATA: GIT_FMR TYPE TABLE OF T_FMR,

    GWA_FMR LIKE LINE OF GIT_FMR.

    DATA: TOTFMR TYPE P9010-BILL_AMOUNT.

    *TYPES: BEGIN OF T_TFMR,

    • PERNR TYPE PERSNO,

    • SUBTY TYPE SUBTY,

    • ENDDA TYPE ENDDA,

    • BEGDA TYPE BEGDA,

    • CLAIM_TYPE TYPE P9010-CLAIM_TYPE,

    • TOTFMR TYPE P9010-BILL_AMOUNT,

    • END OF T_TFMR.

    *

    *DATA: GIT_TFMR TYPE TABLE OF T_TFMR,

    • GWA_TFMR LIKE LINE OF GIT_TFMR.

    TYPES: BEGIN OF T_VMR,

    PERNR TYPE PERSNO,

    SUBTY TYPE SUBTY,

    ENDDA TYPE ENDDA,

    BEGDA TYPE BEGDA,

    CLAIM_TYPE TYPE P9010-CLAIM_TYPE,

    BILL_AMOUNT TYPE P9010-BILL_AMOUNT,

    END OF T_VMR.

    DATA: GIT_VMR TYPE TABLE OF T_VMR,

    GWA_VMR LIKE LINE OF GIT_VMR.

    DATA: TOTVMR TYPE P9010-BILL_AMOUNT.

    *TYPES: BEGIN OF T_TVMR,

    • PERNR TYPE PERSNO,

    • SUBTY TYPE SUBTY,

    • ENDDA TYPE ENDDA,

    • BEGDA TYPE BEGDA,

    • CLAIM_TYPE TYPE P9010-CLAIM_TYPE,

    • TOTVMR TYPE P9010-BILL_AMOUNT,

    • END OF T_TVMR.

    *

    *DATA: GIT_TVMR TYPE TABLE OF T_TVMR,

    • GWA_TVMR LIKE LINE OF GIT_TVMR.

    TYPES: BEGIN OF T_ABDAYS,

    PERNR TYPE PERSNO,

    SUBTY TYPE SUBTY,

    ENDDA TYPE ENDDA,

    BEGDA TYPE BEGDA,

    ABWTG TYPE P2001-ABWTG,

    END OF T_ABDAYS.

    DATA: GIT_ABDAYS TYPE TABLE OF T_ABDAYS,

    GWA_ABDAYS LIKE LINE OF GIT_ABDAYS.

    DATA: TOTABDAYS TYPE P2001-ABWTG.

    *TYPES: BEGIN OF T_TABDAYS,

    • PERNR TYPE PERSNO,

    • SUBTY TYPE SUBTY,

    • ENDDA TYPE ENDDA,

    • BEGDA TYPE BEGDA,

    • TOTABDAYS TYPE P2001-ABWTG,

    • END OF T_TABDAYS.

    *

    *DATA: GIT_TABDAYS TYPE TABLE OF T_TABDAYS,

    • GWA_TABDAYS LIKE LINE OF GIT_TABDAYS.

    TYPES: BEGIN OF T_FINAL,

    PERNR TYPE PERSNO,

    CLAIM_TYPE1(4) TYPE C,

    MONTH1(2) TYPE C,

    YEAR1(4) TYPE C,

    ELIG_AMOUNT TYPE P9010-BILL_AMOUNT,

    NO_OF_DAYS TYPE P DECIMALS 2,

    BILL_AMOUNT TYPE P9010-BILL_AMOUNT,

    AMOUNT TYPE P9010-BILL_AMOUNT,

    PAID_AMOUNT TYPE P9010-BILL_AMOUNT,

    BAL_TO_PAID TYPE P9010-BILL_AMOUNT,

    BILLS_BAL TYPE P9010-BILL_AMOUNT,

    END OF T_FINAL.

    DATA: GIT_FINAL TYPE TABLE OF T_FINAL,

    GWA_FINAL LIKE LINE OF GIT_FINAL.

    TYPES: BEGIN OF T_FINAL1,

    PERNR TYPE PERSNO,

    CLAIM_TYPE1(4) TYPE C,

    MONTH1(2) TYPE C,

    YEAR1(4) TYPE C,

    ELIG_AMOUNT TYPE P9010-BILL_AMOUNT,

    NO_OF_DAYS TYPE P DECIMALS 2,

    BILL_AMOUNT TYPE P9010-BILL_AMOUNT,

    AMOUNT TYPE P9010-BILL_AMOUNT,

    PAID_AMOUNT TYPE P9010-BILL_AMOUNT,

    BAL_TO_PAID TYPE P9010-BILL_AMOUNT,

    BILLS_BAL TYPE P9010-BILL_AMOUNT,

    END OF T_FINAL1.

    DATA: GIT_FINAL1 TYPE TABLE OF T_FINAL1,

    GWA_FINAL1 LIKE LINE OF GIT_FINAL1.

    DATA: L_DATE1 TYPE D,

    P_DATE TYPE D.

    DATA: MONTH(2) TYPE C,

    YEAR(4) TYPE C,

    PBAL TYPE P9010-BILL_AMOUNT,

    PBBAL TYPE P9010-BILL_AMOUNT,

    VAR1 TYPE P9010-BILL_AMOUNT,

    VAR2 TYPE P9010-BILL_AMOUNT,

    PAMOUNT TYPE P9010-BILL_AMOUNT,

    BALTOPAID TYPE P9010-BILL_AMOUNT ,

    BILLBAL TYPE P9010-BILL_AMOUNT ,

    PBAL1 TYPE P9010-BILL_AMOUNT,

    PBBAL1 TYPE P9010-BILL_AMOUNT,

    VAR3 TYPE P9010-BILL_AMOUNT,

    VAR4 TYPE P9010-BILL_AMOUNT,

    PAMOUNT1 TYPE P9010-BILL_AMOUNT,

    BALTOPAID1 TYPE P9010-BILL_AMOUNT ,

    BILLBAL1 TYPE P9010-BILL_AMOUNT .

    DATA: TEMPV1 TYPE P0015-BETRG,

    TEMPV2 TYPE P0015-BETRG.

    DATA: G_DOJ TYPE P0000-BEGDA,

    G_DOL TYPE P0000-BEGDA,

    G_BEGDA1 TYPE P0000-BEGDA,

    G_BEGDA2 TYPE P0000-BEGDA,

    DATEDIFF TYPE P,

    DATEDIFF1 TYPE P,

    DATETOT TYPE P.

    • DEFINING SELECTION SCREEN *****

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE T1.

    SELECTION-SCREEN SKIP 1.

    SELECTION-SCREEN BEGIN OF LINE.

    SELECTION-SCREEN COMMENT 1(31) TEXT-000.

    PARAMETERS: P_MONTH(2) TYPE N OBLIGATORY,

    P_YEAR(4) TYPE N OBLIGATORY.

    SELECTION-SCREEN COMMENT 45(10) TEXT-001.

    SELECTION-SCREEN END OF LINE.

    PARAMETERS: P_PYAREA TYPE PERNR-ABKRS OBLIGATORY.

    *SELECT-OPTIONS : I_PERNR FOR PERNR-PERNR .

    *PARAMETER : I_PERNR LIKE PERNR-PERNR .

    SELECTION-SCREEN END OF BLOCK B1.

    AT SELECTION-SCREEN.

    IF P_MONTH NOT BETWEEN 1 AND 12.

    MESSAGE E001(ZHR_EXTRAHR_MSG).

    ENDIF.

    IF P_YEAR = 9999.

    MESSAGE E002(ZHR_EXTRAHR_MSG).

    ENDIF.

    INITIALIZATION.

    T1 = 'Enter period for which running the payroll'.

    START-OF-SELECTION.

    *GET PERNR.

    PERFORM GET_BEGDA_ENDDA.

    GET PERNR.

    IF PERNR-ABKRS = P_PYAREA." OR PERNR-ABKRS = 'EX'.

    SELECT SINGLE * FROM PA0008 INTO WA_P0008 WHERE PERNR EQ PERNR-PERNR "IN I_PERNR

    AND ENDDA GE G_BEGDA AND BEGDA LE G_ENDDA.

    IF SY-SUBRC = 0 .

    GWA_ZPY_MEDICAL_PAY-PERNR = WA_P0008-PERNR.

    DO 40 TIMES VARYING LGA01 FROM WA_P0008-LGA01

    NEXT WA_P0008-LGA02

    VARYING BET01 FROM WA_P0008-BET01

    NEXT WA_P0008-BET02.

    IF LGA01 = '1FMR'.

    • GWA_ZPY_MEDICAL_PAY-CLAIM_TYPE1 = LGA01.

    • GWA_ZPY_MEDICAL_PAY-ELIG_AMOUNT = BET01.

    • APPEND GWA_ZPY_MEDICAL_PAY TO GIT_ZPY_MEDICAL_PAY.

    • CLEAR: GWA_ZPY_MEDICAL_PAY.

    FMREA = BET01.

    ENDIF.

    IF LGA01 = '1BAS'.

    BAS = BET01.

    ENDIF.

    IF LGA01 = '1DEA'.

    DEA = BET01.

    ENDIF.

    IF LGA01 = '1SWG'.

    SWG = BET01.

    ENDIF.

    IF LGA01 = '1PIS'.

    PIS = BET01.

    ENDIF.

    IF LGA01 = '1SPA'.

    SPA = BET01.

    ENDIF.

    IF LGA01 = '1CEA'.

    CEA = BET01.

    ENDIF.

    • IF LGA01 = '1VME'.

    • GWA_ZPY_MEDICAL_PAY-CLAIM_TYPE1 = LGA01.

    • GWA_ZPY_MEDICAL_PAY-ELIG_AMOUNT = VME.

    • APPEND GWA_ZPY_MEDICAL_PAY TO GIT_ZPY_MEDICAL_PAY.

    • CLEAR: GWA_ZPY_MEDICAL_PAY-CLAIM_TYPE1, GWA_ZPY_MEDICAL_PAY-ELIG_AMOUNT.

    • ENDIF.

    ENDDO.

    IF P0008-TRFGR = 'WS01' OR

    P0008-TRFGR = 'WS02' OR

    P0008-TRFGR = 'WS03' OR

    P0008-TRFGR = 'WS04' OR

    P0008-TRFGR = 'WS05' OR

    P0008-TRFGR = 'WS06' OR

    P0008-TRFGR = 'WS07' OR

    P0008-TRFGR = 'WS08'.

    TOT = BAS + DEA + SWG + PIS + SPA + CEA.

    TOT1 = BAS * '0.06'.

    TOTAL = TOT + TOT1.

    VME = TOTAL * '0.05'.

    ENDIF.

    • GWA_ZPY_MEDICAL_PAY-CLAIM_TYPE1 = '1VME'.

    • GWA_ZPY_MEDICAL_PAY-ELIG_AMOUNT = VME.

    • APPEND GWA_ZPY_MEDICAL_PAY TO GIT_ZPY_MEDICAL_PAY.

    • CLEAR: GWA_ZPY_MEDICAL_PAY.

    ENDIF.

    • ENDIF.

    • LOOP AT P0000 WHERE PERNR = PERNR-PERNR AND MASSN = 'B1'.

    • G_DOJ = P0000-BEGDA.

    • ENDLOOP.

    *

    • LOOP AT P0000 WHERE PERNR = PERNR-PERNR AND MASSN = 'B6'.

    • G_DOL = P0000-BEGDA.

    • ENDLOOP.

    SELECT PERNR

    SUBTY

    BEGDA

    ENDDA

    CLAIM_TYPE

    BILL_AMOUNT

    FROM PA9010

    INTO TABLE GIT_FMR

    WHERE PERNR EQ PERNR-PERNR "IN I_PERNR

    AND SUBTY EQ '0001'

    AND ENDDA BETWEEN G_BEGDA AND G_ENDDA

    AND BEGDA BETWEEN G_BEGDA AND G_ENDDA.

    • IF SY-SUBRC = 0.

    • ENDIF.

    CLEAR: TOTFMR.

    LOOP AT GIT_FMR INTO GWA_FMR.

    IF GWA_FMR-SUBTY EQ '0001'.

    • IF SY-SUBRC = 0.

    TOTFMR = TOTFMR + GWA_FMR-BILL_AMOUNT.

    • ELSE.

    • TOTFMR = '0.00'.

    • ENDIF.

    • ELSE.

    • TOTVMR = TOTVMR + GWA_VMR-BILL_AMOUNT.

    ENDIF.

    ENDLOOP.

    • else.

    • totfmr = '0.00'.

    • endif.

    SELECT PERNR

    SUBTY

    BEGDA

    ENDDA

    CLAIM_TYPE

    BILL_AMOUNT

    FROM PA9010

    INTO TABLE GIT_VMR

    WHERE PERNR EQ PERNR-PERNR "IN I_PERNR

    AND SUBTY EQ '0002'

    AND ENDDA BETWEEN G_BEGDA AND G_ENDDA

    AND BEGDA BETWEEN G_BEGDA AND G_ENDDA.

    • IF SY-SUBRC = 0.

    • ENDIF.

    CLEAR:TOTVMR.

    LOOP AT GIT_VMR INTO GWA_VMR.

    IF GWA_VMR-SUBTY EQ '0002'.

    • IF SY-SUBRC = 0.

    • TOTFMR = TOTFMR + GWA_FMR-BILL_AMOUNT.

    • ELSE.

    TOTVMR = TOTVMR + GWA_VMR-BILL_AMOUNT.

    • ELSE.

    • TOTVMR = '0.00'.

    • ENDIF.

    ENDIF.

    ENDLOOP.

    • else.

    • totvmr = '0.00'.

    • endif.

    SELECT PERNR

    SUBTY

    BEGDA

    ENDDA

    ABWTG

    FROM PA2001

    INTO TABLE GIT_ABDAYS

    WHERE PERNR EQ PERNR-PERNR "IN I_PERNR

    AND SUBTY EQ 'LW'

    AND ENDDA BETWEEN G_BEGDA AND G_ENDDA

    AND BEGDA BETWEEN G_BEGDA AND G_ENDDA.

    CLEAR TOTABDAYS.

    LOOP AT GIT_ABDAYS INTO GWA_ABDAYS.

    TOTABDAYS = TOTABDAYS + GWA_ABDAYS-ABWTG.

    ENDLOOP.

    CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'

    EXPORTING

    IV_DATE = G_BEGDA

    IMPORTING

    EV_DAYS = MDAYS.

    NODAYS1 = MDAYS - TOTABDAYS.

    LOOP AT P0000 WHERE PERNR = PERNR-PERNR AND MASSN = 'B1'.

    G_DOJ = P0000-BEGDA.

    ENDLOOP.

    LOOP AT P0000 WHERE PERNR = PERNR-PERNR AND MASSN = 'B6'.

    G_DOL = P0000-BEGDA.

    ENDLOOP.

    IF G_DOJ GT G_BEGDA .

    CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'

    EXPORTING

    DATE1 = G_BEGDA

    • TIME1 =

    DATE2 = G_DOJ

    • TIME2 =

    IMPORTING

    DATEDIFF = DATEDIFF

    • TIMEDIFF =

    • EARLIEST =

    • EXCEPTIONS

    • INVALID_DATETIME = 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.

    ELSE.

    DATEDIFF = 0.

    ENDIF.

    IF G_ENDDA GT G_DOL .

    DATEDIFF1 = 0.

    ELSE.

    CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'

    EXPORTING

    DATE1 = G_ENDDA

    • TIME1 =

    DATE2 = G_DOL

    • TIME2 =

    IMPORTING

    DATEDIFF = DATEDIFF1

    • TIMEDIFF =

    • EARLIEST =

    • EXCEPTIONS

    • INVALID_DATETIME = 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.

    ENDIF.

    DATETOT = DATEDIFF + DATEDIFF1.

    NODAYS = NODAYS1 - DATETOT.

    • CAL1 = FMREA / MDAYS.

    AMOUNT = ( FMREA / MDAYS ) * ( NODAYS ). "CAL1 * NODAYS.

    • CAL2 = VME / MDAYS.

    AMOUNT1 = ( VME / MDAYS ) * ( NODAYS ). "CAL2 * NODAYS.

    *CALL FUNCTION 'HR_JP_ADD_MONTH_TO_DATE'

    • EXPORTING

    • IV_MONTHCOUNT = -1

    • IV_DATE =

    • IMPORTING

    • EV_DATE =

  • .

  • GWA_ZPY_MEDICAL_PAY-PERNR = PERNR-PERNR.

    GWA_ZPY_MEDICAL_PAY-CLAIM_TYPE1 = '1FMR'.

    GWA_ZPY_MEDICAL_PAY-MONTH1 = P_MONTH.

    GWA_ZPY_MEDICAL_PAY-YEAR1 = P_YEAR.

    GWA_ZPY_MEDICAL_PAY-ELIG_AMOUNT = FMREA.

    GWA_ZPY_MEDICAL_PAY-NO_OF_DAYS = NODAYS.

    GWA_ZPY_MEDICAL_PAY-BILL_AMOUNT = TOTFMR.

    GWA_ZPY_MEDICAL_PAY-AMOUNT = AMOUNT.

    *ZPY_MEDICAL_PAY-PAID_AMOUNT

    *ZPY_MEDICAL_PAY-BAL_TO_PAID

    *ZPY_MEDICAL_PAY-BILLS_BAL

    • INSERT ZPY_MEDICAL_PAY.

    INSERT INTO ZPY_MEDICAL_PAY VALUES GWA_ZPY_MEDICAL_PAY.

    CONCATENATE ZPY_MEDICAL_PAY-YEAR1 ZPY_MEDICAL_PAY-MONTH1 '01' INTO L_DATE1.

    CALL FUNCTION 'HR_JP_ADD_MONTH_TO_DATE'

    EXPORTING

    IV_MONTHCOUNT = -1

    IV_DATE = L_DATE1

    IMPORTING

    EV_DATE = P_DATE.

    MONTH = P_DATE+4(2).

    YEAR = P_DATE+0(4).

    SELECT PERNR

    CLAIM_TYPE1

    MONTH1

    YEAR1

    ELIG_AMOUNT

    NO_OF_DAYS

    BILL_AMOUNT

    AMOUNT

    PAID_AMOUNT

    BAL_TO_PAID

    BILLS_BAL

    FROM ZPY_MEDICAL_PAY

    INTO TABLE GIT_FINAL

    WHERE PERNR EQ PERNR-PERNR

    AND CLAIM_TYPE1 EQ '1FMR'

    AND MONTH1 = MONTH

    AND YEAR1 = YEAR.

    IF SY-SUBRC = 0 .

    ENDIF.

    LOOP AT GIT_FINAL INTO GWA_FINAL.

    IF SY-SUBRC = 0.

    PBAL = GWA_FINAL-BAL_TO_PAID.

    PBBAL = GWA_FINAL-BILLS_BAL.

    ENDIF.

    ENDLOOP.

    VAR1 = ZPY_MEDICAL_PAY-AMOUNT + PBAL.

    VAR2 = ZPY_MEDICAL_PAY-BILL_AMOUNT + PBBAL.

    IF VAR1 LT VAR2.

    PAMOUNT = VAR1.

    ELSE.

    PAMOUNT = VAR2.

    ENDIF.

    BALTOPAID = VAR1 - PAMOUNT.

    BILLBAL = VAR2 - PAMOUNT.

    GWA_ZPY_MEDICAL_PAY-PERNR = PERNR-PERNR.

    GWA_ZPY_MEDICAL_PAY-CLAIM_TYPE1 = '1FMR'.

    GWA_ZPY_MEDICAL_PAY-MONTH1 = P_MONTH.

    GWA_ZPY_MEDICAL_PAY-YEAR1 = P_YEAR.

    GWA_ZPY_MEDICAL_PAY-ELIG_AMOUNT = FMREA.

    GWA_ZPY_MEDICAL_PAY-NO_OF_DAYS = NODAYS.

    GWA_ZPY_MEDICAL_PAY-BILL_AMOUNT = TOTFMR.

    GWA_ZPY_MEDICAL_PAY-AMOUNT = AMOUNT.

    GWA_ZPY_MEDICAL_PAY-PAID_AMOUNT = PAMOUNT.

    GWA_ZPY_MEDICAL_PAY-BAL_TO_PAID = BALTOPAID.

    GWA_ZPY_MEDICAL_PAY-BILLS_BAL = BILLBAL.

    • MODIFY ZPY_MEDICAL_PAY.

    MODIFY ZPY_MEDICAL_PAY FROM GWA_ZPY_MEDICAL_PAY.

    GWA_ZPY_MEDICAL_PAY-PERNR = PERNR-PERNR.

    GWA_ZPY_MEDICAL_PAY-CLAIM_TYPE1 = '1VME'.

    GWA_ZPY_MEDICAL_PAY-MONTH1 = P_MONTH.

    GWA_ZPY_MEDICAL_PAY-YEAR1 = P_YEAR.

    GWA_ZPY_MEDICAL_PAY-ELIG_AMOUNT = VME.

    GWA_ZPY_MEDICAL_PAY-NO_OF_DAYS = NODAYS.

    GWA_ZPY_MEDICAL_PAY-BILL_AMOUNT = TOTVMR.

    GWA_ZPY_MEDICAL_PAY-AMOUNT = AMOUNT1.

    *ZPY_MEDICAL_PAY-PAID_AMOUNT

    *ZPY_MEDICAL_PAY-BAL_TO_PAID

    *ZPY_MEDICAL_PAY-BILLS_BAL

    • INSERT ZPY_MEDICAL_PAY.

    INSERT INTO ZPY_MEDICAL_PAY VALUES GWA_ZPY_MEDICAL_PAY.

    SELECT PERNR

    CLAIM_TYPE1

    MONTH1

    YEAR1

    ELIG_AMOUNT

    NO_OF_DAYS

    BILL_AMOUNT

    AMOUNT

    PAID_AMOUNT

    BAL_TO_PAID

    BILLS_BAL

    FROM ZPY_MEDICAL_PAY

    INTO TABLE GIT_FINAL1

    WHERE PERNR EQ PERNR-PERNR

    AND CLAIM_TYPE1 EQ '1VME'

    AND MONTH1 = MONTH

    AND YEAR1 = YEAR.

    IF SY-SUBRC = 0 .

    ENDIF.

    LOOP AT GIT_FINAL1 INTO GWA_FINAL1.

    IF SY-SUBRC = 0.

    PBAL1 = GWA_FINAL1-BAL_TO_PAID.

    PBBAL1 = GWA_FINAL1-BILLS_BAL.

    ENDIF.

    ENDLOOP.

    VAR3 = ZPY_MEDICAL_PAY-AMOUNT + PBAL1.

    VAR4 = ZPY_MEDICAL_PAY-BILL_AMOUNT + PBBAL1.

    IF VAR3 LT VAR4.

    PAMOUNT1 = VAR3.

    ELSE.

    PAMOUNT1 = VAR4.

    ENDIF.

    BALTOPAID1 = VAR3 - PAMOUNT1.

    BILLBAL1 = VAR4 - PAMOUNT1.

    GWA_ZPY_MEDICAL_PAY-PERNR = PERNR-PERNR.

    GWA_ZPY_MEDICAL_PAY-CLAIM_TYPE1 = '1VME'.

    GWA_ZPY_MEDICAL_PAY-MONTH1 = P_MONTH.

    GWA_ZPY_MEDICAL_PAY-YEAR1 = P_YEAR.

    GWA_ZPY_MEDICAL_PAY-ELIG_AMOUNT = VME.

    GWA_ZPY_MEDICAL_PAY-NO_OF_DAYS = NODAYS.

    GWA_ZPY_MEDICAL_PAY-BILL_AMOUNT = TOTVMR.

    GWA_ZPY_MEDICAL_PAY-AMOUNT = AMOUNT1.

    GWA_ZPY_MEDICAL_PAY-PAID_AMOUNT = PAMOUNT1.

    GWA_ZPY_MEDICAL_PAY-BAL_TO_PAID = BALTOPAID1.

    GWA_ZPY_MEDICAL_PAY-BILLS_BAL = BILLBAL1.

    • MODIFY ZPY_MEDICAL_PAY.

    MODIFY ZPY_MEDICAL_PAY FROM GWA_ZPY_MEDICAL_PAY.

    • UPDATING INFOTYPE 0015.

    DATA: LWA_PPROP TYPE PPROP,

    LIT_PPROP TYPE TABLE OF PPROP.

    DATA: RETURN1 TYPE BAPIRETURN1,

    RETURN TYPE BAPIRETURN,

    HR_RETURN TYPE HRHRMM_MSG.

    IF PAMOUNT GT 1.

    IF G_DOJ GT G_BEGDA.

    G_BEGDA1 = G_DOJ.

    ELSE.

    G_BEGDA1 = G_BEGDA.

    ENDIF.

    SELECT SINGLE BETRG

    FROM PA0015

    INTO TEMPV1

    WHERE SUBTY EQ '1FER'

    AND PERNR EQ PERNR-PERNR "ZPY_MEDICAL_PAY-PERNR

    AND BEGDA EQ G_BEGDA.

    IF SY-SUBRC EQ 0.

    • MESSAGE 'Infotype 0015 is already updated for 1EHC'

    • TYPE 'I'.

    ELSEIF SY-SUBRC NE 0.

    RP_PROVIDE_FROM_LAST P0015 '1FER' G_BEGDA '99991231'.

    LWA_PPROP-INFTY = '0015'.

    LWA_PPROP-FNAME = 'P0015-SUBTY'.

    LWA_PPROP-FVAL = '1FER'.

    APPEND LWA_PPROP TO LIT_PPROP.

    CLEAR LWA_PPROP.

    LWA_PPROP-INFTY = '0015'.

    LWA_PPROP-FNAME = 'P0015-LGART'.

    LWA_PPROP-FVAL = '1FER'.

    APPEND LWA_PPROP TO LIT_PPROP.

    CLEAR LWA_PPROP.

    LWA_PPROP-INFTY = '0015'.

    LWA_PPROP-FNAME = 'P0015-BETRG'.

    LWA_PPROP-FVAL = PAMOUNT.

    APPEND LWA_PPROP TO LIT_PPROP.

    CLEAR LWA_PPROP.

    LWA_PPROP-INFTY = '0015'.

    LWA_PPROP-FNAME = 'P0015-AEDTM'.

    LWA_PPROP-FVAL = SY-DATUM.

    APPEND LWA_PPROP TO LIT_PPROP.

    CLEAR LWA_PPROP.

    LWA_PPROP-INFTY = '0015'.

    LWA_PPROP-FNAME = 'P0015-WAERS'.

    LWA_PPROP-FVAL = 'INR'.

    APPEND LWA_PPROP TO LIT_PPROP.

    CLEAR LWA_PPROP.

    CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'

    EXPORTING

    PERNR = ZPY_MEDICAL_PAY-PERNR

    • MASSN =

    ACTIO = 'INS'

    • TCLAS = 'A'

    BEGDA = G_BEGDA1

    ENDDA = '99991231'

    • OBJPS =

    • SEQNR =

    • SPRPS =

    • SUBTY =

    • WERKS =

    • PERSG =

    • PERSK =

    • PLANS =

    DIALOG_MODE = '0'

    • LUW_MODE = '1'

    • NO_EXISTENCE_CHECK = ' '

    • NO_ENQUEUE = ' '

    IMPORTING

    RETURN = RETURN

    RETURN1 = RETURN1

    HR_RETURN = HR_RETURN

    TABLES

    PROPOSED_VALUES = LIT_PPROP

    • MODIFIED_KEYS =

    .

    IF RETURN IS INITIAL.

    WRITE: 'UPDATED'.

    ENDIF.

    • ELSE.

    • MESSAGE 'Their is no data available for updating infotype 0015'

    • TYPE 'I'.

    • ENDIF.

    ENDIF.

    ENDIF.

    SELECT SINGLE BETRG

    FROM PA0015

    INTO TEMPV2

    WHERE SUBTY EQ '1VMR'

    AND PERNR EQ PERNR-PERNR "ZPY_MEDICAL_PAY-PERNR

    AND BEGDA EQ G_BEGDA.

    IF SY-SUBRC EQ 0.

    MESSAGE 'Infotype 0015 is already updated for 1FER AND 1VMR'

    TYPE 'I'.

    ELSEIF SY-SUBRC NE 0.

    RP_PROVIDE_FROM_LAST P0015 '1VMR' G_BEGDA '99991231'.

    LWA_PPROP-INFTY = '0015'.

    LWA_PPROP-FNAME = 'P0015-SUBTY'.

    LWA_PPROP-FVAL = '1VMR'.

    APPEND LWA_PPROP TO LIT_PPROP.

    CLEAR LWA_PPROP.

    LWA_PPROP-INFTY = '0015'.

    LWA_PPROP-FNAME = 'P0015-LGART'.

    LWA_PPROP-FVAL = '1VMR'.

    APPEND LWA_PPROP TO LIT_PPROP.

    CLEAR LWA_PPROP.

    LWA_PPROP-INFTY = '0015'.

    LWA_PPROP-FNAME = 'P0015-BETRG'.

    LWA_PPROP-FVAL = PAMOUNT1.

    APPEND LWA_PPROP TO LIT_PPROP.

    CLEAR LWA_PPROP.

    LWA_PPROP-INFTY = '0015'.

    LWA_PPROP-FNAME = 'P0015-AEDTM'.

    LWA_PPROP-FVAL = SY-DATUM.

    APPEND LWA_PPROP TO LIT_PPROP.

    CLEAR LWA_PPROP.

    LWA_PPROP-INFTY = '0015'.

    LWA_PPROP-FNAME = 'P0015-WAERS'.

    LWA_PPROP-FVAL = 'INR'.

    APPEND LWA_PPROP TO LIT_PPROP.

    CLEAR LWA_PPROP.

    CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'

    EXPORTING

    PERNR = ZPY_MEDICAL_PAY-PERNR

    • MASSN =

    ACTIO = 'INS'

    • TCLAS = 'A'

    BEGDA = G_BEGDA1

    ENDDA = '99991231'

    • OBJPS =

    • SEQNR =

    • SPRPS =

    • SUBTY =

    • WERKS =

    • PERSG =

    • PERSK =

    • PLANS =

    DIALOG_MODE = '0'

    • LUW_MODE = '1'

    • NO_EXISTENCE_CHECK = ' '

    • NO_ENQUEUE = ' '

    IMPORTING

    RETURN = RETURN

    RETURN1 = RETURN1

    HR_RETURN = HR_RETURN

    TABLES

    PROPOSED_VALUES = LIT_PPROP

    • MODIFIED_KEYS =

    .

    IF RETURN IS INITIAL.

    WRITE: 'UPDATED'.

    ENDIF.

    ENDIF.

    • READ TABLE GIT_ZPY_MEDICAL_PAY INTO GWA_ZPY_MEDICAL_PAY WITH KEY PERNR = GWA_FMR-PERNR

    • CLAIM_TYPE1 = '1FMR'.

    *

    • GWA_ZPY_MEDICAL_PAY-BILL_AMOUNT = TOTFMR.

    • MODIFY TABLE GIT_ZPY_MEDICAL_PAY FROM GWA_ZPY_MEDICAL_PAY

    • TRANSPORTING BILL_AMOUNT.

    *

    *

    *

      • APPEND GWA_ZPY_MEDICAL_PAY TO GIT_ZPY_MEDICAL_PAY.

      • CLEAR GWA_ZPY_MEDICAL_PAY.

      • ENDIF.

    • READ TABLE GIT_ZPY_MEDICAL_PAY INTO GWA_ZPY_MEDICAL_PAY WITH KEY PERNR = GWA_FMR-PERNR

    • CLAIM_TYPE1 = '1VME'.

    • *

      • GWA_ZPY_MEDICAL_PAY-BILL_AMOUNT = TOTVMR.

      • MODIFY TABLE GIT_ZPY_MEDICAL_PAY FROM GWA_ZPY_MEDICAL_PAY

      • TRANSPORTING BILL_AMOUNT.

      *

      *

      *

      • READ TABLE GIT_ZPY_MEDICAL_PAY INTO GWA_ZPY_MEDICAL_PAY WITH KEY PERNR = GWA_FMR-PERNR

      • CLAIM_TYPE1 = '1FMR'.

      *

      • GWA_ZPY_MEDICAL_PAY-NO_OF_DAYS = NODAYS.

      • MODIFY TABLE GIT_ZPY_MEDICAL_PAY FROM GWA_ZPY_MEDICAL_PAY

      • TRANSPORTING NO_OF_DAYS.

      *

      • READ TABLE GIT_ZPY_MEDICAL_PAY INTO GWA_ZPY_MEDICAL_PAY WITH KEY PERNR = GWA_FMR-PERNR

      • CLAIM_TYPE1 = '1VME'.

      *

      • GWA_ZPY_MEDICAL_PAY-NO_OF_DAYS = NODAYS.

      • MODIFY TABLE GIT_ZPY_MEDICAL_PAY FROM GWA_ZPY_MEDICAL_PAY

      • TRANSPORTING NO_OF_DAYS.

      *

      • READ TABLE GIT_ZPY_MEDICAL_PAY INTO GWA_ZPY_MEDICAL_PAY WITH KEY PERNR = GWA_FMR-PERNR

      • CLAIM_TYPE1 = '1FMR'.

      *

      • GWA_ZPY_MEDICAL_PAY-MONTH1 = P_MONTH.

      • GWA_ZPY_MEDICAL_PAY-YEAR1 = P_YEAR.

      • MODIFY TABLE GIT_ZPY_MEDICAL_PAY FROM GWA_ZPY_MEDICAL_PAY

      • TRANSPORTING MONTH1 YEAR1.

      *

      • READ TABLE GIT_ZPY_MEDICAL_PAY INTO GWA_ZPY_MEDICAL_PAY WITH KEY PERNR = GWA_FMR-PERNR

      • CLAIM_TYPE1 = '1VME'.

      *

      • GWA_ZPY_MEDICAL_PAY-MONTH1 = P_MONTH.

      • GWA_ZPY_MEDICAL_PAY-YEAR1 = P_YEAR.

      • MODIFY TABLE GIT_ZPY_MEDICAL_PAY FROM GWA_ZPY_MEDICAL_PAY

      • TRANSPORTING MONTH1 YEAR1.

      *GWA_ZPY_MEDICAL_PAY-NO_OF_DAYS = NODAYS.

      *APPEND GWA_ZPY_MEDICAL_PAY TO GIT_ZPY_MEDICAL_PAY.

      • CLEAR GWA_ZPY_MEDICAL_PAY.

      • CAL1 = GWA_ZPY_MEDICAL_PAY-ELIG_AMOUNT / MDAYS.

      • AMOUNT = CAL1 * GWA_ZPY_MEDICAL_PAY-NO_OF_DAYS.

      *

      • GWA_ZPY_MEDICAL_PAY-AMOUNT = AMOUNT.

      • APPEND GWA_ZPY_MEDICAL_PAY TO GIT_ZPY_MEDICAL_PAY.

      • CLEAR GWA_ZPY_MEDICAL_PAY.

      *modify

      • APPEND GWA_ZPY_MEDICAL_PAY TO GIT_ZPY_MEDICAL_PAY.

      • CLEAR GWA_ZPY_MEDICAL_PAY.

      ENDIF.

      END-OF-SELECTION.

      &----


      *& Form GET_BEGDA_ENDDA

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM GET_BEGDA_ENDDA .

      DATA: L_DATE TYPE D.

      CONCATENATE P_YEAR P_MONTH '01' INTO L_DATE.

      CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'

      EXPORTING

      IV_DATE = L_DATE

      IMPORTING

      EV_MONTH_BEGIN_DATE = G_BEGDA

      EV_MONTH_END_DATE = G_ENDDA.

      ENDFORM. " GET_BEGDA_ENDDA

    Add a comment
    10|10000 characters needed characters exceeded

    Before answering

    You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
    You must be Logged in to submit an answer.

    Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.