Need Sales Contract No. in Invoice in SMARTFORM

Hi,
    I need Sales Contract number in Invoice Smartform. I tried to fetch Contract number form VBFA table
but Contract number is not there but in Sales Document flow for invoice,it is created with reference of  Contract number but there is no Contract number in Table VBFA for that Billing Doc no. Is there any other method to fetch it..I want to fetch Sales Contract number and Sales contract date in Invoice Smartfrom
Please do needful.

try this logic
first select sales order from you invoice number
select vbelv posnv
from vbfa
where vbeln = invoice number
and vbtyp_N = 'M'
and vbtyp_V = 'C' .
Then use these sales order and get records from VBAP, field VGBEL and VGPOS has Sales order contract.
select vgbel vgpos
from vbap
where vbeln = vbfa-vbelv
and posnr = vbfs-posnr.

Similar Messages

  • NEED BAPI FOR  SALES CONTRACT CREATION AND EXTRACTION FOR Trans- PA41& PA43

    Hi All,
    I need the BAPI for T-code PA41 and PA43 for sales contract.
    i would like to extract all the contract details for Contract data contains Table VEDA. And need to create contract.
    Any body please help me out...
    Please give me code if any one have how to do mapping ..
    Thank you,
    Vishnu.

    Hi Vichu,
    Please search on SCN.
    Regards
    Abhii

  • Need a user exit to modify the quantity schedules in a sales contract

    Hi,
      I am using ECC 6.0 with IS OIL. Need a user-exit to update the quantity schedule(table OIA05) in the sales contract VA42.
    I have a new field called timestamp in the table OIA05 which needs to be updated with the timestamp value.
    I tried the user exit MV45AFZZ in USEREXIT_SAVE_DOCUMENT_PREPARE and USEREXIT_SAVE_DOCUMENT to update the values. But the new values are not being reflected. Can you please help me in this regard.
    Thanks,
    Best regards,
    Ajith

    that will allow me to append an initial line with <accit> pointing to the line. Therefore I just have to modify <accit> and the new line will then have my changes?
    Yep, that is exactly it.    So after the APPEND statement, simply fill the fields of the <accit>.
    append initial line to im_document-item ASSIGNING <accit>.
    <accit>-field1 = 'Blah'.
    <accit>-field2 = 'Blah'.
    Regards,
    Rich Heilman

  • Copy contract pricing from sales contracts in billing

    Hi
    I Have a requirement to Copy contract pricing agreements from sales contracts during resource related billing creation.
    At the time of resource related billing is performed, the agreed contract rate should be taken into account when pricing is performed in SAP. So, the agreed price needs to be copied from the contract condition record into the resource related billing transaction (sales pricing) as a condition record.
    Can i get the solution for this?
    If anybody knows the solution please help me out. Appropriate Points will be awarded. Thanks in advance.
    Regards
    Ravi

    You just need to configure your pricing properly.
    Suppose you have condition type with document/item keys in the condition table.
    Now, if you define conditions for contract/item, to pick them up in the invoice - you just need to pass contract number/item number in the fields you use in your access sequence for this particular condition type.
    You can either define new step in the access sequence passign different fields (assuming konh or konp have fields for contract number) OR use ueserexit_pricing_prepare_tkomk, userexit_pricing_prepare_tkomp to populate fields in TKOMK/TKOMP you then use in your access sequence to search for pricing condiiton record.

  • Rules for Date Determination in Sales Contracts

    Hi everyone,
    I have a need for an "enhanced" rule for date determination to be used in a contract profile for a sales contract.
    In our current system (SAP ECC 6.0) only the following rules are possible to choose:
    01 Today's date
    02 Contract start date
    04 Acceptance date
    05 Installation date
    06 Date contract signed
    07 Billing date/Invoice date
    08 CntrctStDate+contract duration
    09 Contract end date
    In supplement to these I would like to create
    ZZ CntrctStDate+to year end
    This rule should set the end date in the contract according to the following logic.
    If the Contract start date is between YYYY-01-01 and YYYY-05-31 the Contract end date should be calculated to YYYY-12-31 in the current year. Else (if Contract start date is between YYYY-06-01 and YYYY-12-31) the Contract end date should be calculated to YYYY-12-31 in the following year.
    I have searched the IMG and Development Workbench but I canu2019t find any place where it is possible to create own rules like the ones above (that is defined by SAP). Does anyone have a tip on how to proceed?
    Best Regards
    Patrik Bergströ

    Hi everyone,
    I have a need for an "enhanced" rule for date determination to be used in a contract profile for a sales contract.
    In our current system (SAP ECC 6.0) only the following rules are possible to choose:
    01 Today's date
    02 Contract start date
    04 Acceptance date
    05 Installation date
    06 Date contract signed
    07 Billing date/Invoice date
    08 CntrctStDate+contract duration
    09 Contract end date
    In supplement to these I would like to create
    ZZ CntrctStDate+to year end
    This rule should set the end date in the contract according to the following logic.
    If the Contract start date is between YYYY-01-01 and YYYY-05-31 the Contract end date should be calculated to YYYY-12-31 in the current year. Else (if Contract start date is between YYYY-06-01 and YYYY-12-31) the Contract end date should be calculated to YYYY-12-31 in the following year.
    I have searched the IMG and Development Workbench but I canu2019t find any place where it is possible to create own rules like the ones above (that is defined by SAP). Does anyone have a tip on how to proceed?
    Best Regards
    Patrik Bergströ

  • How to restrict Material Class in Sales Contract Doc

    Hi,
    I need to restrict Material Class in Sales order based on Item catagory, Material group4 and Sales contract Document type.
    If the above 3 fields having a particular value then the system should restrict all the other classes of that material and display only a particular class and it's related characteristics.
    If any one come across such a senario then pklease let me know.
    Regards
    Ajay

    Hi,
    You have to make few configuration settings before you actually restrict at the object level. The solution is clearly discussed in the below thread:
    how to restrict material master by material type  t-code MM01
    Hope this helps!!
    Regards,
    Raghu

  • How to make the connection between a sale order and an invoice in SDK

    Hi,
    Im trying to make the connection between a sales order and an invoice using the SDK.
    Here is how i create each of them:
    Invoice:
    public int SalesInvoiceInternalSave(string buisnesspartnerCardCode, DateTime dueDate, double discountPercent, string id, IList<InternalItem> items, ref int invoiceId)
          int res = 0;
          SAPbobsCOM.Documents invoice_entry = (SAPbobsCOM.Documents)Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);     
          invoice_entry.CardCode = buisnesspartnerCardCode;
          invoice_entry.DocDueDate = dueDate;
          invoice_entry.DiscountPercent = discountPercent;
          invoice_entry.Reference2 = id;
          foreach (InternalItem item in items)
            invoice_entry.Lines.WarehouseCode = item.Shopid;
            invoice_entry.Lines.ItemCode = item.Code;
            invoice_entry.Lines.ItemDescription = item.Name;
            invoice_entry.Lines.Quantity = item.Quantity;
            invoice_entry.Lines.UnitPrice = item.Price;
            invoice_entry.Lines.Add();
          res = invoice_entry.Add();
          return res;
    Sales order:
        public Boolean SalesOrderInternalSave(string orderId, string buisnesspartnerCardCode, DateTime dueDate, IList<InternalItem> items)
          SAPbobsCOM.Documents order_entry = (SAPbobsCOM.Documents)Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
          order_entry.CardCode = buisnesspartnerCardCode;
          order_entry.DocDueDate = dueDate;
          foreach (InternalItem item in items)
            order_entry.Lines.WarehouseCode = item.Shopid;
            order_entry.Lines.ItemCode = item.Code;
            order_entry.Lines.ItemDescription = item.Name;
            order_entry.Lines.Quantity = item.Quantity;
            order_entry.Lines.UnitPrice = item.Price;
            order_entry.Lines.Add();      
          int res = order_entry.Add();
          return res == 0;
    What do i need to change to get the connection between the two of them?
    And how do you insert a amount (not percent) discount into an invoice?
    Regards,
    Torben

    Hi,
    Add the sale order, then add the invoice. and while adding the invoice please add the following details to the invoce documen
    invoice_entry.Lines.BaseEntry = 'Doc entry of the newly created SO
    invoice_entry.Lines.BaseLine = 'Line No of the SO
    invoice_entry.Lines.BaseType = 17 'For sales order document type.
    Hope it helps,
    Vasu Natari.

  • Sales Contract with Material Variant at Sales Order

    We are producing fabric and using make to order in SAP. Our customer give us a commitment with qty and a fixed price for certain fabric in advance, then later they release order to us with specific qty per color. We want to use Sales Contract for the customer commitment and sales order when the customer release the order with color qty to us.  We are putting color in the sales order in the material variant. However we are facing the following problem:
    1. Let say we have a contract 1 with 100,000 yds of material A. 
    2. then we have a sales order 2 of 20,000 yds of material A with color Blue refering to contract1.
    3. Somehow our factory over produced Material A color blue total 25,000 yds.
    4. Then we have another sales order 3 of 5,000 yds of material A with color RED referring to contract 1.
    5. MRP does not create plan order for RED material A because it is showing customer stock 25,000 with contract 1 and 20,000 consume by sales order 2 and 5,000 extra.  however these 5,000 extra is blue is not red and cannot fulfill sales order 3.
    Any idea how to solve this problem?
    Tks,
    Calvin Ngan

    Hi Calvin,
    I think if you define your material as configurable, it can solve your problem.
    A car, for example, has a large number of options that need to be described wheras the order is created only at a model and variant level. Then you define values for characteristics, to allow you to select specific options, such as 'black' for paint.
    So in your case you need to define characteristics of colour(or texture or thickness) or whatever differentiates each output and add optins for each of them.
    These are asked for and stored both in your reciepts(stocks, Prod. orders, POs etc) and in your requirements(SO etc). Also MRP will differentiate between each characteristics while planning.
    Hope this helps.
    Thanks & Regards
    Santanu Dawn

  • Adding item data in Product tab for sales contract (crm_order_maintain)

    Hi, can I use crm_order_maintain to add line items under the product tab for a sales contract while creating or modifying an order. Is there any sample code to add the line items, I could look at.  I tried calling this FM from my custom tab and then called CRM_ORDER_SAVE but that did not add the line item. I guess I need to call it from the order_save badi and then call the crm_order_save FM as well from within the BADI. If someone could send me some sample code then I can double check if I am missing something.Am I on the right track to be using this FM for adding a line item under the product tab for the sales contract? Please help. thanks

    Hi, I've encountered the same problem while I was creating a Sub-Contract from a Master Contract.
    In my case the solution was:
    first create the Sub-Contract,
    CALL FUNCTION 'CRM_ORDER_MAINTAIN'
          CHANGING
            ct_orderadm_h     = i_ctorderadm_h
            ct_input_fields   = i_ctinput_fields
            ct_doc_flow       = i_ctdoc_flow
          EXCEPTIONS
            error_occurred    = 1
            document_locked   = 2
            no_change_allowed = 3
            no_authority      = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        READ TABLE i_ctorderadm_h INTO wa_ctorderadm_h INDEX 1.
        APPEND wa_ctorderadm_h-guid TO i_objects_to_save.
    in wa_ctorderadm_h-guid now we have the guid of the newly created Sub-Contract.
    SELECT SINGLE it_type_to
                 INTO  v_it_type_to    " --> target item type
                 FROM  crmc_it_copy_ma
                 WHERE it_type_from = wa_out_orderadm_i-itm_type.
         Prepare tables
            wa_ctorderadm_i-header =
            wa_out_orderadm_i-header.   "Retrieved from CRM_ORDER_READ
            wa_ctorderadm_i-handle = '0000000001'.
            wa_ctorderadm_i-number_int = '0000000001'.
            wa_ctorderadm_i-product = wa_out_orderadm_i-product.
            wa_ctorderadm_i-ordered_prod =
            wa_out_orderadm_i-ordered_prod.
            wa_ctorderadm_i-description = wa_out_orderadm_i-description.
            wa_ctorderadm_i-itm_type = v_it_type_to.
            wa_ctorderadm_i-order_date   = sy-datum.
            wa_ctorderadm_i-itm_language = sy-langu.
            wa_ctorderadm_i-mode = c_a.   "c_a = 'A'
            wa_ctorderadm_i-header = wa_ctorderadm_h-guid.
            APPEND wa_ctorderadm_i TO i_ctorderadm_i.
            wa_input_fields-ref_handle = '0000000001'.
            wa_input_fields-objectname = 'ORDERADM_I'.
            REFRESH i_input_field_names.
            wa_input_field_names-fieldname = 'DESCRIPTION'.
            APPEND wa_input_field_names TO i_input_field_names.
            wa_input_field_names-fieldname = 'HEADER'.
            APPEND wa_input_field_names TO i_input_field_names.
            wa_input_field_names-fieldname = 'ITM_TYPE'.
            APPEND wa_input_field_names TO i_input_field_names.
            wa_input_field_names-fieldname = 'MODE'.
            APPEND wa_input_field_names TO i_input_field_names.
            wa_input_field_names-fieldname = 'NUMBER_INT'.
            APPEND wa_input_field_names TO i_input_field_names.
            wa_input_field_names-fieldname = 'ORDERED_PROD'.
            APPEND wa_input_field_names TO i_input_field_names.
            wa_input_field_names-fieldname = 'ORDER_DATE'.
            APPEND wa_input_field_names TO i_input_field_names.
            wa_input_field_names-fieldname = 'PRODUCT'.
            APPEND wa_input_field_names TO i_input_field_names.
            wa_input_fields-field_names = i_input_field_names.
            APPEND wa_input_fields TO i_ctinput_fields.
    After that I've called function 'CRM_ORDER_MAINTAIN', to copy the Items from the Master Contract.
    CALL FUNCTION 'CRM_ORDER_MAINTAIN'
            EXPORTING
              it_sales          = i_sales
              it_schedlin_i     = i_schedlin_i
            CHANGING
              ct_orderadm_i     = i_ctorderadm_i
              ct_input_fields   = i_ctinput_fields
            EXCEPTIONS
              error_occurred    = 1
              document_locked   = 2
              no_change_allowed = 3
              no_authority      = 4
              OTHERS            = 5.
    Maybe if you're not working with Contracts, the procedure is not properly correct.
    I suggest to put a break-point into crm_order_maintain and try to add the Item manually.
    If you reproduce exactly the standard, I'm shure it will work.
    Lorenzo

  • Download Sales Contract data into Excel sheet

    Hi,
    I need to download the Sales Contract Data into excel sheet is there a Function module that i can use?? Else how do i go about it. Kindly help.
    Thanks,
    Riya.

    use the function module FUNCTION 'GUI_DOWNLOAD'
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    filename = 'C:\REPORT.XLS'
    FILETYPE = 'ASC'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = 'X'
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = IT_PR
    FIELDNAMES =
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.

  • Sales AR Item Type Invoice Print Layout Design "Sub Total" per Page

    Dear Forum Team
    We need some advice on how to modify, fomulate(?) [Sub Total] for each page's 'amount' on the Sales AR Item Type Invoice.
    Currently the 'sub total amount' on each page is showing Grand Total instead of sub total.
    Thanks

    Hi,
    In you PLD, In repetitive area, you might have linked the fields like Item name, Item Description, and so on. In these fields one of the field will be Total for line items.  Am i right?
    If it is so, then in repetitive area footer, Create one Formula field and give formula PageSum("Field_025") (in your case)
    Ie., Field_201 = PageSum("Field_025")
    Field_025 - contains the Line Total of Row items.
    I hope this could help you.
    Raja.S

  • SRM 7 ECS : Contract Item in Invoice witout PO reference

    Hello Gurus,
    We are implementing SRM 7 with ECS.
    We create Invoice from scratch without PO reference. In "Add item" we have a very much interesting option called "Contract item".
    Unfortunately this remains desperately gray at the moment.
    We only have Product category local contracts in SRM not distributed in R3.
    1. Does that option work per the standard with ECS?
    2. What would be the required config if yes?
    3. if there is no config do we need to activate a Badi for this?
    Thanks in advance

    As kiran said this feature is available from SRM 7 EHP1
    Contract Handling for Invoices
    You use this function to create invoices with a direct reference to an SAP ERP contract or SRM central contract. The invoice with the contract reference updates the history of the contract in SAP ERP. A release is then created for the reference central contract in SAP Supplier Relationship Management (SAP SRM).
    To use this function, you must activate the business function SRM, Service Procurement Innovations (SRM_SERVICE_PROC_1).
    Prerequisites
    You have connected the SAP SRM system to the SAP ERP system.
    You have performed the Customizing activity under:  SAP Supplier Relationship Management  SRM Server  Cross-Application Basic Settings  Service Procurement  Activate Service Procurement Innovations .
    You have performed the Customizing activity under:  SAP Supplier Relationship Management  SRM Server  Cross-Application Basic Settings  Service Procurement  Activate Service Procurement .
    SOME Information

  • SRM 7 ECS : "Add contract item" to Invoice

    Hello,
    We are creating invoices that will be posted to ECC 6.
    Those are " contract call-off" invoices without PO reference.
    What config should be done to get the option "Add item/Contract item" working? Currently it desperately remains grey...
    Thanks in advance.

    Hi
    Can you elaborate a little bit? It is not clear what I could do regarding Acount Assignment types and they are mapped with ECC as a standard.
    I just need to use the shortcut in the portal to call the contract straight away instead of having to go into the item details.
    Thanks

  • Best practice for Extracting sales contracts from R/3

    Hi Everyone,
    We have a requirement to bring sales contract data from R/3 and most of the fields from table VEDA. 2lis_11_vaitm don't carry VEDA fields.
    What are the best practices on brining VEDA fields into BW?
    Thanks,
    D. Eranezhath

    New URLs are:
    LOGISTIC COCKPIT - WHEN YOU NEED MORE - First option: enhance it !
    Custom fields and BW extractors : Making a mixed marriage work! (Part-II)

  • Do we have any BAPI to get the sales contracts data.

    Hi Experts,
    Do we have any BAPI which fetches sales contracts details as i need to post a new contract based on that data from the legacy system which is also in SAP.
    Hoping an answer soon.
    Chitrasen

    hi,
    u can check all bapis available for sales in se37, searching by BAPI_SALE.
    Here u can check for ur required bapi...

Maybe you are looking for

  • What is difference:  standby_archive_dest and log_archive_dest_1

    what is the difference on the standby database? Some I see for standby_archive_dest: ?/dbs/arch And for log_archive_dest_1: log_archive_dest_1 = /some_other_path/folder Some I see are same, standby_archive_dest = log_archive_dest_1 = /some_other_path

  • Copy command in SQL

    What is the Copy Command in SQL ?

  • Can a disabled ITEM not turn gray?

    I am setting the enabled property of an item to false. This changes the foreground/backgroun color so that it looks disabled. I want to keep the items current color scheme even when I disable it. I tried setting the visual attribute after I disable i

  • Delete row in Error DTP

    Hi, We are using Error DTP's. Is it possible to delete a single record from an Error DTP? Can somebody tell me how? Regards, Jos.

  • Replacing title of movie

    Normally when I have a movie, the file name shows in the title bar of Quicktime. However someone sent me a movie and it has a set title, so even if I save as something different, the original title remains . In Show Movie properties I can see the nam