2007 Sep 03 7:23 AM
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 .....AS IAM NOT GETTING THE ANSWER
REGARDS
code seems to be fine.
probably check the command line there will be some issues in that.
or please try to debug the script keeping break-point in ur include program also.
u will come to know where the data is missing.
REWARD ME IF U FIND IT HELPFUL.
2007 Sep 03 7:31 AM
Hi,
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.
<b>READ TABLE IN_TAB INDEX 2.
V_UNIT = IN_TAB-VALUE.</b>
IF V_UNIT = 'MIN'.
V_TIME = V_DURATION / 60.
ELSEIF V_UNIT = 'H'.
V_TIME = V_DURATION.
<b>V_TOTAL = V_TOTAL + V_TIME.</b>
<b>??????</b>
<b>V_TOTAL is of type c. what do you want to do?</b>
ENDIF.
READ TABLE OUT_TAB INDEX 1.
MOVE V_TOTAL TO OUT_TAB-VALUE.
MODIFY OUT_TAB INDEX 1.
CLEAR OUT_TAB.
ENDFORM.
2007 Sep 03 7:34 AM
Hi Khan..
Check the changes in the code in BOLD:
READ TABLE OUT_TAB INDEX 1.
<b>write V_TOTAL TO OUT_TAB-VALUE left-justified.</b> "instead of MOVE
MODIFY OUT_TAB INDEX 1.
CLEAR OUT_TAB.
here OUTTAB-VALUE is Type C and length 256. so you need to Align the Value to left.
incase of any further issues debug the subroutine.
<b>reward if Helpful</b>
2007 Sep 03 7:54 AM
code seems to be fine.
probably check the command line there will be some issues in that.
or please try to debug the script keeping break-point in ur include program also.
u will come to know where the data is missing.
REWARD ME IF U FIND IT HELPFUL.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |