How to add a button in Sales Order screen?

Hi,
Basically I want to add a new button "Show My lookup" in sales order screen and when clicking the button I want to show a form.
Please anyone tell me how to do this?.
thanks in advance
Mina

Here is a sample ItemEvent that adds a custom button to Sales Order Entry, and loads a form from XML when it is clicked.  Make sure you give the forms unique identifiers when you create them - the sample just uses a hardcoded value.
Hope it helps,
John
Private Sub sboApp_ItemEvent(ByVal FormUID As String, pVal As SAPbouiCOM.IItemEvent, BubbleEvent As Boolean)
    On Error GoTo ErrorHandler
    Dim sboForm                 As SAPbouiCOM.Form
    Dim sboItem                 As SAPbouiCOM.Item
    Dim sboBtn                  As SAPbouiCOM.Button
    Dim objXMLDoc               As MSXML2.DOMDocument
    Dim objXMLErr               As IXMLDOMParseError
    Dim objXMLElem              As MSXML2.IXMLDOMElement
    Dim strIdentifier           As String
    If pVal.EventType = et_FORM_LOAD And pVal.Before_Action = False And pVal.FormType = 139 Then
        'Add Custom Button
        Set sboForm = sboApp.Forms(FormUID)
        Set sboItem = sboForm.Items.Add("AZU_BTN", it_BUTTON)
        sboItem.Top = sboForm.Items("1").Top
        sboItem.Width = "80"
        sboItem.Left = sboForm.Width - 105
        Set sboBtn = sboItem.Specific
        sboBtn.Caption = "Custom Button"
    End If
    If pVal.EventType = et_ITEM_PRESSED And pVal.Before_Action = False And pVal.ItemUID = "AZU_BTN" And pVal.FormType = 139 Then
        strIdentifier = "AZU_XXX" 'You should set this to a unique value each time
        Set objXMLDoc = New MSXML2.DOMDocument
        objXMLDoc.async = False
        objXMLDoc.validateOnParse = True
        objXMLDoc.Load (App.Path & "\Config\AZU_CUSTOM.srf")
        Set objXMLErr = objXMLDoc.parseError
        If (objXMLErr <> 0) Then
            MsgBox "Failed to load XML screen definition."
            Exit Sub
        Else
            For Each objXMLElem In objXMLDoc.getElementsByTagName("form")
                objXMLElem.setAttribute "uid", strIdentifier
            Next
            sboApp.LoadBatchActions objXMLDoc.xml
        End If
    End If
    Exit Sub
ErrorHandler:
    MsgBox Err.Number & " " & Err.Description
End Sub

Similar Messages

  • How to add push buttons in out put screen of ALV

    Hai,
    How to add push buttons in out put screen of ALV (tool bar) with out using classes or methods .I want to know using normal ALV .
    Thanks in advance .
    kiran

    Hi Kiran,
    Here is the sample code.If you are using reuse_alv_grid_display, no need to write code in PBO.
    Just double click the 'TEST' which is written in code.Then create a GUI Status.In Application toolbar,type the name of the button you want(say BUTTON).Then double click that name.Then enter the ICON name and function text.Activate it.This itself will work.If you want all the functionalities,then try to do as Vinod told.
    TYPE-POOLS: slis.
    DATA: i_qmel LIKE qmel OCCURS 0.
    data v_repid type repid.
    SELECT * FROM qmel INTO TABLE i_qmel.
    v_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = v_repid
       I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
       I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
       i_structure_name                  = 'QMEL'
      TABLES
        t_outtab                          = i_qmel
      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.
    form set_pf_status using rt_extab type slis_t_extab.
    set pf-status '<b>TEST</b>'.
    endform.
    FORM user_command USING ucomm LIKE sy-ucomm
                             selfield TYPE slis_selfield.
    data lv_ucomm type sy-ucomm.
    lv_ucomm
    = sy-ucomm.                                        
      CASE lv_ucomm.
        WHEN 'BUTTON'.                              "Double Click line Item
          call transaction 'MM01'.
      endcase.
    endform.

  • How to add line item to sales order item table?

    Kindly help me the with the below requirement .
    Add line item to sales order(va01) dynamically on click of button. The button is also custom created push button.
    In the above requirement I have added the pushbutton to va01 tcode. But when I click on that button I need to add line item to sales order item table.
    I tried a lot but I am not successful. If possible can u please help on this.
    Regards,
    Rachel

    Hi!
    It's quite easy even in the standard SAP to add a line item for a customer order, I don't think it worth to develop a new button for this.
    However if you wanted to add a line automatically, the you can do the following in the program MV45AFZZ, FORM USEREXIT_SAVE_DOCUMENT.
    You can use similar code, but with some modifications.
    DATA: lv_posnr.
    LOOP AT xvbap.
    MOVE xvbap-posnr TO lv_posnr.   "get the last posnr
    ENDLOOP.
    ADD 10 TO lv_posnr.
    MOVE 'XYZ' TO xvbap-matnr.   "enter your material number here
    MOVE lv_posnr TO xvbap-posnr.
    * fill additinal field data in XVBAP if necessary
    MOVE 'I' TO xvbap-updkz.                  "Insert line
    APPEND xvbap.
    Regards
    Tamá

  • How to create a job card and how to add waranty card in sales order

    I have one scenario for CS.the scenario is realted to automotive industry. Basically its a trading industry of HCV,MCV,LCV apart from that they will do servicing also. First the customer comes for a service.he is having free services. he will have waranty for spare parts of the vehicle. once he comes for servicing first the executive will take complains from the customer after that a Job card will be issued to the customer. there his chasis no ,engine no and registration no will be there. once enter the chasis no entire customer details has to come. how many free services he is having for how many kilo meters.then job card will go to the spare parts dept.that dept will issue the spare parts.then they will invoice the customer. he will pay the payment.and finally the gate pass will be given to the customer to deliver the vehicle.
    painful area is how to create a job card and how to add waranty in sales order.
    Regards,
    Venkat

    Hi,
    Have u resolved it then Please let me know !!! It is a very interesting problem and owuld like to know the solution...
    Regards
    Krishna

  • How to add a field in sales order header

    Hi all,
    I need to add a custom field say a check box in sales order header in additional data B tab.
    let me know step by step.
    Points will be rewarded.
    Thanks.
    Ramya

    additional data B in sales order
    sales order - Additional data B
    Add new fields to Additional Data B tab in sales order
    Reward Points..

  • How to add three fields in Sales order item level and supress/hide many

    Hi Gurus,
    My client requirement is :
    1. Three fields to be added at Sales order Item level and they should flow till billing.
    2. Supress/hide most of the fields in Sales order, so that end user will be happy( thru SHDO how to do)
    Please share your experiences and help me.
    BEST REGARDS
    Srikanth

    Hi Subba Rao
    in VA01 screen - Material /qty/ after entering this client wants to enter three more details say X/Y/Z
    and after that he dont want to see maximum fields displayed in VA01 Screen.
    I think it makes sense.
    Regards
    Srikanth

  • How to add material characteristics in sales order via BAPI?

    Hi all!
    I'm trying to use BAPI_SALESORDER_CREATEFROMDAT1 to create a sales order with one item that has some characteristics, but i can't seem to get it work. It creates the salesorder with the item but without characteristics data. Can somebody tell me what could be wrong?
    Here's the code:
    header-doc_type   = 'TA'.
    header-sales_org  = '3000'.
    header-distr_chan = '10'.
    header-division   = '00'.
    items-itm_number = '000010'.
    items-material   = 'CP-12'.
    items-req_qty    = '1000'.
    APPEND items.
    partners-partn_role = 'AG'.
    partners-partn_numb = '0000050000'.
    APPEND partners.
    c_ref-posex     = '000010'.
    c_ref-config_id = '000001'.
    c_ref-root_id   = '00000001'.
    APPEND c_ref.
    c_ins-config_id = '000001'.
    c_ins-inst_id   = '00000001'.
    c_ins-obj_type  = 'MARA'.
    c_ins-obj_key   = 'CP-12'.
    c_ins-complete  = 'T'.
    c_ins-consistent = 'T'.
    c_ins-quantity  = '0'.
    c_ins-quantity_unit  = 'ST'.
    c_ins-class_type = '300'.
    APPEND c_ins.
    c_val-config_id = '000001'.
    c_val-inst_id   = '00000001'.
    c_val-charc     = 'CP_12_ADD_ON'.
    c_val-value     = 'F'.
    c_val-valcode   = '1'.
    APPEND c_val.
    c_val-charc     = 'CP_12_COLOUR'.
    c_val-value     = 'M'.
    APPEND c_val.
    c_val-charc     = 'CP_12_MODEL'.
    c_val-value     = 'M'.
    APPEND c_val.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
      EXPORTING
        order_header_in           = header
        convert_parvw_auart       = 'X'
      IMPORTING
       salesdocument             = salesdoc
       return                    = return
      TABLES
        order_items_in            = items
        order_partners            = partners
       order_cfgs_ref            = c_ref
       order_cfgs_inst           = c_ins
       order_cfgs_part_of        = c_prt
       order_cfgs_value          = c_val

    BAPI_SALESORDER_CREATEFROMDAT1
    "(obsolete from 4.6 version)
    BAPI_SALESORDER_CREATEFROMDAT2
    please see the version  and change the BAPI
    reward  points if it is usefull ....
    Girish

  • How to add a field in sales order

    Dear All,
    First I created a ZTable in which there are 15 fields exist then I append structure in ZVBAP which contain only one field from this ZTable. Now I place this field in the Subscreen 8459 of Sales Order under "Additional Data B" by using access key. Also i have Access to edit the module MV45AFZZ.
    Then I wote the code in the
    FORM userexit_save_document_prepare.
    IF XVBAP-ZZSPENR = ''.
    MESSAGE 'SPECIFICATION NO. IS NOT SPECIFIED' TYPE 'E'.
    ELSE.
    VBAP-ZZSPENR = ZSPEC-ZSPENR.
    ENDIF.
    ENDFORM.    
    so that while saving it Checks that field in screen and then if it has value then save it to in the VBAP Table.
    I think I have to write the code into the module
    FORM userexit_move_field_to_vbap.
    VBAP-zzfield = xxxx-zzfield2.
    *{   INSERT         ID3K908846                                        1
      DATA: zlgort LIKE vbap-lgort.
      IF vbap-pstyv EQ 'ZWP'.
        CHECK vbap-lgort IS INITIAL.
        GET PARAMETER ID 'LAG' FIELD zlgort.
        vbap-lgort = zlgort.
      ENDIF.
    *}   INSERT
    WA_XVBAP-ZZSPENR = xvbap-zzspenr.  "but this line gives * me error cause I have to move the screen fields into  * the VBAP Table. So that after this it checks in internal table XVBAP that the field ZZSPENR has value or not ?
    ENDFORM.
    But when I checks XVBAP TAble it shows all entries that I fill in Sales Order except ZZSPENR (My  Field)
    Thanks in advance.
    Regards.
    Adams.
    Helpful answer will be appretiated.

    hi Amams
    check this link
    Adding Fields to Sales order
    i think it may give u some idea
    Regards,
    Naveen

  • How to add a partner in sales order item by enhancement?

    Hi expert,
    Sales order item's bill-to and payer will be same with header if you do not change it manually. now I want to modify some item's bill-to and payer which different from the header automatically. Is there any enhancement for this function?
    Thanks and best regards
    Lance

    Hi Lance,
    You can populate the XVBPA structure with function module "VIEW_XVBPA_FILL".
    You have to pass the following values to the FM:
    COMWA-KUNNR <- the changed partner code
    COMWA-PARVW <- parter role
    COMWA-VBELN, COMWA-POSNR <- Salesorder and item: just fill it with VBAK-VBELN,VBAP-POSNR
    You'll get the result in parameter XVBPA, which can be used for append the internal
    table XVBPA in the userexit.
    BR,
    Barna

  • Help: how to add a button to print the screen

    Hi,
    I am working on a set of forms. One of the feature user ask is to place a "Print Screen" button on the form so that user will be about to simply print the form screen.
    Any help will be greatly appreciated.
    Thank you in advance.
    Jimmy

    Thanks Rosario. I did that but it seems not working. In fact, I added a form level trigger key-PRINT and put "print;"
    Anyway, what does it really do? I think that it should not be identical to Print-Scrn on the key board.
    Jimmy
    Message was edited by:
    WJH

  • How to add push button in alv display with out class or method

    Hai,
    How to add push buttons in out put screen of ALV (tool bar) with out using classes or methods .I want to know using normal ALV .
    Thanks in advance .
    kiran

    You should post your question in the ABAP forum.
    ABAP Development

  • BADI for Sales order Screen

    Hi all,
    I want to trigger my program after pressing the save button in Sales order screen.Is there any User exist or BADI for that?
    Regards,
    Krishnamoorthy.

    I am not sure which version SAP has these released, but at least in 4.7 and above there is a BADI definition called BADI_SD_SALES with methods for the old SAVE_DOCUMENT_PREPARE and SAVE_DOCUMENT form routines in MV45AFZZ.  There are some other general methods as well.
    Chris H.

  • Add buttons in Sales Order's Addtional Data B Tab

    Hi All,
    I want to add buttons in Sales Order's Additional Data B tab. I had try to draw a creen in painter and push a button in the screen, also assign a fcode to it.
    I had try to test the button, and I find that, it could work, but after it's action, a error msg give out and said there are no this request function.
    I think it may cause by the fcode passing between screen. However, I don't know how to fix it. Any sample coding could for me reference?
    Thanks!

    Hi,
    yes u can add the button  with Fcode on Additional data B screen.But u have write the code in the PAI of the screen,inorder to do something,for that u need to have accesskey also...i hope while adding fields to Additional data B screen u ahve used teh accessskey for adding..zfields
    Regards,
    Nagaraj

  • How to update  pricing in open sale order

    Hi all
    in open sale order suppose my basic price has been changed .how Can i update all open sales order basic price in one shot.

    Dear Sachin,
    Please follow the point as given below;
    1. In VTFL for your item category maintain pricing type as B if it is delivery related billing and if it is order related billing VTFA maintain pricing type as B and one more thing maintained Billing Quantity as C if you using VTFA and Billing Quantity as D if you using VTFL.
    2. Create the new condition records in VK11 for your new price ( Do not change the existing  condition record in VK12) with proper validity dates
    3. Use update button in billing the system will pick the new record by accessing VK11 in billing.
    Try this, it will work.
    Regards,
    Bharat B

  • Services for Object button in Sales Order

    Hello Experts,
    We are not getting Services for Object Button in Sales Orders. Actually we need to attach some documents to Sales Orders.
    Thanks in advance.
    Mamta.

    Dear Friend,
    If you are not getting Services for Object Icon in Sales Document, then follow this:
    T-code - SU01 u2013 Here Enter User ID & click in change icon.
    Then click on Parameters Tab & Add Parameter u2013 SD_SWU_ACTIVE. .
    This will definitely solve your problem...
    Thanks,
    Jignesh mehta

Maybe you are looking for