cancel
Showing results for 
Search instead for 
Did you mean: 

help needed in displaying rows in table

Former Member
0 Kudos

hi gurus,

i have created a table and using select statement i was able to retrieve the data.the problem iam facing is ..when i run the application and give a value for a field and clicked on the button i was able to see only one record in the web dynpro table..actually the database table contains 10 records and i was able to see only one record,i didnt give any where condition in the select statement,i have changed the cardinality property of the node to 0..n and the sys was throwing error and if i put 0..1 or 1..1 it was running fine..

Please give me your valuable inputs for solving this...

Thanks in advance

Regards

ravi

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Well you can't have the context set to x:1 and expect more than record to show up. You have specified that you are restricted to just one record with that context setting. So the root question is what is the source of the error when it was set to x:n - since that is the setting you will need. We would have to know more about the rest of your coding and application to be able to comment. Perhaps you code to bind your ABAP internal table was not correct? Were you using BIND_TABLE? What exactly was the error you were getting and were did it occur? Do you have any other UI elements bound to the same context node?

Former Member
0 Kudos

Hi thomas,

i application iam working on is a basic applcation , retreiving the database table contents to a table in webdynpro.I have written a Select statemtn on a button..I have 2 context nodes,

first node contains the input field for entering value...assume Input1

second node contains the table fields to be filled...

when i gave the where for input1 case in select stament i wa able to see only one record though i have multiple records for tht value in the database table..

I have changed the cardinality for the nodes 1..n and still getting only one row..

Regars

Ravi

Former Member
0 Kudos

Hello,

Can you send the DATA and SELECT statements?

Regards.

Former Member
0 Kudos

hi David ,

thanks for the reply...

this is the select statement code iam using ..

data: it_csunit type /BI0/PCS_UNIT.

select * from /BI0/PCS_UNIT into it_csunit.

ls_n2-Cs_unit = it_csunit-Cs_unit.

ls_n2-Company = it_csunit-Company.

ls_n2-Cons_ba = it_csunit-Cons_ba.

ls_n2-Country = it_csunit-Country.

ls_n2-Co_area = it_csunit-Co_area.

endselect.

CALL METHOD LO_ND_N2->SET_STATIC_ATTRIBUTES

EXPORTING

  • INDEX = USE_LEAD_SELECTION

STATIC_ATTRIBUTES = ls_n2.

Regards

ravi

Former Member
0 Kudos

Hello,

In your code you're moving only one record to the table (from the work area ls_n2), I suggest you the following:


DATA: it_csunit TYPE STANDARD TABLE OF /BI0/PCS_UNIT,
  lo_nd_n2 TYPE REF TO if_wd_context_node.

SELECT * FROM /BI0/PCS_UNIT INTO TABLE it_csunit.

IF it_csunit IS NOT INITIAL.
* GET THE REFERENCE TO THE NODE - SOMETHING LIKE
*  lo_nd_n2 = wd_context->get_child_node(name = wd_this->wdctx_nd_n2).

* Bind the data to the node
  lo_nd_n2->bind_table( it_csunit).

ENDIF.

Regards.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You aren't appending ls_n2 to anything and you are only calling the SET_STATIC_ATTRIBUTES once outside the loop. So you are only processing one record.

Instead, just read all the records at once into an interal table using SELECT * FROM <TABLE> into table <itab>.

Then you just use the node->BIND_TABLE API to set all the data into the contect at once. It is much easier.

data isflight type standard table of sflight.
select * from sflight into table isflight.
 data lo_r_sflight type ref to if_wd_context_node.

lo_r_sflight  = wd_context->get_child_node( wd_this->wdctx_sflight ).
  lo_r_sflight->bind_table( isflight ).

Former Member
0 Kudos

HI

i have modified my code with the code mentioned..when i executed i got an error stating

THE ASSERT CONDITION WAS VIOLATED

Please help me on this issue

regards

ravi

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Are you sure you have the cardinality of the node set correctly to 0:n? The assert condition is usually do to an incorrect violation of the cardinality settings. If that isn't the problem, look at the short dump and see where the assert condition was triggered from. We will need to know more details than just that you got an Assertion error.

Former Member
0 Kudos

I have found that when I mess up the cardinality on a context node for instance (1:1 or 1:n when no data exists), you might see a similar message with the associated dump that provides more detail.

Try to change the cardinality to 0:n.

Regards.

Former Member
0 Kudos

hi david

i have changed he cardinality to 0..n for node2 ...still facing the same error...

i also tried changing diff cardinality values but getting the same error

regards

ravi

Former Member
0 Kudos

And how about node 1 what's the cardinality?

Can you send the dump message?

Regards

Answers (0)