Skip to Content
avatar image
Former Member

Multiple Line items in BAPI_PO_CREATE

Hi Everyone,

I am trying to create a webdynpro application for Creating a Purchase Order using "BAPI_PO_CREATE". Could you help in getting the code for adding a new line item while creating a purchase order using the above BAPI. Adding a new line item means similar to that of in the Transaction "ME21N". I need a table where each row is for a line item. Let me know if my question is not clear.

Please help me resolve this issue. I would appreciate your help.

Regards,

Gopal.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 17, 2009 at 05:35 PM

    If the PO is already in ERP and you are adding another line to it, you will need to use BAPI_PO_CHANGE. Pass in the first line item (with any changed data), and also the second line item (the new one), in the table parameter POITEM.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Raghu,

      I am having a similar problem. I hope the Webdynpro expert here can help since I am very new to Webdynpro.

      I need to create Multiple INPUT Line item and then call a BAPI to post. I created a table and Binded w/ the 'Item' Node. Created a button "Add New Line".

      It gives me an Error of "Assertion Violated" error. I think I am having some Code Error. Please tell me where/how to add code to add additional line to the item section?

      Thanks all,

      Marie

  • avatar image
    Former Member
    Jul 17, 2009 at 09:52 AM

    Hi Gopal,

    If i remember correctly there not much to do while creating PO application, simply you have to call the BAPI and pass the mendotry parameter to it ..

    Note: if it ask for some input data is missing then you have pass all the input value to it manually thr WDA coding.

    Thanks

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      HI,

      try this.

      As u said u have a button which upon clicking will create a new row.

      under the action method of the button,

      IPrivateView<yourview>.IprivateNode<yournode> node = wdContext().node<yournode>();

      IPrivateView<Yourview>.IPrivateElement<yourelem> elem = node.create<yournode>Element();

      node.add(elem);

      Regards,

      Satya.

  • avatar image
    Former Member
    Jul 17, 2009 at 09:48 AM

    Hi,

    U can check line item details in "EKPO" table.

    U can check header details in "EKKO" table.

    Regards,

    Sunaina Reddy T

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Sunaina,

      Thanks alot for your reply. Can you explain me how do I implement the process of adding Multiple Line Items to a Purchase Order.

      My requirement is that "When a user wants to add an additional Line Item to a purchase order, then they click a button and they get another row added to the Table". Do you know how to acheive this. I would appreciate your help.

      Regards,

      Gopal.

  • avatar image
    Former Member
    Jul 17, 2009 at 10:11 AM

    Hi gopal,

    Ur explanation is correct.

    already u did for single item details na so u create one button for multiple line items. when the user clicks that button u enter second item details. after that u create one submit button, in that submit button u call "BAPI_PO_CREATE" bapi.

    Regards,

    Sunaina Reddy t

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Sunaina,

      Thanks a lot for your reply. So, how do I bind the second Item values to the context of the BAPI? How does the BAPI know that the user is entering multiple line items? Did you get me?

      Regards,

      Gopal.

  • avatar image
    Former Member
    Jul 21, 2009 at 01:26 PM

    HI,

    implement a code simlar to

    int i=1;

    IPrivateSamappView.ISNode node = wdContext.nodeS();

    IPrivateSamappView.ISElement elem = node.createSElement();

    node.addElement(i,elem);

    i=i+1;

    under action of the button

    in your code..

    Regards,

    satya

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 17, 2009 at 10:45 AM

    Hi gopal,

    second item details also u bind to same context attributes that will not override.

    finally u call that bapi that time all the details will go to bapi (including sencond line items).

    Regards,

    Sunaina Reddy T

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Sunaina,

      Thanks for your reply. I tried the way you said but, it doesn't work that way. It is not taking the two line items. It is just overwriting the the second item with the data of the first item. What is the flag in the BAPI that tells it that the user wants to enter more than 1 line items. Do you understand my problem.

      Regards,

      Gopal.

  • avatar image
    Former Member
    Jul 21, 2009 at 09:08 AM

    Hi gopal,

    1) Create element to POITEM node.

    2) use setxxxxxxxxxxx() to set the values.

    3) add this element to POITEM node.

    4) execute the bapi

    Regards,

    Sunaina Reddy T

    Add comment
    10|10000 characters needed characters exceeded