How to make a bit field (multiple bits selectable) structure?

I'm develping a program to communicate with an external device, and it has a specific protocol. Often times, I need to make structs/typedefs of specific type (u8/u16/u32) that have values defined by multiple selection. For example, the protocol asks for the following:
The field is a bit field structure (multiple bits can be set simultaneously) defined as follows:
typedef u_16 COMM_TYPES;
#define A 0x8000
#define B 0x4000
#define C 0x2000
#define D 0x1000
How would you recommend implementing this? I've tried looping through a listbox in combination with a text ring that has the name and value pairs, but its cumbersome doing for each unique typedef (see image below)

That's what I would do.  Other than I might use OR instead of sum, but that shouldn't make a difference.
The other possibility would be to take the array of index values,  to a 2^x where x the array of indices, then add that.  This assumes that every index in the array matches bit for bit with the enum values.  Nothing is missing, and array element 0 corresponds to bit 0.  In your case, your order is reversed, but you can reverse the array.  And all your values are in the highest nibble of the highest byte (hex ?000)  So you'd have to do some bit shifting or multiplication to get the actual values.
But I think this would make your code that much more fragile.  I would just do what you have shown.

Similar Messages

  • Vendor Master Management - How to make 'Corporate Group' field an autoupdat

    Vendor Master Management - How to make 'Corporate Group' field an automatically updated field
    Frnz,
    I am doing a Spend Analysis and thereby restructring some aspects of SAP and business processes. One of the intiatives is to leverage the 'Corporate Group' field in Vendor Master for getting the consolidated spend visibility at the corporate group level of vendors. So far this field wasn't been used to effect. I can update it manually, but the question remains is how do I do with the change management of the corporate group of large vendor base in the scenario of everhappening Mergers and Acquisitions. Are there any alternatives anybody can suggest ? (Like linking D&B numbers etc)
    Thanks in advance for your suggestions..

    Hi Shiv,
    Let me elaborate the purpose of using this field. I want to have a consolidated spend visibility across a corporate group which has multiple vendor codes. Its difficult everytime to group the spends of these vendors manually especially when the number of vendors are too high. Also sometimes the names of vendor companies may not indicate that these are from same corporate group but in fact they could be. In order to have the reports generated on corporate groups, I must maintain this field in vendor master or a Z table. But the problem here is, it should be possible to update this field as and when there are any mergers or acquisitions at vendor side and the corporate group of a particular vendor gets changed due to this. So this has to be effected in vendor master or Z-table automatically. I do know that there are certain agencies like Dunn & Brad (DNB) which provide possibly the details on corporate group of a company but its not fully effective for Indian Vendors as its not mandatory on them to have DNB number & also its a disconnected process and I was looking to connect it seamlessly to Corporate Group field so that I need not bother to update these things manually everytime. I also wanted to explore various possibilities of doing this.
    I hope I have spelled it out correctly.

  • How to make read only field in Task list?

    Hi All,
    How to make read only field in Task list?

    This can be done one of two ways:
    1. Customize the form in Infopath, right click your field and disable the control.
    2. Use JavaScript/jQuery on the page to disable the element.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • How to make Sales Office field mandatory in VA01 initial screen?

    Hi,
    How to make Sales Office field mandatory in VA01 initial screen? I mean in the first screen where we enter the document type and the sales area?
    Regards,
    Ajit

    Dear Deepak,
    Thanks for the clarification.
    But, as far, I have understood the query - it is very simple and that is..
    Whenever one creates a Sales Order (T.Code: VA01), Parameter: Sales Office needs to be mandatory (for all Sales Order, irrespective of Customer Account).
    Until-unless, user won't enter the parameter: Sales Office, System will not lead to next page (now, here we need to enter Customer/ material etc...).
    I have answered the query, in this regards, only.
    Best Regards,
    Amit.
    Note: Pls. correct me, if I am wrong. Thanks for everyones guidance.

  • How to make tax classification field mandatory in sales order ?

    Hi,
    while creating sales order, " how to make tax classification field mandatory ".
    Please tell me the procedure.
    In tcode OVA2. what are the entries for fields,table.
    Regards,
    sapsduser

    Dear ,
    Could you please share why you want to make tax Classification field mandatory in sales order.
    Maintain Tax classification field for customer in Customer Master Data = (Sales Area Data - Billing document Tab page)
    Tax Classification field for Material in Material Master Data = Sales Org. 1 View.
    While creating sales order and enter customer and material system automatically fetch the tax classification related data into sales order.
    Tax is calculated based on the ship to party.
    Hope this will help you.....
    Regards,
    Manoranjan.

  • How to make valuation type field not changeable  in delivery tab of PO

    Hai friends,
                    I am new to badis..please guide me to solve the issue...
    how to make valuation type field not changeable  in delivery tab of PO...
    The field shd be in display mode only ...actually...there  a badi has been used before
    to get valuation type from a ztable depending on material and plant...
    Now ..my requirement is that the user shd not change the default value brought from the ztable...

    Hi SRINIVAS,
    You can achieve this from BADI only if BADI is allows you to do this. You cannot achieve everything from a BADI. Check if there is any expoting field in the methods that can be ticked for making the field in display mode. If not then you cannot achieve this from BADI.
    The field you want to default to display is a standard or zfield. If z, then you can changethe attribute of the screen field to Output only.
    Regards,
    Manish

  • How to make WBS element field in Notification a mandatory.

    How to make WBS element field in Notification a mandatory.
    Should I use USer Exit.
    In cutomization I didnt find ant standard customization

    Hi,
         If it is about WBS element field in Maintenance Order then check up user exit ;- IWO10009 PM Order: Customer Check for 'Save' Event
    For Notification i am not sure whether this field is ther , but anything u can perform checkings via 
    QQMA0014 QM/PM/SM: Checks before saving a notification
    Alternatively u can also explore via Transaction variant SHD0 ..
    regards
    pushpa

  • How to make the CATEGORY field mandatory in the SMIN Support Ticket in test management?

    Hi,
    how to make the CATEGORY field mandatory in the SMIN Support Ticket in test management?
    Rg,
    Karthik

    Hi Kamal,
    This note steps will no validation that the user actually enters a value and the message will be created even if this 'required field' is left blank.
    Any other way to validate the enter a value also?
    Rg,
    Karthik

  • How do we validate input fields on the selection screen

    How do we validate input fields on the selection screen

    hi balram,
    u can validate input fields using <b>AT SELECTION-SCREEN</b>  Event.
    PARAMETERS : p_werks TYPE marc-werks.
    AT SELECTION-SCREEN ON p_werks.
    SELECT SINGLE *
    FROM t001w
    WHERE werks = p_werks.
    IF sy-subrc <> 0.
    MESSAGE 'Invalid Plant' TYPE 'I'.
    ENDIF.
    Like this, we can validate user input for plant.
    check this link:
    http://help.sap.com/saphelp_nw04s/helpdata/en/9f/db9a2e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
    Reware me if useful......
    Harimanjesh AN

  • How to make icons of photos bigger when selecting to attach to email?

    how to make icons of photos bigger when selecting to attach to email?

    Changing the DPI to 120 won't affect the font size of the menu bar in the Editor.  See this FAQ for what happens when you change the DPI:
    http://www.johnrellis.com/psedbtool/photoshopelements-6-7-faq.htm#The_Organizers_Menu_Bar_ doesnt_show

  • How to make a Input Field with multiple lines?

    hey folks,
    i need to make a popup window or a dynpro with 2 input fields, where the user can write on multiple lines. why isnt there such an input field in the screen painter? how can i make this? if i can do this with a dynpro it would be nice but a popup with that feature would be better. didnt found any infos anywhere except for that thread, but its answer didnt work with my dynpro:
    How to make a input/output field with multiple lines
    thx for any helping answer

    i made it just like in that thread but there is an error message telling that gv_custom_container is not declared.
    *  MODULE status_0110 OUTPUT
    MODULE status_0110 OUTPUT.
      CREATE OBJECT custom_container
        EXPORTING
          container_name              = 'TEXT_CONTROL'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5.
      CREATE OBJECT text_editor
        EXPORTING
          parent                     = gv_custom_container
          wordwrap_mode              = cl_gui_textedit=>wordwrap_at_windowborder
          wordwrap_to_linebreak_mode = cl_gui_textedit=>false
        EXCEPTIONS
          error_cntl_create          = 1
          error_cntl_init            = 2
          error_cntl_link            = 3
          error_dp_create            = 4
          gui_type_not_supported     = 5.
      SET PF-STATUS 'STATUS_0110'.
      SET TITLEBAR 'TITLE'.
    ENDMODULE.                    "status_0110 OUTPUT
    Edited by: rafe b. on Oct 26, 2009 2:56 PM

  • How to make 32 bit software to contact 64 bit oracle

    Hi
    I m using Oracle 10G 64 bit in Windows 64 bit server. Our Product is a 32 bit software and when i m trying to create database using our product it is throwing JDBC Driver error. So i installed 32 bit Oracle client and set the user env variables for client oracle home and path. but still i m not able to create the database because it is taking the client Oracle home which should not happen. i m totally confused now and not sure how to achieve the end goal. Can anyone help me on how to contact 64 bit Oracle using a 32 bit client software.
    Thanks
    Ram

    Hi Aman
    Sorry for late reply, was sick.
    we ship the product to the customer where it is supposed to do it this way.
    below is the error we are getting:
    Data store 'historical' is broken: status is DRIVER.
    This is specific to our product and This says that 32 bit product with its driver is not able to contact 64 bit oracle driver. So i introduced Oracle Client where our 32 bit product will speak with our 32 bit oracle client and oracle client inturn will speak with 64 bit oracle server. But again there was a confusion in this setup. When i did the Environment variables configuration, our product is trying to create the database in 32 bit client oracle home path which is not correct. Kindly suggest me if u have any idea on this.
    Thanks
    Ram

  • How to make  a Password Field in a Dynpro?

    Hi Folks,
    as the subject says i need to make a password field in my dynpro. i know how to do it with parameters but thats not what i need. i made a dynpro with a field in which Users can type a Password and i need it to be shown like this "********".
    how can i do this?
    thanks in advance.

    heh... its really annoying that i just can't find such easy things with google and have to post it in the forums -.-
    anyway. thanks a lot.

  • HOW TO MAKE MATERIAL DESCRIPTION  FIELD IN SALES ORDER AS UNEDITABLE

    how to make the material description field as un editable in sales order , pls help me

    Through Transaction Variant <b>SHD0</b>
    Refer the thread
    /message/4083386#4083386 [original link is broken]
    Message was edited by:
            SHESAGIRI.G

  • How to make multi-box fields for name or address in a PDF form to be filled in?

    I would like to know how to make fields for name and address in a PDF form.
    I am now using Acrobat 8 Pro on Windows Vista. I have downloaded a form in the format of a PDF file. Basically it is just a file holding images of pages of the document, and there are no fields for me to type something on it using computer. This form will be used frequently by me, but I don't want to print it out and fill it in every time by hand. I want to fill it in in the computer and print copies of it when needed. The output will then be much more neat and tidy.
    I have seen PDF forms with blanks for typing name and address, which means the form can be filled in on the computer before printing. They are special, as these blanks allow users to type name and address with every character occupying a box in the field, which consists of ten boxes or so. These are not ordinary textfields. I want to make similar inputting field as well.
    Does anyone knows something about making these input fields with each character using 1 little box in the multi-box field? Any ideas are appreciated.

    Does anyone knows something about making these input fields with each
    character using 1 little box in the multi-box field?
    Use text fields with the comb of x characters feature.

  • How to make few DFF fields read only in Forms

    Hello.....
    I am having an Issue in forms customization through custom.pll
    I need to make few DFF fields read only in HRMS enter and maintain form through custom.pll
    I tried with fnd_descr_flex.update_definition but in vain
    So please help me how to rectify this issue.
    Edited by: user.nazeer25 on Jul 9, 2010 5:27 AM

    Hello,
    Wrong forum.
    Ask this kind of question in the E-Business Suite forum ;-)
    Francois

Maybe you are looking for

  • How to restore my iPhone when my backup doesn't show up?

    Today 12/28/13, I brought my iPhone 5 into an apple store to get a battery replacement and had to delete everything on my iphone. I backed up my iphone a few nights before and made sure that everything was saved onto my computer. When I came home aft

  • I have many PDF files in iBooks for iPad 2. How can I get those files to sync with iPhone 5?

    I Have many categories of my work brochures stored in PDF format in iBooks. iPad 2 running iOS 6. I'd like to be able to view those same PDF files on my iPhone 5. Is this possible to do over the iCloud ? i Cannot do it via iTunes because my MacBook i

  • Complex Type

    Hi,    I have made a Web Service and it is Portal Web Service, I wanna return a List of elements  to the user but I checked that I need to use DTO in oderto deal with Complex type but I do not know how can i make it. I get to variables for example Us

  • Can I set up two iphones, two I-macs, one I-pad, on ICloud and have everything in Synch?

    I currently have two i-phones(IOS 5.0.1), two I-Macs(OS 10.6.8), and one I-Pad(5.0.1) syching on MobileMe.  I had to get the faamily pack of Mobile me in order to sych both phones.  How about i-cloud?  What do I have to do with these two syching acco

  • Is this "update" download legitimate

    I've received a notice offering to download a Flash Player update, but I'm suspicious.  It passed the Microsoft Security Essentials scan, but it doesn't look like it's from Adobe.  The notice says "Program Name: ICReinstall_adobe_flash_setup.exe" and