Create hours worked functions

I am trying to create a form for employee attendance, the attendance table is populated by employee login and log out.
my table looks like this
table attendance
employee_id
schedule_id
start_time
end_time
total_time_worked (for this column i tried this formula in the property palette (:timeout-:timein) it did work but came out in .333333)
any ideas please?
thank you in advance.

Here is a function that return something more comprehensive:
CREATE OR REPLACE FUNCTION Diff_Time
     LD$Date_Deb IN DATE DEFAULT SYSDATE
     ,LD$Date_Fin IN DATE DEFAULT SYSDATE
     ,LN$JJ       OUT PLS_INTEGER
     ,LN$HH       OUT PLS_INTEGER
     ,LN$MI       OUT PLS_INTEGER
     ,LN$SS       OUT PLS_INTEGER
  ) Return NUMBER
IS
  dif   NUMBER ;
Begin
  If LD$Date_Fin < LD$Date_Deb Then
     Return ( -1 ) ;
  End if ;
  Select  LD$Date_Fin - LD$Date_Deb Into dif  From DUAL ;
  Select  trunc ( LD$Date_Fin - LD$Date_Deb)  Into LN$JJ  From DUAL ;
  Select  trunc ( (LD$Date_Fin - LD$Date_Deb) * 24) -  ( LN$JJ * 24 ) Into LN$HH From DUAL ;
  Select  trunc ( (LD$Date_Fin - LD$Date_Deb) * 1440) - ( (LN$HH * 60) + ( LN$JJ * 1440) ) Into LN$MI From DUAL ;
  Select  trunc ( (LD$Date_Fin - LD$Date_Deb) * 86400) - ( (LN$MI * 60) + (LN$HH * 3600) + ( LN$JJ * 3600 * 24 ) ) Into LN$SS From DUAL ;
  Return( dif ) ;
End ;
/That you can call as follow:
SQL> set serveroutput on
SQL> declare
  2   dd pls_integer;
  3   hh pls_integer;
  4   mi pls_integer;
  5   ss pls_integer;
  6   dif number ;
  7  Begin
  8   dif := diff_time ( sysdate, sysdate + 10.523, dd,hh,mi,ss ) ;
  9   dbms_output.put_line(
10     '(' || ltrim(to_char(dif,'99999.99999')) || ')' || '  '
11     || to_char(dd,'99999') || 'd '
12     || to_char(hh,'00') ||':'
13     || to_char(mi,'00') ||':'
14     || to_char(ss,'00')
15     ) ;
16  End;
17  /
(10.52300)      10d  12: 33: 07Francois

Similar Messages

  • How to create a common function in Sqlserver to get Effective working hours of employee

    Hi
    The following is the logic applied in the application , But I want to create an server function , Pls help
    adc_opening  is starting time and   is an argument 1
    adc_break is finishing time and   is an argument 2
    adc_break is breake time and   is an argument 3
    My  Existing logic is  given below, I want to create sqlserver function , to replace the given logic. Please help
    long ll_opening_in_minutes, ll_closing_in_minutes, ll_break_in_minutes, ll_effective_in_minutes
    decimal {2} ldc_result
    ll_opening_in_minutes = truncate(adc_opening, 0) * 60 + (adc_opening - truncate(adc_opening, 0)) * 100
    ll_closing_in_minutes = truncate(adc_closing, 0) * 60 + (adc_closing - truncate(adc_closing, 0)) * 100
    // If the closing time is on the next day, add 24 hours to the value
    if ll_closing_in_minutes < ll_opening_in_minutes then ll_closing_in_minutes += 24 * 60
    ll_break_in_minutes = truncate(adc_break, 0) * 60 + (adc_break - truncate(adc_break, 0)) * 100
    // Use max function to disallow negative results
    ll_effective_in_minutes = Max(ll_closing_in_minutes - ll_opening_in_minutes - ll_break_in_minutes, 0)
    ldc_result = truncate(ll_effective_in_minutes / 60, 0) + mod(ll_effective_in_minutes, 60) / 100
    return ldc_result
    polachan

    That is not datetime information, the argument of the function 
    adc_opening = 8.30
    adc_break = 1.00
     adc_closing = 17.30
    I want to get net hours  ( 8.30 - 17.30 ) - 1.00 . The result minutes  part
     should be shown like 
    if .75  should be shown as .45.  if .50 should be shown as .30  , if  .25  as
    .15. 
    I cannot give datediff function because the argument will not be  the date , its like decimal  
    as I given above.
    Any idea
    polachan
    isnt it enough to multiply by 0.6?
    0.75 * 0.6 = 0.45
    0.5 * 0.6 = 0.3 etc
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to create the INBOUND Function Module for INBOUND IDOCs

    Hi Friends,
    Can any Suggest me How to proceed to Create an INBOUND Function Module for Processing the INBOUND IDOCS
    which are recieved from XI Server ?
    I am working in SAP-ISU
    Here i will recieve the INBOUND IDOCs for the Meter Reading Orders.
    We have a Standard INBOUND FUNCTION MODULE
    IDOC_INPUT_ISU_MR_UPLOAD
    which Uploads the Meter Reading Results.
    I copied the Same function Module into ZIDOC_INPUT_
    and working on it.
    Can any one suggest me, whether i am going in correct way or not.
    In IDOC_INPUT_ISU_MR_UPLOAD Inbound fun module,
    BAPI_MTRREADDOC_UPLOAD is used to Update or Insert the Meter Reading Results,
    My requirment is to Insert and Update the Meter Reading Orders which are Inbounded from XI.
    Can I Use the Same BAPI
    BAPI_MTRREADDOC_UPLOAD
    to Update the below fields,
    EABL-SERNR
    EABL-ZWNUMMER
    EABLG-ABLESGR
    EABL-V_ZWSTAND
    EABL-N_ZWSTAND
    EABL-ABLHINW
    EABL-ZSKIPC
    EABL-ADAT
    EABL-ATIMTATS
    EABL-ADATTATS
    EABL-ATIM
    EABL-ZMESSAGE
    EABL-ABLESER(Meter reader number)
    Kindly Suggest me,
    Thanks in Advance,
    Ganesh

    Hello Ganesh
    I think you are going completely astray with you z-function module for IDoc processing.
    If you look at TABLES parameter METERREADINGRESULTS (type BAPIEABLU ) of BAPI_MTRREADDOC_UPLOAD you will find many of the requested fields already:
    EABL-SERNR => BAPIEABLU-SERIALNO
    EABL-ZWNUMMER =>REGISTER
    EABLG-ABLESGR
    EABL-V_ZWSTAND
    EABL-N_ZWSTAND
    EABL-ABLHINW
    EABL-ZSKIPC
    EABL-ADAT
    EABL-ATIMTATS => ACTUALMRTIME
    EABL-ADATTATS => ACTUALMRDATE
    EABL-ATIM
    EABL-ZMESSAGE
    EABL-ABLESER(Meter reader number)
    Field EABL-ZMESSAGE appears to be custom field (at least I cannot find it on ECC 6.0). If this field was added using include CI_EABL then you probably can get these values into the BAPI using the EXTENSIONIN parameter.
    Check routine CHECK_UPLOADRECORDS in the BAPI which allows two extension structures:
    - BAPI_TE_EABL
    - BAPI_TE_EOSB
    Not surprisingly BAPI_TE_EABL contains the include CI_EABL.
    Regards
      Uwe

  • How to create a callback function module

    Hi all,
    I am working in a requirement where we need to call a function module at a 'after change' event. So how to create a callback function module and register it with the crmvevent ?_
    I created a sample function module and try to create entries in table crmv_event_cust, but i got an error message saying that the function module name I provided is not in table CRMC_FUNC_ASSIGN. When I try to create entry there, I got a message that function module is not in CRMC_OBJ_FUNC and that table is a standard table with no maintanance options !!
    looks like i am going in wrong way ... can any one please help ??

    Looking at my system all you need to do is create the entry for the callback function in maint view: CRMV_FUNC_ASSIGN.
    Your entry should be as simple as Z-function name Object Function - <same as others in the segment you are assigning>
    IE for the partner it would be CRM_PARTNER as object function, for general order processing CRM_ORDER
    Take care,
    Stephen

  • Is there a way to create a group function?

    I want to create a group function like max,sum,count for a
    pl/sgl function. This group function will be something like max
    (let's call it max2) but it will return the second highest value
    of a group.
    Any ideas anyone?

    Since you might not completely understand what i mean i give you
    this example:
    the ranktest table is:
    A     B     C
    a     b     1
    a     b     1
    a     b     5
    a     b     12
    a     b     7
    b     c     1
    b     c     3
    b     c     2
    b     c     4
    b     c     8
    c     d     4
    c     d     3
    c     d     6
    c     d     1
    c     d     2
    c     d     12
    c     d     7
    c     d     3
    a     b     5
    c     d     12
    SELECT A,B,C
    FROM (
    SELECT A,B,C, dense_rank() over (
    PARTITION BY A,B
    ORDER BY C desc) AS sorted_c
    FROM ranktest a)
    WHERE sorted_c = 2
    -- this way we get the c column to have the 2nd highest value
    -- for each set of A and B
    --RESULT
    a b 7
    b c 4
    c d 7
    SELECT a.A,a.B, sum(a.C), count(a.C)
    FROM ranktest a
    GROUP BY a.A,a.B
    -- this way we get the group functions to work on two of the
    -- columns
    --RESULT
    a b 31 6
    b c 18 5
    c d 50 9
    The result that i want is
    a b 31 6 7
    b c 18 5 4
    c d 50 9 7
    My question is can this be done in a single select statement. I
    know it can be done with an intermediate step (of the creation
    of a temp table).
    Plus i would like to ask the experts, would a single select
    statement be more efficient?
    NOTE: the tables and data are just test data. The real tables
    and data and the select query are different. The real ranktable
    has about 1 million records. That's why i am worried about
    efficiency.

  • Is it possible to create a filter function in Muse?

    I was wondering how to create a filter function in Adobe muse. I need this for a website that rents B&B´s, Agriturismo and some other stuff. I would like to have this filter where people have search options.
    Michiel

    Hi Hans,
    I mean a filter for searching in your website. I give you a website and you see what I mean. I think i have to make a database for this to work.
    www.vivere-e-gustare.com. Here you find on the left top a search engine to fill in your wishes about what you are looking for. I hope I made myself clear.
    Thank you
    Verzonden met Windows Mail
    Van: hans-g.
    Verzonden: donderdag 29 mei 2014 10:08
    Aan: michiel brouwer
    Is it possible to create a filter function in Muse?
    created by hans-g. in Help with using Adobe Muse CC - View the full discussion 
    Hello,
    in which area "people" should have search options? About your whole website, in a menu or, or ...
    To be not left empty-handed  here some links:
    http://helpx.adobe.com/muse/tutorials/building-your-first-website-part-7.html  >>> how to filter the items in the menu list ...
    http://helpx.adobe.com/muse/tutorials/creating-mobile-layout-designs-muse-2.html  >>> Adding links with the Links menu
    Hans-Günter
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6417713#6417713
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Help with using Adobe Muse CC by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • How create and work with Z output to meet the client requirment?

    hi  gurus,
    I am SD functional consultant and need ur help
    Please explain me how create and work with Z output .
    How we arrange and change the fields in header and footer
    where and how we do changes in Layouts setting and SAP scripts to meet the user requirments.
    pls forward functional or Tech spec of Z output
    points will be rewarded
    thanx & regards
    shabnum

    Hi shabnum ,
    I hope you can do it.
    Goto SE71, enter form name--> click change
    1) click in page window command button, Identify the header and footer window
    2) single click on Header window and click change button(pencil symbol)
    3) identify the fields and change order of the fields
    I hope this will help to solve your issue
    Regards,
    SaiRam

  • Creating a global function

    Dear,
    I want to creat a global function. Can you tell me here i have to type my function.
    Thanks

    In the hierarchy view, click on the root node, then right click and you will see insert Scripting Object as an option.
    Also this is well described in the help files as to how it works.
    paul

  • Calculate the performance of an activity according to the hours worked

    Hi for all,
    I need to calculate the performance of an activity according to the hours worked by anyone. Someone could tell me how can I do this?
    timetable of staff
    ID  HR1  HR2  HR3  HR4   DAY
    1   492  720  780  1080  Monday
    1   612  720  780  1200  Tuesday
    1   492  720  780  1080  Wednesday
    1   612  720  780  1200  Thursday
    1   492  720  780  1080  Friday
    2   492  720  780  1080  Monday
    3   492  720  780  1080  Saturday
    SQL> Select to_date(to_char(trunc(sysdate) + 492/1440,'dd/mm/yyyy HH24:MI:SS' ), 'dd/mm/yyyy HH24:MI:SS') from dual;
    TO_DATE(TO_CHAR(TRUNC(SYSDATE)
    20/01/2011 08:12:00
    Table Holidays
    ID DATE_HOLIDAY HOLIDAY
    1  01/01/2011   Holiday X
    1  03/15/2011   Holiday Y
    1  07/04/2011   Holiday Z
    2  01/01/2011   Holiday X
    Input Values
    Start Date : 17/01/2011
    Qtd Days   : 0
    Qtd Hours  : 11
    Qtd Minutes: 0
    Result
    18/01/2011 13:24Regards,

    Okay here is my second attempt.
    With schedule_of_work As
         Select 1 ID, 492 HR1, 720 HR2, 780 HR3, 1080 HR4, 'Monday'    Day_of_week from dual union all
         Select 1 ID, 612 HR1, 720 HR2, 780 HR3, 1200 HR4, 'Tuesday'   Day_of_week from dual union all
         Select 1 ID, 492 HR1, 720 HR2, 780 HR3, 1080 HR4, 'Wednesday' Day_of_week from dual union all
         Select 1 ID, 612 HR1, 720 HR2, 780 HR3, 1200 HR4, 'Thursday'  Day_of_week from dual union all
         Select 1 ID, 492 HR1, 720 HR2, 780 HR3, 1080 HR4, 'Friday'    Day_of_week from dual
    ), parameters AS
            /* Creating a single row of input values that can be used multiple times */
            SELECT TO_DATE(:job_start_date,'MM/DD/YYYY HH24:MI')             AS job_start_date
                 , TRUNC(TO_DATE(:job_start_date,'MM/DD/YYYY HH24:MI'),'IW') AS beginning_of_week
                 , NVL(:days,0)
                 + NVL(:hours,0)/24
                 + NVL(:minutes,0)/(60*24)                                   AS job_length
            FROM   dual
    ), holidays AS
            SELECT TO_DATE('01/01/2011','MM/DD/YYYY') AS dt FROM DUAL
    ), date_range AS
            /* Trying to generate a date range that should encompass the maximum date it would take
             * to complete the task. Rough estimate is number of 8 hour work days plus a padding of 10 days.
             * You may want to adjust this to something more suitable for your business or set it to an artificially
             * high value. Be aware of possible performance implicications the higher you set it.
            SELECT TRUNC(job_start_date) + (ROWNUM - 1) AS dts
            FROM   parameters
            CONNECT BY ROWNUM <= TRUNC(job_length*24/8) + 10
    ), schedule_as_dates AS
            SELECT sowo.id
                 , sowo.day_of_week
                 , dara.dts
                 , holi.dt
                 , CASE
                        /* Only perform the effective hours when the day is not a holiday
                        * and it matches a date in the date range. Otherwise set effective hours to midnight
                        * making the running sum below zero.
                      WHEN sowo.day_of_week IS NOT NULL AND holi.dt IS NULL
                       THEN dara.dts + HR1/(60*24)
                       ELSE dara.dts
                   END                                    AS start1
                 , CASE
                       WHEN sowo.day_of_week IS NOT NULL AND holi.dt IS NULL
                       THEN dara.dts + HR2/(60*24)
                       ELSE dara.dts
                   END                                    AS end1
                 , CASE
                       WHEN sowo.day_of_week IS NOT NULL AND holi.dt IS NULL
                       THEN dara.dts + HR3/(60*24)
                       ELSE dara.dts
                   END                                    AS start2
                 , CASE
                       WHEN sowo.day_of_week IS NOT NULL AND holi.dt IS NULL
                       THEN dara.dts + HR4/(60*24)
                       ELSE dara.dts
                   END                                    AS end2
            FROM      date_range       dara
            LEFT JOIN schedule_of_work sowo PARTITION BY (sowo.id) ON sowo.day_of_week = TO_CHAR(dara.dts,'FMDay','NLS_DATE_LANGUAGE=English')
            LEFT JOIN holidays         holi                        ON holi.dt          = dara.dts
    SELECT
           CASE
           /* This means that we need to go into the second shift (start2-end2) to calculate the end date */
           WHEN  work_remaining > end1 - start1
           THEN  start2 + work_remaining - ( end1 - start1 )
           /* This means we can complete the work in the first shift */
           WHEN  work_remaining < end1 - start1
           THEN  start1 + work_remaining
           END   AS finish_time
    FROM
            SELECT b.*
                 /* Determine how much work is remaining from the previous days value */
                 , job_length - prev_work_time                               AS work_remaining
                 /* Calculate the smallest delta value to pick the right day of the week
                    to calculate the end date
                 , ROW_NUMBER() OVER (partition by B.ID ORDER BY DELTA desc) AS RN
            FROM
                    SELECT a.*
                         /* This computation is used to determine which day of the week we need to use
                            to determine the end date of the task
                         , job_length - effective_work_time AS delta
                         /* retrieve the previous effective_work_time. This will be used above */
                         , LAG(effective_work_time) OVER (PARTITION BY ID order by start1) AS prev_work_time
                    FROM
                            SELECT job_start_date
                                 , job_length
                                 , id
                                 , day_of_week
                                 , start1
                                 , end1
                                 , start2
                                 , end2
                                  /* Compute the amount of time an employee can work in any given day. Then take a running total of this */
                                 , SUM
                                     CASE
                                         /* When the job_start_date is the same day as the first eligible work day we need to diskount (spam filter misspelled on purpose the
                                          * effective work hours because the job could start in the middle of the day.
                                         WHEN TRUNC(job_start_date) = TRUNC(start1)
                                         THEN
                                              CASE
                                                   WHEN job_start_date BETWEEN start1 AND end1
                                                   THEN (end1 - job_start_date) + (end2 - start2)
                                                   WHEN job_start_date BETWEEN start2 AND end2
                                                   THEN (end2 - job_start_date)
                                                   WHEN job_start_date < start1
                                                   THEN (end2 - start2) + (end1 - start1)
                                                   WHEN job_start_date > end2
                                                   THEN 0
                                              END
                                         ELSE (end2 - start2) + (end1 - start1)
                                     END
                                 ) OVER (PARTITION BY ID order by start1) AS effective_work_time
                            FROM       schedule_as_dates
                            CROSS JOIN parameters
                    ) a
            ) b
            /* Only interested in delta less than zero because the positive deltas indicate more work needs to be done. */
            WHERE delta < 0
    WHERE RN = 1I got slightly different results then you. My query got me 1/24/2011 at 13:12. I double checked the math and I think that's right.
    Hopefully this works out for you. My apologies for any mistakes.
    EDIT
    Query is fully posted now.

  • URGENT : Error: Please create data processing function module

    Hi
    I am getting the folloiwng error
    "Please create data processing function module" in table maintainence.
    It is working fine in dev environment but not in QA and production.
    Pleae help.
    Regards
    Kalpesh

    Hi Kalpesh,
       I see it is something to do with the naming convention used in the quality and production system. These must have been setup differently compared to ur development system. So check with different naming conventions.
    Reward points if helpful.
    Cheers
    Shafiq

  • How create and work with Z output to meet user req

    hi gurus,
    I am SD functional consultant and need ur help
    Please explain me how create and work with Z output .
    How we arrange and change the fields in header and footer
    where and how we do changes in Layouts setting and SAP scripts to meet the user requirments.
    pls forward functional or Tech spec of Z output
    points will be rewarded
    thanx & regards
    shabnum

    Hi
    From SPRO do the all steps.
    Goto SD-> BASIC functions->Output control->Output determination->Output determination by condition technique->Maintain Output determination for sales documents
    Here define all like access sequences, Output types, condition tables and assign them to Program and Forms.
    From SE71 copy the script to a Zscript and to modify it to suit your requirements and the same Zscript has to be assigned to Output type, Program in NACE transaction.
    Reward points if useful
    Regards
    Anji

  • Creating Includes for Function Modules

    Hi Experts,
    Can you please let me know how to create includes for function modules.
    I came across this in a standard include program, which was generated by a function library. The includes inside this program where linked to the function modules (when I double clicked on them).
    Please let me know how to create it.
    Thanks in advance !
    Regards,
    Anand Patil.

    Hi,
    have a look at the code for better understanding
    Declaration of Workareas                                             *
      DATA: lwa_e1bp2017_gm_item_create TYPE e1bp2017_gm_item_create,
            lwa_data         TYPE edidd, " Work area for IDOC
            lwa_control      TYPE edidc. " Work Area for control rec
    Read the control data information of idoc.
      loop at idoc_contrl INTO lwa_control Where mestyp = lc_mbgmcr.
    Extract the data from the segments.
        LOOP AT idoc_data INTO lwa_data
        WHERE docnum = lwa_control-docnum and
              segnam = lc_item_create.
    *->> Set the tabix of the internal table
          lv_index = sy-tabix.
    Move the Material Document Item Segment data
          MOVE lwa_data-sdata TO lwa_e1bp2017_gm_item_create.
    Modify the material document item data  internal table
          PERFORM sub_modify_idocdata changing lwa_e1bp2017_gm_item_create.
    *->> set the changed values to the IDOC SDATA
          MOVE  lwa_e1bp2017_gm_item_create TO lwa_data-sdata.
    *->> Modify the table
          MODIFY idoc_data FROM lwa_data index lv_index.
    Clear the Work areas
          CLEAR : lwa_data,
                  lwa_e1bp2017_gm_item_create.
        ENDLOOP.                                     "LOOP AT t_idoc_data
    Call the BAPI function module to create the
    appropriate Material Document
        CALL FUNCTION 'BAPI_IDOC_INPUT1'
          EXPORTING
            input_method          = input_method
            mass_processing       = mass_processing
          IMPORTING
            workflow_result       = workflow_result
            application_variable  = application_variable
            in_update_task        = in_update_task
            call_transaction_done = call_transaction_done
          TABLES
            idoc_contrl           = idoc_contrl
            idoc_data             = idoc_data
            idoc_status           = idoc_status
            return_variables      = return_variables
            serialization_info    = serialization_info
          EXCEPTIONS
            wrong_function_called = 1
            OTHERS                = 2.
        IF sy-subrc = 1.
          RAISE wrong_function_called.
        ENDIF.
      endloop.
    ENDFUNCTION.
    here when we write the statment
    PERFORM sub_modify_idocdata changing lwa_e1bp2017_gm_item_create and double click on sub_modify_idocdata .
    it will create a include with the name "LZDTSINT052F_GPOMS_GMF01 ".
    now we can write the FORM ..END FORM In this inculde.like this.
    ***INCLUDE LZDTSINT052F_GPOMS_GMF01 .
    *&      Form  sub_modify_idocdata
    Modify the material document item data  internal table
    FORM sub_modify_idocdata
    CHANGING pwa_e1bp2017_gm_item_create TYPE e1bp2017_gm_item_create.
    contant declaration
      CONSTANTS: lc_261(3) TYPE c VALUE '261'.
      DATA : lv_aplzl LIKE resb-aplzl,
             lv_aufpl LIKE resb-aufpl,
             lv_subrc LIKE sy-subrc,
             lv_charg LIKE resb-charg,
             lv_uom LIKE pwa_e1bp2017_gm_item_create-entry_uom.
      CLEAR: pwa_e1bp2017_gm_item_create-reserv_no,
             pwa_e1bp2017_gm_item_create-res_item.
    *->> Get SAP storage bin & Storage type from the Z table
      SELECT lgtyp lgpla
        INTO (pwa_e1bp2017_gm_item_create-stge_type,
              pwa_e1bp2017_gm_item_create-stge_bin)
         UP TO 1 ROWS
        FROM zdtsint050_sttyp
         WHERE zstorage_typ = pwa_e1bp2017_gm_item_create-stge_type
          AND  zstorage_bin = pwa_e1bp2017_gm_item_create-stge_bin.
      ENDSELECT.
      IF sy-subrc NE 0.
        CLEAR: pwa_e1bp2017_gm_item_create-stge_type,
               pwa_e1bp2017_gm_item_create-stge_bin.
      ENDIF.
      PERFORM get_oper CHANGING pwa_e1bp2017_gm_item_create.
    Get the Reservation number and Reservation item number
    basing on the idoc data.
      SELECT rspos werks lgort
             INTO (pwa_e1bp2017_gm_item_create-res_item,
                  pwa_e1bp2017_gm_item_create-plant,
                     pwa_e1bp2017_gm_item_create-stge_loc)
             FROM resb
             UP TO 1 ROWS
             WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no
             AND   matnr = pwa_e1bp2017_gm_item_create-material
             AND   charg = pwa_e1bp2017_gm_item_create-batch
             AND   aufnr = pwa_e1bp2017_gm_item_create-orderid
             AND   vornr = pwa_e1bp2017_gm_item_create-activity
             AND   bwart = lc_261.
      ENDSELECT.
      IF sy-subrc <> 0.
    Start of insertion for R31K993797
        CLEAR lv_charg.
        SELECT rspos werks lgort
             INTO (pwa_e1bp2017_gm_item_create-res_item,
                  pwa_e1bp2017_gm_item_create-plant,
                     pwa_e1bp2017_gm_item_create-stge_loc)
             FROM resb
             UP TO 1 ROWS
             WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no
             AND   matnr = pwa_e1bp2017_gm_item_create-material
             AND   charg = lv_charg
             AND   aufnr = pwa_e1bp2017_gm_item_create-orderid
             AND   vornr = pwa_e1bp2017_gm_item_create-activity
             AND   ( splkz = 'X' or
                     splkz = space )
             AND   bwart = lc_261.
        ENDSELECT.
        IF sy-subrc <> 0.
    End of insertion for R31K993797
          SELECT SINGLE werks lgort
                INTO (pwa_e1bp2017_gm_item_create-plant,
                       pwa_e1bp2017_gm_item_create-stge_loc)
                FROM resb
                WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no.
          CLEAR : pwa_e1bp2017_gm_item_create-reserv_no,
                  pwa_e1bp2017_gm_item_create-res_item.
        ENDIF.
      ENDIF.
    get SAP UOM
      SELECT SINGLE zsap_uom
                    INTO lv_uom
                    FROM zca_uom_conv
                    WHERE zext_uom = pwa_e1bp2017_gm_item_create-entry_uom.
      IF sy-subrc = 0.
        pwa_e1bp2017_gm_item_create-entry_uom = lv_uom.
      ENDIF.
    ENDFORM.                    " sub_modify_idocdata
    *&      Form  get_oper
         Get the operation
         <--P_PWA_E1BP2017_GM_ITEM_CREATE_RE  Segment
    FORM get_oper  CHANGING p_pwa_e1bp2017_gm_item_create TYPE
                   e1bp2017_gm_item_create.
      DATA : l_aufpl LIKE afko-aufpl,
             l_aplzl LIKE afvc-aplzl.
      REFRESH : i_op.
      UNPACK p_pwa_e1bp2017_gm_item_create-orderid TO
             p_pwa_e1bp2017_gm_item_create-orderid.
    Get the reservation and routing number for the order
      SELECT SINGLE
             rsnum
             aufpl
             FROM afko
             INTO (p_pwa_e1bp2017_gm_item_create-reserv_no,
                   l_aufpl)
             WHERE aufnr = p_pwa_e1bp2017_gm_item_create-orderid.
      IF sy-subrc = 0.
        CALL FUNCTION 'CONVERSION_EXIT_NUMCV_INPUT'
          EXPORTING
            input  = p_pwa_e1bp2017_gm_item_create-activity
          IMPORTING
            output = p_pwa_e1bp2017_gm_item_create-activity.
      ENDIF.
    ENDFORM.                    " get_oper
    Regards,
    nagaraj

  • The correct ways to create a helper functions in C++

    Hi there
    I have many functions which I use in my projects from different classes.
    Which is the most correct ways to create a helper functions.
    Thanks

    1) Split your project into different versatile sub-modules each handle by an object. The module should be reusable later on.
    2) Each module or class should be declared on separate .hpp and .cpp files. ( for reusability and portability ) 
    3)Make each module as much self contained as possible(independent) . That way you can reduce unnecessary linking with other files and reduce dependency on helper files. Compiling and working on only one module at a time will be easier and faster.
    4)When your code is better organize , coding will more systematic, less error prone, easy debugging and more fun in programming.
    For example in my project I create classes like
        i) CDatabaseManager - to take care of SQL database
        ii)CPlaylistManager - to deal with complex playlist
       iii)CGraphicManager - to deal with graphic overlay over video
       and so on.
    Thanks. I would like to know how organize it ? Is it right to write helper function in namespace or class ? And is it right to make
    static functions ?

  • How get the actual hours worked by the employee in SAP.

    Hello Experts,
    How to get the actual hours worked by employee in a month.( Any infotypes or tables or fm)
    I have report to get planned hours of the employee
    Thanks and Regards
    Reddy

    Hello expert,
    I am a technical guy, I dont have functional knowledge and HR functional support is not available at the moment..
    I have requriement to develop a report to caluclate the actual night shift hours worked by the employee...
    I have report : RPTEDT00 where in I have actual hours worked day and night..
    But I am not able to find how do in my custom program from the program reference...So I want to know is there any way where in I see this data in tables or infotypes
    Thanks and Regards
    Reddy

  • CF10 Sandbox Security prevents CFCOLLECTION create from working

    Hello, everyone,
    I've got CF10 installed on my dev system.  I've created several Solr collections.  I have turned on Sandbox Security, and added defined directory permissions for C:/ColdFusion10/cfusion/collections and C:/ColdFusion10/cfusion/jetty folders.  I have edited both paths so that NOTHING is disabled.
    If Sandbox is on and I remove a collection from within CFAdmin, when I try to use the CFCOLLECTION action="create" tag, I get java.io.filePermission "read" access denied messages.
    If I turn off Sandbox, the tag runs fine.
    What else do I need to do in order for CFCOLLECTION action="create" to work while Sandbox is on?
    V/r,
    ^_^

    Hi, Charlie!  Thanks for chiming in.  (Also, sorry for delay in responding..)
    Yes, when the collection is created in CFAdmin, the collection IS creating the folders in C:\ColdFusion10\cfusion\collections.
    When I create them with CFCOLLECTION, I am specifying the same path to the collections folder.
    For the Sandbox, CF10 installs with three items in the Sandbox, already:
    (ColdFusion WEB-INF system directory)
    (ColdFusion CFIDE system directory)
    C:/ColdFusion10/cfusion/wwwroot/
    I have added to this list:
    C:/ColdFusion10/cfusion/jetty/
    C:/ColdFusion10/cfusion/collections/
    For each of the two I added, I edited them both:
    Data Sources - ALL DATASOURCES enabled
    CF Tags - All tags enabled, none disabled
    CF Functions - All functions enabled, none disabled
    Files/Dirs - Each path (with two entries, each: / and /-) set for Read, Write, Delete
    Server/Ports - ALL IP:ports are open, no restrictions
    Others - ALL runtimes enabled, none disabled
    I have gone in to look at the settings for wwwroot.  With one exception, it is identical to the above.  That one exception is that all runtimes (under Others) are disabled, none enabled.
    V/r,
    ^_^

Maybe you are looking for