cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop inserting the rows

Former Member
0 Kudos

Hi all,

I have created an application in WD4A, where i added an INSERT button which creates a new row every time it is inserted. I want to put a check on it that if the rows exceed 30, it should stop inserting further rows.

being a new programmer to Dynpro, i dont have much idea about that. Please tell me how to do that & what code do i need to put to stop inserting the next row & displaying an error or Information message on the screen.

Regards

Parteek.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Parteek,

u can use the method get_elemet count of interface if_wd_context_node to get the no of elements. Then in modify view fet focus to the alv and make the insert button hide.

eg:

in the mofify view check if the no of elements in more than u expexted

then

l_ref_interfacecontroller = wd_this->wd_cpifc_alv_name ( ).

l_reference = l_ref_interfacecontroller->get_model(

).

Data: lr_std tYPE REF TO if_salv_wd_std_functions.

lr_std ?= l_reference.

lr_std->set_edit_insert_row_allowed( abap_false ).

Regards

Sarath

Former Member
0 Kudos

hi yashpal

I am already using that method but i need that after inserting 30 rows, i should display an error message that user can not insert more than 30 rows, what do i need to do for that? so which condition (IF...ENDIF) i need to put & what should i write to stop the transaction after the count is 30.

plz help.

thanx for the reply.

Rgds.

Yashpal
Active Contributor
0 Kudos

in the method in which u r adding the rows do the following..

get the element count

if > 30 .

display error using the message manager.

exit the method using EXIT .

else.

code for adding the row...

Regards

Yash

Former Member
0 Kudos

thanx yash... it solved the problem. thanx a lot.

Yashpal
Active Contributor
0 Kudos

Hey where r the points !!!!!!!!!!!!!!!!!!!!!!!!!!

Former Member
0 Kudos

i m not having any option for points..... sorry.

Yashpal
Active Contributor
0 Kudos

Hi ,

use the method GET_ELEMENT_COUNT of the interface IF_WD_CONTEXT_NODE to get the no of elements in ur node in which u r adding the row..

Regards

Yashpal