cancel
Showing results for 
Search instead for 
Did you mean: 

Want to combine the data different coloumn of table into single coloumn.

Former Member
0 Kudos

HI All ,

Requirement : I want to create an application which will display diffrent coloumn(data) of a table into single coloumn in web-dynpro abap .

For ex:

Table : employee

coloumn : PERSON , PAYMENT , STATUS , SUBMISSION .

RETURN = PAYMENT + STATUS + SUBMISSION

(return coloumn will contain the data of other coloumn )

Thanks in advance .

Rahul

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

In your context, create a node 'Employee'. It should have the attributes person, payment, status, submission, return. Let return be of type string. I assume you have a ztable or some ddic structure employee, which does not have the return field.

You code will be on these lines - change it to your requirements anyway. Place the code in a method depending on your requirement of when the data should be displayed.

data: node_emp type ref to if_wd_context_node,

itab_emp type table of employee,

wa_emp type employee,

itab_node_emp type if_main=>elements_employee,

wa_node_emp type if_main=>element_employee.

node_emp = wd_context->get_child_node( name = 'EMPLOYEE' ).

<i>* Get data from your API here into itab_emp *</i>

loop at itab_emp into wa_emp.

move-corresponding wa_emp to wa_node_emp.

concatenate wa_emp-payment wa_emp-status wa_emp-submission separated by space into wa_node_emp-return.

append wa_node_emp to itab_node_emp.

endloop.

node_emp->bind_elements( itab_node_emp ).

Here, before the loop, you need to fetch the data into itab_emp using your APIs. Since you have said you want to display the data of multiple columns as is, I have just concatenated them.

In your view layout, have a table and bind the data source to be the context node Employee.

<b>The data types of itab_node_emp, wa_node_emp will differ based on your view name and node name. Use the code wizard to generate your code according to your design time.</b>

Hope this helps.

Regards,

Nithya

Former Member
0 Kudos

Hi Nithya ,

Thanks for your help.

Answers (1)

Answers (1)

Former Member
0 Kudos

In your context node that you bind to the table, create an attribute 'RETURN'. When you bind the data to the context, you can loop through the internal table and fill in the return field based on other fields in the work area. It could be a sum of the other fields, or a mere concatenation. When you bind the internal table to the context, you will have the data as you want.

Regards,

Nithya

Former Member
0 Kudos

Hi Nithya ,

Could you please let me know the code also for this as I am new to web-dynpro?

Thanks for help .

rahul