BAPI Error in creating quotation

Hi all,
In BAPI ' BAPI_QUOTATION_CREATEFROMDATA2', I given all manditory parameters ( QUOTATION_HEADER_IN -import parameter and QUOTATION_PARTNERS - tables ).
But If I execute, its returning below messages.
Please enter sold-to party or ship-to party
Sales document was not changed.
Can u please tell me where to specify the sold-to party and ship-to party in this BAPI.
Thanks
Murali.

Hi Murali,
I tried creating a quotation in my system using the same BAPI, and i was able to create one with the very basic info and without having to pass any ITEM details.
QUOTATION_HEADER_IN-DOC_TYPE  
QUOTATION_HEADER_IN-SALES_ORG 
QUOTATION_HEADER_IN-DISTR_CHAN
QUOTATION_HEADER_IN-DIVISION  
QUOTATION_HEADER_INX-DOC_TYPE  
QUOTATION_HEADER_INX-SALES_ORG 
QUOTATION_HEADER_INX-DISTR_CHAN
QUOTATION_HEADER_INX-DIVISION
(* You dont need to set the update flag)
QUOTATION_PARTNERS-PARTN_ROLE
QUOTATION_PARTNERS-PARTN_NUMB
Try passing just the above fields in SE37, and let me know.
Regards,
Chen

Similar Messages

  • Error while creating quotation

    Hi All,
        I am getting error ' Please enter Post Dated Cheque Number By creating Customer Note Item F-49 '  while creating Quotation Order using BAPI_QUOTATION_CTREATEFROMDATA2.Can u  tell me is there any solution to resolve this problem.

    Hi,
    the date field (?) "Post Dated Cheque Number" seems to be a mandatory field.
    Just change it in the date profile customizing.
    Cheers,
    André

  • Error while creating quotation in sales order verion ?

    Dear All,
    while creating an quotation in sales order version management getting an error.
    Sales Doc. MsgType Message Class        Msg.No. Message text
               E       AM                        53 Specify either address number or address
               W       V1                       555 The sales document is not yet complete:
               E       V4                       219 Sales document  was not changed
    thanks
    vincent

    Dear Vincent
    May be this is related ABAP Issue please check with them because i found same issue
    "BAPI_SALESORDER_CREATEFROMDAT2" - getting error while executing in se37.
    "Specify either address number or address handle " BAPI_SALESORDER_CREATEFR

  • Error while creating BOM using BAPI 'BAPI_BOM_UPLOAD_SAVE'

    Hi All,
    We are getting an error as 'Data is incomplete' while trying to create BoM using the bapi 'BAPI_BOM_UPLOAD_SAVE', if the item contains Item category as 'T'. But for other item category like 'L' or 'N', the bapi is sucessfull.
    The values that we pass to fill the item category 'T' are operation, item_cat, bom_itm_no, COMPON_QTY, FIXED_QTY as 'X', UNMEAS as 'ST', ITEM_TEXT1 and ITEM_TEXT2.
    Anyone who has faced same problem or has a solution to the problem, kindly provide a solution.
    Regards,
    Vijay

    The error you receive is because of different config for different Item Categories. Find out from the functional team what fields have they kept mandatory for the item category 'T'. You may not be passing one of those fields in the BAPI.
    Try creating a BOM manually for item category 'T' and you may figure our which field you are missing.

  • Error while creating SO w/r to quotation

    Hi All,
    When I create a sales order with reference quotation the following error occurred. In selection list also Quotation number was not displayed.
    Copying is not possible because an entry is missing in Table TVCPL: LO TA TAN
    Waiting for ur replies
    Regards,
    Ganesh
    Edited by: KAGaneshbabu on Jul 15, 2011 7:28 AM

    Dear Ganesh Babu,
    Eventhough you have mentioned that you are copying from quotation to sales order,the error message you have given suggests thats you are facing the error while creating the delivery as  TVCPL is the table for copying from sales order to delivery.
    Hence kindly check in VTLA giving your document types (sales order and delivery) and check whether your item category TAN is included.
    If not , check OR-LF copying control and you will find TAN.
    Create a new entry for item category, enter TAN and maintain the same settings as you see in OR-LF copying control.
    Check and revert back.
    Thanks &  Regards,
    Hegal K Charles

  • Getting an error while creating a ERP Quotation from CRM Sales Web-UI.

    Hi Experts,
    I am getting an error while creating a ERP quotation from CRM Sales Web-UI. Here  I am enclosing the screen shot. Please give me the solution for this.Thank you in advance.
    Regards
    Kishor Kumar.

    Hi Kishore,
    Please refer to the link below -
    Entry of ERP Sales Documents in SAP CRM - Sales Quotation and Order Management - SAP Library
    Also, refer to the SAP note -
    1446253  - FAQ note: ERP documents in the CRM Web UI (lead-to-cash scenario)
    This note will give you the related topic and the configuration required through SAP help links.
    Hope this will be useful.
    Thanks and Regards
    DJ

  • URGENT: Error while creating a BAPI

    Hi all !!
    I am facing the below mentioned error while creating a BAPI , to be more specific , the error comes when i try adding a new method by using
    Utilities > API method > add a method
    on after adding a function modile name in there, when i click on the tick mark..
    It shows an error as in :
    BAPI &1 : BAPI function module &2 has no return parameter
    Please help in resolving the same !!
    Thanks & Regards
    Gaurav Verma
    Edited by: Gaurav Verma on Feb 13, 2008 11:52 AM

    Hi,
    cehck the below link how to create a bapi and add as method..
    http://www.sapdev.co.uk/java/jco/bapi_jco.pdf
    Regards,
    Nagaraj

  • Tables TCURM and T001K inconsistent Error While Creating Materials by BAPI

    Hi I am Using the BAPI
    BAPI_MATERIAL_SAVEDATA to create Material Masters I am creating all views for a Material.
    When I repeatedly run the BAPI for Multiple runs to create the Materials for Multiple plants and multple sales Views
    I get an Error Message when it is tryng to create accounting and costing View
    The error is Tables
    TCURM and T001K inconsistent; notify your systems administrator
    I dont get this message if I create one Material.
    I get this error message only when I repeat the loop and try to create Materials for different valvation areas..
    Please some one give ur views ..
    I promise All replies will be rewarded..
    Thanks
    Martin

    Rob,
    This is the peculiar behavious of SAP.
    As i am trying to create the materials by using the BAPI with in Visual Basic.
    The error can be simulated by using online data entry
    i did a research on it and i found that the error can be overcome if we create the accouting view first and later oher views and this occurs if we try to create accouting views for other valuation areas are plants when we set the MRP_VIEW = "X" and ACCOUNT_VIEW = "X" and COST_VIEW = "X"
    i dont know the exact reason for all this...
    Thanks
    Martin

  • Sales order costing error found in quotation 2 order line items created in

    Sales order costing error found in quotation 2 order line items created in quotation 5000562
    1st line item with third party
    2nd line item with PTO
    Purchase price was entered in the configuration screen
    1st item : 2,000 EUR
    2nd item: 1,200 EUR
    Purchasing info record was created with variant condition for EUR
    Error in sales order costing:-
    System does not take the purchase price in the configuration screen to
    calculate sales order costing. It incorrectly took 1 EUR from variant
    condition in sales order costing for both items.
    By right, it should take purchase price from configuration screen.
    Pls advise
    Thanks

    no replies and my thread was dead.

  • Bapi-salesorder creation error in  creating document

    hai friends..
      iam doing creation of sales order using bapi .-structures..
      but error in creating doucment ....
    can u send me some example .. abt sales order .creation ..
    once u check my code ...
    DATA: BEGIN OF HEADER OCCURS 0,
           VBELN LIKE BAPIVBELN-VBELN,
           AUART LIKE VBAK-AUART,
           VKORG LIKE VBAK-VKORG,
           VTWEG LIKE VBAK-VTWEG ,
           SPART LIKE VBAK-SPART,
           VKBUR LIKE VBAK-VKBUR,
           KUNNR LIKE BAPIPARNR-PARTN_NUMB ,"vbak-kunnr,
        END OF HEADER.
    DATA: BEGIN OF ITEM OCCURS 0,
           VBELN LIKE BAPIVBELN-VBELN,
           POSNR LIKE BAPISDITM-ITM_NUMBER ,"vbap-posnr,
           MATNR LIKE VBAP-MATNR,
          NETWR LIKE VBAP-NETWR,
           KWMENGE LIKE VBAP-KWMENG,
          WERKS LIKE VBAP-WERKS,
          NETPR LIKE VBAP-NETPR,
       END OF ITEM.
    DATA:  ORDER_HEADER_IN LIKE BAPISDHD1,
           ORDER_HEADER_INX LIKE BAPISDHD1X.
    DATA: ITAB_HEAD likE order_header_in,
          ITAB_HEADX likE ORDER_HEADER_INX.
    DATA: ITAB_ITEM  TYPE STANDARD TABLE OF  BAPISDITM WITH HEADER LINE,
          ITAB_ITEMX TYPE STANDARD TABLE OF  BAPISDITMX WITH HEADER LINE.
    DATA: KUST TYPE STANDARD TABLE OF  BAPIPARNR WITH HEADER LINE,
           RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA: VNO  LIKE BAPIVBELN-VBELN,
          VCNT LIKE VBAP-POSNR.
    LOOP AT HEADER.
        VCNT = 10.
        CLEAR ITAB_HEAD.
       ORDER_HEADER_IN-REFOBJTYPE = 'OR'.
       ORDER_HEADER_IN-REFOBJKEY = 'OR'.
       ORDER_HEADER_IN-REFDOCTYPE = 'OR'.
       ORDER_HEADER_IN-DOC_TYPE = HEADER-AUART.
        ITAB_HEAD-DOC_TYPE = HEADER-AUART.
        ITAB_HEAD-SALES_ORG = HEADER-VKORG.
        ITAB_HEAD-DISTR_CHAN = HEADER-VTWEG.
        ITAB_HEAD-DIVISION = HEADER-SPART.
        ITAB_HEAD-SALES_OFF = HEADER-VKBUR.
        KUST-PARTN_NUMB = HEADER-KUNNR.
         ITAB_HEADX-DOC_TYPE = 'X'.
         ITAB_HEADX-SALES_ORG = 'X'.
        ITAB_HEADX-DISTR_CHAN = 'X'.
        ITAB_HEADX-DIVISION = 'X'.
        ITAB_HEADX-SALES_OFF = 'X'.
        LOOP AT ITEM WHERE VBELN = HEADER-VBELN.
          REFRESH RETURN.
          ITAB_ITEM-ITM_NUMBER = VCNT.
          ITAB_ITEM-MATERIAL = ITEM-MATNR.
          ITAB_ITEM-NET_WEIGHT = ITEM-KWMENGE.
          APPEND ITAB_ITEM.
          ITAB_ITEMX-ITM_NUMBER = VCNT.
          ITAB_ITEMX-MATERIAL = 'X'.
          ITAB_ITEMX-NET_WEIGHT = 'X'.
          APPEND ITAB_ITEMX.
          VCNT  = VCNT + 10 .
        ENDLOOP.
        CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
          EXPORTING
        SALESDOCUMENTIN               = SALESORDER
            ORDER_HEADER_IN              = ITAB_HEAD
         ORDER_HEADER_INX              = ITAB_HEADX
        SENDER                        =
        BINARY_RELATIONSHIPTYPE       =
        INT_NUMBER_ASSIGNMENT         =
        BEHAVE_WHEN_ERROR             =
        LOGIC_SWITCH                  =
        TESTRUN                       =
        CONVERT                       = ' '
         IMPORTING
           SALESDOCUMENT                 = VNO
          TABLES
           RETURN                        = RETURN
           ORDER_ITEMS_IN                = ITAB_ITEM
           ORDER_ITEMS_INX               = ITAB_ITEMX
            ORDER_PARTNERS                = KUST.
       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              WAIT          = 'X'.
             IMPORTING
               RETURN        = RETURN.
    LOOP AT return WHERE type = 'E' OR type = 'A'.
    EXIT.
    ENDLOOP.
    IF sy-subrc = 0.
    WRITE: / 'Error in creating document'.
    ELSE.
    COMMIT WORK AND WAIT.
    ENDIF.
        WRITE: / '   Sales Order NO  IS: ', VNO.
        WRITE: / SPACE.
        CLEAR VNO.
        WRITE SY-ULINE.
      ENDLOOP.
    my HEader  is    123    OR  1000 30 10 SATYA.
    ITem  2  IS     123   10  HAI   15
    once u check it ......

    Hi Satya,
    just check this
    REPORT  Z_STANDARD_SALES_ORDER no standard page heading.
    DATA DECLARATION
    CONSTANTS : C_X VALUE 'X'.
    Structures to hold Sales order header data
    DATA : HEADER LIKE BAPISDHD1," OCCURS 0 WITH HEADER LINE,
           HEADERX LIKE BAPISDHD1X." OCCURS 0 WITH HEADER LINE.
    Internal Tables to hold Sales order ITEM DATA
    DATA : ITEM LIKE BAPISDITM OCCURS 0 WITH HEADER LINE,
           ITEMX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.
    Internal Tables to hold Partners ITEM DATA
    DATA : PART LIKE BAPIPARNR OCCURS 0 WITH HEADER LINE.
    Internal Tables to hold Partners SCHEDULE DATA
    DATA: SCHEDULE LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE,
          SCHEDULEX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE.
    Internal table to hold messages from BAPI call
    DATA: RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA  W_MSG(150).
    *DATA: begin of wa_MESSAGE,
         message(150),
         end of wa_message.
    *DATA: itab_msg like table of wa_message with header line.
    Data: Begin of Record occurs 0,
          Control type i,
          DOC_TYPE like HEADER-DOC_TYPE,
          SALES_ORG like HEADER-SALES_ORG,
          DISTR_CHAN like HEADER-SALES_ORG,
          DIVISION like HEADER-DIVISION,
          PURCH_NO_C like HEADER-PURCH_NO_C,
          PARTN_NUMB like PART-PARTN_NUMB ,
          PARTN_ROLE like PART-PARTN_ROLE ,
          ITM_NUMBER like ITEM-ITM_NUMBER,
          MATERIAL like ITEM-MATERIAL,
         TARGET_QTY like item-TARGET_QTY,
          REQ_QTY LIKE BAPISCHDL-REQ_QTY,
          TARGET_QU like item-TARGET_QU,
          PLANT like ITEM-PLANT,
          PMNTTRMS like header-PMNTTRMS,
          End of record.
    data: itab like ALSMEX_TABLINE occurs 0,
          wa like ALSMEX_TABLINE.
    data: SO like BAPIVBELN-VBELN.
    Selection Screen
    selection-screen begin of block b1 with frame title text-001.
    PARAMETERS: P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
    selection-screen end of block b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      PERFORM GET_FILE USING P_FILE.
    Start of Selection
    start-of-selection.
      DATA: xl type string.
      xl = '*.xls'.
      IF not P_FILE CP xl.
        Message 'Wrong input file format' type 'E'.
      ENDIF.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME                      = P_FILE
          I_BEGIN_COL                   = 1
          I_BEGIN_ROW                   = 1
          I_END_COL                     = 13
          I_END_ROW                     = 3000
        TABLES
          INTERN                        = itab
    EXCEPTIONS
      INCONSISTENT_PARAMETERS       = 1
      UPLOAD_OLE                    = 2
      OTHERS                        = 3
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    DATA POPULATION
      loop at itab into wa.
        if wa-col = '0001'.
          record-Control = wa-value.
        elseif wa-col = '0002'.
          record-DOC_TYPE = wa-value.
        elseif wa-col = '0003'.
          record-SALES_ORG = wa-value.
        elseif wa-col = '0004'.
          record-DISTR_CHAN = wa-value.
        elseif wa-col = '0005'.
          record-DIVISION = wa-value.
        elseif wa-col = '0006'.
          record-PURCH_NO_C = wa-value.
        elseif wa-col = '0007'.
          record-PARTN_NUMB = wa-value.
        elseif wa-col = '0008'.
          record-PARTN_ROLE = wa-value.
        elseif wa-col = '0009'.
          record-PMNTTRMS = wa-value.
        elseif wa-col = '0010'.
          record-ITM_NUMBER = wa-value.
        elseif wa-col = '0011'.
          record-MATERIAL = wa-value.
        elseif wa-col = '0012'.
          record-REQ_QTY = wa-value.
        elseif wa-col = '0013'.
          record-TARGET_QU = wa-value.
        elseif wa-col = '0014'.
          record-PLANT = wa-value.
        endif.
        AT END OF row.
          APPEND record.
          CLEAR: wa, record.
        ENDAT.
      endloop.
      DATA: tot_lines type i,
            tot_po type i,
            index type i.
      describe table record lines tot_lines.
      read table record index tot_lines.
      tot_po = record-control.
      DO tot_po times.
        index = index + 1.
        clear: HEADER,HEADERX,ITEM[],ITEMX[],RETURN,RETURN[],SCHEDULE[],SCHEDULEX[], PART[],PART.
        refresh: ITEM[],ITEMX[],RETURN[],SCHEDULE[],SCHEDULEX[],PART[] .
    POPULATE HEADER FLAG.
        HEADERX-UPDATEFLAG = c_x.
        HEADERX-doc_type = c_x.
        HEADERX-SALES_ORG = c_x.
        HEADERX-DISTR_CHAN = c_x.
        HEADERX-DIVISION = c_x.
        HEADERX-PURCH_NO_C = c_X.
        HEADERX-PMNTTRMS = c_X.
        loop at record where control = index.
    POPULATE HEADER DATA FOR PO
          HEADER-DOC_TYPE = record-DOC_TYPE.
          HEADER-SALES_ORG = record-SALES_ORG.
          HEADER-DISTR_CHAN = record-DISTR_CHAN.
          HEADER-DIVISION = record-DIVISION.
          HEADER-PURCH_NO_C = record-PURCH_NO_C.
          HEADER-PMNTTRMS = record-PMNTTRMS.
    *POPULATE ITEM DATA.
          ITEM-ITM_NUMBER = record-ITM_NUMBER.
          ITEM-MATERIAL = record-material.
         ITEM-TARGET_QTY = record-TARGET_QTY.
          ITEM-TARGET_QU = record-TARGET_QU.
          ITEM-PLANT  = record-PLANT .
          APPEND ITEM.
    *POPULATE ITEM FLAG TABLE
          ITEMX-ITM_NUMBER = record-ITM_NUMBER.
          ITEMX-UPDATEFLAG = C_X.
         ITEMX-TARGET_QTY = C_X.
          ITEMX-PLANT = C_X .
          ITEMX-MATERIAL = C_X .
          ITEMX-TARGET_QU = C_X .
          APPEND ITEMX.
    *POPULATE SCHEDULE  TABLE
          SCHEDULE-ITM_NUMBER = RECORD-ITM_NUMBER.
          SCHEDULE-REQ_QTY = RECORD-REQ_QTY.
          APPEND SCHEDULE.
    *POPULATE SCHEDULE  TABLE
          SCHEDULEX-ITM_NUMBER = RECORD-ITM_NUMBER.
          SCHEDULEX-REQ_QTY = C_X.
          APPEND SCHEDULEX.
        endloop.
    *POPULATE PARTNER  TABLE
        PART-PARTN_NUMB = record-PARTN_NUMB.
        PART-PARTN_ROLE = record-PARTN_ROLE.
        APPEND PART.
    *BAPI CALL
        CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
              EXPORTING
               ORDER_HEADER_IN               = HEADER
               ORDER_HEADER_INX              = HEADERX
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
              IMPORTING
               SALESDOCUMENT                 = SO
              TABLES
               RETURN                        = RETURN
               ORDER_ITEMS_IN                = ITEM
               ORDER_ITEMS_INX               = ITEMX
               ORDER_PARTNERS                = PART
               ORDER_SCHEDULES_IN            = SCHEDULE
               ORDER_SCHEDULES_INX           = SCHEDULEX
      ORDER_CONDITIONS_IN           =
      ORDER_CONDITIONS_INX          =
      ORDER_CFGS_REF                =
      ORDER_CFGS_INST               =
      ORDER_CFGS_PART_OF            =
      ORDER_CFGS_VALUE              =
      ORDER_CFGS_BLOB               =
      ORDER_CFGS_VK                 =
      ORDER_CFGS_REFINST            =
      ORDER_CCARD                   =
      ORDER_TEXT                    =
      ORDER_KEYS                    =
      EXTENSIONIN                   =
      PARTNERADDRESSES              =
        loop at return where type = 'E' and ID NE 'MEPO' and ID NE 'BAPI'.
          WRITE:/ Return-message.
        endloop.
    *Confirm the document creation by calling database COMMIT
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            WAIT = 'X'.
    *Messages
        loop at return where type = 'S' and number ne '233'.
         WRITE:/ Return-message.
          CALL FUNCTION 'FORMAT_MESSAGE'
            EXPORTING
              ID        = return-ID
              LANG      = SY-LANGU
              NO        = return-NUMBER
            IMPORTING
              MSG       = W_MSG
            EXCEPTIONS
              NOT_FOUND = 1
              OTHERS    = 2.
          WRITE W_MSG.
         itab_msg-message = w_msg.
         append itab_msg.
          clear: W_MSG.
        ENDLOOP.
      enddo.
         -->P_W_FILE  text
    FORM GET_FILE  USING    P_W_FILE.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          FILE_NAME     = P_W_FILE
        EXCEPTIONS
          MASK_TOO_LONG = 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.     "GET_FILE
    Regards,
    Sachin

  • BAPI create quotation - conditon record problem

    Dear experts,
    Plz help. Many thanks.
    Background:
    Due to special request, condtion type z replaces Z-table, i.e. for record value & used for calculation. Let's say condition record for Z is 0.12USD.
    When creating quotation via BAPI, the value of condtion type z will automatically pick 0.12USD once the output value of condtion type z is less than 0.01USD. Actually, the final value of condtion type z is 0.12 x ABC (one value). Let's say the final value is 0.003.
    Problem: In quoation, condition type z shows value 0.12USD but not 0.003USD.
    Request: How to make condition type z picks the final value, say 0.003USD via BAPI?

    Any advice?

  • Very urgent::: Standard BAPI for creating quotation in vendor side

    hi all
    i need a standard bapi for creating Quotation in the vendor side
    i found 2 bapi's :
    bapi_quotation_createfromdata,
    bapi_salesorder_createfromdat1.
    but these are related to customer side itseems...
    i want standard bapi's for vendor side Quotation creation....
    points will be awarded for useful answer...

    hi all
    i need a standard bapi for creating Quotation in the vendor side
    i found 2 bapi's :
    bapi_quotation_createfromdata,
    bapi_salesorder_createfromdat1.
    but these are related to customer side itseems...
    i want standard bapi's for vendor side Quotation creation....
    points will be awarded for useful answer...

  • Error while creating Salesorder using BAPI

    hello frnds,
    I m new to abap and tryin to make use of BAPI_SALESORDER_CREATEFROMDAT1 to create Sales Order
    I have used the progrtam below.
    *& Report  ZSALESBAPITRIAL
    REPORT  zsalesbapitrial.
    TABLES : vbak , vbap.
    Parameter Screen.
    Sales Document Type.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    Sales document type.
    PARAMETERS: p_auart TYPE vbak-auart OBLIGATORY.
    Sales Organisation.
    PARAMETERS: p_vkorg TYPE vbak-vkorg OBLIGATORY.
    Distribution channel.
    PARAMETERS: p_vtweg TYPE vbak-vtweg OBLIGATORY.
    Division.
    PARAMETERS: p_spart TYPE vbak-spart OBLIGATORY.
    SKIP 1.
    Sold to.
    PARAMETERS: p_sold TYPE vbak-kunnr OBLIGATORY.
    Ship to.
    PARAMETERS: p_ship TYPE vbak-kunnr OBLIGATORY.
    SKIP 1.
    Material(Article No).
    PARAMETERS: p_matnr TYPE vbap-matnr   OBLIGATORY.
    Quantity (Cummulative quantity of sales Order)
    PARAMETERS: p_menge type vbap-kwmeng obligatory.
    Plant(Site )
    parameters: p_plant type vbap-werks obligatory.
    SELECTION-SCREEN END OF BLOCK b1.
    Data declarations.
    DATA: v_vbeln            LIKE vbak-vbeln.
    DATA: header             LIKE bapisdhead1.
    DATA: headerx            LIKE bapisdhead1x.
    DATA: item               LIKE bapisditem  OCCURS 0 WITH HEADER LINE.
    DATA: itemx              LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner            LIKE bapipartnr  OCCURS 0 WITH HEADER LINE.
    DATA: return             LIKE bapiret2    OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx   TYPE STANDARD TABLE OF bapischdlx
                             WITH HEADER LINE.
    DATA: lt_schedules_in    TYPE STANDARD TABLE OF bapischdl
                             WITH HEADER LINE.
    Header data
    Sales document type
      header-doc_type = p_auart.
      headerx-doc_type = 'X'.
    Sales organization
      header-sales_org = p_vkorg.
      headerx-sales_org = 'X'.
    Distribution channel
      header-distr_chan  = p_vtweg.
      headerx-distr_chan = 'X'.
    Division
      header-division = p_spart.
      headerx-division = 'X'.
      headerx-updateflag = 'I'.
    Partner data
    Sold to
      partner-partn_role = 'AG'.
      partner-partn_numb = p_sold.
      APPEND partner.
    Ship to
      partner-partn_role = 'WE'.
      partner-partn_numb = p_ship.
      APPEND partner.
    ITEM DATA
      itemx-updateflag = 'I'.
    Line item number.
      item-itm_number = '000010'.
      itemx-itm_number = 'X'.
    Material
      item-material = p_matnr.
      itemx-material = 'X'.
    Plant
      item-plant    = p_plant.
      itemx-plant   = 'X'.
    Quantity
      item-target_qty = p_menge.
      itemx-target_qty = 'X'.
      APPEND item.
      APPEND itemx.
      Fill schedule lines
      lt_schedules_in-itm_number = '000010'.
      lt_schedules_in-sched_line = '0001'.
      lt_schedules_in-req_qty    = p_menge.
      APPEND lt_schedules_in.
      Fill schedule line flags
      lt_schedules_inx-itm_number  = '000010'.
      lt_schedules_inx-sched_line  = '0001'.
      lt_schedules_inx-updateflag  = 'X'.
      lt_schedules_inx-req_qty     = 'X'.
      APPEND lt_schedules_inx.
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
    EXPORTING
    sales_header_in = header
    sales_header_inx = headerx
    IMPORTING
    salesdocument_ex = v_vbeln
    TABLES
    return = return
    sales_items_in = item
    sales_items_inx = itemx
    sales_schedules_in = lt_schedules_in
    sales_schedules_inx = lt_schedules_inx
    sales_partners = partner.
    Check the return table.
    LOOP AT return WHERE type = 'E' OR type = 'A'.
    EXIT.
    ENDLOOP.
    IF sy-subrc = 0.
    WRITE: / 'Error in creating document'.
    ELSE.
    WRITE: / 'Document ', v_vbeln, ' created'.
    ENDIF.
    but its giving 'Error in creating document' I m unable to figure wat i m missing . Is it tht i m gving wrong parameters.
    Please help !!!

    Does tht mean i need to add the following code
    Line item number.
    item-itm_number = '000010'.
    itemx-itm_number = 'X'.
    Material
    item-material = p_matnr.
    itemx-material = 'X'.
    Plant
    item-plant    = p_plant.
    itemx-plant   = 'X'.
    Quantity
    item-target_qty = p_menge.
    itemx-target_qty = 'X'.
    APPEND item.
    APPEND itemx.
    For second item.
    Line item number.
    item-itm_number = '000020'.
    itemx-itm_number = 'X'.
    Material
    item-material = '600020001'.
    itemx-material = 'X'.
    Plant
    item-plant    = p_plant.
    itemx-plant   = 'X'.
    Quantity
    item-target_qty = p_menge.
    itemx-target_qty = 'X'.
    APPEND item.
    APPEND itemx.
      Fill schedule lines
    lt_schedules_in-itm_number = '000010'.
    lt_schedules_in-sched_line = '0001'.
    lt_schedules_in-req_qty    = p_menge.
    APPEND lt_schedules_in.
      Fill schedule lines
    lt_schedules_in-itm_number = '000020'.
    lt_schedules_in-sched_line = '0002'.
    lt_schedules_in-req_qty    = p_menge.
    APPEND lt_schedules_in.
      Fill schedule line flags
    lt_schedules_inx-itm_number  = '000010'.
    lt_schedules_inx-sched_line  = '0001'.
    lt_schedules_inx-updateflag  = 'X'.
    lt_schedules_inx-req_qty     = 'X'.
    APPEND lt_schedules_inx.
      Fill schedule line flags
    lt_schedules_inx-itm_number  = '000020'.
    lt_schedules_inx-sched_line  = '0002'.
    lt_schedules_inx-updateflag  = 'X'.
    lt_schedules_inx-req_qty     = 'X'.
    APPEND lt_schedules_inx.
    But i guess it is overwritting my frst material..
    Also i m gettin a error 
    For object rv_beleg, number  range interval doesnot exist
    Pls suggest

  • Error while creating Contracts using BAPI

    Hello,
    I am trying to use BAPI BUS2014 to create new Purchasing Contracts. Now everything works fine, except for some strange cases where Contracts are failing out with a message as:
    Reference document or master record has different language
    I don't understand it why. Language being set in Contracts is defined for those items in MM and it works for others but not for all. I think I am missing some basic point here. Can anyone please suggest?
    Any help is highly appreciated!
    Cheers
    EssKay

    OK - stupid question. I did figure it out myself. Sorry for my impatience. This is my first BAPI program, so a bit too shaky
    Cheers
    EssKay

  • Error:First create the valuation-type-independent data:BAPI MM

    Hello all,
    I am getting above error (First create the valuation-type-independent data) when i sent the BWTAR field to BAPI_MATERIAL_GET_ALL and material data is not getting fetched.
    Please guide to resolve the issue.
    Thank you.
    Edited by: sanjivrd on Nov 30, 2009 10:08 AM

    Hi all,
    I'm using BAPI_MATERIAL_SAVEDATA for opening all views of material. I I try to open COST and ACCOUNT views, still having same message error "First create the valuation-type-independent data".
    Also If I don't open ACCOUNT and COST views, the creation works fine. After in updating material, I set up the VALUATIONDATA / X structure but the error is the same.
    We use "split valuation on material" and the Valuation Type is a mandatory field.
    Any help?
    Thanks in advance.
    GB

Maybe you are looking for

  • Multiple iPhones to a single iTunes Account - doable?

    Hi all, heres one - Is it possible to have 2 iphones authorised to 2 personal machines (windows) AND my mac which has all my centralised iTunes music? Currently, my music collection is dottted around various machines and drives. I am in the process o

  • I need help getting my purchased music back please

    I'm pretty sure i have somehow deleted a lot of music from my itunes and computer accidentally. I am only bothered about getting my purchased music back, most of which now has a grey exclamation mark next to it and says it cannot be located. I have t

  • Broadcaster Settings in BW7.0 WebTemplates

    Hello experts, my customer uses an individual copy of the standard program RSRD_BROADCAST_STARTER for mass publishing of web reports within Information Broadcasting. This individual copy manipulates the entries in the table RSRD_SETT_NODE_A ; variabl

  • Htmlb:tableView Recover the selected row

    Hi. How can I recover the selected row in a internal table, with the htmlb:tableView, in the onInputProcessing? Thanks very much! I'm using this sentence in the "layout": <!-- Visualizamos Línea de selección + tabla interna -->     <htmlb:tableView i

  • Why does Pages app have no 'labels' template?

    Why does "Pages" have no 'labels' template?