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.

Similar Messages

  • Not able to put reason for rejection at sales order level.

    Hi Gurus,
    I have an issue where I am not able to put reason for rejection for line item in sales order. It gives error as please delete the follow on document purchase order line item number 10. I have already deleted the line item in purchase order. Then tried but did not work. Tried by deleting the purchase requision item also but it did not work.
    Tried to undelete the item from PO and then again tried to put reason for rejection but it could no worked out. 
    Please guide me what can be the solution.
    Regards
    Vinod

    As far a I understand you created PO for line item
    So first check whether GR is reversed or not for PO
    Then mark this line item for deletion in PO and then in PR
    Check if you have created any billing document for PO if so reversed that invoice
    Also check if you have created any delivery for the Line item in sales order if yes then reversed the same
    If you have Sales order related Billing, and if you have done billing reverse the same
    If you have Delivery related Billing, and if you have done billing reverse the same
    After reversing all docuemnts created for Sales order then only try to reject the line item
    You can check table VBFA for document flow

  • Reason for rejection at line itme question - ?

    Hi
    how the line item will pick reason for rejection automatically in the order -?
    Normally reason for rejection will enter manually  for line items -?
    In my scenario when i create a order I am seeing reason for rejection at line item. what could be the reason? where I can check -?
    Please help me.
    Thanks
    Greg

    Hi Vas
    You said with the help of BDC -?
    what could be the bussiness reason -?
    can you help me to understnad the scenario with the example -?
    Please.
    Thanks
    Greg

  • Unable to put  Reason for Rejection for Return Sales Order

    Hi
    I am unable to put  Reason for Rejection for Return Sales Order.
    what may be the reason?
    Reg,
    Antaa21

    hi
    One of the possible reson could be, there is subsequent document created. Please check the VBFA table for document flow and see if there is any other document created for this line item, if yes then you have to reverse the same
    Check whether this field is maintained as DISPLAY only or not
    T-Code SE51(Screen Painter)
    Give Program Name SAPMV45A
    (before doing this confirm from the field from sales order, keep curcer on the pricing date press F1
    and then select technical details)
    Screen Number 4441
    (before doing this confirm from the field from sales order, keep curcer on the pricing date press F1
    and then select technical details)
    Select Attributes radio button.
    Go to Element list Tab. Inturn select Special Attribute tab in Subscreen.
    For Field Name "VBAP-ABGRU" Check what is maintained might be it is maintained as DISPLAY only.

  • How to place a delivery block at line item level from Inbound ORDERS IDoc?

    Hi EDI/ABAP Experts,
    Can anyone please tell me how to place a delivery block at line item level from Inbound ORDERS IDoc?
    I tried using exit "EXIT_SAPLVEDA_001'. But there is no LIFSP field in either of XVBEP and YVBEP structures.
    Can you guys throw some light. How to place a delivery block @ line item level on sales order from Inbound ORDERS IDoc.
    Thanks,
    Matt .

    Look into the Include: LVEDAF5A that is the only place where this exit is hit... double click on the Structures and look which structure has billling block field.. and use that..
    FORM CUSTOMER_FUNCTION_IDOC USING IDOC_DATA.
      CALL CUSTOMER-FUNCTION '001'
        EXPORTING SEGMENT = IDOC_DATA
                  DVTCOMAG = VTCOMAG
                  DXMESCOD = IDOC_CONTRL-MESCOD
                  CONTRL   = IDOC_CONTRL
        TABLES    DXBDCDATA = BDCDATA
                  DXVBAP    = XVBAP
                  DXVBEP    = XVBEP
                  DYVBEP    = YVBEP
                  DXVBADR   = XVBADR
                  DYVBADR   = YVBADR
                  DXVBPA    = XVBPA
                  DXVBUV    = XVBUV
                  DD_FLAG_P = D_FLAG_P
                  DXKOMV    = XKOMV
                  DXVEKP    = XVEKP
                  DYVEKP    = YVEKP
        CHANGING  DXVBAK   = XVBAK
                  DD_FLAG_K = D_FLAG_K
        EXCEPTIONS
                  USER_ERROR = 01.
    If you are in ECC6.0  you can also use Enhancement point : INTERPRET_IDOC_ORDERS_01 SPOTS ES_SAPLVEDA. in include: LVEDAF2U

  • How to control Payment Block field at line item level

    Hi Experts,
    Could anyone please let me know how to control payment block and payment method fields at line item level.
    I have checked field status at posting key (OB41) and GL (OB14) level but didn’t get any parameter to control these fields.
    I need your expert guidance.
    Regards,
    Mohammed Kalim

    Hi Mohammed,
    Please go to OB24/
    Select * (for all co.codes) default field status.Or Create new entry and input your co.code, Save it. Come back to co.code.
    Go to payment transaction
    Payment block and payment method display can be controlled from here for vendor master data
    Thanks and good luck.
    Regards,
    Sam

  • Reason for deleted PO line item

    Hi Gurus, I have several PO line items appear deleted and thrown back to Open Purchase Req list. Buyers did not deleted those PO items. They were fully received and backflushed. What might be the reason that they should reappear in PR list?
    Thanks a lot for your help.
    AG

    Hi,
    As Jurgen suggests go to ME23N=>Environment=>Header changes or (select the line item) Item Changes and you can find the history of changes.
    Regards,
    BK

  • FI New GL for FI at line item level in BW

    Hello,
    I would like to obtain New FI GL on a line item document level in BW. ( Document number+Line Item number )
    Business Content Datasource 0FI_GL_10 is based on a total table in FI New GL that does not fit our requirement.
    Does anybody have any other solution in mind apart from creating a generic Datasource?
    Thanks for your answers

    Hi dear and welcome on board!
    I don't think you can use 0FI_GL_4 for NEW FI GL...
    http://help.sap.com/saphelp_nw04/helpdata/en/be/928f40f5767d17e10000000a1550b0/content.htm
    Surely you have to do some (heavy) enhancement to 0FI_GL_10 in order to transform a TOTAL extractor to an ITEM extractor and anyway, there is only the TOTAL std way available for any ledger..
    http://help.sap.com/saphelp_nw04/helpdata/en/be/928f40f5767d17e10000000a1550b0/content.htm
    I think you need to build your own datasource (it's easier!)
    Hope it helps!
    Bye,
    Roberto
    ...please don't forget to reward the answers...it's THE way to say thanks here !

  • How to implement reason for rejection step

    Hi Friends,
    I want to create a sales order approval and rejection steps using workflow. For this I have created User Decision Step where I have included approval and rejection decisions. When approver presses approve or rejection button, immediately he should get an option to enter the comments and after saving the same these comments should go as a mail to the initiators inbox. How to achieve this.
    Regards,
    Steve

    hi steve
    For getting iniatiator dynamically you have to code. It will not do automatically. For getting automatically you have to code to achieve that. Maintain a container get all the elements filled in the container. Use this container in the expression of the task. So that it will go to the iniatiator or to the next approver.
    As for my view y do u want to get the initiator automatically. For one instance of workflow there will be only one initiator. So in the expression you can choose workflow initator. That is my option. Or go ahead with your logic as per your scenerio.
    Regards
    vijay

  • How to put some tabs in sales order item level  invisible mode

    Hello Gurus ,
    Good evening everybody ,
    We have some specific requirement from the client - Client does n't want few  end users to see the price details in sales so they want  the condition tab to be  invisible mode in sales order item lvel only for few users  i.e the condition tab  should not be displayed  for that user  is this possible  ?
    Note : I only have idea setting few fields in  sales order  but not tabs in sales order through screen variant -SHD0
    Looking for your inputs
    Thanks and regards
    Venkat

    Hi,
    There are a couple of options you can go with.
    1) You can use Transaction and Screen variants to create your own ZVariant and then put that to user profile.  Allow the user to run only with the variant you setup for the user via authorizations.
    2) Get GUIXT software by Synactive, to perform the above task for you. 
    3) If you happen to have latest version of SAP ECC i.e. 6.0 with EHP3 or above, you can go with NWBC (Netweaver Business Client).
    Thanks
    Kapil Sharma

  • 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 

  • Problem in adding "Reason for Rejection" using BAPI_SALESORDER_CHANGE

    Hi all,
           I have a requirement to stop further processing of sales order by changing the reason for rejection at line item. I have done the code and passed the reason code in the item table to BAPI. The return message says the sales order ammended successsfully, but when i go and see the sales order I dont see it getting updated. when i go to check the order its throwing an error message "Update was terminated"  Could some one please help in getting this solved.
    The code is shown below
    Populate the headerX details
    it_bapisdh1x-updateflag  = 'U'.
    it_bapisdh1x-sales_org   = 'X'.
    it_bapisdh1x-distr_chan  = 'X'.
    it_bapisdh1x-division    = 'X'.
    it_bapisdh1x-purch_no_c  = 'X'.
    it_bapisdh1x-cust_group  = 'X'.
    Populate the header details
    it_bapisdh1-sales_org    = '1298'.
    it_bapisdh1-distr_chan   = '95'.
    it_bapisdh1-division     = '00'.
    it_bapisdh1-purch_no_c   = 'Test1'.
    Partner Roles
    it_bapiparnr-partn_role = 'AG'.
    it_bapiparnr-partn_numb = '9820000049'.
    it_bapiparnr-itm_number = '00000'.
    APPEND it_bapiparnr.
    it_bapiparnr-partn_role = 'WE'.
    it_bapiparnr-partn_numb = '9820000049'.
    it_bapiparnr-itm_number = '000000'.
    APPEND it_bapiparnr.
    it_bapisditmx-itm_number = '00010'.
    it_bapisditmx-updateflag = 'U'.
    it_bapisditmx-material   = 'X'.
    it_bapisditmx-cust_group = 'X'.
    it_bapisditmx-reason_rej = 'X'.
    APPEND it_bapisditmx.
    it_bapisditm-itm_number = '00010'.
    it_bapisditm-material   = 'YAG'.
    it_bapisditm-reason_rej = '01'.
    APPEND it_bapisditm.
    BREAK-POINT.
    salesd = '4000004045'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      salesdocument = salesd
      order_header_in = it_bapisdh1
      order_header_inx = it_bapisdh1x
      behave_when_error = ' '
      int_number_assignment = ' '
    TABLES
      order_item_in = it_bapisditm
      order_item_inx = it_bapisditmx
      partners = it_bapiparnr
      return = it_bapiret2.
    IF sy-subrc = 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    endif.

    When using BAPI_SALESORDER_CHANGE, you set the fields your are updating to 'X'.  In the example you gave, you are trying to change the header data, material number, etc.
    Try slimming it down to:
    Populate the headerX details
    it_bapisdh1x-updateflag = 'U'.
    it_bapisditmx-itm_number = '00010'.
    it_bapisditmx-updateflag = 'U'.
    it_bapisditmx-reason_rej = 'X'.
    APPEND it_bapisditmx.
    it_bapisditm-itm_number = '00010'.
    it_bapisditm-reason_rej = '01'.
    APPEND it_bapisditm.
    BREAK-POINT.
    salesd = '4000004045'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = salesd
    order_header_in = it_bapisdh1
    order_header_inx = it_bapisdh1x
    behave_when_error = ' '
    int_number_assignment = ' '
    TABLES
    order_item_in = it_bapisditm
    order_item_inx = it_bapisditmx
    return = it_bapiret2.
    IF sy-subrc = 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    endif.
    I hope this helps,
    Mark

  • Mass change with Reason for Rejection.

    Dear Gurus,
    Pl tell me the process to close all the open orders at one go. I have tried with the t.code MASS, but I was unable to do that.
    Pl give the step by step process.
    Regds,
    Sreehari

    Hari,
    MASS transaction is useful, If you know what fields to change  and in what documents/customers/vendors/.
    In your case what fields is pretty clear (VBAP-ABGRU  or MASSVBAP-ABGRU )
    But what documents is not clear.
    Points to consider.
         You can the documents that are open by just writing some query or even you can get it from SE16 using VBAP table
            and you can use these document numbers and enter in the MASS T.Code.
    It looks simple but the main hurdle is not all of the items in these orders are open, right...so you can't enter the reason for rejection in an item which was already delivered, or scheduled to deliver.
    So  Unless you know that all the items of an order are open, its not feasible to use MASS T.code.
             So my suggestion is to write an ABAP program that check whether the item in an order is open or not and then change the reason for rejection using BDC code.
                    Thats my suggestion. I hope you understood the reason for going to an ABAP program.
    Regards,
    Ajai.
    Reward points if helpful.

  • How to maintain Status at the line item level

    Hi Folks,
    How to maintain the status at the line item level. I could able to find the path in the IMG for Header level. I will be looking forward for the path or the procedure for maintaining the status at the Line item level. Do the needful. Thank you.
    Regards,
    Amrita

    Hi Amrita,
    Goto SPRO>Customer Relationship Management>Transactions>Basic Settings>Define Item Categories, Select your Item category and click on Details. Witin profiles set type Assign Status profile you created against field Status profile.
    Hope this helps.
    Regards,
    Chandrakant

  • Report at line item level but also for document total for once only

    Dear all,
    seek for your help for the following issue
    There is a A/R invoice with 3 items
    There is a report for retrieving the line item level data from inv1, user would also like to add a column to display the Document total , but the problem is, each line item will also display the Document total, any method to only display the corresponding Document total for once only?
    Example, for AR invoice number 1234567:
    Currently:
    No.                ItemCode        Price      Qty    LineItemTotal      DocumentTotal
    1234567       Item-A            10           1       10                       100
    1234567       Item-B             50          1       50                       100
    1234567       Item-B             20          2       40                       100
    Requested to be presented as:
    No.                ItemCode        Price      Qty    LineItemTotal      DocumentTotal
    1234567       Item-A            10           1       10                       100
    1234567       Item-B             50          1       50                      
    1234567       Item-B             20          2       40                      
    Thank you very much!!!

    Hi,
    Try This.....
    select T0.DocNum ,T1.ItemCode ,T1.Price ,T1.Quantity ,T1.LineNum ,case  when T1.LineNum ='0' then T0.DocTotal else 0 end    from oinv T0 inner join INV1 T1 on T0.DocEntry =T1.DocEntry where T0.DocNum=[%0]
    Thanks
    Shafi
    Edited by: shafi_sunshine on Oct 19, 2011 12:50 PM

Maybe you are looking for