Skip to Content
avatar image
Former Member

Saving Multiple Rows in a Table simultaneously

Hi All,

I have a requirement in which I have to validate and save multiple entries from table through BAPI. The validations are checked on Button click (save). If a row entry is correct , it is saved in the backend and for the rows which are not correct, an error message is displayed.

My requirement is to clear the rows which are correct or saved in the backend.

Thanks,

Nikhil

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Oct 15, 2008 at 06:06 AM

    Hi,

    Private<name>View.I<value node name >Node node = wdContext.node<value node name >();

    Private<name>View.I<value node name>Element ele;

    <your rfc name> input = new <your rfc name>(); // your rfc name

    wdContext.node<your rfc name>().bind(input); // bind

    <table name> inputTable;

    for (int i=0; i < node.size(); i++ ) // value node - where data is available

    {

    if(<check here element for validation>){

    inputTable= new <table name>();

    ele = node.get<value node>ElementAt(i);

    inputTable.set<Attribute>(ele.get<Attribute>());

    ......

    input.add<table name>();

    node.removeElement(ele);

    }

    }

    // execute rfc.

    Regards,

    ramesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 06:32 AM

    Hi Nikhil,

    You can use the following code to remove the node element

    
    for(int i = 0; i < wdContext.node<Node Name>().size(); i++)
    {
    wdContext.node<Node Name>().removeElement(wdContext.node<Node Name>().getElementAt(i));
    }
    

    Edited by: Aishwarya Sharma on Oct 15, 2008 8:33 AM

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 15, 2008 at 07:29 AM

    Hi Nikhil,

    code to clear elements from table:

    int size=wdContext.node<NodeName>().size();
        for(int i=0;i<size;i++){
        	/**Check condition here*/
        	///
        	if(/*if element is  to be removed*/){
        		wdContext.node<NodeName>().removeElement(i);
        		size--;
        		i--;
        	}
        }

    Regards,

    Deepti

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 09:17 AM

    Hi,

    Try this

    for(int i = 0; i < wdContext.node<Node Name>().size(); i++)

    {

    if(wdContext.node.getElementAt(i).get<<Attrname>> == cond && ....)

    {

    wdContext.node<Nodename>().<<setvaluestoDatabase>>;

    wdContext.node<Node Name>().removeElement(wdContext.node<Node Name>().getElementAt(i));

    }

    else

    {

    wdComponentAPI.getMessageManager.reportSuccess("invalid values")

    }

    Regards

    Raghu

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 09:54 AM

    Hi

    for(int j = 0; j < wdContext.nodeMyNode().size(); j++)

    {

    if(wdContext.node.getElementAt(j).getCity== cond && ....)

    {

    wdContext.nodeMyNode().<<setvaluestoDatabase>>;

    wdContext.nodeMyNode ().removeElement(wdContext.nodeMyNode ().getElementAt(j));

    }

    else

    {

    wdComponentAPI.getMessageManager.reportSuccess("invalid values")

    }

    Hope this is useful for you

    Regards

    Ruturaj

    Edited by: Ruturaj Inamdar on Oct 15, 2008 11:54 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 10:02 AM

    Hi,

    Try this code

    for(int i=0;i<wdContext.nodename().size();i++)

    {

    if(wdContext.nodename().isSelected(i))

    {

    wdContext.nodename().removeElement(wdContext.nodename().getElementAt(i));

    }

    }

    Thanks & Regards,

    Sunaina Reddy T

    Add comment
    10|10000 characters needed characters exceeded