cancel
Showing results for 
Search instead for 
Did you mean: 

Table in view with input field (repost from ABAP General)

ross_goodman
Participant
0 Kudos

Hi,

I have a table in a view which HAS NOT BEEN DEVELOPED WITH ALV.

I inherited this from the previous developer and he installed it using table columns and input fields.

Each column is bound to a field of one particular context and that context is defined from the fields of a dictionary structure.

Only one of the fields is available for input.

The context is filled in the handlestart method of the window controller.

At runtime the user will fill the input field on each line of the table on screen and then hit the save button.

I need to know how to get the values of the input field for each line of the altered table so that I can use them in an update.

Ross

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ross,

I don't think it matters if is an ALV or a Table.

in the SAVE action you need to READ the context node value, if you want to read the whole structure you can used method get_static_attributes or if you want to get a particular attribute from your context node you will used get_attribute.

this can easily be accessed from the WIZARD tool on webdynpro ABAP.

Select the wizard->click on READ radio button-> select a context node or attribute and then click green arrow to continue.

it will automatically coded for you!

Hope this help!

Jason PV

ross_goodman
Participant
0 Kudos

Hi Jason,

I take it then that there is no explicit action to put the value from the screen field into the attribute? Does the binding handle that automatically?

Ross

Former Member
0 Kudos

Ross,

all the UI attributes are bind to the context (you can check in the layout tab the UI attributes value will be bind to an attribute in the context node)

if you entered 12345 in an input field when you do an Action at the time you are reading the attribute it will have 12345 as the value.

thanks!

Jason PV

Please provide points if is helpful, I will like one of those new medals! hahaha!

Answers (3)

Answers (3)

ross_goodman
Participant
0 Kudos

Jason's code got me to the right place. Thanks jason

Sharathmg
Active Contributor
0 Kudos

Dear Ross,

My understanding is you have a table with input fields. Everytime the user enters soem data in the fields, he clicks on the save button. Now, you need to read the data entered in the table and push it to the backend.

As you have said that node is bound to a structure. So firstly, declare an internal table and a work area of the type fo structure.

( DATA: it_node_table TYPE STANDARD TABLE OF node_strructure,

wa_node_table TYPE node_structure,

"Then declare the node

nd_node_table TYPE REF TO if_wd_context_node.

Obtain the ref to the exact node usign get_child_node. Then,

nd_node_table->get_static_attributes_table(

IMPORTING

table = it_node_table ).

Later, loop through the internal table it_node_table and move it to wa_node_table.

So, you have the data edited by user in the table.

Regards,

Sharath

ross_goodman
Participant
0 Kudos

code not correct

Former Member
0 Kudos

what do you mean????

use the WIZARD tool and click the radio button for READ and select the context node or the attribute you want to read.

Wizard won't code bad code.

ross_goodman
Participant
0 Kudos

Tryinjg to sdeit my resonse and it wont let me !!

I used the wizard and the last piece of the code is

lo_el_po_item_inv->get_static_attributes(

IMPORTING

static_attributes = ls_po_item_inv ).

The 'ls_po_item_inv' is a structure with the fields of the node yes? In which case if my table has 10 lines of data how does this code get me the complete table content? ie all 10 lines.

Ross

Former Member
0 Kudos

you are correct, is only a structure, if you want a table in the WIZARD when you click the READ radio button, also click the check-box AS TABLE OPERATION in this case you need to select the whole context node not just an attribute.

it will create an itab will all your 10 items, then you do whatever you need to do with that itab (LOOP, READ, etc)

ross_goodman
Participant
0 Kudos

I do not have a check box for the as table operation option.

Checking my context node I see it has been defined according to the structure in the dictionary not to the table type that uses that structure. Could this be why I do not have the check box available?

Ross

Former Member
0 Kudos

I'm in 7.01 so I don't know how it was handle in older versions.

I do know that the option comes available even before selecting the context node I want to read.

you can code it.

you see how is define your structure... data: ls_po_item_inv type wd_this->element_xyz....

you can define an itab like: data: lt_po_item_inv type wd_this->elements_xyx.... (please note that there's an "S" in the word elements)

and then in the node do:

lo_nd_po_item_inv->get_static_attributes_table( IMPORTING table = lt_po_item_inv ).

you can loop this table with the structure that you had define already (delete the code you post before since you already has the table)

hope this help!

Jason PV

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>I'm in 7.01 so I don't know how it was handle in older versions.

On 7.0 the context wizards don't have nearly as many options. It only has read context and there is no As Table addition. On 7.0 many developers would use the single wizard, but then have to adjust for update or table operations.