How to insert a new line item in VA01/VA02 by using ABAP code?

Hi Gurus
i have a very tough requirement. the customer wants to insert a free goods after an item has been populated in VA01/VA02 automatically according to some certain rules. the input material may be a main material of a sales BOM.
for example. let's suppose there is a material A who has two sub-material B and C which is maintained in a sales BOM via CS01/CS02. when the material A has been input in the line item in VA01/VA02, its quantity input and after the ENTER key has been clicked, another material D may be displayed in a new line as a gift if the condition met.  the condition relates to customer/material/quanity and these information are stored in a Z-table.
on the other hand, if the material A is only a single material(not a BOM), the gift(material D) will also be filled automatically if the condition met.
i have already enhance the FM cs_bom_explosion to filfill the requirment for BOM materials. whereas it is very hard to find the enhanment point for the single material.
so my question is where is the correct place for me to insert the ABAP code, which decides whether the gift should be given or not and furthermore inserts the new line item into XVBAP. i tried to use MV45AFZZ, whereas the data is always inconsistant if a new line has been inserted. it is very strange that there is no temperary internal table storing line item data input in the table controal of VA01/VA02. system reads the line item data , line by line, via a system kernal function call.
any hints are welcome. thanks

HI Stephen,
I have the same prolem. I modified the 5 global tables, but I don't see the new line in the screen.
Can you help me with some details?
Thx!
Mihaela

Similar Messages

  • Insert new line item in va01&va02 - urgent

    Hi frndz,
    At the time of creation standard sales order using va01.
    When user enters the sold to party in header and then
    material & quantity in line item reocrds. After user enters the details in first line. I have some checks to be executed and on the basis of that customer will get the free material that should come on second line item.
    I am getting the details which i will be inserting on new line item but the problem is that in which exit i should write the code for the same.
    So frndz could you please let me know, in which userexit I should insert this new line item. There can be more than one free material.
    If anyone has done this already, please let me know.
    I know one exit i.e.MV45AFZB but in that there are many forms. so exactly which form i should where i will write the code to insert new line item???
    Points will be awarded surely.
    Regards,
    Prashant

    HI Stephen,
    I have the same prolem. I modified the 5 global tables, but I don't see the new line in the screen.
    Can you help me with some details?
    Thx!
    Mihaela

  • Add a new line item in VA01/VA02 using user exits.

    Hi Experts,
    I have a problem regarding adding of line items in VA01/VA02. I was able to add a line item but my problem is, there is no validation for the added line. I want SAP to validate it before posting it to database. I'm using USEREXIT_SAVE_DOCUMENT_PREPARE for this one.
    I also found out from other threads, that adding line items in XVBAP is not advisable since no checking will be done after USEREXIT_SAVE_DOCUMENT_PREPARE.
    I'm thinking if I can use FM DYNP_VALUES_UPDATE on one of the user exits to add a line item in VA01/VA02 and let SAP do the checking and validation. This way, I'm sure that the added line is correct and data integrity will be maintained.
    Do you have any comments/suggestions about this?
    Thanks a lot,
    Arman.

    Hi,
    I am trying to do this as well but I don't get it working...
    I am able to add records to XVBAP, but those never show up in my sales order.
    I have found that I should also add records to XVBEP, XKOMV and XKOMP before it will be working, but when I add something to XVBEP I do get a dump on SAVE.
    I would like to ask people that managed to get this working to post the code as an example here.
    Thanks and best regards,
    Marnix

  • How to Insert the new line items in Billing

    Hi Friends,
    I have an issue in Billing process.
    When the user is creating the billing document from Delivery document, then based on some conditions, I have to split the line item into 2 different line items(We have to change the Quantity and value).
    Please let me know what are all the possible options.
    Regards
    Elini.P

    Many times, there is no new line (unless there is some sort of list in the paragraph). Since Word (actually most editors now) word wraps automatically, the paragraph is usually (essentially) one long line that the editor wraps for you.
    But, to tell you the truth, I don't see anywhere in that code where you are even attempting to find newline characters. What, exactly, are you trying to accomplish. I.e. what is your desired result (not the process you are envisioning to get there).

  • How to insert a new line in MC1H(maintaining formula)

    How to insert a new line in MC1H(maintaining formula)
    Can anybody help me with  the steps

    Hi,
    1.run transaction SCC4 -> press Ctrl+F4 or the button for change ->double click one the row for your client -> on the field Cross Client Object Changes select Changes to the Repository and cross-client Customizing allowed -> SAVE
    2. run MC1H and now you will have access to insert new line in the table
    Regards Vassko!
    Edited by: Vasil Pavlov on Sep 16, 2008 9:51 AM

  • How to Insert a new line in a clob

    hi,
    i want to create reports as multi-line clob data using PL/SQL procedures.
    is there any standard way of inserting a new line when iam generating
    this clob data based on the data i fetch from a different table.
    i short my question is "How to insert a new line in a clob?"
    i tried using the character '\n', but that was of no use.
    thanks in advance
    ramesh

    You could always do a:
    newLine := '
    Since PL/SQL allows a tring to span multiple lines.

  • How to extract data from info cube into an internal table using ABAP code

    HI
    Can Anyone plz suggest me
    How to extract data from info cube into an internal table using ABAP code like BAPI's or function modules.
    Thankx in advance
    regds
    AJAY

    HI Dinesh,
    Thankq for ur reply
    but i ahve already tried to use the function module.
    When I try to Use the function module RSDRI_INFOPOV_READ
    I get an information message "ERROR GENERATION TEST FRAME".
    can U plz tell me what could be the problem
    Bye
    AJAY

  • How to add a new line item to a Purchase Requisition number

    Hello All,
    Can anyone please provide me with some FM or BAPI to add a new line item to an existing Purchase Requisition number.
    Can it be done using BAPI_REQUISITION_CHANGE; if yes, then how do I pass the parameters into the BAPI tables..?
    Useful pointers would be appreciated...!!
    Thanks & Regards,
    Tarun Gambhir

    @Gautham,
    Thanks for the quick reply.
    I want to update the table EBAN, so should I use the parameter table XEBAN to put in the new line item and then execute..
    Also to fill up this table I need to pass certain value, so can I use BAPI_REQUISITON_GETDETAIL and pass the same details as found from the same BAPI and create a new line item...
    Regards,
    Tarun Gambhir

  • How to create a new line item automatically in CRMD_ORDER

    Hi,
    While creating a sales order in CRMD_ORDER, after user enters a line item say 'xxxx' and press 'Enter', we need to create a new line item say 'yyyy' dynamically.  Any ways of how to achieve this functionality?
    thanks in advance,
    amar.s

    Hi Amar
    You can use structured products:
    Step1:COMM_PR01
    Open Product xxxx > Relationships > Tab Component > Select Relationship type = STRSET Set > Assing product yyyy
    Step2: IMG > CRM > Transactions > Define Item Categories
    Open you item category and in Structure scope field select option A Single-Level Explosion of structured products
    Step3: IMG >  CRM > Transactions > Define Item Category Determination
    create new entry
    Transaction type =
    Item   category group = Category group of xxxx product
    main item cat = item cat of xxxx product
    item cat =  item cat of yyyy product
    now when you enter product xxxx , product yyyy will be automatically added
    Hope it helps
    Rupesh

  • How to make a new line item appear in a sales order in VA01 transaction?

    Dear All,
    I am trying to create a SO with single line item with quantity 100.
    Upon hitting the 'Enter' key, if the available quantity is less than the requested quantity (say 20), it takes me to an availabilty control screen which has a push-button 'One-time delivery' on the application tool bar.
    Upon clicking on this button, it takes me back to the main screen of VA01 where I currently see only one line item with quantity 100 and confirmed quantity 20.
    My requirement here is to make two line items appear, one with quantity 20 and the other with quantity 80, once I navigate back to the main screen of VA01 after clicking on the push-button 'One-time delivery'.
    Please provide me your valuable inputs. Any kind of help is highly appreciated.
    Useful answers never go unrewarded.
    Regards,
    Sreekanth Reddy B.

    Hi Sreekanth ,
    creating line items based on the confirmation qty can be done thru config, not thru ABAP,standard SAP will gives you options to create a new line item for unconfirmed qtys.
    check with ur functional consultant or try to post in SD /APO forums.
    regards
    Prabhu

  • How to add a new line item when i click on UPDATE in orderpage B2B webshop?

    Hi Gurus,
    I need to add a new line item based on some condition when i click on update in the order page in b2b web shop. Is there any way to pass some parameters to the BADI crm_isa_basket_items and create a new line item when i update? If so can you please tell the parameters that i need to pass to the badi.
    Any help will be highly appreciated!!!!!
    Thanks in advance,
    Lakshman.

    You can put condition when you call java script function while clicking on "update" button.
    On order.jsp  update button call "submit_refresh()" java script function. You can check your condition over here.
    You can find this function in "orderTools.js" file.
    And when you enter item in last line on order page and click on the update button it will automatically add new empty lines on your order page as per your selected new line items from drop down box.
    Or may be you can call your custome action class when you click on update to check particular condition.
    I hope it will help you.
    Thanks and Regards.
    eCommerce Developer

  • Add New line item from Quote to Contract using CRM_ORDER_MAINTAIN

    HI Gurus,
    I need to add a new line item with entire item details such as SALES PRICING etc in contract,
    i am confused like what are the parameters i need to pass to FM CRM ORDER MAINTAIN,
    Please help me on this regard.
    Thanks & regards.

    Experts,
    any luck i have please help me on the same.
    Thanks.

  • How to insert a new line character inside CDATA tag in the source xml data file?

    values for form fields in the xml data file is contained inside CDATA tags which is an Unparsed Format.
    Eg: [CDATA[IBM-01 ~ DSHFSJDSJ ~ FGFGFJ, ~ VA 665665]] delimited by "~" char
    Actual o/p:-
    IBM-01 ~ DSHFSJDSJ ~ FGFGFJ, ~ VA 665665
    Expected o/p is like :-
    IBM-01
    DSHFSJDSJ
    FGFGFJ,
    VA 665665
    live cycle product does not interpret ~ as a newline character. Please suggest which character should be used instead inside CDATA section or if there is any other way to fix this?

    I do not have any problem while using IE's XML parser
    for XML+XSLT merging.That is because IE's parser does not implement XML correctly.
    But when I use JAXP's Transformer object, it does not
    preserve the new lines inside attribute values and
    converts those into white spaces.That is exactly what the XML specifications say should happen.
    >
    ----If you have text that contains newlines, you
    should put it in an element, not in
    ----an attribute.
    That would be my last solution. But I'd really hate
    to change my logic just 'coz JAXP is not capable of
    handling new lines inside attribute values. I may be
    wrong... but If IE can keep those then there has to
    be a way to do the same from server side merging....Sure. Write your own parser with the same bug in it. But you don't have any right to demand that other people supply you with parsers that work incorrectly.

  • How to insert a new line in a jlabel???

    hi everyone
    i have a panel that have a jlabel... my problem is that i can make this label show line feeds even though im adding the "\n" escape character...
    please help
    thanks in advance
    this is my code
    <code>
    import java.awt.FlowLayout;
    import javax.swing.BoxLayout;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class Test extends JFrame{
    private String message = "This tool is used to set the database path\n" +
    "If the database is on the local machine, you should use \"localhost\" or \"127.0.0.1\"\n" +
    "If the database is on a networked machine, you should use the IP address of that machine\n";
    private JLabel help = new JLabel(message);
    private JPanel mPanel = new JPanel();
    private JPanel hPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    public Test() {
    setTitle("Database Path Updater");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setSize(450,350);
    setLocation(100,100);
    setResizable(false);
    setupComponents();
    initializeGUI();
    private void setupComponents() {
    mPanel.setLayout(new BoxLayout(mPanel, BoxLayout.Y_AXIS));
    private void initializeGUI() {
    add(mPanel);
    hPanel.add(help);
    mPanel.add(hPanel);
    public static void main(String[] args){
    new Test().setVisible(true);
    </code>

    bif_f wrote:
    thank you...that was really helpful but i just wanna know if using HTML tags is the only way to accomplish this task ????I think it's the only way because "\n" doesn't work and that's what I have learned a long
    time ago in this forum.
    another not related question: do you have any idea where the CODE tags are in this new forum???? i cant find them and i think you have noticed that i have inserted source code that are not CODE formatted....The forum has been updated you should notice that when you replied
    I don't know what's on there mind but they remove the code tags.
    you have to put it manually.
    e.g.
    [code]
    your code
    [[b]code]

  • Swing: How to insert a new line in JTextArea?

    As the title says, how do i position a text to the next line? The conventional "\n" doesn't seem to work in JTextArea....how can i resolve this?
    Thank You. :-)

    Is it running under windows?
    If so, try "\r\n"
    If that fixes the problem, use System.getProperty("line.separator") which returns the appropriate string ("\n", "\r" or "\r\n") for the system it's running on.

Maybe you are looking for