Get an enum based on a number

Hi,
Consider the following enum declaration:
public enum MyEnum {
        STATE1 (1),
        STATE2 (2),
        STATE3 (3),
        private final int id;
        MyEnum (Integer id) { this.id = id; }
        public itn getId() { return id; }
    };I use this enum to persist the object state in the database. Actually I use the id value. But now I would like to read this column from the database and turn this value back to an enum. I couldn't find a straight way to do that. Is that possible or, maybe the question should take other direction, is that compliant to the concept of enums?
Thanks!

Thanks for the answers.
Unfortunately I must use the id as I can't touch de database schemma. Another problem is that the id does not correspond to the enum position, so, the suggestion of using enum.values won't work either. My real enum looks like
public enum MyEnum {
        STATE1 (14),
        STATE2 (22),
        STATE3 (37),
......So, the first index corresponds to the id 14. I would like to read 14 from the database and get MyEnum.STATE1

Similar Messages

  • BAPI to get Invoice Details based on PO Number

    HI,
    Is there any BAPI to get Invoice Details based on PO number. If so could you pls let me know that.
    Regards,
    Ramesh

    Hi Ramesh  ,
    there is no Direct BAPI to get the List of Invoices ,But based on the Vendor list u can get the List .
    pass Vendor list , Document Dates.
    <b>BAPI_INCOMINGINVOICE_GETLIST</b> for more info check the Documentation of this FM.
    Regards
    Prabhu

  • How to get ATINN value based on material number and Class Type ?

    I have below SELECT stmt code which gives the correct value of atwrt based on materil no and ATINN.
    However in quality system, it is failing because in quality system "atinn" value is not 0000000381. It is different.
    So how can I get ATINN(Internal characteristic) value based on material number and Class Type?
    -Obtain the batch characterstic value for the Material******************
      SELECT atwrt
        UP TO 1 ROWS
        INTO v_charvalue
        FROM ausp
       WHERE objek = mcha-matnr
         AND atinn = '0000000381'   " 'US80_FRENCH_ON_LABEL'
         AND klart = '001'.
    THANKS N ADVANCE.

    Hi SAm,
    use the Below function module to get the Atinn for Atwrt for thr Class and MAterial combination..
    CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
          EXPORTING
            classtype          = '023'       "Class type
            object             = w_object  "Material number with Leading zeros
            no_value_descript  = 'X'      "Default X
            objecttable        = 'MCH1'    "Table name Mara or MCH1 or MARC
          TABLES
            t_class            = t_class   "It return the Batch class available for the above combination
            t_objectdata       = t_char  "Return Batch characteristics(ATWRT) and their value ATINN in this table
          EXCEPTIONS
            no_classification  = 1
            no_classtypes      = 2
            invalid_class_type = 3
            OTHERS             = 4.
    Regards,
    Prabhudas

  • How to get planned % complete based on number of days

    Hello:
    I a trying to figure out a way(best way) to determine a "planned % complete" simply based on the number of days in a task.
    For example:
    Task Start Date = 3/1/15
    Task Finish Date = 3/20/15
    So the task is 20 days long
    Today is 3/10/15 so "planned % complete" should be 50%
    (Today-Start) / (Finish-Start)
    =
    ((3/10/15)-(3/1/15)) / ((3/20/15)-(3/1/15))
    =
    (10) / (20)
    =
    50%
    Do I just enter this into a custom field as a formula or is there a better way of doing this?
    Also, when I tried to do this with a formula, it did not apply to the roll up tasks. So, the bolded tasks were blank.
    I am trying to get to a calculated number of the % I should be completed based on the current date and length of the task. I realize this might not be the best way so any
    suggestions are greatly appreciated.
    I would like to be able to look at my project and see that I am 35% complete, but I should be 50%.
    Any guidance is greatly appreciated.
    I am using MS Project 2010.
    Thanks
    kp

    Hi kp,
    You are typically asking for Earned Value indicators. You could of course use the kind of formula you are refering to, but have in mind that MS Project proposes by default a large number of EV fields, such as CPI, SPI and all variance fields. Although it
    requires a certain maturity in scheduling (cost, baselines, status date, tracking), it will provide you a large set of EV indicators out of the box.
    See an excellent article
    here.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • BAPI function module to get condition type and its values based on delivery number?

    Hi All,
    I would like to have the BAPI function module to get condition type value based on delivery number before invoice is created.please provide detail program for as a reference .please reply as soon as possible its urgent.
    Regards,
    saaikumar.

    If you haven't already, you may first need to search via the SAP transaction "BAPI" in the area this is applicable to.  Failing that I do hope you get an answer.

  • BAPI or Function Module to get MSEG table data based on PO Number (EBELN)

    Hi
    1. Is there any BAPI /  Function Module to get PO details based on Plant and PO date?
    2. Is there any BAPI / Function Module to get Material document details(MSEG data) based on PO number?
    Thanks
    Narendra

    Hi,
    check the Bapis Givem below
    BAPI_PO_GETITEMS
    http://abap.wikiprog.com/wiki/BAPI_PO_GETDETAIL1
    you will get the detail.
    Regards

  • Based on personel number, how do I get country code for that person?

    Based on personel number, how do I get country code for that person? Is there any function module to allow me to do that? Thanks!

    Hi,
    Check function module HR_PERNR_COUNTRY_GET.
    Donnie

  • Get CMdetails based on Reference Number

    Hi,
    I am developing Credit Memo Details report, here user wants all the details including Acct Docu Number based on Reference number.
    The report is working fine if the Credit memo has account docu number, but now user wants this report to work if Cmemo does not have ACCtDocuNum also.
    Please help me to modify this report so that it displays all details with out AcctDocuNumber also based on Reference number.
    Thanks,
    Neelu.
    FORM get_data.
      SELECT a~vbeln a~posnr a~vgbel a~netwr a~fkimg a~matnr
             b~vkorg b~vtweg b~spart b~kunag b~xblnr b~bstnk_vf
             FROM vbrp AS a
             INNER JOIN vbrk AS b
              ON a~vbeln = b~vbeln
              INTO TABLE ivbrkp
              WHERE b~xblnr IN s_xblnr
              AND b~fkart = 'ZMKD'.
      IF sy-subrc = 0.
        SELECT kunnr matnr sprice eprice eohqty bstkd crmemo
              FROM zppprice INTO TABLE izppprice
              FOR ALL ENTRIES IN ivbrkp
              WHERE kunnr = ivbrkp-kunag
                    AND matnr = ivbrkp-matnr
                    AND crmemo = ivbrkp-vgbel.
      ENDIF.
    ENDFORM.                    " get_data
    *&      Form  process_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM process_data.
      DATA: lv_name1 LIKE kna1-name1,
            lv_auart LIKE vbak-auart,
            lv_augru LIKE vbak-augru,
            lv_werks LIKE vbap-werks,
            lv_fkdat LIKE vbkd-fkdat,
            lv_knumv LIKE vbak-knumv,
            lv_kbetr LIKE konv-kbetr.
      LOOP AT ivbrkp.
        g_bqty  =  ivbrkp-fkimg.
        MOVE ivbrkp-vbeln      TO iout-vbeln.
        MOVE ivbrkp-posnr      TO iout-posnr.
        MOVE ivbrkp-vgbel      TO iout-vgbel.
        MOVE ivbrkp-netwr      TO iout-netwr.
        MOVE g_bqty            TO iout-g_bqty.
        MOVE ivbrkp-vkorg      TO iout-vkorg.
        MOVE ivbrkp-vtweg      TO iout-vtweg.
        MOVE ivbrkp-spart      TO iout-spart.
        MOVE ivbrkp-kunag      TO iout-kunnr.
        MOVE ivbrkp-matnr      TO iout-matnr.
        MOVE ivbrkp-xblnr      TO iout-xblnr.
        MOVE ivbrkp-bstnk_vf   TO iout-bstnk_vf.
        READ TABLE izppprice WITH KEY kunnr = ivbrkp-kunag
                                      matnr = ivbrkp-matnr
                                      crmemo = ivbrkp-vgbel.
        g_qdiff =  izppprice-eohqty - g_bqty.
        IF sy-subrc = 0.
          MOVE izppprice-sprice  TO iout-sprice.
          MOVE izppprice-eprice  TO iout-eprice.
          MOVE izppprice-eohqty  TO iout-eohqty.
          MOVE g_qdiff           TO iout-g_qdiff.
        ENDIF.
        SELECT SINGLE name1
                FROM kna1 INTO lv_name1 WHERE kunnr = ivbrkp-kunag.
        IF sy-subrc = 0.
          MOVE lv_name1 TO iout-name1.
        ENDIF.
        SELECT SINGLE auart augru FROM vbak INTO (lv_auart, lv_augru)
                                  WHERE vbeln = ivbrkp-vgbel.
        IF sy-subrc = 0.
          MOVE lv_auart TO iout-auart.
          MOVE lv_augru TO iout-augru.
        ENDIF.
        SELECT SINGLE werks FROM vbap INTO lv_werks
                            WHERE vbeln = ivbrkp-vgbel
                              AND posnr = ivbrkp-posnr.
        IF sy-subrc = 0.
          MOVE lv_werks TO iout-werks.
        ENDIF.
        SELECT SINGLE fkdat FROM vbkd INTO lv_fkdat
                            WHERE vbeln = ivbrkp-vgbel.
        IF sy-subrc = 0.
          MOVE lv_fkdat TO iout-fkdat.
        ENDIF.
        SELECT SINGLE knumv
               FROM vbak INTO lv_knumv
                WHERE vbeln = ivbrkp-vgbel.
        SELECT SINGLE kbetr
               FROM konv INTO lv_kbetr
                WHERE knumv = lv_knumv
                AND kschl = 'ZCPP'.
        IF sy-subrc = 0.
          MOVE lv_kbetr TO iout-g_pdiff.
        ENDIF.
        APPEND iout.
        CLEAR iout.
        CLEAR ivbrkp.
        CLEAR lv_name1.
        CLEAR lv_auart.
        CLEAR lv_augru.
        CLEAR lv_werks.
        CLEAR lv_fkdat.
        CLEAR lv_knumv.
        CLEAR lv_kbetr.
      ENDLOOP.
    ENDFORM.                    " process_data

    Hi,
    There is std Tcode MB25 in sap or u can use RESB table to see reservation against production order.
    Arun

  • HOW TO FIND LAST DOCUMENT DATE BASED ON MATERIAL NUMBER

    Hi,
           I want to know how to find the last document details based on material number.
    Is there any Functional modulle or BAPI programe?
    i,e, I want know last goods receipt details (MIGO)  based on material number.
    Can u please anybody tell me.
    Thanks,
    S.Muthu.
    Edited by: Subramaniyan Marimuthu on Jan 2, 2008 9:07 AM

    Hello.
    Check the BAPI_GOODSMVT_GETITEMS
    -example--
    Get GRs after a specific date for a specific plant/ storage location and movement types
      wa_budats-sign = 'I'.
      wa_budats-option = 'GE'.
      wa_budats-low = '20071201'.
      APPEND wa_budats TO budats.
      wa_plants-sign = 'I'.
      wa_plants-option = 'EQ'.
      wa_plants-low = '1000'.
      APPEND wa_plants TO plants.
      wa_stlocs-sign = 'I'.
      wa_stlocs-option = 'EQ'.
      wa_stlocs-low = '0001'.
      APPEND wa_stlocs TO stlocs.
      wa_mvts-sign = 'I'.
      wa_mvts-option = 'EQ'.
      wa_mvts-low = '101'.
      APPEND wa_mvts TO mvts.
      wa_mvts-low = '901'.
      APPEND wa_mvts TO mvts.
      wa_mvts-low = '123'.
      APPEND wa_mvts TO mvts.
      CALL FUNCTION 'BAPI_GOODSMVT_GETITEMS'
        TABLES
          plant_ra        = plants
          stge_loc_ra     = stlocs
          move_type_ra    = mvts
          pstng_date_ra   = budats
          goodsmvt_header = header
          goodsmvt_items  = item
          return          = return.
    Reward if helpful.
    Cheers,
    George

  • Freight revenue is allocated by profit center, based on the number of units

    Hi SAP Gurus,
    I am facing one issue in sales order processing.
    The Sales order is getting created through an inbound IDOC.
    The data (Condtion type and Condition value) for Freight will get populated at at the header level at will get allocated to the line Items wrt quantity.
    The requirement is - "Freight revenue is allocated by profit center, based on the number of units shipped".
    Please let me know how to achieve this requirement.
    Regards,
    Bhaskar

    In VOFM- Reqirements- Pricing- You need to create a new requirement- Routine.
    That Routine should calculate
    To check Frieght condition(i.e. ZFRT) at the header in the sales order, if tcode - "VA01" 
    If Freight conditon ZFRT found then transfer that reqirement to item level  by data transfer,
    IF Freight conditon is found at the item level then allocate revenue by = profit center XXXX to XXXXX , (based on MARC- PRCTR ) in MM03  number of units shipped .
    You might also need to configure Account determination for this freight conditon to post to correct G/L A/C.
    This is an Enhancement.
    Good luck

  • How to split the IDOCS based on document number change whit out BPM

    Hi all,
    Thanks,for giving the responce..
    Scenario:File to IDoc.
    Problum1 : How to Split the IDocs based on document number change in the source file with out BPM.My file contains document numbers like
    20000092
    20000092
    20000092
    50000050
    50000050
    50000065
    I want 3 IDocs in target system.i.e 1 for 20000092,20000092,20000092
                                                       2 for 50000050,50000050
                                                       3 for 5000006
    By using external definations i am getting 6 IDOCs insted of 3.
    Problum 2:Is there any chnges/modifications in Directory when we are using external definations.
    Could u plz provide me the step by step process(Repository/Directory) with using of external definations.
    Thanks in advance.
    Regards,
    KP

    HI,
    for this no need of BPM.
    You can think of Idoc bundling concept to acheive this-just you need to do the external definition to change the idoc occurence
    /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change
    to achieve for each document no, one idoc, you can write small user defined function in the mapping with context handling you an achieve this.
    For this e.g
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6bd6f69a-0701-0010-a88b-adbb6ee89b34
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/877c0d53-0801-0010-3bb0-e38d5ecd352c
    Regards,
    Moorthy

  • PM Work Orders Details based on  Equipment number

    Hi Friends
    I need some help on finding BAPI or FM for
    Plant Maintenance <u>Work Orders list </u><b>AND</b> <u>Work Orders Details </u>based on  Equipment Number [ if i proved  the Equipment Number as input result is  Work Orders Details of  Equipment no ] any doc....
    Thanks in advance ,
    Regards
    Ram

    Hi,
    I think you can get from AFIH Table.
    Regards,
    Satish

  • GL account number based on plant number

    Dear All,
    Please let me know how can we find the GL Account assigned for a plant.
    I fetch some data(say A) based on WERKS(plant 101) in ITAB1 and some data(say B) based on GL account number( 0001130101   Estoque Loja Matriz).
    A = 100
    B = 200
    Now , i need to add A and B comparing WERKS and GL account number.
    Is there any way i can relate these two fields ??
    I can explain it clearly if i am not clear .
    Thanks in Advance
    SSK

    Hello,
    To make all things clear. The issue regards regular sale process in ERP, I mean we have sale order, delivery and invoice. There are two financial documents related to it. One of them is a reference to sale invoice and the other one to goods issue material document. In case first of those documents the case is easy, proper financial accounts for posting can be done by settings account numbers in transaction VKOA (Assign G/L account) where among the others I can set account based on customer number. The same thing I need to for my financial document related to MM document. I know I can achieve it by setting additional movement type and assigning to it account number using OBYC general modifications and so on. The point is that I donu2019t like this idea. As a result Iu2019ll get a bunch of movement types created only for FI purposes but I have no slightest idea how to do it any other way.
    Iu2019ll be grateful help and advice.
    Regards
    Pawel Kobylinski

  • Function Module to get PO details based on Plant and PO date

    Hi
    1. Is there any Function Module to get PO details based on Plant and PO date?
    2. Is there any Function Module to get Material document details based on PO number?
    Thanks
    Narendra

    hi,
    check these standard reports.
    ME2L - By vendor
    ME2M - By material
    MSRV3 - By service
    ME2K - By account assignment
    ME2C - By material group
    ME2B - By tracking number
    ME2N - By PO number
    ME2W - By supplying plant
    also chck this func module.
    REPL_LIST_PURCHASE_ORDER_READ
    reward if hlpful.

  • How do I create a new Folder for each test report based on Serial number?

    I want to be able to create a new folder for each test report based on serial number. Each time a UUT is tested, I want the report to go to the appropriate folder. What is the best way to do this?
    Thanks

    Hello Tman,
    This is a slightly tricky question. The reason being, the report options like the report path etc, are set before you see the serial number prompt when you run your UUT. There might be other ways of getting around this, but a quick solution would be modifying the process model.
    I modified the PreUUT callback to set the report options. I passed the reportOptions as a parameter to this sequence. In the PreUUT sequence, I set the following fields:
    Parameters.ReportOptions.GeneratePath=False
    Parameters.ReportOptions.ReportFilePath= "c:\\"+ Locals.SerialNumber +"\\report.xml"
    I hope this would give you an idea.
    SijinK

Maybe you are looking for

  • Getpeername: Socket operation on non-socket

    when i am starting the in.ftpd service. i am getting the below error in.ftpd[5418]: [ID 572618 daemon.error] getpeername: Socket operation on non-socket. Thanks in advance.

  • My iphone4 will not sync with my mac

    i have gone through all the help tutorials and nothing is working. iv reset my phone and dowloaded all the updates and nothing is making a difference. have i disabled something somewhere? im not sure. can somebody help me please!

  • How to buy iSight camera?

    I have a 30" Apple Cinema HD display with no iSight camera. For some reason, I can't find an iSight camera for sale at the Apple Store. Do you have to buy a new computer to get the iSight?

  • Accural GL in Billing

    Dear Gurus, I have a condition type in pricing procedure for accrual. Means the value of this condition type will not be part of Net or Tax but going to the specific GL. So in that condition type configuration page I mark it as Accural in control dat

  • BW Connectivity in 1.17

    The latest release of Lumira (1.17) now has the option to connect online to BW queries. As Lumira and PA are now supposedly sharing the same release strategy again I was expecting to see this option available in PA 1.17 as well, but no luck unfortuna