"Enter document number error" in BAPI_SALESORDER_CHANGE

Hi,
I am trying to change the sales order thorugh BAPI_SALEORDER_CHANGE as follows,
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = <fs_order_alv_aux>-vbeln
order_header_in = e_bapisdh1
order_header_inx = e_bapisdh1x
simulation = p_consol
TABLES
return = t_bapi_return
extensionin = t_bapiparex.
I am changing only KVGR5 through this BAPI, and I am passing sales documetn number through <fs_order_alv_aux>-vbeln.
When I check inside BAPI I am able to see SALESDOCUMENT : 0021033932, while debugging further I came to know about following.
Inside the Function SD_SALES_DOCUMENT_READ. following 2 lines gets executed.
VBAK-VBELN = DOCUMENT_NUMBER.
PERFORM BELEG_LESEN(SAPMV45A).
Here, VBAK-VBELN has a value, but as soon as it goes inside PERFORM BELEG_LESEN(SAPMV45A). VBAK-VBELN value gets cleared and following error has been set inside the perform.
if vbak-vbeln is initial.
message e045.
endif.
If I manually fill VBAK-VBELN inside this perform then everything works fine.
I even tried same thing through SE37 by executing this BAPI but in this case it doesnot clear the VBAK-VBELN inside this PERFROM.
Can anyone help?
Thank you.

Hi Pramod,
it does not look like a conversion error.
You may try again with SE37, enter debugger at start and set a watchpoint at VBAK-VBELN in function SD_SALES_DOCUMENT_READ, i.e. program SAPLV45A.
When VBAK-VBELN is set, it will stop at the watchpoint. Check the call stack at this point to find out how the value gets here. Then start your misbehaving program and (I hope so) find out ehere it is going wrong.
The SD process is heavily penetrated with enhancements for a couple of industry solutions. I do not know your environment so it is hard to say how the document number is passed to function group V45A.
Regards,
Clemens

Similar Messages

  • Enter the document number error in BAPI_SALESORDER_CHANGE

    Hi,
    please help me on the below error:
    Call of BAPI_SALESORDER_CHANGE gives us an error V1 045 "Enter the document number". We are sure the call is proper (document number is send). The errors occurs in function module SD_SALES_DOCUMENT_READ in lines 60 and 61:
    60 VBAK-VBELN = DOCUMENT_NUMBER.
    61 PERFORM BELEG_LESEN(SAPMV45A).
    In line 60 field VBAK-VBELN is set but in form BELEG_LESEN(SAPMV45) is initial. The value of field is checked in MV45AF0B_BELEG_LESEN line 53.
    53 if vbak-vbeln is initial.
    54 message e045.
    55 endif.
    kindly help me on this error,
    Thanks in advance friends,
    Naidu

    LOOP AT IT_ZVCONTRACT_SUSP_SAVE INTO WA_ZVCONTRACT_SUSP_SAVE.
    *Assign values to required fields for for updation
        SALESDOCUMENT = WA_ZVCONTRACT_SUSP_SAVE-VBELN.
        ORDER_HEADER_IN-SALES_ORG = WA_ZVCONTRACT_SUSP_SAVE-VKORG.
        ORDER_HEADER_IN-PURCH_DATE = '00000000'.
        ORDER_HEADER_INX-SALES_ORG = 'X'.
        ORDER_HEADER_INX-PURCH_DATE = 'X'.
        ORDER_HEADER_INX-UPDATEFLAG = 'U'.
        WA_ORDER_ITEM_IN-ITM_NUMBER = WA_ZVCONTRACT_SUSP_SAVE-POSNR.
        IF WA_ZVCONTRACT_SUSP_SAVE-CFLAG EQ 'P'.      "flag for permanent suspension
          WA_ORDER_ITEM_IN-REASON_REJ = WA_ZVCONTRACT_SUSP_SAVE-ABGRU.
        ELSEIF WA_ZVCONTRACT_SUSP_SAVE-CFLAG EQ 'T'.  "flag for temporary suspension
          WA_ORDER_ITEM_IN-REASON_REJ = ''.
        ENDIF.
        APPEND WA_ORDER_ITEM_IN TO ORDER_ITEM_IN.
        WA_ORDER_ITEM_INX-ITM_NUMBER = WA_ZVCONTRACT_SUSP_SAVE-POSNR.
        WA_ORDER_ITEM_INX-UPDATEFLAG = 'U'.
        WA_ORDER_ITEM_INX-REASON_REJ = 'X'.
        APPEND WA_ORDER_ITEM_INX TO ORDER_ITEM_INX.
    *update contract for reason code
        CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
          EXPORTING
            SALESDOCUMENT    = SALESDOCUMENT
            ORDER_HEADER_IN  = ORDER_HEADER_IN
            ORDER_HEADER_INX = ORDER_HEADER_INX
          TABLES
            RETURN           = RETURN
            ORDER_ITEM_IN    = ORDER_ITEM_IN
            ORDER_ITEM_INX   = ORDER_ITEM_INX.
    ENDLOOP.
    We are using it the above given way and it is working fine.
    Regards,
    Abhijit G. Borkar

  • Enter Document Number in "BAPI_SALESORDER_CHANGE".

    Hi All,
    I am facing some problem with BAPI_SALESORDER_CHANGE.
    I am trying to update the Sales Order header with the BAPI BAPI_SALESORDER_CHANGE.
    However, I am facing the below error though I pass the Sales document number correctly with all leading zeroes.
    "Enter Document Number".
    When I debugged, I found that it hits a function module SD_SALESDOCUMENT_CHANGE which inturn calls the FM
    SD_SALES_DOCUMENT_READ. Inside the FM SD_SALES_DOCUMENT_READ, I could see that the value is being assigned to
    VBAK-VBELN. But, there is a subroutine which gets executed after that. As soon as it enters in to the subroutine, the value of VBAK-VBELN gets vanished.
    VBAK-VBELN = DOCUMENT_NUMBER.
      PERFORM BELEG_LESEN(SAPMV45A).    "Once it enters inside this subroutine, the value of VBAK-VBELN gets cleared.
      PERFORM KONV_SELECT(SAPFV45P).
    Any pointers on this would be highly appreciated. I have gone through various posts of SDN. But, none of them could help me.
    Note:  When I execute the above FM from SE37, it works fine and the VBAK-VBELN value doesnt get vanish even after entering the above mentioned Subroutine.
    Thanks,
    Babu KIilari

    Hi Babu,
    Just replying to update this thread in case it can help others in the future, as I had a similar issue (at our same client ).  To paraphrase/quote your reply to my mail on similar error " the solution for the same is not the implicit enhancement that we have created there. It was just a temporary solution and as you have highlighted that transport never moved into any other system across the landscape. The actual issue that caused the error was due to a conflict between the subroutine pool and the program SAPMV45A.  Someone had defined a subroutines in SAPMV45A and they were calling the same in the USEREXIT_SAVE_DOCUMENT_PREPARE which I think belongs to the same program. Don’t recall the actual glitch at the variable level, however VBAK-VBELN was being reset by the subroutine pool. Instead of calling the external subroutines from the parent program SAPMV45A, I had created one Subroutine pool and consolidated all the 6 subroutines into it and then I am calling these 6 subroutines from the FM." 
    So your issue was within a sales order change being saved, in the save user-exit, someone was again referring to SAPMV45A which was blanking out VBAK-VBELN as you showed above.
    In my issue, same issue was happening that VBAK-VBELN was disappearing.  The scenario for us was as follows.  We have an interface from a TMS system which can update STOs or Sales Orders (1 doc per IDOC).  We saw the Sales Order IDOCs were sometimes getting a 51 status if the BAPI call failed with V1045 Enter the Document Number.  By the hints above, we suspected somehow SAPMV45A was being called.  By analysis, we realized that the issue happened when an IDOC to do a BAPI_PO_CHANGE preceded the BAPI call for the sales order.  And then debugging showed us that someone had put a user-exit in a gATP exit which was performing a subroutine in SAPMV45A for  an STO (which the logic was only pertinent to SOs).  By going into the SAPMV45A routine, the (SAPMV45A)VBAK-VBELN work area was created albeit empty.  Then, when the Sales Order BAPI gets called (his IDOC was next in line of the IDOC processing program) that blank work area overlaid VBAK-VBELN when code entered into BELEG_LESEN.  Our solution will be to prevent the gATP exit from calling a perform into SAPMV45A when its working with STOs.

  • Document number error in billing

    HI all,
    When I am doing billing for a sales order, I am getting the following error. The full message is :
    "The document number you specified is not in the appropriate number range. The number range is dependent on the  document type.
    The exception to this rule is formed by recurring entry documents, which must use number range 'x1' and sample documents, which must use number range 'x2'.
    Possible reasons for this error are given as
    You have given an incorrect document number
    An incorrect document number is transferred to this application during an  update from another application (eg CO)"
    Can anybody give a solution for this errror.
    Thanks in advance,
    Sreedhar

    Normally billing docs are internally number ranged which is the sap standard. If you have not canged this then the only problem which occurs is w.r.t Costing. Generally at the time invoicing some CO docs get generated as well if you have automatic posting enabled.
    In this case number range formats need to be maintianed. Please maintian them and proceed.
    If you are ofcourse on an IDES system for training purposes Check your assignments to Controlling area/ Profit centre ... Deactivate them. It will allow you to invoice. However in this no costing docs will get generated.
    regards
    Jude

  • F-32, clear customer - document number

    Hi,
    My client is using F-32 to clear customer items, it selects document no. as selction crieteria. it enters document number wrongly and press enters, system stores document no. user get back by pressing F3 once and select choose open items whr he again follow the same process as mentioned above and execute process open items. line items appears with current as well as last document selectin. now user says i want only current selectiion without getting out of Tcode, he doesnt want the system store the doc no.
    on this i replied it is std functionality/feature given by sap whr if user misses or want to use diff diff selction crieteria this feature is useful. But client is not ready to accept it as a feature. he is sayin it is system bug.
    Please advise.
    Thanks
    Homi.

    Hi,
    Better You can post a query to Service.SAP.com with your SID (S000xxxxxxx) . So that they will guide your client properly. If it is a bug they will send a patch file. and they will issue SNote for this.
    Thanks
    Chandra

  • No document number in Approval Workflow

    Hi!
    I have crated a work flow where I check if the status is FA for docType 900. If this is true then I send a mail to the person responsible for the approval. Everything works exept that I don't get the document number for the document that I change. I use the &document.documentnumber& command in the mail but the system don't get the docNr.
    //Krip

    Hi,
    by using standard document distribution, whenver you send an mail along with object (document), reciepient recieves the mail with object(document) which is indicated by its description.
    once you click on the object(attached document) in mail, you wil be redirected to SAP screen.
    In order to identify the document in terms of document number then you may manually enter document number in description field.
    Thank You,
    Manoj
    if useful pls consider points..!

  • JHF3 transaction:Accounting document display error

    Hi,
    I am displaying an order billing document through transaction JHF3. there's an accounting document which is being generated and i am displaying it. In the assignment field the sales document number should be populated but instead the reference billing number is getting displayed.
    the internal table XBSEG is used to display data and it is populated from the int. table YBSEG. the data populated in YBSEG is wrong.
    before going into the perform READ_BSEG (this is screen no 750, module set_buzeile) which populates the table YBSEG, the table is empty. as soon as u enter the form the table YBSEG gets populated. In the debug mode i saw that there's no code for populating YBSEG. I need to resolve this problem soon.

    Dear,
    Use T.code
    FB03 - Display document.
    Enter
    Document number :
    Company Code :
    Fiscal Year :
    You will get the document.
    Another T.code MIR6 Invoice Overview.
    Enter :
    Company Code :
    Fiscal Year :
    Invoicing Party (Vendor Code):
    Select All the check box in entry type & Invoice status.
    Execute.
    Check the vendor/GL ledger. If document is posted then it will give impace in ledger.
    GOPAN.

  • "Enter the document number" in BAPI_SALESORDER_CHANGE.

    Hi,
    I've got the following error:
    Call of BAPI_SALESORDER_CHANGE gives us an error V1 045 "Enter the document number". We are sure the call is proper (document number is send). The errors occurs in function module SD_SALES_DOCUMENT_READ in lines 60 and 61:
    60    VBAK-VBELN = DOCUMENT_NUMBER.
    61   PERFORM BELEG_LESEN(SAPMV45A).
    In line 60 field VBAK-VBELN is set  but in form BELEG_LESEN(SAPMV45) is initial. The value of field is checked in MV45AF0B_BELEG_LESEN line 53.
    53    if vbak-vbeln is initial.
    54    message e045.
    55   endif.
    The error occurs only when we have mass changing of sales order and posting deliveries in reference to sales order. Single operation doesn't make any problem.
    Our system:
       SAP_APPL 470 with  SAPKH47026
       SAP_BASIS 620 with SAPKB62059
    Anyone met it before? I'm quite confused.
    Best regards:
    Lukasz Tylutki

    Hi Lukasz,
    If I understand correctly the problem occurs with multiple calls of the BAPI within the same program call. As a general rule of thumb, this could be due to parts of the program not properly initialized. Don't try to correct the BAPI - it's hopeless.
    I suggest you make use of the suggestion in note 760068 to start a new task.
    This can be achieved as follows:
    Call function 'XXXXXX' starting new task 'BLABLA'
    performing yyyyy on end of task
    ...rest of function interface (only export and tables)...
    wait until semaphore = 'X'.
    form yyyyy
    receive results from function 'XXXXXX'
    importing...
    tables...
    exceptions....
    semaphore = 'X'.
    endform.
    This way all data are initalized in a different LUW, thus not influencing the next function executions. An alternative would be to submit programs for each function call, passing the interface through export-import parameters, but it doesn't look as nice.
    Best regards,
    Stratis

  • IDOC error status 'Enter the Document Number'

    Hi PI or SD masters,
    I have a status 51 in my IDOC. The reason was 'Enter the Document Number'. Has anyone encountered this before?

    Sold To Party Account number was changed

  • Error while generatin the Billing document number in WPUK

    Dear Experts,
    My clien thaving ISRETAIL ECC6.0 version & we would like to implement Fund management. At the time of sales at stores below mentioned error displaying.
    No commitment item entered in item 2700 2009 9000067
    In this my company code is 2700
    9000067 is billing document number (It is not yet created)
    Best Rgds
    Suma

    980273 NOTE HAS BEEN APPLIED TO ERROR FREE

  • ASN Reference document number is invalid error with SA

    Hi~
    We have ASN creation error with SA(Scheduling Agreement).
    Portal Menu : Delivery-Receipts and Requirements-Due List for purchasing document(Supplier)
    1. Select SA(Scheduling Agreement) line
    2. Click 'Create ASN '
    3. After enter ship from location, ASN number, Error occur
       "ASN ASN-1112, item 000001: Reference document number is invalid "
    When we execute with PO, there are no error.
    But with SA, there are always error.
    Bestregards,
    SKY

    Hi SKY
    Please make sure the external procurement releationship (SA) exists in the below transaction
    /n/sapapo/pwbsrc1 between source and destination locations. i.e shipfrom and ship to
    Also make sure that the external procurement relation ship is referenced in the transportation lane /n/sapapo/tl1
    Select your product -specific transportation lane- go to detail screen
    There you can find external procurement releationship, maintain the data
    Please enhance your master data acoringly. Afterwards you can select reference doc nomber as well as item number with the value help in the ASN creation screen. By that the reported error msg should not appear anymore.
    Or Switch off PURCH_REF_MANDATORY validation check
    i suggest you follow first method and complete the master data setup
    Best Regards
    Vinod

  • Accounting Document Number range error

    Dear All,
    As per my client requirement 3 types of billing document is thier. SD Consulant maintain the number range below
    1. Domestic billing (Number range between 000040000- 0000401000 )
    2. Export billing (Number range between  0000900001-0000901000 )
    3. Cash sales billing (Number range between  0000900001-0000901000 )
    In VF01 billing is saved for above billing documents. But not posted into Accounting Documents.
    I am gettin error " Incorrect Doc Number 40000 select the document number between 9000001-901000"
    In my understanding FI Consulant maintain the same number range the Account Document automatically posted in to Accounting. How to maintian the 3 number range in FBN1.Plz help me.
    Thanks and regards
    chandra

    Hi,
    In FBN1  FI Consultant maintain the number range Cash sales billing (Number range between 0000900001-0000901000 . This Cash sales billing posted to account, other billings not posted to accountg. plz guide me.
    Thanks and regards
    chandra

  • Error while detrmining Internal Document Number for Excise Invoice.

    Hello mate, I am trying to create excise invoice for for factory sale. while saving the document I am getting an error" Error
    while detrmining Internal Document Number for Excise Invoice. Message: Maintain Number Range for J_1IINTNUM". I have already maintained number range for mentioned object "J_1INTNUM" in TCODE SNUM , still getting error. Please solve my querry . Is it related to transport or number range activation or something else? I have maintained number range with serial no. "01"

    Hello ,
    Ensure that number ranges are properly maintained in the respective client that should be the year specific.Some times even u maintained the system should not consider that number ranges  due to table updation problem ,because i had faced the same in the earlier and received the reply from the sap stating that this error was occured rarely after the years,so please ignore that ,for your problem u first come out of the screen and then re log in and then create the excise invoice ,then check the number ranges .
    Please revert for any
    Kalyan

  • ERROR: You entered a number which is lower than or equal to the package....

    Hi ,
    I'm doing PREPARE for the upgrade to ECC60 from SAP 4.7 R1, but I have the following error in the phase of including patch.
    Any idea ?
    ERROR
    SAPup> Do you want to search for new packages in directory
    sappino\sapmnt\trans\EPS\in" first?
           Because of errors during package extraction, "Search" is recommended.
                - "Search"
                - "Skip"
    Enter one of these options [Search] :=
    uploading data ...
    Please select the Support Packages to include:
                                    Support Package Level
    Component             min        equi       current    select  
    [9]
    SAP_ABA              <none>     <none>     0009      0009
    [9]
    SAP_BASIS            <none>     <none>     0009      0009
    [9]
    PI_BASIS             <none>     <none>     0009      0009
    [5]
    ST-PI                <none>     0005       0002      0005
    [9]
    SAP_BW               <none>     <none>     0009      0009
    [6]
    SAP_AP               <none>     <none>     0006      0006
    [7]
    SAP_HR               <none>     <none>     0007      0007
    [6]
    SAP_APPL             <none>     <none>     0006      0006
    [6]
    EA-IPPE              <none>     <none>     0006      0006
    [6]
    EA-FINSERV           <none>     <none>     0006      0006
    [6]
    EA-GLTRADE           <none>     <none>     0006      0006
    [7]
    EA-HR                <none>     <none>     0007      0007
    [6]
    EA-PS                <none>     <none>     0006      0006
    [6]
    EA-RETAIL            <none>     <none>     0006      0006
    [6]
    EA-DFPS              <none>     <none>     0006      0006
    [6]
    EA-APPL              <none>     <none>     0006      0006
    [6]
    FINBASIS             <none>     <none>     0006      0006
    [6]
    ERECRUIT             <none>     <none>     0006      0006
    [6]
    SEM-BW               <none>     <none>     0006      0006
    [6]
    LSOFE                <none>     <none>     0006      0006
          SAPup message
    SAPup> ERROR: You entered a number which is lower than or equal to the
                  package level which is integrated in this upgrade.
                  SAP_ABA - package level (9) too low (integrated package level 9).
                  SAP_BASIS - package level (9) too low (integrated package level 9).
                  PI_BASIS - package level (9) too low (integrated package level 9).
                  ST-PI - package level (2) too low (integrated package level 2).
                  SAP_BW - package level (9) too low (integrated package level 9).
                  SAP_AP - package level (6) too low (integrated package level 6).
                  SAP_HR - package level (7) too low (integrated package level 7).
                  SAP_APPL - package level (6) too low (integrated package level 6).
                  EA-IPPE - package level (6) too low (integrated package level 6).
                  EA-FINSERV - package level (6) too low (integrated package level 6).
                  EA-GLTRADE - package level (6) too low (integrated package level 6).
                  EA-HR - package level (7) too low (integrated package level 7).
                  EA-PS - package level (6) too low (integrated package level 6).
                  EA-RETAIL - package level (6) too low (integrated package level 6).
                  EA-DFPS - package level (6) too low (integrated package level 6).
                  EA-APPL - package level (6) too low (integrated package level 6).
                  FINBASIS - package level (6) too low (integrated package level 6).
                  ERECRUIT - package level (6) too low (integrated package level 6).
                  SEM-BW - package level (6) too low (integrated package level 6).
                  LSOFE - package level (6) too low (integrated package level 6).
                - "continue"
                - "cancel"
    Enter one of these options [continue] :=
    Thank's.

    Yes - you have to download them and put them into the directory-  that´s the purpose of this phase
    Markus

  • Error  in document number while posting the material

    Dear experts
    while posting the stock  MB1C  for the material  the error  is  " incorrect doc number $  1 .select doc number between   800000100  and 800000199.
    how to  correct  this  error. where  to check this  number ranges  of  document.
    Thanks  &  Regards.
    Erfan.

    Hi
    The document type, which is integrated for Material related posting is appears to be configured as "External Document Number Ranges".  In the event of external number ranges, MM transaction tries to post same document number individually at MM system and propose same number in FI for Accounting Posting.  If the proposed number is not within document number ranges, then you would expect this kind of errors.
    What you need to do is:
    1.  See the document type, which is being posted and set correct number ranges as per MM transaction document type number ranges  or
    2.  change MM transaction number rages in order to FI document number rages
    Hope this helps

Maybe you are looking for

  • Creation of Workflow related to Invoice Posting

    Hello,   I need to create a Workflow which gets triggered whenever an Invoice is posted and should be sending a mail to a specific agent two days before the clearing date, intimating him that the clearing date is nearing.   I have used the Event Inco

  • Safari won't open more than one page at a time

    I only got a new ipad 2 about a week ago. My safari is working perfectly but when I go to open a new tab it freezes and exits the safari. I have tried rebooting it and my iPad is fully up to date. I need help because I can't find any answer to my pro

  • Display a PDF in a web architecture

    All interested Flex developers, I was asked to post this entire issue to Flex forum. Flash Web applications cannot directly display PDF images (unlike PNG, JPEG, GIF images). Our network architecture is: user browser <---- Flex web app <---- SOAP/WSD

  • JMS_TRANSMISSION_ERROR

    Dear Experts, I have a specific error in the Receiver JMS channel. It is a IDOC - JMS channel scenario. 6 IDOCs have been sent from SAP R/3 to XI, 3 were successfully sent by the JMS channel to MQ. But the rest 3 are stuck up. I have resent the first

  • Xcode IOS Simulator Error

    I'm currently using Xcode 3.2.6 on Snow Leoperd. I downloaded everything sucessfully, and it worked great for a couple of hours. Than all of a sudden I try to test a iPhone application in IOS Simulator, (I hit "build and run") and in Xcode I get a me