STATUS_READ & line item rejection reason - too complex

Hi All,
  I have to trigger an output to a smartform via an output routine. I have to do the following checks in my output routine before I decide to propose the output or decline to propose the output if conditions fail.
1. Order header can have status PEND, Hold, Release. IF the status has changed to anything else except pending, i should propose output.
2. Again if a line item is rejected with certain reason code, then also I have to propose the output.
  Both the above conditions must be checked before proposing the output. My issue is how do I know what was the old value of status and rejection reason.
I tried using FM STATUS_READ, but it does not give something like this was the old value and this is the new value. I do not find any FM to get item rejection reason. Do I have to use change documents for these.
examples
a)Order with 2 Framing Configurable Line Items.  The user status of the order is changed from PEND to QAHD.  The standard order output label is proposed for both line items on the order.  At a later time, one of the line items is rejected for reason 90 (for example).  At that time a new label is created, just for that specific line item – with the rejected artwork text on the label. 
  In this case if I use STATUS_READ, i will get active status as QAHD, so I will try to propose normal output so I am fine. Later when the item is rejected, I will again get staus as QAHD and I will propose output for one unrejected item which is WRONG. I had already proposed the output in past, so I should not. I should only propose output for the rejected item.
b)Order with 2 Framing Configurable Line Items.  The user status of the order is still in a PEND status.  The user changes one of the line items to a rejected for reason 91 (for example).  A label is printed just for that line item with the rejected artwork text on the label.  At a later time, the user status on the order is changed from PEND to QARD.  A label will print, only for the unrejected line item and the label is the standard order output label for HJ.
  In this case I do not know where to get the old rejection reason of item. If I do a database select, I will get current rejection reason 91, but how do I know if I had already proposed the output or not for a certain item.
c)Another scenario to think about is that there is nothing preventing the user from setting a rejection status on an item and changing the user status at the same time and saving it.  In that case we would want only one label per piece (the rejected label for the rejected item and the standard label for the non-rejected item).
  I think I have to check the time order was updated and do something like that.
All inputs are welcomed.
Thanks
Pulin

Write the code like
  concatenate 'OR' int_orders-aufnr into d_objnr.
    call function 'STATUS_READ'
         EXPORTING
              client          = sy-mandt
              objnr           = d_objnr
         TABLES
              status          = t_status
         EXCEPTIONS
              object_not_found.
Read table t_status with key stat = 'I0076'.
if sy-subrc eq 0.
do not print output.
endif.
Thanks
Seshu

Similar Messages

  • Short dump while marking Sales order Line item for Reason for rejection

    Hi All,
    Need your help in the following regards.
    In system Client is creating a sales order with 100+ line items and for each line item a project gets created automatically at the background as it is a make to order senario. Now what is happening is customer suddenly call's and tells to stop few line items tempororily till he gives go-ahead, so our client is marking it for reason for rejection, while doing this the network created for a project is getting deleted. Once we receive conformation for that line item agin to proceed we are removing the reason for rejection and it was suppose to create a new network, but system is taking huge time to do this and going for a shout dump saying time-out error, in few cases it is creating the network.
    Need your valuable inputs how we can address this issue to avoid the short dump. We have increased the buffer time to 30min also.
    Thanks
    regards
    kishore

    Hi,
    You can easily list out sales order that have been assigned reason for rejection..simple extract of table VBAP-ABGRU = not blank.
    This report should list out the sales order number along with some more details, as required.
    Now the report should allow to choose the documents i.e. like giving checkboxes in the left most side and once the user chooses the sales documents he wants to get processed--> the program should call change Sales Order FM or BAPI. Execute this in background.
    Regards,
    Raghu.

  • Delivery of Contract Quantity after Order Line Item Rejection

    Hi,
    We have following scenario:
    The Sales Order (100 units) is created with reference to Contract (500 units) and then partially delivered (95 units).
    As the small residual of 5 units is remaining so we have put reson for rejection for line item.
    When we try to create new Order with reference to Contract then system is considering the 500 units again. Actually as per contract, system should consider 405 units (500 in contract - 95 already delivered)
    Also if we will not reject the line item then 5 units will not be considered for delivery.
    We would like to design the solution wherein we can deliver all 500 units.
    Thanks in advance.
    Regards,
    Sameer

    Hi Sameer ,
    The described case is part of standard behavior. Look below the exaplanation:
    The open quantity of a contract is calculated only from the ordered   
    quantity. It does not consider the delivered quantity.                                                                               
    When you set the reason for rejection, it means that this order is not 
    related to the contract. So the copied quantity is set to zero.        
    If you wish that the relation to the contract remains,                 
    you should reduce the order quantity to the delivered quantity.                                                                               
    So if you create a sales order with reference to a contract and you    
    enter a reason for rejection in the sales order we reopen the quantity 
    in the contract. We suppose that the customer wants to get these       
    quantities at a later time.                                                                               
    In both cases, our suggestion is the following:                        
    instead of rejecting the sales order item or set delivery tolerance,   
    you should decrease order quantity directly,                           
    so that delivery quantity= sales order item quantity.    
    I hope it clarifies the situation.
    regards
    Ruy Castro

  • Purchase requisition line item reject

    I need to reject the requisition line item programatically.
    Can any body suggest BAPI or Fun mod for it.
    Please suggest me the solution.

    you have posted correct question in wrong forum. Post is in ABAP forum

  • User Exit during Sales Order Creation - New Line Item needed

    I have a situation during the process of sales order creation. If a Material in a line item has say 27 EA and the Base Unit is EA. But the Sales Unit is CSE. Then whenever the user enters 27 EA and presses enter he should get two line items.
    The first line item needs to convert to maximum number of CSE posible and the rest will be the second line item with the remaining EA. The order isn't important but that is what is needed. Question is how do I approach this problem and code my user exit accordingly and where do I code it.
    I was looking at SAPMV45A and saw the program MV45AIZZ which is meant as a user exit for any PAI event handling. If anybody has encountered this kind of requirement can you please share your view on this.
    I will definitely reward points for useful answers.
    Clark

    Hello Mahendra
    The requirement is as follows :
    PART 1:
    Sales Order Enter: 
    1.     When a line item is entered on a sales order (VA01 or VA02), at enter, check the sales unit of measure (VBAP-VRKME).
    •     Do not check line items where item category (VBAP-PSTYV) = TANN, TAPS or ZTAP.  TANN are free goods that should not be considered for consolidation.  TAPS & ZTAP are lower level materials as a result of product selection.  They will be attached to a higher-level material with an item category of TAX, which is relevant for consolidation.
    •     Do not check items where VRKME <> EA
    2.     If VRKME = EA, go to MARM for MATNR.
    3.     Go to record where alternate unit of measure (MEINH) = CSE, get the value from the numerator field (UMREZ).
    4.     Divide the order quantity (VBEP-WMENG) by UMREZ.
    5.     If the result is greater than 1.0, the customer has ordered more than one case and a new line item needs to be added to the sales order for the case quantity.
    6.     Add a new line to VBAP for the same material with the case quantity.  If not a whole value, the remainder of eaches (bottles) should update the qty on the first item on VBAP.
    •     Part 1 is relevant for order types ZCA, ZOR, ZSO, RE, ZSM
    PART 2:
    Batch Job to run prior to the Delivery Due List:
    1.     Read VBUK for Delivery Status (LFSTK) = A (delivery not processed).  Get all of the document numbers (VBELN).
    2.     Go to VBEP for those document numbers to get the goods issue date for the order.  There will be many records in VBEP for the same sales order.  Look at all orders with a goods issue date (WADAT) of next day.
    3.     Go to VBAK for those document numbers to see if there are multiple sales orders for the same Sold To party (KUNNR).
    4.     For customers who have more than one order in VBAK, search all line items (for all orders).  If there are no duplicate materials across sales orders, do nothing.
    •     Do not check line items where item category (VBAP-PSTYV) = TANN, TAPS or ZTAP.  TANN are free goods that should not be considered for consolidation.  TAPS & ZTAP are lower level materials as a result of product selection.  They will be attached to a higher-level material with an item category of TAX, which is relevant for consolidation.
    •     Do not check line items where reason for rejection (VBAP-ABGRU) is not blank
    5.     If there are duplicate materials, go through the same logic as in part 1.  If the quantity across the sales orders adds up to greater than one case, add the appropriate quantity to a new line item on the first sales order.   If there is a remainder qty, update the line item on the first sales order with this qty. In this case, the quantities on the second sales order needs to be closed out with a reason for rejection code of 50, ‘Line Item Consolidation’. If there is no remainder,  update the qty on this item directly.
    •     Part 2 is relevant for order types ZOR, ZCA, ZSM
    •     This batch job will have to be run manually for Day Pick orders.  The end of this program should automatically kick off the delivery due list for Day Pick orders, shipping condition 02.
    Business Justification:
    The business requires that like order line items be consolidated to one line item prior to the order going to the warehouse for picking.  This will aid in picking at the warehouse as well as result in the customer invoice not reflecting more than one line item for the same material.  In the case where the customer has truly ordered more than a case, i.e;, 1 case, 2 bottles, the documents in SAP will still reflect 2 lines.

  • Line item PO should disply in the report

    Hi,
    As per the business requriement i need to display the line item PO discritpion into the  report.
    Currently we have one existing Z report and we are developing new Z reprot by copying that exisitng report by adding the line field.
    The PO number field is same for both header and line item ( the reason could be since header PO number header data which is copied to all the line items). the field name for both is VBKD-BSTKD
    Sales order:
    we have developed one new Z report as per the above requirement, below is the output of it. it is showing both line items are HEADER PO only. But our requriement it should display the 2nd line item as ITEM PO1 which was manually changed by the user in sales order.
    So what is the field and table i should give to the ABAP er so that it would display the line item PO details of Sales order into the report.
    Please let me know if you need any further details?
    thanks,

    Hi Lakshmipathi Sir,
    Thanks for your reply. Could you please let me know how exactly i need to mention the logic to ABAPer.
    I can see two fields are giving from VBKD table with line item wise it is displaying.
    1. BSTKD
    2. BSTKD_M
    thanks,

  • Reason for rejection for sale order stock existing line item

    Hi,
        I am giving reason for rejection for a line item where there is already sale order stock. Then I am getting a warning message like " there is sale order stock assigned". I want this message to be as error message. Any customisation (SPRO) is there for this?
    Kindly update.
    Ratna

    Dear Rama Rao
    I think, there is no problem you can ignore the warning message and go ahead give reason of rejection and close the order
    There wont be any problem absolutely
    The reason  of warning message is, (it is sales order created with item category with special stock indicator as E )  that means the system tells you that it is extra special stock which you have created and now you are trying to reject hence it alerts you by giving a warning  message
    The item category of the items which you are trying to reject  is marked  or should have been marked with special stock indicator (you can check that in VOV7)
    By double clicking warning message if it is of V4 message class in t code OVAH you can make that as no message
    But i doubt that this is available in OVAH
    Regards
    Raja

  • How can I disable the Reason for Rejection field in VA02 line items

    Hi,
      I dont want the users to be able to change the reason for rejection field in the sales order line items. Can someone please suggest a tried and tested way of doing this
    Thanks for reading.

    Set up an auth object for the field.  In userexit field modification check the auth object and set the field to be grayed out if they don't have authority.  Users can then not change the value of the field  Sample code
    IF screen-name = 'VBAP-ABGRU'.
           AUTHORITY-CHECK OBJECT 'Z_BLK_REAS'
                   ID 'ABGRU' DUMMY.
          IF sy-subrc EQ 0.
            screen-input = 1.
          ELSE.
            screen-input = 0.
          ENDIF.
      ENDIF.

  • Reason for rejection For open line items

    Hi Experts ..
    I Have checked in Google and in scn But Not able to find exact one
    How to achieve This Issue
    Created sales order line item ---150 qnty Now delivered---100 qnty PGI As well as
    Now Clint wants to give reason For rejection For 50 qnty
    Now Generally what we are doing is Just changing the qnty in sales order change mode VA02 --100
    But some times they have so many open line items are there and not possible to change in all line items exact number
    So now i trying to give reason for rejection Line item For full 150 qnty Because Automatically 50 qnty Will be reduced in MD04
    But when i am Giving reason For rejection To line item system is giving error msg that subsequent document is being processed
    So any Enhancement shall we do To skip this 
      Thank a lot

    Dear T.W Sir Thanks a lot For your replay
    But I can not see that the excess qty (not delivered) is being deducted from MRP, when Reason for Rejection is set.
    Sir we can see ...May be it will take 5 mnts time To be updated ( MD04)
    By the By , sir you have any idea To control This pop-up Message ( In your case it may be information msg But some times We are getting Error Msg )
    so Where we can control Warning to Error like this
    or it is related to enhancement issue 

  • Reason for Rejection for blocking line item for delivery

    Hi All,
    I am working on this project where based on earlier configuration, by selection reason for rejection, delivery for line item is getting blocked.
    I want to change this settings because reason for rejection should not be controlling the blockage it should be merely be the reason. Delivery should be blocked if it is blocked by selecting delivery block field in schedule line for the line item.
    How can I change the settings for the reason for rejection?

    Dear ankit.k.agarwal      
    If you assign a reason for rejection system will block the particular sales order and that sales order shouldn't be used any longer.
    This is the standard SAP behavior and the program was written like that.
    Still if you want to do , you have to go for an enhancement to change the standard program(It is not suggestible)
    In stead you add a new field in sales order(field exit)  and convince your key/core users to maintain the reason for rejection in that field .
    Co ordinate with your technical team
    Thanks&Regards
    Raghu.k

  • Change the  sales order reason for rejection for line item

    Hi,
    i want to change the  sales order reason for rejection for line item.
    iam using bapi_salesorder_change.but i unable to change the sales order.
    if possible please provide me what are the fields necessary  for changing
    sales order reason for rejection for line item.
    Regards,
    Suresh

    This is the standard config to supress printing on the rejected item. Are you using standard programs or customised ?

  • How to put Reason for  rejection to line item level?

    Hi
    I am updating the Sales order at line item and putting the reason for rejection but it didnt updates the database. Below is the code.
          LOOP AT LT_VBUP1 INTO WA_VBUP1.
             ON CHANGE OF  WA_VBUP1-VBELN.
              CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
                EXPORTING
                  SALESDOCUMENT    = WA_VBUP1-VBELN
                  ORDER_HEADER_INX = LV_ORDER_HEADER_INX
                TABLES
                  RETURN           = IT_RETURN
                  ORDER_ITEM_IN    = IT_ORDER_ITEM_IN
                  ORDER_ITEM_INX   = IT_ORDER_ITEM_INX.
              CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                EXPORTING
                  WAIT = 'X'.
              CLEAR WA_TY_SOCLOSE.
              IF SY-SUBRC EQ 0.
                LT_TY_SOCLOSE-VBELN = LV_SALESDOCUMENT.
                LT_TY_SOCLOSE-STCLOSE = 'Y'.
              ELSE.
                LT_TY_SOCLOSE-VBELN = LV_SALESDOCUMENT.
                LT_TY_SOCLOSE-STCLOSE = 'N'.
              ENDIF.
              APPEND  LT_TY_SOCLOSE.
            ENDON.
            CLEAR: WA_ORDER_ITEM_IN,WA_ORDER_ITEM_INX.
            WA_ORDER_ITEM_IN-ITM_NUMBER =  WA_VBUP1-POSNR.
            WA_ORDER_ITEM_IN-REASON_REJ = 'Y1'. " Putting order of rejection for the archiving
            WA_ORDER_ITEM_INX-ITM_NUMBER = WA_VBUP1-POSNR.
            WA_ORDER_ITEM_INX-UPDATEFLAG = 'U'.
            WA_ORDER_ITEM_INX-REASON_REJ = 'X'.
            APPEND WA_ORDER_ITEM_IN TO IT_ORDER_ITEM_IN.
            APPEND WA_ORDER_ITEM_INX TO IT_ORDER_ITEM_INX.
            CLEAR WA_VBUP1.
          ENDLOOP.
    Correct me where I am putting wrong.
    Regards
    Mohinder

    LOOP AT LT_VBUP1 INTO WA_VBUP1.
    ON CHANGE OF WA_VBUP1-VBELN.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    SALESDOCUMENT = WA_VBUP1-VBELN
    ORDER_HEADER_INX = LV_ORDER_HEADER_INX
    TABLES
    RETURN = IT_RETURN
    ORDER_ITEM_IN = IT_ORDER_ITEM_IN
    ORDER_ITEM_INX = IT_ORDER_ITEM_INX.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'.
    CLEAR WA_TY_SOCLOSE.
    IF SY-SUBRC EQ 0.
    LT_TY_SOCLOSE-VBELN = LV_SALESDOCUMENT.
    LT_TY_SOCLOSE-STCLOSE = 'Y'.
    ELSE.
    LT_TY_SOCLOSE-VBELN = LV_SALESDOCUMENT.
    LT_TY_SOCLOSE-STCLOSE = 'N'.
    ENDIF.
    APPEND LT_TY_SOCLOSE.
    ENDON.
    CLEAR: WA_ORDER_ITEM_IN,WA_ORDER_ITEM_INX.
    WA_ORDER_ITEM_IN-ITM_NUMBER = WA_VBUP1-POSNR.
    WA_ORDER_ITEM_IN-REASON_REJ = 'Y1'. " Putting order of rejection for the archiving
    WA_ORDER_ITEM_INX-ITM_NUMBER = WA_VBUP1-POSNR.
    WA_ORDER_ITEM_INX-UPDATEFLAG = 'U'.
    WA_ORDER_ITEM_INX-REASON_REJ = 'X'.
    APPEND WA_ORDER_ITEM_IN TO IT_ORDER_ITEM_IN.
    APPEND WA_ORDER_ITEM_INX TO IT_ORDER_ITEM_INX.
    ***********************************************************************<<<<do this bit here
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    SALESDOCUMENT = WA_VBUP1-VBELN
    ORDER_HEADER_INX = LV_ORDER_HEADER_INX
    TABLES
    RETURN = IT_RETURN
    ORDER_ITEM_IN = IT_ORDER_ITEM_IN
    ORDER_ITEM_INX = IT_ORDER_ITEM_INX.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'.
    CLEAR WA_VBUP1.
    ENDLOOP.

  • Reject reason schedule line not updated item level

    Hi,
    Say a particular sales order line item has 3 schedule lines all of which had been rejected through reason '00',
    Just a clarification as to why the line item doesnt get rejected with a reject reason if all the schedule lines in tht line item is rejected.
    Thanks
    Keshi

    Dear Keshi,
            When there is reason for rejection set for all schedule line then what is the need of getting at item level.
    Reason for rejection at Scheduleline level is more specific than at item level,
    I hope it will help you
    Regards,
    Murali.

  • Open status of Credit Memo after rejecting all line items

    Dear Gurus
    I am facing a problem. In my company we are using 2 credit memo types. One is CR and other ZCR (Copy of CR). I have tried both but both have same problem. I have also tried creating credit memos with reference to billing document, sales document and without reference also but the issue is same.
    Problem is this we create credit memo with VA01 and post it with VF01. After posting if we cancel its posting with VF11 and reject the line items in VA02 the status of credit memo remain open. Cancellation documents are ok and completed but only credit memo in VA02 remain open even after rejecting all line items.
    I have checked incomplete log of sales document type (CR and ZCR) in VOV8 and item types (G2N) in VOV7. All fields which are defined in incompletion log are there in document header and item.
    Following is the copy paste data of Header Status tab
    Overall status       Open
    Rejection status     Everything rejected
    Credit status        Not performed
    Bill.stat.order-rel. Not invoiced
    Overall blkd status  Not blocked
    Header data     Complete                   Item data       All items complete
    Header dlv.data Complete                 Item deliv.data All items complete
    Header bill.dat Complete                   Item bill.data  All items complete
    please help.

    dear sir
    if you mean to say to check Reason for rejection's settings in OVAG i have checked it and all rejection reasons are being in use in all other sales documents too. They are working fine in all other sales document. Issue is only in these two credit memos types.
    Assigned by the System (Internal)
    Delivery date too late
    Poor quality
    Too expensive
    Competitor better
    Guarantee
    Unreasonable request
    Cust.to receive replacement
    Transaction is being checked
    These are reasons and Stat column is empty for all. Other 3 columns have no tick in any reason.

  • Line Items are getting rejected in Sales Orders

    Hi,
    I am creating sales orders using ORDERS Message type and for this I am using the Standard SAP Inbound Function Module to create sales orders.
    Idocs are getting processed successfully and sales orders are getting created, but line items in the sales order are getting rejected and hey are getting rejected with reason for rejection to be <b> No Availability Lost</b>.
    So, I would like to know if this is a problem with the data furnished in the Idoc or else any custom setting have to be maintained or not?
    Raghuram

    The reason why they are failing is because in the user exit as per the logic present here whenever a EDI Order with customer Purchaser Order Type DFUE is to be processed ABGRU (Reason for Rejection) has been flagged equal to 01 and hence order item lines are having rejection reason.

Maybe you are looking for

  • PHP and Oracle Workflow

    Hi everyone, Is it possible to use PHP and Oracle Workflow together? I means use PHP to generate user-interface and PHP-OCI8 API to call WFEngine PL/SQL code?

  • Where in se11 to make changes to mclips

    hi, i would like to know in which part of mclips in se11 do i need to change so that i can see the fields on the right frame when i go to maintenance screen of lo cockpit. is there some step that needs to be done between enhanceing the comm structure

  • Java input xml data and xsl template -output file excel

    i need help or same special link on web. i must develop code or use a special tool that make this. INPUT: xml that contain real data xsl that explain a report template OUTPUT: file excel that show the template xsl with xml data source thank for help

  • Mount points needed for oel 6.3 64bit for oracle 11.2.0.3 rac

    Friends, i have already installed oel 5.7 and 11.2.0.3 rac in 2 node db and 1node dns and it was working fine suddenly it was not working when one node is up the other node is not booting. i tried a lot after that i deleted everything... Now I am pla

  • Wierd Error in Web Service Model

    Hi, I tried accessing a web service on net. I downloaded the WSDL file and imported the model into my Webdynpro Application. Next i wrote the reqd code and finally did execute(). I am getting the foll exception:      Service call exception; nested ex