ME21N-ME51N - change value of field at item level

Hello All,
We create a purchase requisition from a sales order and after a purchase order in reference to the purchase requisition.
We would like to have the sales order number in the EBAN-BSTNR and/or in EKPO-BEDNR.
We found some user-exits but it seems that we can't change value of standard fields with these.
Could someone help us to find a solution ?
May be with a BADI ?
Thanks
Véronique

The code below should work for you, as for explanation why it will work look at SAP note 178328 over some coffee! )
I gave some explanation below the code but the SAP note explains it in more detail
DATA: ls_yvbap LIKE yvbap.
* Sales doc is in creation mode
IF t180-trtyp = charh.
  LOOP AT xvbap.
    xvbap-spart = cobl-spart.
    MODIFY xvbap.
  ENDLOOP.
ENDIF.
* Sales doc is in change mode
IF t180-trtyp = charv.
  LOOP AT xvbap.
*   Append Y-table and set update flag if necessary
    IF xvbap-updkz EQ space.
*     Save unchanged version of XVBAP to YVBAP
      ls_yvbap = xvbap.
      APPEND ls_yvbap TO yvbap.
      <xvbap-updkz = charu.
      upd_vbap = charu.
    ENDIF.
    xvbap-spart = cobl-spart.
    MODIFY xvbap.
  ENDLOOP.
ENDIF.
SAP uses two internal tables XVBAP and YVBAP in sales document processing. XVBAP which contains the order items as they are currently after the user changed them on the screen, whereas YVBAP stores only changed item records the way they were before change. So YVBAP is only populated in change mode and not in creation mode. So if we are updating XVBAP when sales document is in change mode, we should ensure that YVBAP also contains the same record the way it was before our change.
SAP will only update the records to database if we ensure the integrity of XVBAP and YVBAP internal tables.

Similar Messages

  • How to change value date field

    HI,
    After posting the transaction data into the document , is it possible to change the 'value date' . if it is possible pl.give me guidelines . As i know it is possible to change "Assignmentand Text filed"
    This is my user Requirement to change " Value date field".
    Regards,
    Prabhakar

    Hi,
    Check in document change FB02.
      It may allow you to change the value date. If it is not allow to change the filed then create value date in
      Document Change Rules, Document Header.
    Regards,
    Sankar

  • New Field at Item Level

    Hi Folks,
    We are using BOB web shop in our project. we have a requirement of an additional field at Item Level named 'Order Reason'. This will be a drop down with a set of values, client requirement is that this range of values should be easily maintainable as it keeps changing from time to time.
    - Can this be achieved with configuration, i actually researched a bit on 'Subject Profile'. But i am not sure whether it can be configured for item level.
    - If done with Customization, i want this drop down to be populated on loading of shopping basket. Which BADI or FM should i use during shopping basket loading that can populate this drop down.
    Kindly feel free to suggest any alternative approach too.
    Thanks for cooperation.
    Regards,
    Rahul

    Hi Rahul,
    From the technical point of view to achieve this you need to write new custom RFC where you will fetch the dropdown items for your new field and send this data as a table to your frontend application.
    In the frontend application you need to write one java backend object which will call your RFC and fetch
    the dropdown list from backend.
    You need to write atleast one business object which will hold your data and will make it available to http session.
    You need to write one action which will call your backend java object and make the data available to
    the order creation jsp.
    You need to modify the config.xml file like below
    <!--  Customizing the show basket action with Z-Actions  -->
    <!-- <action path="/b2b/showbasket" type="com.sap.isa.isacore.action.order.ShowBasketAction">
         <forward name="showbasket" path="/b2b/order.jsp"/>
          </action>-->
    <action path="/b2b/showbasket" type="com.sap.isa.isacore.action.order.ShowBasketAction">
            <forward name="showbasket" path="/b2b/Z_getItem.do" />
    </action>
    <action path="/b2b/Z_getItem" type="com.yourcompany.isa.actions.Z_Zitem">
       <forward name="success" path="/b2b/order.jsp" />
    </action>
    <!--  End of customization  -->
    Than you need to make the changes there in jsp to create a new custom field at item level.
    Once you are done with all above you have to send the user selected data back to the backend also.
    To save the data to the backend you again have to write one action and make the changes in config.xml
    like below
    <!-- Edited for item -->
    <!-- <action path="/b2b/maintainbasket" type="com.sap.isa.isacore.action.order.MaintainBasketDispatcherAction">-->
    <action path="/b2b/maintainbasket"
    type="com.youcompany.isa.customBasketDispatchAction.Z_CustomBasketDispatcherAction">
    <!-- End of edit-->
    To save the data to the backend you can implement "CRM_ISA_BASKET_ITEMS" BADI and can get the data in "CHANGEITEMS_BEFORE_ORDER"
    Regards,
    Arshi

  • Changing address in sales order item level

    Dear very good mng
    i want to know , i am trying to change ship to party address in sales order line item level
    but showing Gray mode only ..  i have maintained Sales document item level ( partners) Removed check box not modifiable
    And i activated Item partners check box at partner tab
    even i am not able to change address in sales order item level plz tell me
    Thanks a lot

    Hi Madhuri
    I  have checked my self.system does allow to change different ship to Party on line Item level .
    Please do the following steps .
    1. Replace/delete  the WE partner Number ( Example -1) in my case  in change mode.
    2. system will show some error message as show below while deleting or replacing WE with some other ship to Party code.
    3. Ignore the message and go ahead  . Please put the new Partner's number and double click
    address Screen will Pop up . You can Change the address .
    Hope this helps .Let me know for more clarification needed .
    Regards
    Santosh Verma

  • Disable a field at Item level for SC confirmation Screen

    Dear All ,
    PLEase help me with a step by step instruction on how to disable field at Item level of  confirmation screen of SC .
    I tried in Webdynpro component : Web Dynpro Component:/SAPSRM/WDC_DODC_CONF_IBD in se80 and below is what I get ;
    When I click on Display it asks me for an access key which I dont have ..
    When I click on the enhancement option it asked me to create an implemenation which I did as seen in yellow below and still the enabled field is not getting editable so tha I can uncheck and make the field dissapper .
    Please can some one really help me in understanding what exactly I am doing wrong ?
    Also  Please let me know if the SPRO path related in this to be able to do in any which way ... I tried expanding
    Configure field control .. and it doesnt expand so dont know which other option to use ..
    Thanks for your help in advance .
    Kindly let me know !!
    Regards
    Vinita

    HI Laurent .
    1. Thanks for your input . I wasnt able to open the SPRO path coz I was using SAP 720 and when I installed 730 I was able to use it .
    2. I am still not able to udnerstand how to configure it through Meta data .. What does Final_Entry mean .. I want to disable the field Last del indicator and its flag box and the label as well ..
    3. I tried through component configuration and it worked ..as below :
    I went to the webdynpro component and started the component configiurator :
    Here I made both the field and Label insisible and was able to do this .
    Please can some one help ,me know how to configire this through Meta data concept as well .. I wanted to try that method as well for my understanding ..
    Would appreciate your help and would be closing this post soon ..

  • Viewer slow while retrieving data while changing value from a page item

    Hi, I am using 9.0.2 to create reports. My end-users are using Viewer to run these reports. Recently, we are experiencing performance problems with Viewer. We have reports with Page Item. Let say a report takes 1 min to run. After running the report if a different value is selected for a page item, it is takes another 1 min to get new data. Whereas, Desktop is not taking any additional time (noticable) for a different value for the page item. Recently, we are experiencing this problem. I thought that it was cache problem in Application server, so we restarted all the pieces in aps server. However, the problem still exists. We are using a materialized for this particular report.
    Any tips would be highly appreciated. Thanks.

    The performance differences can be attributed to the differences in product. Desktop is a client server product. A query executes and ALL data is returned to the desktop. You can manipulate that data in any way and the database is not required. Web (Plus/Viewer) only return the data needed to satisfy the query currently being viewed. If you change a page item, a database call is made to retreive additional/different data.
    In other words this is just how things work. You can alter settings in your prefs.txt file to improve performance in Viewer/Plus. Changing number of rows returned, memory settings, row fetch limits, rows per fetch all can improve/reduce performance.
    As best I know there is not a "magic" setting for these values. It is based on the server/volume of data/workbook content/ workbook layout. etc. Crosstab workbooks are much slower to return data than page -detail.

  • User Exit: AFAR0002. How to change value in field: ANLC - NAFAP?

    Hi,
    At the moment I am working on custom Depreciation Key for which the depreciation for period (and subperiods) will be recounted and taken into account for depreciation posting.
    I try to use exit AFAR0002 for this purpose.
    I am able to count and change the value of depreciation for each subperiods. The problem is, that I cannot change the value of "Ordinary depreciation that is planned for the asset in the current fiscal year" for the pierod '000'. Due to this, in the last period of the current fiscal year system tries to reverse the sum of planned depreciation in previous subperiods. It simply tries to meet the "planned depreciation for fiscal year' with the sum of planned depreciation for subperiods.
    example:
    ANLC-NAFAP = 100.
    Active Asset value = 1000
    Depreciation for periods:
    001     ->     -50
    002     ->     -50
    003     ->     -50
    004     ->     -50
    005     ->     -50
    006     ->     -50
    007     ->     -50
    008     ->     -50
    009     ->     -50
    010     ->     -50
    011     ->     -50
    *012     ->     450
    planned value -> -100
    The questions are:
    1. is it possible to change value in ANLC-NAFAP in this exit
    2. How it sould be done.
    Thanks in advance for help.
    Regards,
    Wojciech

    Dear Paul,
    I had run AFAR. The report changed to '0' the value of ANLC-NAFAP  field - sth changed - thanks.
    But I still have a problem to set this value to the sum of planned depreciation for each month. At the moment, in the last period the system tries to reverse all planned "sub"depreciation to '0' in total.
    Is it any additional condition that has to be fulfilled in order to change the value of "Ordinary depreciation that is planned for the asset in the current fiscal year" for the pierod '000'?
    Regards,
    Wojciech

  • Fixed Value Date at line item level is not in changable mode when copied

    Dear SDN Team,
    Hi i have a problem in the Fixed Value date at the line item level in the Return sales order.
    The Problem is When creating the return order with reference to the scheduling agreement (10.03.2010).  In the Return sales Order at the line item level the fixed value date is coping from scheduling agreement item (fixed value date eg: 31.12.2009)
    But i would like to have the fixed value date in the return order as 10.03.2010  but the field is greyed out.
    But normally when the sales document is created with reference to the preceding document the same will be copied.  But field is greyed out and it is not in changable mode.
    Can any one help how to solve this.
    I have checked also SAP Note where i did not find any messages.
    In normal scenario - when the order is created without any reference the fixed value date is in changable mode until the document is in open.
    Pleas help me to resolve this.
    With Regards,
    Jai

    Hi Lakshmipathi,
    I am sharing the resolution which was done to this requirement.
    We have a specific condition type with statisticaly used and with routine to have KWERT with zero value,
    Based on the different key combination. We have a specific key combination for the SA and SDoc and for this we need to maintain a condition record for the condition type with fixed value date and which will be linked to only the specific document.  Once this is done.
    We need to do update pricing in the sales order for the particular line item. by doing this the Fixed value date will be changed in the particular line item.
    Thanks and Regards,
    Jana

  • Account Assignment Gp. Change in Sales Order At Item Level

    Due to Some Changes in Material Account Assignment Gps. , I want to Change A/C Assignment Gps. at Item Level in the Sales order it self . as there are so many pending sales orders with Old A/C assignment gp. I tried through MASS updation , but Item level A/C assignment field is not avialable . Pl. help to solve this matter

    Dear,
           I explain you the process that where the actual field is this.
          First Go on T.Code MASS --> Select Object Type : BUS2032 ---> F8 (Execute) --> Select SD document: Business item data : Table Name :MASSSDPOSVBKD ---> F8 (Execute) -- > Choose Selection Field (Square Check Button at Footer) ---> Select AcctAssgGr Field from Pool to Selection criteria --> Select OK.
          Hope it will help you.
    Regards,
    Sandip

  • BAdI: ME_GUI_PO_CUST add customer field to item level

    Hi Experts,
    I want to add a customer field to PO item level, how to do that? the functional consultant told me to first implement the BAdI: ME_PROCESS_PO_CUST before I can use BAdI: ME_GUI_PO_CUST, can anyone show me the procedure on how to implement this? thanks in advance.
    Kind regards
    Dawson

    Hi Dawson,
    Those BADIs are having good documentation and sample code. Once gone through the documentation, you can refer below thread.
    Re: ME_GUI_PO_CUST & ME_PROCESS_PO_CUST   - ME21N/ME22N/ME23N
    Reddy

  • Add "Customer fields" for item level

    Hi experts.
    Please i need a help.
    Im using the SAP CRM 5.0 win client.
    I will use the EEWB method to add new fields at the item level (CRMD_CUSTOMER_I). I believe that these fields will appear in the "customer fields" tab, but this tab isnu2019t displayed inside item details.
    Why its can be happen?
    Is some config. missed?
    Thanks in advanced.
    Daniel

    Yes. it is possible but you have to take care of in the back end too and how these fields comes and sit in ECC. so that you may need to map in the IDOC or XI data . so that these information must be pssed to ECC and available  and accordingly you need to change in purchase order too since all these data will be copied into purchase order too.
    for example :- if you add one field in header level /item level of contract
    and it must be coppied into Backend contract as well as your next consecutive docuemnt like Purchase order must be taken care. hope you understand now.
    Muthu

  • Display cost center field under item level when creating sales order

    Hi dear experts,
       during  the sales order creation(tcode VA01),  is it possible to display the cost center field in the tab account assignment under item level??
    currently we are using ECC6,in the tab account assignment, the cost center field was actually already defined in the screen by the system...i used to try to 'activate' the cost center field VBAP-KOSTL in the user exit  MV45AFZZ, but the cost center still not shown.
    I know that there is a config to the sales doc type can be used to open the cost center at header level, how about item level?
    thanks and best rgds
    Mu

    Hi,
    The Cost Center Determination settings is in OVF3 -  but there are some cases where the Cost Center must be exceptionally changed. 
    If the document category for order type in IMG VOV8 is defined to be "I" which belong to order type FD - Deliv.Free of Charge, then the field cost center is active for input during transaction VA01. 
    Alternatively, you can specify an order reason and assign a cost center to an order reason. 
    However the standard SAP works only at the header level though, so it would not work if cost center is needed on the line item. 
    The cost center are assign for such business transactions as :
    - Free deliveries
    - Returns
    - Deliveries of advertising materials
    You can also make cost center allocation dependent on the order reason, for example:
    Order reason: Damage in transit
    Order reason: Free sample
    Both the IMG settings are done in transaction OVF3, either with/without the order reason.
    regards,
    Siddharth.

  • Adding field on item level of invoice

    Hi,
    I would like to add one more field into the form of invoice. I changed print program so I have my field calculated.Because I'm a beginner in SAPScript forms I don't know how to add this field in ITEM line.
    Please advice !
    BR
    Stefan

    Hi,
    the field which u wanted to add is at Item level or Header level?
    If it is at item level, usually it should be defined in MAIN WINDOW. first u check in the Graphical form painter, where to add the new field...
    goto se71> settings> click on Form Painter--> now, check the Graphical Form Painter check box...by doing this, it opens the layout and can understand where to add... to add the variable use like (eg: &fieldname& )...
    Hope it helps!!
    Rgds,
    Pavan

  • Net Value at Header and Item Level

    Guyz
    I have a header condition say ZFRE, which is manual. when I see total at header level it should be added to other components and show the Net Value. But, it shouldn't appear at item level Net value. With standard settings, ZFRE is being distributed to item level and item total is also considering this condition.
    Thanks!
    MAM

    Hi,
    Header conditions apply to all items in the document and are automatically distributed to the items. A header condition can be based on either a percentage or on an absolute amount. If you enter a header condition that is based on a percentage (for example, a discount of 2%) the system automatically applies this percentage to all items in the document. If the header condition is an absolute amount, there are two different ways in which the system can distribute the amount among the items in the document:
    The condition value of a header condition is either
    distributed proportionally among the items or
    the amount entered at header level is duplicated for each item.
    You control the distribution of absolute header conditions in the group price field per condition type. In the standard version, condition type HB00 is marked as a header condition and as group condition. Condition type RB00 is only marked as a header condition.
    You can try with User Exit USEREXIT_XKOMV_ERGAENZEN_MANU
    in RV61AFZB.
    Thanks.
    Krishna.

  • Open sales order indicator / field at Item level

    Is there any field at sales order item level to tell  the order is Opened (open order Item)?.  Will anyone share your expertise pl.

    Hi,
    Yes you can find at the sales item -> status tab field Overall status.
    Regards,

Maybe you are looking for