Reg: Department no in Sales Order Bapi BAPI_SALESDOCU_CREATEFROMDATA1

Hi ALL
i passing Department no at item level
For example...
  item-DEPARTMENT_NO = 0563.
  itemx-DEPARTMENT_NO = 'X'.
i am passing header level ..partner level data to Bapi BAPI_SALESDOCU_CREATEFROMDATA1
After executing the bapi i am getting error...
S   |V4                  |233   |VBAKKOM has been processed successfully  <
E   |V1                  |640   |Department 563 is not available          <
E   |V4                  |248   |Error in VBAPKOM 000010                  <
E   |V1                  |331   |Item 000010 does not exist               <
E   |V4                  |219   |Sales document  was not changed          <
E   |V4                  |219   |Sales document  was not changed          <
i am getting Department no is invalid...
Any thing i am missing here??
RR

our is SAP AFS Industry...
Department number willbe passed to below ...
Table Name       J_3ASZDID
Field Name       J_3ADEPM
Data Element     J_3ADEPM
in VA01....
and
Mso department is stored in  table J_3ADEP (MSO Department)
RR

Similar Messages

  • Problem in creating sales order with BAPI_SALESDOCU_CREATEFROMDATA1.

    Hi everybody
    I am not able create a sales order with BAPI_SALESDOCU_CREATEFROMDATA1.i also did debugging.its not throwing  up any errors in return table. return table is empty. but when i check the  BAPI in se37 with same data its creating the sales order.
    Here i am attaching my program.please kindly can anyone have a look and tell me whether i did anything wrong in  the program.
    thx in advance.
    *& Report  YORDERCREATE
    REPORT  YORDERCREATE.
    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: it_schedules_inx like bapischdlx occurs 0 with header line.
    data: it_schedules_in like bapischdl occurs 0 with header line.
    types: begin of itab,
    auart like vbak-auart,
    vkorg like vbak-vkorg,
    vtweg like vbak-vtweg,
    spart like vbak-spart,
    kunnr like kuagv-kunnr,
    kunnr1 like kuwev-kunnr,
    posnr like  vbup-posnr,
    matnr like mara-matnr,
    Tquan type string,
    end of itab.
    data: it-out type table of itab with header line.
    data: menge(10) type c.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'C:\VA01.TXT'
      FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      TABLES
        DATA_TAB                      = it-out.
    loop at it-out.
    header-doc_type = it-out-auart.
    headerx-doc_type = 'X'.
    header-sales_org = it-out-vkorg.
    headerx-sales_org = 'X'.
    header-distr_chan = it-out-vtweg.
    headerx-distr_chan = 'X'.
    header-division = it-out-spart.
    headerx-division = 'x'.
    headerx-updateflag = 'I'.
    *partner data
    partner-partn_role = 'SP'.
    partner-partn_numb = it-out-kunnr.
    append partner.
    partner-partn_role = 'SH'.
    partner-partn_numb = it-out-kunnr1.
    append partner.
    *item data
    itemx-updateflag = 'I'.
    item-itm_number = it-out-posnr.
    itemx-itm_number = 'X'.
    item-material = it-out-matnr.
    itemx-material = 'X'.
    item-target_qty = it-out-tquan..
    itemx-target_qty = 'X'.
    APPEND item.
    APPEND itemx.
    *loop at it-out.
    *write:/ it-out-auart,it-out-vkorg.
    *endloop.
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
      EXPORTING
       SALESDOCUMENT                 = v_vbeln
        SALES_HEADER_IN               = header
        SALES_HEADER_INX              = headerx
      SENDER                        = SENDER
      BINARY_RELATIONSHIPTYPE       = 'VORL'
      INT_NUMBER_ASSIGNMENT         = ' '
    IMPORTING
       SALESDOCUMENT_EX              = v_vbeln
    TABLES
       RETURN                        = return
       SALES_ITEMS_IN                = item
       SALES_ITEMS_INX               = itemx
       SALES_PARTNERS                = partner.
      SALES_SCHEDULES_IN            = SALES_SCHEDULES_IN
      SALES_SCHEDULES_INX           = SALES_SCHEDULES_INX
      SALES_CONDITIONS_IN           = SALES_CONDITIONS_IN
      SALES_CFGS_REF                = SALES_CFGS_REF
      SALES_CFGS_INST               = SALES_CFGS_INST
      SALES_CFGS_PART_OF            = SALES_CFGS_PART_OF
      SALES_CFGS_VALUE              = SALES_CFGS_VALUE
      SALES_CFGS_BLOB               = SALES_CFGS_BLOB
      SALES_CCARD                   = SALES_CCARD
      KEY_TABLE                     = KEY_TABLE
    endloop.
    loop at return where type  = 'E' or type = 'A'.
    exit.
    endloop.
    if sy-subrc = 0.
    write:/ 'error in creating document'.
    else.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT          = 'X'
    IMPORTING
      RETURN        = RETURN
    commit work and wait.
    write:/ 'document',v_vbeln,'created'.
    endif.

    Hi Patrick,
    Here are a couple of issues/recommendations:
    1) Checkboxes must be populated by capital X (your headerx-division = 'x' is wrong)
    2) Why you are using the COMMIT WORK AND WAIT statement? The CALL BAPI_TRANSACTION_COMMIT does exactly the same! Comment it out or better delete one of them!
    3) Does one of your sales order tables (VBAK, VBAP, ....) have any customer appended fields? In this case you have to populate an additional value table and the related index table as well.
    Check it out,
    Heinz

  • How to change pricing Conditions in Sales order in change sales order bapi

    Hi Experts,
    How to change pricing Conditions in Sales order in change sales order bapi.
    I have used the 2 function modules bapi-changesalesorder and sd salesdocument change, But it is creating the new record , instead of changing the existing one, Could please assist regarding the same
    Thanks in Advance .
    NLN

    HI NLN
      I have just tried on my system and managed to overwrite the existing price by passing the following parameters.
      <b>Import Paramters:</b>
         SALESDOCUMENT - Sales Document Number
         ORDER_HEADER_INX - UPDATEFLAG as <b>'U'</b>.
         LOGIC_SWITCH - Import Structure - Pass 'X' to LOGIC_SWITCH-COND_HANDL.
      <b>Tables:</b>
         CONDITIONS_IN - ITM_NUMBER,
                         COND_COUNT, -> Condition counter same as KONV-ZAEHK generally it is <b>'01'</b>
                         COND_TYPE,
                         COND_VALUE,
                         CURRENCY.
         CONDITIONS_INX - ITM_NUMBER,
                          COND_COUNT,
                          COND_TYPE,
                          UPDATEFLAG as <b>'U'</b>,
                          CURRENCY.
       Hope i have clarified your query.
    Kind Regards
    Eswar

  • Sales Order BAPI Extension

    Hi,
        We would like to pass custom fields data to Custom screens in VA01 Standard Sales Order. For that we are extending standard BAPI BAPI_SALESORDER_CREATEFROMDAT2 using EXTENSION parameter. We have appended custom structures to VBAKKOZ. VBAKKOZX, BAPE_VBAK,BAPE_VBAKX and able to pass information from portal upto 480 characters using
    valuepart1 and valuepart2.
    But when we are trying to extend it further, standard sales order BAPI
    BAPI_SALESORDER_CREATEFROMDAT2 is going to dump at :
             CALL METHOD cl_abap_container_utilities=>fill_container_c
                            EXPORTING
                               im_value     = da_bape_vbap
                            IMPORTING
                               ex_container =
    ch_parex+lenstruc(da_length_bape_vbap)
                            EXCEPTIONS
                               illegal_parameter_type = 1
                               OTHERS                 = 2.
    We need to extend it up to 900 chars.
    Any help on this will be greatly apprecited.
    Thanks
    Kalyan

    I found shortly after posting my message that the notes had not been correctly applied as the Notes Assistant ended with an error, and the error that resulted in this failure had not been corrected.  The basis folks failed to inform me that this error had occured in applying the notes.  I discovered it through testing.  Had you applied the notes and run into the same error?
    When we subsequently corrected for this, the issue with lenstruc went away and everything appears to be OK.  The real problem was that due to the error in the Notes Assistant the updated version of LVBAKTOP with the definition of lenstruc did not get activated.  It was left in a state where it needed an SSCR key to be applied manually, which should all have been handled automatically with SNOTE.
    Once this was done and the source was activated, the original error went away.  The two notes seem to have solved the original Unicode issue as well.
    We still have this update in the development area only since the CRM enhancements that caused the original problem with an append to the VBAK structure are also still in development.   We will be testing those changes together before moving everything up.  If there are any further issues that come up, I'll let you know.
    What I am wondering is if you had a similar problem applying the above notes, since the problem went away for us when the notes to handle the Unicode conversion were properly applied.
    Brian
    Edited by: Brian Sammond on Jul 24, 2008 10:55 AM

  • Problem in Sales Order BAPI

    Hi All,
    M using BAPI_SALESORDER_CREATEFROMDAT2 to create Sales Order. It is working fine & creating sales order. But i also want to give Order Quantity in sales order. What is the field name for that in BAPI.
    Thanks in advance....
    Regards
    AK

    Hi AK....
    You  can assign the quantity in table  
    ORDER_SCHEDULES_IN
    you have to assign REQ_QTY in this table for material....
    Here For each material you have to assign Item no....
    like
    010
    020
    with ref to that material gets identified in this table.......
    eg.
    in item table
    item 010 and material no is 0000000001
    and if u wan to give quantity then
    ORDER_SCHEDULES_IN
    itme no 010 and   REQ_QTY = 10
    That will solve your problem
    Regards
    Ashish

  • Sending Email to Material Department when a Sales Order is created

    Hello All,
           I am a facing the problem to find out the exit when creating the sales order.
    My Requirement is whenever a sales order is created via VA01, a email is sent to the material department with some contents. My task is to enhance the contents of the email.
    Can anybody tell me where, this exit is triggered.
    I have checked in USEREXIT_SAVE_DOCUMENT_PREPARE and
    USEREXIT_SAVE_DOCUMENT. But nothing written in these to forms
    Please come up with ur Ideas
    Regards,
    Vasanth.M

    Hi,
    There might be some output type which is associated with VA02 , that output type triggers when ever you create or change , that might be sending the mail.
    You Go to <b>NACE</b> transaction there you can see the output type related to sales order , in that look for output types which are sending mails. there you can get the driver program and use that progrm , go to SE38 and modify the content accordingly..
    Regards
    vijay

  • Return SALES Order BAPI

    Hi,
    I'm passing following values in  BAPI_SALESORDER_CREATEFROMDAT2  bapi for Return sales Order
    it_header-ref_doc = '0090000047'. " Invice Billing Number
    it_header-REFDOC_CAT = 'M'.     " M for Invoice
    it_header-ORD_REASON = '101'.   " 101 stand for Poor Quility
    headerx-ref_doc = 'X'.
    headerx-REFDOC_CAT = 'X'.
    headerx-ORD_REASON = 'X'.
    But it showing below msg why.
    Error  V1  Message No = 761
    'Unpermitted combination of business object BUS2032 and sales doc. category H'
    anything missing or Wrong ?

    the error is coming because the BAPI BAPI_SALESORDER_CREATEFROMDAT2  is meant for only Sales orders(i.e for BUS2032) since in the code it is hardcoded .
    call function 'SD_SALESDOCUMENT_CREATE'
           exporting
                salesdocument           = salesdocumentin
                sales_header_in         = order_header_in
                sales_header_inx        = order_header_inx
                sender                  = sender
                binary_relationshiptype = binary_relationshiptype
                int_number_assignment   = int_number_assignment
                behave_when_error       = behave_when_error
                logic_switch            = logic_switch
                business_object         = 'BUS2032'  "<----hardcoded
                testrun                 = testrun
    if you want to avoid the error. copy the BAPI to ZBAPI and change the Business object to Return order's business object.
    For Return order BUS2102 . so replace that with BUS2102.
    Edited by: Vijay Babu Dudla on Oct 15, 2008 10:22 AM

  • Problem with Sales Order BAPI  Update...Very Very Urgent....Pls Help me out

    I am trying to update the sales order text using "BAPI_SALESORDER_CHANGE" But i am getting an error as " Sold-to party E455 not maintained for sales area E901 C1"
        I passed the sales order no, and the text to be upated and the Update flag is set to "U".
        When i try giving the same values in se37 it updates the sales order text successfully but when i use the same BAPI in the report i am getting the above error. Can anyone pls help me out.

    hi
    the message is very clear that the sold to party ur refering is not from the same sales area. if u have the customer already then extend the same to the said sales area, by common division and distribution channel
    <b>reward points</b>
    Regards

  • AFS Return sales orders BAPI

    Hi ,
          Please help me in the issue . I want a bapi for return sales orders specific to AFS as i am not able to use the normal returns orders bapi BAPI_CUSTOMERRETURN_CREATE.  Can anyone please let me know how to proceed for the same.
    Thanks in advance,

    Hi...
    try by using FM " BAPI_SALESDOCUMENT_CREATE".
    Regards,
    Lokeswari.

  • ISSUE REGARDING SALES ORDER BAPI

    Is "ISM_SALESORDER_CREATEFROMDAT2" function module and
    "BAPI_SALESORDER_CREATEFROMDAT2" function module same for creation of sales order for bapi.
    srinivas

    This is because you are still missing some segments or data.
    Maybe this thread will be helpful:
    BAPI_SALESORDER_CREATEFROMDAT2 to replace VA01, KBETR and NETWR
    You should also check the documentation from transaction BAPI.

  • LSMW Sales Order BAPI : Header & Item Text

    Hi frenz,
           I'm migrating Sales Order data using LSMW with BAPI method. We got four files...
    one for header, one for item, one for header text, one for item text.
    Now my problem is how do i update both header and item text.
    B'cos while assigning structural relations we got only one text structure(E1BPSDTEXT) common for both header and item. So which source structure(whether header_text or item_text) should be assigned to this segment(E1BPSDTEXT)?
    Else is there any other way to update both header and item texts?
    With regards,
    praveen.

    Unfortunately, you cannot assign more than one source structure to a target structure. But you can still manipulate the code. Here is how.
    Let us say your source structure defined for item texts is ITEM_TEXTS. In your field mapping section for E1BPSDTEXT, double click the '__BEGIN_OF_RECORD__' in change mode. It will pop-up a warning message, say 'yes' and proceed. Remove all the coding that is there in this section, but copy the lines to somewhere(say x buffer) before you do that. You will need those lines below. Just add the following lines there.
    if v_transferred_texts = 'X'.
    *-- all the texts are transferred, don't need to process again.
      skip_record.
    endif.
    You need to define 'v_transferred_texts' in the
    '__GLOBAL_DATA__' section as follows.
    data: v_transferred_texts type c.
    Now double click on '_END_OF_RECORD_' in change mode. It will pop-up a warning, but you can say 'yes' and proceed. This will open up the coding window with one line of code in it 'transfer_record.'. Here you need to add your coding as follows.
    *-- move the header texts
    LOOP AT HEADER_TEXTS.
    *-- This should <b>ALWAYS</b> be there
      g_edidd_segnam = 'E2BPSDTEXT000'.
      g_edidd_segnum = '0021'.         
      g_edidd_psgnum = '000001'.       
      g_edidd_hlevel = '02'.           
      clear E1BPSDTEXT.                
    *-- fill each field of the following fields
      E1BPSDTEXT-DOC_NUMBER = SALESHEADER-ORDERNUMBER.
      E1BPSDTEXT-ITM_NUMBER = '000000'.
      E1BPSDTEXT-TEXT_ID    = HEADER_TEXTS-TEXTID.
      E1BPSDTEXT-LANGU      = SY-LANGU.
      E1BPSDTEXT-LANGU_ISO 
      E1BPSDTEXT-FORMAT_COL
      E1BPSDTEXT-TEXT_LINE  = HEADER_TEXTS-TEXT.
      E1BPSDTEXT-FUNCTION   = '005'.
      transfer_record.
    ENDLOOP.
    *-- Now move the item texts
    LOOP AT ITEM_TEXTS.
    *-- This should <b>ALWAYS</b> be there
      g_edidd_segnam = 'E2BPSDTEXT000'.
      g_edidd_segnum = '0021'.         
      g_edidd_psgnum = '000001'.       
      g_edidd_hlevel = '02'.           
      clear E1BPSDTEXT.                
    *-- fill each field of the following fields
      E1BPSDTEXT-DOC_NUMBER = SALESHEADER-ORDERNUMBER.
      E1BPSDTEXT-ITM_NUMBER = ITEM_TEXTS-ITM_NUMBER.
      E1BPSDTEXT-TEXT_ID    = ITEM_TEXTS-TEXTID.
      E1BPSDTEXT-LANGU      = SY-LANGU.
    *  E1BPSDTEXT-LANGU_ISO  =
    *  E1BPSDTEXT-FORMAT_COL
      E1BPSDTEXT-TEXT_LINE  = ITEM_TEXTS-TEXT.
      E1BPSDTEXT-FUNCTION   = '005'.
      transfer_record.
    ENDLOOP.
    *-- set the flag that the texts have been transferred
    v_transferred_texts = 'X'.
    Please let me know how it goes.
    Srinivas

  • Regarding Sales Order Bapi

    Hi Friends,
    I am trying to upload the sales order history from the legacy side using Bapi BAPI_SALESORDER_CREATEFROMDAT2. I am passing all the mandatory values but I am getting an error message "please select sold-to or ship-to party".
    What is that I am missing? Can anybody guide me in this issue.
    Thanks,
    Raj

    Raj,  when calling the BAPI are you passing values in the following table which is in BOLD.  If not, I'm pretty sure that you need to pass the SOLDto and the SHIPto partners in this table.  Please see Srinivas's previous reply also.
    FUNCTION BAPI_SALESORDER_CREATEFROMDAT2.
    **Lokale Schnittstelle:
    *  IMPORTING
    *     VALUE(SALESDOCUMENTIN) LIKE  BAPIVBELN-VBELN OPTIONAL
    *     VALUE(ORDER_HEADER_IN) LIKE  BAPISDHD1 STRUCTURE  BAPISDHD1
    *     VALUE(ORDER_HEADER_INX) LIKE  BAPISDHD1X STRUCTURE  BAPISDHD1X
    *       OPTIONAL
    *     VALUE(SENDER) LIKE  BAPI_SENDER STRUCTURE  BAPI_SENDER OPTIONAL
    *     VALUE(BINARY_RELATIONSHIPTYPE) LIKE  BAPIRELTYPE-RELTYPE
    *       OPTIONAL
    *     VALUE(INT_NUMBER_ASSIGNMENT) LIKE  BAPIFLAG-BAPIFLAG OPTIONAL
    *   VALUE(BEHAVE_WHEN_ERROR) LIKE  BAPIFLAG-BAPIFLAG OPTIONAL
    *    VALUE(LOGIC_SWITCH) LIKE  BAPISDLS STRUCTURE  BAPISDLS OPTIONAL
    *    VALUE(TESTRUN) LIKE  BAPIFLAG-BAPIFLAG OPTIONAL
    *    VALUE(CONVERT) LIKE  BAPIFLAG-BAPIFLAG DEFAULT SPACE
    *  EXPORTING
    *     VALUE(SALESDOCUMENT) LIKE  BAPIVBELN-VBELN
    * TABLES
    *      RETURN STRUCTURE  BAPIRET2 OPTIONAL
    *      ORDER_ITEMS_IN STRUCTURE  BAPISDITM OPTIONAL
    *      ORDER_ITEMS_INX STRUCTURE  BAPISDITMX OPTIONAL
    *      <b>ORDER_PARTNERS STRUCTURE  BAPIPARNR</b>
    *      ORDER_SCHEDULES_IN STRUCTURE  BAPISCHDL OPTIONAL
    *      ORDER_SCHEDULES_INX STRUCTURE  BAPISCHDLX OPTIONAL
    *      ORDER_CONDITIONS_IN STRUCTURE  BAPICOND OPTIONAL
    *      ORDER_CFGS_REF STRUCTURE  BAPICUCFG OPTIONAL
    *      ORDER_CFGS_INST STRUCTURE  BAPICUINS OPTIONAL
    *      ORDER_CFGS_PART_OF STRUCTURE  BAPICUPRT OPTIONAL
    *      ORDER_CFGS_VALUE STRUCTURE  BAPICUVAL OPTIONAL
    *      ORDER_CFGS_BLOB STRUCTURE  BAPICUBLB OPTIONAL
    *      ORDER_CFGS_VK STRUCTURE  BAPICUVK OPTIONAL
    *      ORDER_CFGS_REFINST STRUCTURE  BAPICUREF OPTIONAL
    *      ORDER_CCARD STRUCTURE  BAPICCARD OPTIONAL
    *      ORDER_TEXT STRUCTURE  BAPISDTEXT OPTIONAL
    *      ORDER_KEYS STRUCTURE  BAPISDKEY OPTIONAL
    *      EXTENSIONIN STRUCTURE  BAPIPAREX OPTIONAL
    *      PARTNERADDRESSES STRUCTURE  BAPIADDR1 OPTIONAL
    Regards,
    Rich Heilman

  • Bapi For Blocked sales orders & Bapi for Releasing those orders

    Hi All,
        Can anybody help me regarding <b>Bapi</b> for getting <b>Blocked sales orders</b> and bapi for <b>releasing</b> those sales orders..
    Any help will be rewarded...
    Thanks..
    Regards,
    Srinivas.

    Use bapi:
    BAPI_SALESORDER_GETLIST to get the list of all sales orders based on Parameters
    CUSTOMER_NUMBER
    SALES_ORGANIZATION
    MATERIAL
    DOCUMENT_DATE
    DOCUMENT_DATE_TO
    PURCHASE_ORDER
    Then,
    loop at the internal table
    and use the bapi BAPI_SALESORDER_GETSTATUS to get the status of each sales order.
    choose only which are blocked.
    Regards,
    ravi

  • Reg...Open sales order

    Hi Experts
    can u let me know the standard Transaction/ Program for Open Sales Orders.
    Regards,
    kumar

    Hi,
    Please check transaction VA05.
    Regards,
    Ferry Lianto

  • Reg.Stock keeping against sale order

    Dear Gurus
    how to purchase and keep stock against one sale order.pls explain,more over in our concern the material goes to consumption account with account assignment category E, but should not keep blank the AAC field in PO,I tried in my level best but no gain.

    Dear
    If you wnat to block a stock for the particular sales order then you can convert the unrestricted stock to the sales order stock.
    but you need to also customize for the requirement type that is determied so that it can take the sales order stock
    i think the movement type 412 E can be used for moving from normal stock to sales order stock
    thanks
    Virandr

Maybe you are looking for

  • Error in ABAP table

    Hi, I am executing script logic in SAP BPC. however it's back end is SAP BI and i am getting this following error "A dump error occourred in ABAP stack". while i have tried to pull error info by going through ST22, i can see this below error. The cur

  • Oracle SSL connectivity

    Hi, Can any one please let me know if we can connect to oracle SSL database using jdbc driver with below connection string format. user/password@hostname:sslport:SID Or is there any other way to connect? Thanks.

  • Name cannot be resolved

    hi, how to modify this code?to solve name cannot be resolved error. function ValidateUsername(formobj) var name=formobj.username.value; alert(name); <% UserDAO userDao = new UserDAOHibernate(); Integer userID = userDao.getValidUserForForgotPassword(n

  • Applescript to switch audio output

    I am having a little trouble with this applescript which is intended to present a dialog with some choices and switch the audio output accordingly. Any help would be greatly appreciated. I've started a gist too. tell application "System Preferences"

  • SG200-08 won't boot anymore

    Hi, When I came back home today I saw that my SG200-08 switch did not look fine. Basically, the system LED of the switch keeps blinking and end devices connected just don't have any network. I tried to reset the switch with the "reset" button (with a