cancel
Showing results for 
Search instead for 
Did you mean: 

Add and Delete a row in table

Former Member
0 Kudos

Hi Expert,

In SAP interactive form OFFLINE Scneario.

I have a deep structure. In which i am using other structures like kna1, knb1, knvv.

Now in KNVV is again a deep structure in which i have a table type.

Now a draged and droped this table type to my layout so i got a table.

I Need to have two buttons ADD and Delete, To add and delete a row in table repectvily.

I saw other threads also but get not do it.

My table type attribute's name in KNVV structure is VLACT.

I write following code on click action of ADD button

-


data.#subform[0].Button1::click: - (FormCalc, client) -


VLACT.row.instanceManager.addInstance(1);

xfa.form.recalculate(1);

but it shows error msg

accessor "VLACT.row.instanceManager.addInstance(1);"

is unknown.

Also i am not able to see tabel itself wich i draged and droped. Only two buttons are there.

Plz help

Thanks ? Regards,

Arvind

Accepted Solutions (1)

Accepted Solutions (1)

OttoGold
Active Contributor
0 Kudos

Hello,

I am not 111% sure, but I think this doesn´t work with tables. In fact that would definitely work if your "table" would be built from subforms. But I have never used it this way the table (the MS Word-like table). At least this is the type of table you get after drag and drop from data view.

Regards Otto

Former Member
0 Kudos

Hi Otto,

Thanks for Ur reply.

Even when i creted this form UI elements and than did the binding later, it's giving the same error.

Plz if u can sugges some other way to do the Same.

Thanks & Regards,

OttoGold
Active Contributor
0 Kudos

Check this one: http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_ba...

For example page 113:

if (advanced.Subform3.instanceManager.count ==
advanced.Subform3.instanceManager.max) {
xfa.host.messageBox("You have reached the maximum number of items
allowed.","Combining Instance Manager Concepts", 1);
}
else {
advanced.Subform3.instanceManager.addInstance(1);
xfa.form.recalculate(1);
}

I am not sure but a) your naming convetion is a little crazy or b) you´re not working with the right object.

Regards Otto

Former Member
0 Kudos

Hi Otto,

I got it correct. no java script error.

But am not able to see the new row on PDF from when i click on ADD button.

Will / Can I have the same effect as when i click on add button in Web DynPro application and can see the new row.

if yes than how Plz help.

Thanks & Regards

Arvind

OttoGold
Active Contributor
0 Kudos

That could be anything. Does your subform expand? (auto-fit height = checked).

addInstance(1); the 1 is important here, do you use it?

xfa.form.recalculate(1); also this one looks useful, probably the alternative (??) is to make the new row visible explicitely. But I don´t have the exact code here with me. But you can search for something like visible(1) or something like that.

Otto

Former Member
0 Kudos

Hi Otto,

This is the code i am using to add new row.

Also all the settings in form are correct like "Repeat row for each data item" etc.

I want to have at most 7 rows.

________________________________________________________

var nTableLength = Table1.nodes.length;

var nNumRow = 0;

for (var nCount = 0; nCount < nTableLength; nCount ++)

{

if ((Table1.nodes.item(nCount).className == "subform") & (Table1.nodes.item(nCount).name !== "HeaderRow"))

{ nNumRow = nNumRow + 1; }

}

if (nNumRow == 7)

{ xfa.host.messageBox("The maximum allowable number of rows is 7. You cannot add any more rows.", "Warning", 3); }

else {

Table1.Row1.instanceManager.addInstance(1);

xfa.form.recalculate(1);

xfa.host.messageBox("row added" );

}

__________________________________________________________________

I get the msg form the statment xfa.host.messageBox("row added" );

But i can not see the newly added row

Plz help

Thansks & Regards,

Arvind

OttoGold
Active Contributor
0 Kudos

What about these?:

http://groups.google.com/group/livecycle/browse_thread/thread/46c9b9d26fb824fd/fe141c6da715c808

Means: is your form dynamic? (explicitely set to dynamic)

Otto

Former Member
0 Kudos

Hi Otto,

I created form from SFP. so i can not insert web Dynpro code to make it dynamic.

When Save As the form there is no Dynamic pdf option in ht edrop down

How to make this offline form Dynamic??

i have checked all the form properties, and found thses correct as per m understanding.

I am doing very silly mistake but not able to get it..

What else i can try.

Plz sugess,

Thaanks & Regards,

Arvind

OttoGold
Active Contributor
0 Kudos

You´re kidding me, right? You didn´t search for a minute right? Well, next time search first, ask later. I can also recommend you to get some SDN points to prove you have helped anybody as well and you thus are worth helping.

 DATA lv_sfpdocparams TYPE sfpdocparams.
  lv_sfpdocparams-dynamic = 'X'.
  CALL FUNCTION fm_name
    EXPORTING
      /1bcdwb/docparams = lv_sfpdocparams

Regards Otto

Former Member
0 Kudos

Hi Otto,

Thanks a lot man.

it is working fine. Add and Delete

I was looking into the form only, so didn't think of my printing program.

full points for ur patience and help.

Again thank u very much.

Thanks & Regards

Arvind

Answers (0)