cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with sending table input parameter into R/3 - all rows are same

Former Member
0 Kudos

Hi all,

I tried to send data into R/3 using table input parameter of BAPI.

When I sent one row, sending is succesfull and data are save in R/3, but if I want to send more rows, all rows are filled by the last row of table and this value is save in the R/3

Any idea how I could solve this problem?

Thank

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

I think your not proper to capture the table record value.

If u capture the proper value then u should do it correct.

U can do all these things in the Onleadselection of the table.

Check the value when u press the record on the table , if it is correct value is coming or not.

it make sense.

Thanks

Lohi.

Former Member
0 Kudos

Hi Lohitha M,

exactly I have long text fron TextEdit element.

I must to split this long text to more rows of table (72 chars lenght).

Here is code I used:

temp_NewCommentary - long text

// Create node for binding Table data

Zc4Liv_Bapi_Send_Result_Input input = new Zc4Liv_Bapi_Send_Result_Input();

Zc4Liv_Ln_Ltext commentary = new Zc4Liv_Ln_Ltext();

int modul = 72;

int startPosition = 0;

int endPosition = 0;

if(wdContext.currentContextElement().getTemp_NewCommentary() != "")

{

do

{

startPosition = endPosition;

endPosition = endPosition + modul;

if(endPosition > wdContext.currentContextElement().getTemp_NewCommentary().length())

{

endPosition = wdContext.currentContextElement().getTemp_NewCommentary().length();

}

commentary.setTdformat("*");

commentary.setTdid("9000");

commentary.setTdline(wdContext.currentContextElement().getTemp_NewCommentary().substring(startPosition, endPosition));

input.addIt_Ltext(commentary);

}

while(endPosition<wdContext.currentContextElement().getTemp_NewCommentary().length());

wdContext.nodeZc4Liv_Bapi_Send_Result_Input().bind(input);

I don't know where I have to use Onleadselection statement.

former_member182372
Active Contributor
0 Kudos

temp_NewCommentary - long text 


// Create node for binding Table data
Zc4Liv_Bapi_Send_Result_Input input = new Zc4Liv_Bapi_Send_Result_Input();
int modul = 72;
int startPosition = 0;
int endPosition = 0;
String temp_NewCommentary = wdContext.currentContextElement().getTemp_NewCommentary();
if(temp_NewCommentary != null && temp_NewCommentary.length()>0)
{
	int length = temp_NewCommentary.length();
	do
	{
		Zc4Liv_Ln_Ltext commentary = new Zc4Liv_Ln_Ltext(); 

		startPosition = endPosition;
		endPosition = endPosition + modul;
		if(endPosition > length)
		{
			endPosition = length;
		} 
		commentary.setTdformat("*");
		commentary.setTdid("9000");
		commentary.setTdline(temp_NewCommentary.substring(startPosition, endPosition));
		input.addIt_Ltext(commentary);

	} while(endPosition<length);
}

wdContext.nodeZc4Liv_Bapi_Send_Result_Input().bind(input);
former_member182372
Active Contributor
0 Kudos

Doubled

Message was edited by: Maksim Rashchynski

Former Member
0 Kudos

Hi Maksim,

imagine, that I fill the TextEdit element by text with lenght about 160 chars and start execution.

Result is, that in R/3 in the appropriate table there are three new rows, all filled with the end of input string (16 chars).

I think split code is OK (yours code is optimized, but idea is the same as mine), but statement

input.addIt_Ltext(commentary);

or transport to the R/3 ocures that first two rows are rewrited by the last row.

I tried fill the table from predefined field, but it works as bad as the previous part of code.

I need to find way to insert new row into the table and not rewrite all rows by the last sentence.

I read something about this problem in WebDynpro forum (it was about handling tables and add new row into the table), but I can't to find this message

Artax

former_member182372
Active Contributor
0 Kudos

Artax,

The main idea is to create instance of object for every line. Zc4Liv_Ln_Ltext commentary = new Zc4Liv_Ln_Ltext(); inside the loop not outside.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Maksim,

thank you very much, now it works fine

Artax

former_member182372
Active Contributor
0 Kudos

Hi Artax,

If the problem is solved please close the thread and mark useful answers.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi Maxim,

I don't know how to close thread.

Could you please navigate me?

Thanks,

Artax

Answers (0)