cancel
Showing results for 
Search instead for 
Did you mean: 

index of the row created in webdynpro for ABAP

Former Member
0 Kudos

hi experts ,

i got a problem tht ,

i hve a table and i am using the onaction enter .

so wen i created a new row and press entr on tht i want to read the index of tht row .

so pl help in this .

thanks in advance .

its urjent ...

setu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

when you have your event,

you can find your selected element in context_element in wdevent

so you wont need the index

grtz,

Koen

Former Member
0 Kudos

hi nitya ,

i my application i am not selecting any button ,

just i am using onaction enter event .

my req is i am entering the g/l account no .

after this i hve to find this gl acc is valid or invalid ,

i it is valid i hve to set visibility of next coloumn.

so i am creating a new row and entering my gl acc , and just i am hitting my enter .

so i am not selecting And pressing any button , just pressing enter .

thanks

setu

Former Member
0 Kudos

What I meant was, how are you creating a new row? If you have 5 rows already, you will create a 6th by appending an empty row right? In which case, your index will be 6. This is what i meant in the previous post.

Otherwise, I dont think you can get the index directly without a lead selection. You can only get the element by wdevent->get_context_element( 'CONTEXT_ELEMENT' ). You can then get the data in the row by using get_static_attributes on the element. After which you should probably loop, do a field compare and only get the index.

Regards

Nithya

Former Member
0 Kudos

hi koen ,

thanks for u r quick reply .

here i am not clicking any button or any linkaction .

i am using the 'on action enter' , think i am in 6th row of the table and i entered my value omn the field and pressing 'enter key ' . so i want to read the index of tht row .

pl reply for this .

thanks in advance .

setu

Former Member
0 Kudos

thank u nitya for u r quick reply .

think i hve 10 rows in my table , but i changed my value of the 6th row and pressed enter , intht case i want to capture the index value of the r\row as the 6th .

i think u understood my problem with this .

once again again in advance .

reply soon .

setu

Former Member
0 Kudos

As I said earlier, it is not possible to get the index. You can only loop and get the current index by doing a field comparison. That too will fail if you have two identical rows.

A better idea would be to have your table as read-only. Have a 'Display/Change' button in your toolbar. You should be able to select a row and click on 'change'. Then you should make the row as editable and do your validations on the edited values. If you have your entire table as editable, it will not be easy to track the changes.

Otherwise, if you want to have the table as editable only, then you can get the changed values using the context change log. Refer to web dynpro component DEMO_CONTEXT_CHANGES to see how this works. You will not get the index, but you will get all the changes that have been done to the context after the last binding.

Regards

Nithya

Former Member
0 Kudos

thank u nitya ,

here i am using my application for the BDC .

so i cant make my table as read only .

so if any other solution , letme know .

thank u

setu

Former Member
0 Kudos

thank u nitya .

my problem solved .

i am using the same wdevent .

thanku for u r reply,

thank u

setu

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Setu,

pls make the below call using the reference to your node to which the Table is Bound.

  • get Index of selected table item

CALL METHOD NODE_NAME->GET_LEAD_SELECTION_INDEX

RECEIVING INDEX = Lv_Indx.

( DATA: Lv_Indx Type i )

This should definitely solve the Problem.... If so.. Points

Thanks,

Phani M.

PS: reach me if u have any issues./.

Former Member
0 Kudos

hi phani,

i am not using the lead selection .

just i am using the onaction enter .

so think if i am in 10th row and anterin the value in table field and i am pressing the enter .

thans

setu

Former Member
0 Kudos

Hi Setu,

No problem. you can call the method i mentioned within "OnAction Enter" event handler method. This should work in the way you desire.

Thanks,

Phani

Former Member
0 Kudos

hi phani ,

thank u for u r quick reply .

i used the method , but it giving the index of the lead selection.

here i dont want tht one ,

i want tht index of the row where i press enter .

if i am in6th row and my lead selection is in 1st row .

i want the index of the 6th row

thanks

setu

Former Member
0 Kudos

Hi Setu,

Ideally, when u create a New Row, We need to select tht row & then do any further processing. So, user should select the new row first, the press Enter which solves the issue.

There might be some other work-around, but this is my preferred solution.

Thanks,

Phani

Former Member
0 Kudos

thank u phani .

but due to some logic in my application we r not using lead selection .

so its not possible to depend on this lead selection .

so pl tell me if any other solution for this problem .

thank u .

setu

Former Member
0 Kudos

Hi,

I assume you will be creating a new row by appending an empty row to your internal table and bind it to the context again. The index in this case will simply be the last line in your table.

Regards

Nithya