• PM停机时间问题处理


    根据通知单号取设备维修停机时间

    *&---------------------------------------------------------------------*
    *& Report YCX_TJSJ
    *&---------------------------------------------------------------------*
    *&
    *&---------------------------------------------------------------------*
    REPORT YCX_TJSJ.
    
    PARAMETERS: P_QMNUM LIKE VIQMEL-QMNUM.
    
    
    SELECT SINGLE * INTO @DATA(LS_VIQMEL)
      FROM VIQMEL
     WHERE QMNUM = @P_QMNUM.
    
    "TIME_CONVERSION
    DATA EXTERNAL_UNIT TYPE T006A-MSEH3.
    DATA INTERNAL_UNIT TYPE T006-MSEHI.
    DATA TIME_OUT      TYPE QMIH-AUSZT.
    CALL FUNCTION 'PM_TIME_CONVERSION'
      EXPORTING
        TIME_IN           = LS_VIQMEL-AUSZT
    *   UNIT_IN           = 'S'
    *   UNIT_IN_INT       = ' '
    *   UNIT_OUT          = 'H'
    *   UNIT_OUT_INT      = ' '
      IMPORTING
        EXTERNAL_UNIT     = EXTERNAL_UNIT
        INTERNAL_UNIT     = INTERNAL_UNIT
        TIME_OUT          = TIME_OUT
      EXCEPTIONS
        INVALID_TIME_UNIT = 1
        OTHERS            = 2.
    IF SY-SUBRC <> 0.
    * Implement suitable error handling here
    ENDIF.
    
    DATA: LV_TIME(10) TYPE C.
    WRITE TIME_OUT DECIMALS 2 TO LV_TIME.
    *REPLACE ALL OCCURRENCES OF 'A' IN lv_string WITH 'B'.
    REPLACE ALL OCCURRENCES OF 'E+00' IN LV_TIME WITH ''.
    
    WRITE: /'通知单维护停机时间'.
    WRITE:  LS_VIQMEL-QMNUM,
            LV_TIME ,
            INTERNAL_UNIT.
    2015年04月28日 08:59

    How to convert PM Module Breakdown Duration (AUSZT) floating point value into Minutes

    751 Views


    Hi Frnds,

    My requirement is to display a normal alv report. Out of which one of the filed is from VIQMEL-AUSZT (Breakdown Duration).

    Which is of Data type FLTP.

    Details:

    AUZTV AUZTV TIMS 6 Start of Malfunction (Time) 12:39:19 AUZTB AUZTB TIMS 6 End of Malfunction (Time) 12:42:00 AUSZT AUSZT FLTP 16 Breakdown Duration 1.6100000000000000E+02

    Now I want to convert the value '1.6100000000000000E+02' into Minutes.

    Kindly let me know the solution.

    Note: I tried with standard FM 'PM_TIME_CONVERSION' and converted the break down value into hours.

    For example: 1.6100000000000000E+02 to 4,472222222222222E-02.

    But i want to convert the break down duration value into perfect minutes.

    With Regards,

    Sudhir.

    Assigned Tags

    2 Answers
    排序
    Best Answer
    author's profile photo Yarnagula Sudhir
    Sep 17, 2015 at 05:18 AM

    Hi All,

    I've found another way of finding out Breakdown Duration in Hours or Minutes.

    a. Collect the details of Malfunction Start Date/Start Time/End Date and End Time.

    b. If all above values are not initial, then use the FM: L_TO_TIME_DIFF

    c. Then Round Off that Value, FM: ROUND

    Sample Code:

    *Converting the Breakdown Duration into Minutes

    DATA: i_start_date TYPE ltak-stdat,
    lv_start_date TYPE char8,

    i_start_time TYPE ltak-stuzt,
    lv_start_time TYPE char6,

    i_end_date TYPE ltak-endat,
    lv_end_date TYPE char8,

    i_end_time TYPE ltak-enuzt,
    lv_end_time TYPE char6,

    e_time_diff TYPE ltak-istwm,
    lv_e_time_diff TYPE char10,

    ls_viqmel TYPE viqmel,

    wa_input TYPE p DECIMALS 8,
    wa_output TYPE p DECIMALS 2.


    *Getting the Values
    CLEAR: ls_viqmel.
    SELECT SINGLE * FROM viqmel
    INTO ls_viqmel
    WHERE qmnum = <ls_rihqmel>-qmnum.
    IF sy-subrc = 0.
    IF ls_viqmel-ausvn IS NOT INITIAL AND
    ls_viqmel-auztv IS NOT INITIAL AND
    ls_viqmel-ausbs IS NOT INITIAL AND
    ls_viqmel-auztb IS NOT INITIAL.

    lv_start_date = ls_viqmel-ausvn. "Start of Malfunction (Date)
    i_start_date = lv_start_date.

    lv_start_time = ls_viqmel-auztv. "Start of Malfunction (Time)
    i_start_time = lv_start_time.

    lv_end_date = ls_viqmel-ausbs. "End of Malfunction (Date)
    i_end_date = lv_end_date.

    lv_end_time = ls_viqmel-auztb. "End of Malfunction (Time)
    i_end_time = lv_end_time.

    CLEAR: wa_input, wa_output.
    CALL FUNCTION 'L_TO_TIME_DIFF'
    EXPORTING
    i_start_date = i_start_date "Start of Malfunction (Date)
    i_start_time = i_start_time "Start of Malfunction (Time)
    i_end_date = i_end_date "End of Malfunction (Date)
    i_end_time = i_end_time "End of Malfunction (Time)
    i_time_uom = 'MIN'
    IMPORTING
    e_time_diff = e_time_diff.

    wa_input = e_time_diff.

    *Round Off
    CALL FUNCTION 'ROUND'
    EXPORTING
    input = wa_input
    IMPORTING
    output = wa_output
    EXCEPTIONS
    input_invalid = 1
    overflow = 2
    type_invalid = 3
    OTHERS = 4.

    ENDIF.
    ENDIF.

    Finally wa_output is your breakdown duration in Minutes.

    With Regards,

    Sudhir.

    Attachments

    bd min.JPG (256.0 kB)
    author's profile photo K Jogeswara Rao
    Apr 28, 2015 at 02:25 PM

    Simply equate to a variable of type P decimals zero. It should give you value in seconds. Divide it by 60 to have it in minutes.

    本人常年接收SAP运维和远程项目,ECC,S/4HANA,CRM,WDA. 远程人天可谈,终身售后,有活请联系V信:18925782767(问问题免费,欢迎交流!) !!请关注本人技术分享公众号:SAP翔子(可扫头像二维码) 每天分享新知识,博客文章也会陆续整理并迁移至公众号,与您一起共同学习
  • 相关阅读:
    实验10 使用PBR实现策略路由
    实验9 使用route-policy控制路由
    实验8 filter-policy过滤路由
    实验7 ISIS多区域配置
    实验6 IS-IS基本配置
    MySQL复制表
    mysql数据备份
    mysql 创建用户,授权
    数据库
    mysql 修改文件记录:
  • 原文地址:https://www.cnblogs.com/rainysblog/p/14971491.html
Copyright © 2020-2023  润新知