Skip to Content
avatar image
Former Member

Correction in code.

ENTRIES ARE AS FOLLOWS 30 MIN,80 MIN,1.5 H I NEED TO CALCULATE THE TOTAL TIME IN FORMAT H:M.

THIS IS WHT I HAVE DONE IN SAP SCRIPT.

PERFORM Z_PM_COMMON_DURN IN PROGRAM ZPMLINCLUDE

USING &AFVGD-DAUNO& "DURATION

USING &AFVGD-DAUNE& "UNIT. I.E, MINUTES ,HOURS.

CHANGING &CONV_WORK&

ENDPERFORM

[INCLUDE]

FORM Z_PM_COMMON_DURN

TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA : V_DURATION TYPE AFVGD-DAUNO, "DURATION

V_UNIT TYPE AFVGD-DAUNE, "UNIT

V_TIME(8) TYPE C, "TIME

V_TOTAL(8) TYPE C.

READ TABLE IN_TAB INDEX 1.

V_DURATION = IN_TAB-VALUE.

IF V_UNIT = 'MIN'.

V_TIME = V_DURATION / 60.

ELSEIF V_UNIT = 'H'.

V_TIME = V_DURATION.

V_TOTAL = V_TOTAL + V_TIME.

ENDIF.

READ TABLE OUT_TAB INDEX 1.

MOVE V_TOTAL TO OUT_TAB-VALUE.

MODIFY OUT_TAB INDEX 1.

CLEAR OUT_TAB.

ENDFORM.

PLEASE CORRECT THE ABOVE CODE .....

REGARDS

essamsaud@yahoo.co.in

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Sep 03, 2007 at 06:38 AM

    Changes has been done.. this will solve your problem...

    PERFORM Z_PM_COMMON_DURN IN PROGRAM ZPMLINCLUDE

    USING &AFVGD-DAUNO& "DURATION

    USING &AFVGD-DAUNE& "UNIT. I.E, MINUTES ,HOURS.

    CHANGING &CONV_WORK&

    ENDPERFORM

    [INCLUDE]

    FORM Z_PM_COMMON_DURN

    TABLES in_tab STRUCTURE itcsy

    out_tab STRUCTURE itcsy.

    DATA : V_DURATION TYPE AFVGD-DAUNO, "DURATION

    V_UNIT TYPE AFVGD-DAUNE, "UNIT

    V_TIME(8) TYPE C, "TIME

    V_TOTAL(8) TYPE C.

    <b>READ TABLE in_tab WITH KEY name = 'AFVGD-DAUNO'.

    V_TIME = IN_TAB-VALUE.</b>

    <b>READ TABLE in_tab WITH KEY name = 'AFVGD-DAUNE'.

    V_UNIT = IN_TAB-VALUE.</b>

    IF V_UNIT = 'H'.

    V_TIME = V_DURATION / 60.

    ENDIF.

    b]READ TABLE in_tab WITH KEY name = 'CONV_WORK'.

    V_TOTAL = IN_TAB-VALUE.</b>

    V_TOTAL = V_TOTAL + V_TIME.

    <b>READ TABLE OUT_TAB WITH KEY name = 'CONV_WORK'.

    MOVE V_TOTAL TO OUT_TAB-VALUE.

    MODIFY OUT_TAB INDEX 1.</b>

    Close the thread once your question is answered. Reward points to all useful answers.

    Regards,

    SaiRam

    Add comment
    10|10000 characters needed characters exceeded