cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting selected record in Dynamic Internal table

Former Member
0 Kudos

Hi Friends,

I want to delete selected row from a dynamic internal table. The selected entry should be deleted from Adobe and as well as Webdynpro abap.

Kindly help me how to solve this problem.

Thanks in advance.

Regards,

Phani.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Matthias,

Thanks a lot for responding.

In my adobe i kept a check box to delete the record. It should delete the selected ones. But right now, its deleting one by one.

I have coded following script for delete button:

IT_TIME_SHEET --> is my internal table

G_ROW_STATUS is the field to track the action performed.

var tlength = xfa.resolveNodes("IT_TIME_SHEET.DATA[*]").length;

for ( var i=0; i<tlength; i++

)

{

if(xfa.resolveNode("IT_TIME_SHEET.DATA["i"].FLAG").rawValue ==

1 )

{

IT_TIME_SHEET.DATA.instanceManager.removeInstance(i);

G_ROW_STATUS.rawValue = "DELETE";

}}

In the Webdynpro abap following code I wrote:

row_count = 1.

FIELD-SYMBOLS <wa> TYPE zshr_time_sheet_time.

LOOP AT it_time_sheet ASSIGNING <wa>.

<wa>-srl_no = row_count.

row_count = row_count + 1.

ENDLOOP.

last_row = <wa>-srl_no.

DELETE it_time_sheet WHERE srl_no EQ last_row.

Suppose if two records checkboxes are selected I can loop at the internal table IT_TIME_SHEET in webdynpro and delete where checkbox is selected.

But problem is once user deletes records, adobe is deleting only one record and if i delete two records from webdynpro it looks like something wrong for the user.

Please help me how to solve this problem.

Regards,

Phani.

NoJo
Active Participant
0 Kudos

hi,

in my opinion you delete twice and thats the problem!!

DON'T delete in the form (because your table in the web dynpro backend gets a problem, i think).

Just delete in the WEb Dynpro backend!!!

you got the answers, allready! Trigger a round trip when the delete button is pressed, but don't delete via javascript!).

loop in the backend and delete the marked rows (the flag has to be bound, too!).

when the form is refreshed in the web dynpro the lines will be missing!

norbert

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi ,

Thanks for responding.

My requirement is as follows:

I have created a dynamic internal table in interactive form with insert and delete row buttons. Insert is working fine.

Where as when the user selects the delete button its deleting in between records. Instead, the adobe should take the user cursor position and delete that particular record.

E.g. Suppose user has put a cursor in 2nd row and clicks on delete button, it should delete the 2nd row only. Currently its deleting the last row all the times.

My query here is, how can i find out the user cursor position using adobe scripting and delete the record.

Please do the needful at the earliest.

Thanks in advance.

Regards,

Phani.

Former Member
0 Kudos

Hi Phani,

For ur Scenario(Deleting selected row from Dynamic Table)

You can place an common ADD button and Table Header in an subform And

DELETE button and Table Body in another subform.

On click of ADD button you can add instance of Body row subform.

So on adding you wil have each row with delete button and it solve ur purpose.

For Coding Reference you can See this Standard Form. Click ADD/Delete button script wil be displayed in editor.

It wil Help You a lot.


"C:\Program Files\Adobe\Designer 7.1\EN\Samples\Purchase Order\Dynamic Interactive\Forms\ ..etc.Purchase Order.pdf".

regards,

vinoth.

0 Kudos

Hi Vinoth,

could you please explain how to see the script that is being executed when clicking the DELETE button?

Would help me a lot!

Thanks,

Matthias

Former Member
0 Kudos

Hi Surya,

Thanks for reply.

Problem is the data is getting deleted from adobe before the web dynpro. So i need to catch the selected record in adobe too.

Please suggest me.

Thanks in advance.

Regards,

Phani.

Former Member
0 Kudos

Hi Phani,

Can u explain me ur actual requirement now..? I can't what u asked in ur last post..

regards,

Surya

Former Member
0 Kudos

Hi Phani,

U can delete a particular row from a dynamic internal table and also u can reflect this in the form as well..


" lt_table is ur internal table
" 'field' is the internal table's field
" 'value' is a value in that field

delete lt_table where field = 'value'.
lo_nd_table->bind_table( lt_table ).   "binding the table.

regards,

Surya.

Former Member
0 Kudos

Hi,

Thanks for reply.

Is there any way to created dynamic table without using web dynpro.

How can I have delete button for each row? As its a dynamic table how can I copy the script and capture the action everytime new record is deleted or inserted?

Please suggest me.

Thanks,

Phani,

NoJo
Active Participant
0 Kudos

hi,

sap recommends NOT to use dynamic tables in combination with web dynpro

you will have to do some thigs in the form and some in the abap coding

in the form: add a "DELETE" button in each row. use this button for deleting the row with the same function as the standard submit button (copy the scripting from the submit button from the "click" event)

to tell the backend the specific function (deleting a row) you use additional variables.

in the abap-backend create 2 variables (gv_function, gv_index) that will be in the form too.

they have to be filled in the form at the "click" event of the "delete row" button.

gv_function.rawValue = "DELETE"; gv_index with the index of the row.

when you are in the backend after clicking read the gv_function and gv_index, delete the selected row and after the roundtrip it will have disappeaered in the form.

don't delete the rows only in the form via instanceManager, you will get problems in the backend...