Comparing a table itself to find the grade change duration

hi Frnds
I have one table with Grades and jobs and i need to find the duration of staff for a particular grade.If a person have multiple grades in his EmpGrade History how long he was on that grade.I want to find the grade differe not job Difference.How long one person stayed in a certian grade as of 31-DEC- 2007,31-DEC-2008
EmpGradeHist
empno---------grade----------job-------Datestart---------Dateend
110-------------4---------------Clerk------- 01-JAN-2006------01-DEC-2007
110--------------4--------------SnrClerk----02-DEC-2006------01--JAN-2008
110--------------5---------------Officer------02-JAN-2008------31-APR-2009
110-------------6----------------SnrOfficer--- 01-MAy-2009---
111-------------5---------------officer-------01-JAN-2005------01-DEC-2005
110--------------5--------------Snrofficer--02-DEC-2005------31--MAR-2007
110--------------8---------------SnrEXe----01-APR-2007------31-APR-2008
110-------------9----------------SnrExe--------01-MAy-2008--- -
the Desired result should be
as of 31-DEC-2008
empno------ Grade------Dur
110-----------4----------2yrs
110---------- 5----------.9yr
111---------5----------2.3yr
I tried following query but its not working
SELECT empno,grade,MIN(datestart),MAX(dateend),MAX(dateend)-MIN(datestart) Duration FROM
SELECT emp,grade,datestart,(CASE WHEN NVL(dateend,:dt)>=:dt
THEN :dt
                         ELSE dateend END) dateend
FROM EmpGradeHist
WHERE datestart <= :dt)
GROUP BY empno,grade
rgds
radhika

Starting a duplicate thread is not the answer to avoid a question: Comparing a table itself to find the change duration

Similar Messages

  • From which table we can find the stuck process in workflow from background

    Hi There,
    from which table we can find the stuck process
    in workflow from background.
    i mean the table which store information about going on process.
    It's Urgent
    Thank's
    Bachan
    Message was edited by:
    Bachan

    You can also run "bde_wf_item.sql" script.
    Note: 187071.1 - bde_wf_item.sql - Runtime Data of a Single Workflow Item
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=187071.1
    "Oracle Workflow Cartridge (WF): Workflow Item Details Data Collection Test" should be also helpful.
    Note: 369576.1 - Oracle Workflow Cartridge Workflow Item Details Data Collection Test
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=369576.1

  • From what table I can find the field STTXT?

    From what table I can find the field STTXT (Description of maintenance status)?
    Regards,
    Subhasish

    Hello,
    Have a look at thgis thread.
    what is STATUS_TEXT_EDIT function
    Vasanth

  • From which table I can find the "Class type" and "Class" of the material?

    From which table I can find the "Class type" and "Class" of the material?
    Thanks in advance for the answers....

    Hi,
    try following table
    KSSK     Material number to class     
    KLAS     Class description     
    KSML     Characteristic name     
    CABN/CABNT     Characteristic name description     
    CAWN/CAWNT     Characteristic name
    [http://www.sap-img.com/materials/classification-view-of-material-master.htm]
    [http://wiki.sdn.sap.com/wiki/display/ERPLO/FrequentlyUsedTables]
    Regards
    kailas Ugale

  • In which table cound i find the info on EDI standard Message type??

    Example
    EDI standard Message type Business process
    EDIFACT ORDERS Purchase order
                   INVOIC Invoice
    ANSI X12  850 Purchase order
                    810 Invoice
    Like those 850..810..etc info, i dont know from which table could i find the related info?
    Thanks.

    Hi Hoo,
    Electronic Data Interchange (or EDI) refers to the use of computers in formatting and exchanging business information using internationally recognized standards and formats. Standards organizations throughout the world have defined hundreds of document types to create a universal language for companies to conduct business while using dissimilar systems and processes. Common business documents, such as the invoice, purchase order, production planning schedule, ship manifest, and customs declaration, have been standardized and are sent and received electronically over private secure networks (Value-Added Networks - VANs) and the Internet.
    So EDI is not an SAP product, It is a method to exchange the data over internet.
    You dont get any information in any table in SAP. SAP supports EDI to exchange the data over internet. There are no. of third party EDI tools to connect to SAP.
    following is link to know more about EDI message types.
    http://www.edifactory.de/messages.php?s=D96A

  • In which table we can find the relationship between Role id and Task id

    Hi Experts,
    In which table we can find the relationship between Role id and Task id in Cprojects.
    Thanks
    Subhaskar

    Hi Subhaskar,
    Apart from DPR_ENTITY_LINK , you can also get it from table DPR_PART.
    Please go through the below link
    http://wiki.sdn.sap.com/wiki/display/PLM/cProjectstablesin+SAP
    I hope this will help you.
    Regards,
    Rahul

  • In which table can I find the name and surname  for a username ?

    Hello,
    I search the table with the master data of users. Specially I search the table where I can find the
    name, surname for a user.
    In which table can I find the name and surname  for a username ?
    Thanx in Advance

    Hello  everybody,
    thank you for the helpful informations.
    thank you very much
    with kind regards
    cetoman

  • In which table can I find the tcode, username and data of login ?

    Hello,
    I would like to know which tcode and when specific users use.
    And therefore I have  question:
    In which table can I find the the tcode, username and data and time of login ?
    Rgds Stenwa

    Depending on the version of SAP you are using, you can trace this via:
    1. STAD.
    2. SM20. But proper config should be maintained via SM19.
    Please read this documentation by SAP for details: [http://help.sap.com/saphelp_nw70/helpdata/EN/8a/a8b5386f64b555e10000009b38f8cf/content.htm]
    BR,
    Suhas
    Edited by: Suhas Saha on Apr 22, 2010 6:45 PM

  • From which tables i would find the delivery and billing document field..??

    I need to create an ALV report which displays the following details in the output.
    Order No  Item No     Material     Order Qty     Item Category     Plant     Delivery     Billing Document     Sales Org     Dist Channel     Division     Created By     Created On      Changed On
    For(Order No  Item No     Material     Order Qty     Item Category     Plant) i took the fields from vbap and
    for(Sales Org     Dist Channel     Division     Created By     Created On      Changed On)i took the fields from vbak..
    From which tables i would find the delivery and billing document field related to sales document.??
    need help...
    Moderator message : Requirements dumping not allowed, thread locked.
    Edited by: Vinod Kumar on Mar 6, 2012 2:53 PM

    i am new to abap...so i dont have idea about sd table relationship.
    so please reply how to add delivery and billing doc in my coding below..
    *& Report  ZINAA_SD
    REPORT  zinaa_sd.
    TABLES: vbap, vbak, vbfa.
    TYPE-POOLS: slis.
    CONSTANTS: c_x TYPE char1 VALUE 'X'.
    TYPES:
            BEGIN OF st_vbap,
             vbeln TYPE vbap-vbeln,
             posnr TYPE vbap-posnr,
             matnr TYPE vbap-matnr,
             pstyv TYPE vbap-pstyv,
             kwmeng TYPE vbap-kwmeng,
             werks TYPE vbap-werks,
            END OF st_vbap,
            BEGIN OF st_vbak,
              vbeln TYPE vbak-vbeln,
              erdat TYPE vbak-erdat,
              ernam TYPE vbak-ernam,
              vkorg TYPE vbak-vkorg,
              vtweg TYPE vbak-vtweg,
              spart TYPE vbak-spart,
              aedat TYPE vbak-aedat,
            END OF st_vbak, 
           BEGIN OF st_final,
             vbeln TYPE vbap-vbeln,
             posnr TYPE vbap-posnr,
             matnr TYPE vbap-matnr,
             pstyv TYPE vbap-pstyv,
             kwmeng TYPE vbap-kwmeng,
             werks TYPE vbap-werks,
             erdat TYPE vbak-erdat,
             ernam TYPE vbak-ernam,
             vkorg TYPE vbak-vkorg,
             vtweg TYPE vbak-vtweg,
             spart TYPE vbak-spart,
             aedat TYPE vbak-aedat,
           END OF st_final.
    DATA:
          lt_vbap TYPE TABLE OF st_vbap,
          ls_vbap TYPE st_vbap,
          lt_vbak TYPE TABLE OF st_vbak,
          ls_vbak TYPE st_vbak,
          lt_final TYPE TABLE OF st_final,
          ls_final TYPE st_final,
          lt_fieldcat TYPE slis_t_fieldcat_alv,
          ls_fieldcat TYPE slis_fieldcat_alv,
          layout TYPE slis_layout_alv,
          lt_sort TYPE slis_t_sortinfo_alv,
          ls_sort TYPE slis_sortinfo_alv.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbap-vbeln,
                    s_erdat FOR vbap-erdat.
    SELECTION-SCREEN END OF BLOCK b1.
    PERFORM select_data.
    PERFORM loop_final.
    PERFORM sort.
    PERFORM a USING:
          'VBELN' TEXT-002,
          'POSNR' TEXT-003,
          'MATNR' TEXT-004,
          'KWMENG' TEXT-005,
          'PSTYV' TEXT-006,
          'WERKS' TEXT-007,
          'VKORG' TEXT-008,
          'VTWEG' TEXT-009,
          'SPART' TEXT-010,
          'ERNAM' TEXT-011,
          'ERDAT' TEXT-012,
          'AEDAT' TEXT-013.
    PERFORM display.
    *&      Form  SELECT_DATA
          text
    FORM select_data.
      SELECT
       vbeln
       vkorg
       vtweg
       spart
       ernam
       erdat
       aedat
       INTO CORRESPONDING FIELDS OF TABLE lt_vbak
       FROM vbak
       WHERE vbeln IN s_vbeln AND erdat IN s_erdat.
      IF sy-subrc = 0.
        SORT lt_vbak by vbeln.
      ENDIF.
      SELECT
       vbeln
       posnr
       matnr
       kwmeng
       pstyv
       werks
       INTO CORRESPONDING FIELDS OF TABLE lt_vbap
       FROM vbap
       FOR ALL ENTRIES IN lt_vbak
       WHERE vbeln = lt_vbak-vbeln.
      IF sy-subrc = 0.
        SORT lt_vbap by vbeln.
      ENDIF.
    ENDFORM.                    "SELECT_DATA
    *&      Form  LOOP_FINAL
          text
    FORM loop_final.
      LOOP AT lt_vbap INTO ls_vbap.
        ls_final-vbeln = ls_vbap-vbeln.
        ls_final-posnr = ls_vbap-posnr.
        ls_final-matnr = ls_vbap-matnr.
        ls_final-kwmeng = ls_vbap-kwmeng.
        ls_final-pstyv = ls_vbap-pstyv.
        ls_final-werks = ls_vbap-werks.
        READ TABLE lt_vbak INTO ls_vbak WITH KEY vbeln = ls_vbap-vbeln BINARY SEARCH.
        ls_final-vkorg = ls_vbak-vkorg.
        ls_final-vtweg = ls_vbak-vtweg.
        ls_final-spart = ls_vbak-spart.
        ls_final-ernam = ls_vbak-ernam.
        ls_final-erdat = ls_vbak-erdat.
        ls_final-aedat = ls_vbak-aedat.
        APPEND ls_final TO lt_final.
        CLEAR ls_final.
      ENDLOOP.
      ENDFORM.                    "LOOP_FINAL
    *&      Form  SORT
          text
    FORM sort.
      ls_sort-spos = '01' .
      ls_sort-fieldname = 'VBELN'.
      ls_sort-tabname = 'LT_FINAL'.
      ls_sort-up = c_x.
      ls_sort-subtot = c_x.
      APPEND ls_sort TO lt_sort .
    ENDFORM.                    "SORT
    *&      Form  A
          text
         -->FNAME      text
         -->SELTEXT    text
         -->EMPHA      text
    FORM a USING fname TYPE string seltext TYPE string.
      IF fname = 'KWMENG'.
        ls_fieldcat-do_sum =  c_x.
      ENDIF.
      ls_fieldcat-fieldname = fname.
      ls_fieldcat-seltext_m = seltext.
      APPEND ls_fieldcat TO lt_fieldcat.
      CLEAR ls_fieldcat.
    ENDFORM.                    "A
    *&      Form  ALV
          text
    FORM display.
      layout-zebra = c_x.
      layout-colwidth_optimize = c_x.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       i_callback_program                = sy-repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
        is_layout                         = layout
        it_fieldcat                       = lt_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
        it_sort                           = lt_sort
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = C_X
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
        t_outtab                          = lt_final
    EXCEPTIONS
      PROGRAM_ERROR                     = 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.
    ENDFORM.                    "ALV

  • Which Table, can I find the class and characteristic assigned to equipment.

    Hi all,
    I have assigned a characteristc to a class.
    And assigned this class to an equipment.
    Now in which table can i find the class assigned to this equipment.
    What is the logic to find the class and characteristic.
    Thanks in advance.
    Piyush

    Hi,
    As per above post, you can find classes. To find characteristics, Give EQUNR value in OBJEK field in AUSP table & get the ATINN value.
    Give ATINN value in ATINN field in CABN table & get ATNAM field value.
    In AUSP table, you can get the values against each characteristics as well.
    Regards,
    Maheswaran.
    Edited by: Maheswaran.K on Apr 19, 2011 9:28 AM

  • In which tables can I find the sd texts in the material register?

    Hi,
    In which tables can I find the sd texts in the material register?  
    Thanks.

    Hi,
    The texts are stored in tables STXH , STXL etc. But it is not possible to fetch the details directly from the tables. You have to use the function module READ_TEXT where you have pass the parameters  Text ID, Language, object as material number etc to fetch the text.
    You can take the help of an ABAPer to create a program for this.

  • In which table may I find the settled values from the WO's settlement

    Hello Expert,
    Can anyone be so kind an let me know In which table may I find  the value of settled costs from Work Order broken donwn into Settlement Receivers?
    I have found the table COBRB where I'm able to see the settlement rules for the WO but where the values from settlement are stored?
    Thank you in advance for valubale answers.
    Regards:
    Lukasz Kurlit

    Hello Kolla,
    I was too quick with my last answer, still I have the problem with this relation between COBRB and COEP, let me clarify it again.
    In WO I have manually modified the settlement rule that way that I settled costs split into two Cost Centers.
    Both lines regarding settlement rules are visible in table COBRB.
    Then I have  found in COEP table that there are stored exact values regarding settlement for both Cost Centers, one value for one Cost Center but without any key shows which one refers to which Cost Center (I recognized it after values which were settled in different time and after modification of settlement rule)
    What I need now is to find the relationship between COBRB and COEP that way that I will be able to know clearly (for reporting purpose) which line from COEP refers to which Cost Center recorded in COBRB.
    Link via OBJNR gives me only both lines in COEP without knowledge which one is from which Cost Center, there is no such field which will indicate which Cost center is hidden behind the value.
    I will be very appreciated for any hints how to find it.
    Regards:
    Lukasz Kurlit

  • Could anyone tell me in which tables could I find the field DMSHB?

    Hi All
    Could anyone tell mein which tables could I find the field DMSHB?
    It's managed in the t.code f-32
    Thanks

    Hi,
    find the below tables;
    BWPOS
    DSKOP
    J_1AOIFWVL
    MHND
    RFASLD11B
    TBKOW
    TZIN3
    Thanks

  • How to find the recent changes done in the workflow by user id ?

    Hello all,
    How to find the recent changes done in the workflow by user id ?
    I have made changed in Production system .
    Like changing the status ,
    changing the agent ,
    but for these it will , not ask for any request .
    So i want to know is there any method to find what are the changes done by me ?
    Thanks and regards
    Prem

    Hi,
    This is caused by mandant settings in scc4. It's better not to make changes in PRD, because then your DEV en QA systems differ.
    Kind regards, Rob Dielemans

  • I would like to find the object change and to move

    Thank you very much, but
    Sayfaları, tek tek sayfalarını bakacak bu script belgede (3, 5, 7, ...) işlem yok
    I would like to object all page (height and width of the rectangle is known, the text frame) to move to find and replace
    The height and width of a rectangle with known or find text frame, changing the height and width, to move to a point
    I'm glad I sent you edit scprit
    var findX, findY, changeX, changeY, moveX, moveY;
    var diyalogWindow = app.dialogs.add({name:"RECTANGLE oR TEXT FRAME", canCancel:true});
    with(diyalogWindow){
      with(dialogColumns.add()){
    with(borderPanels.add()){
    with(dialogColumns.add()) {
    staticTexts.add({staticLabel:"FİND X"});
                         findX = textEditboxes.add({editContents: "10"});
                        staticTexts.add({staticLabel:"FİND Y"});
                          findY = textEditboxes.add({editContents: "10"});
    with(dialogColumns.add()) {
         staticTexts.add({staticLabel:"CHANGE X"});
                          changeX = textEditboxes.add({editContents: "50"});
                          staticTexts.add({staticLabel:"CHANGE Y"});
                          changeY = textEditboxes.add({editContents: "60"});
             with(dialogColumns.add()) {
         staticTexts.add({staticLabel:"MOVE X"});
                          moveX = textEditboxes.add({editContents: "100"});
                          staticTexts.add({staticLabel:"MOVE Y"});
                          moveY = textEditboxes.add({editContents: "10"});
    if(diyalogWindow.show() == 1) {
    var myDocument=app.activeDocument;
    var p;
    for(p=0; p < myDocument.selection.length; ++p) {
            myDocument.selection[p].move([changeX.editContents,changeY.editContents]); // ................... how contined ???

    https://forums.adobe.com/message/6714843#6714843
    this script
    app.selection  .paragraphs.everyItem (). spaceAfter = 1
    its make spaceafter = 1
    but how make
    1
    2
    3
    4
    5
    Each click, I get a continuous increase
    2014-09-04 12:14 GMT+03:00 vandy88 <[email protected]>:
        I would like to find the object change and to move  created by vandy88
    <https://forums.adobe.com/people/vandy88> in InDesign Scripting - View
    the full discussion <https://forums.adobe.com/message/6700008#6700008>

Maybe you are looking for