cancel
Showing results for 
Search instead for 
Did you mean: 

problem with getting data from MARA and MAKT tablea

Former Member
0 Kudos

Hi experts,

I requirement is like that. I need to get MATNR, MTART, MATKL, BISMT and MEINS from MARA table. Also I also need to get the data MAKTX from MAKT table against MATNR from MARA table.

I need to display both table entries in only one ALV table and in only view.

How to get the the data from both the tables in one ALV ?

Anyone please help me out.

Thanks in advance!

Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Create a node with attributes from both MARA and MAKT tables;

SO your node say CN_ALV will look like;

->MATNR

->MTART

-> MATKL

-> BISMT

-> MEINS

-> MAKTX

Now declare an internal table fo type CN_ALV.

Now write to select statements to fetch data from MARA and MAKT.

Loop at the MARA and rea the MAKT table and fill your CN_ALV table.

finally bind this internal table to your ALV.

Former Member
0 Kudos

Hi radhika,

I created CN_ALV node and added all the fields from MARA table, but how to add another field MAKTX from MAKT table into CN_ALV node ?

Let me know.

Thanks

saket_abhyankar
Active Participant
0 Kudos

I think If system is not allowing you to add the attribute, it is because you have used 'Dictionary structure' (i.e. MARA). Still you can add the attribute to the node

If you have created node CN_ALV with dictionary structure, then

1) goto component controller and delete 'Dictionary Structure' from there (Which is MARA in your case) and save

2) Right click on the node-> Create (not using wizard)-> Attribute-> Add attribute name and attribute type

3) Repeat above step to create each attribute one by one

If you have created node without dictionary structure, directly follow 2nd step.

Regards,

Saket.

Former Member
0 Kudos

Instead of using the dictionary structure add the attribtues one by one.

Former Member
0 Kudos

Radhika,

How to i need to add attributes one by one...

Can u let me know the steps.....

Thanks

Former Member
0 Kudos

hi ,

right click on ur node and choose create attribute .. create attributes CA_MATNR, CA_MTART, CA_MATKL, CA_BISMT and CA_MEINS of type string ..

u can also create attribute thru wizard

create using wizard->Attributes from Components of Structure

give the structure name as MARA there and choose the fields , context attribute will be created for the attributes

regards,

amit

Answers (2)

Answers (2)

Former Member
0 Kudos

hi ,

In the context tab

1 create a context node cn_table of cardianlity 0..n

2 create 6 attributes of type string under it for the fields in the table

In the layout tab

1 right click on the RootElemnt container and choose insert UI , insert a TABLE UI element

2 right click on the UI and choose create binding and choose the context node cn_table

now in ur method

1 use SELECT SQL statement


SELECT * FROM ztable APPENDING TABLE it_table.

2 now use bind_table method and bind this internal table with the context node


DATA: lo_nd_cn_table TYPE REF TO if_wd_context_node,
        lo_el_cn_table TYPE REF TO if_wd_context_element,
        ls_cn_table   TYPE wd_this->element_cn_table.

*   navigate from <CONTEXT> to <CN_TABLE> via lead selection
  lo_nd_cn_role = wd_context->get_child_node(
  name = wd_this->wdctx_cn_table ).
  lo_nd_cn_role->bind_table( it_table ).

regards,

amit

saket_abhyankar
Active Participant
0 Kudos

Hi Shyamal,

1) Create context node with all the fields from all three tables that you require.

2) Create internal table of context node type.

3) Fill the internal table with data

a) If there are more than 1 values per matnr value, then append the internal table with uncommon values and leave the

common values blank

b) Fill the internal table in normal way otherwise

4) Bind this table to node and display in ALV

You can also use table popin functionality of Table UI element for this purpose. For that you need to use table instead of ALV

Regards,

Saket.