cancel
Showing results for 
Search instead for 
Did you mean: 

inserting more than one row of data to the table at the backend

former_member187658
Participant
0 Kudos

Hi

I have an application, where i have to store 4 rows of data to the table in the back end.And as a result mail is generated displaying all the information. The table has 2 columns whcih can save n number of rows. This has to be doen in the component controller. I wrote this code:

Zxx_xxx_xxxx xyz=new Zxx_xxx_xxxx();

xyz.setA(campaign_A);

xyz.setB(campaign_B);

input.addLi_xxx_xxxx(xyz);

i have 4 rows to send, so the above 3 lines of the code i wrote as many time. Each time the field is to be set to a different string type variable, like campaign_C, campaign_D etc.

but when i ran this application, i get the mail but in the mail the last pair of values is repeated 4 times rather than displaying all 4 pairs of data.

can anybody please help as to what to do?

Thanks & regards,

Anupreet

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Didi u check the RFC in the ABAP end. My guess is the import parameter might be a structure instead of a table..

former_member187658
Participant
0 Kudos

Hi

It is a structure at the Backend.

Former Member
0 Kudos

Hi,

If its a structure you can store only one instance of data in it..unlike a table.. Maybe thats why it is takiong one set of data.

But i am wondering how its storing the data 4 times.. are u executing the RFC 4 times.. ?

Can u paste the whole code

Regards

Bharathwaj

former_member187658
Participant
0 Kudos

Hi

The code is as follows:

Zsy_Survey_Data surveyTable=new Zsy_Survey_Data();

surveyTable.setQuestion(nglcampaign_ques);

surveyTable.setAnswer(nglcampaign_ans);

input.addLi_Survey_Data(surveyTable);

surveyTable.setQuestion(infobenefit_ques);

surveyTable.setAnswer(infobenefit_ans);

input.addLi_Survey_Data(surveyTable);

surveyTable.setQuestion(connectivity_ques);

surveyTable.setAnswer(connectivity_ans);

input.addLi_Survey_Data(surveyTable);

surveyTable.setQuestion(compligift_ques);

surveyTable.setAnswer(compligift_ans);

input.addLi_Survey_Data(surveyTable);

try

{

wdContext.nodeCmpNode_SimplifyInterfaceNode().currentCmpNode_SimplifyInterfaceNodeElement().modelObject().execute();

}catch(Exception ex)

{

ex.printStackTrace();

}

wdContext.nodeCmpNode_SimplifyInterfaceNode().nodeOutput().invalidate();

Thanks & regards,

Anupreet

Former Member
0 Kudos

Hi Anupreet,

In this code, you are creating just one instance of 'Zsy_Survey_Data' and adding the same element four times. Instead create four different instances & these elements.

eg:

Zsy_Survey_Data surveyTable=new Zsy_Survey_Data();

surveyTable.setQuestion(nglcampaign_ques);

surveyTable.setAnswer(nglcampaign_ans);

input.addLi_Survey_Data(surveyTable);

<b>surveyTable=new Zsy_Survey_Data();</b>

surveyTable.setQuestion(infobenefit_ques);

surveyTable.setAnswer(infobenefit_ans);

input.addLi_Survey_Data(surveyTable);

<b>surveyTable=new Zsy_Survey_Data();</b>

surveyTable.setQuestion(connectivity_ques);

surveyTable.setAnswer(connectivity_ans);

input.addLi_Survey_Data(surveyTable);

<b>surveyTable=new Zsy_Survey_Data();</b>

surveyTable.setQuestion(compligift_ques);

surveyTable.setAnswer(compligift_ans);

input.addLi_Survey_Data(surveyTable);

Hope this helps,

Best Regards,

Nibu.

former_member187658
Participant
0 Kudos

Hi Nibu

Thank you so much. I got the solution as per your suggestion.

Thanks & regards,

Anupreet

Answers (0)