cancel
Showing results for 
Search instead for 
Did you mean: 

alv-ouput

Former Member
0 Kudos

Hi to all,

How can i get the text as a header in alv.can any one provide a

sample model code.actually this header has to get display from

the input field (which cosists of help functionality )

whcih i have selcted,based on this i need to get that

perticular values as header of the alv and then the list should

follow as alv.

need one more thing i need a alv list when the user press enter key in the

keyboard but i won't be have any button,so how can i achive this any

suggestions on the same

Inadvance

Thanks,

Satti

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Actually i mean to say that, i have an input field and i have given a f4 functioanality to that perticular field.

after selecting that (ex:vbeln no) when the user press the enter key i need to display the alv report.but iam

not placing any buttons in the screen.at the same can you explain in detail so that i can do in my development.

at the same suppose i have selected the sales doc no then while displaying alv i need to get the header

as sales doc no :<value> erdate <value> and some more fields.

Inadvance

Thanks

Satti

uday_gubbala2
Active Contributor
0 Kudos

Hi Satish,

Thought that you could take it further from the "onEnter" property of the input field... Anyways let me explain you it in more detail.

I am having 2 context nodes INPUT & VBAP. I have 2 attributes under my INPUT node:

1) VBELN type VBAK-VBELN

2) SHOW_ALV type WDY_BOOLEAN

I bind the VBELN attribute to my input field & I bind the SHOW_ALV attribute to the "visible" property of my ViewContainerUIElement. I have specified the "Default Value" property of my SHOW_ALV as blank so my ALV would not be displayed by default.

I specify an action POPULATE_ALV for the event onEnter of my input field & within this event:

1) I first read the value in the input field to a local variable.

2) I then fetch the corresponding details from VABP using this VBELN value from my local variable and bind them to my VBAP context node.

3) I set the value of context attribute SHOW_ALV to 'X'. So as you can understand my ALV would not get displayed as we had bound the "visible" property of our ViewContainerUIElement to this particular attribute.

Below is the coding inside my input fields onEnter event:

METHOD onactionpopulate_alv .
  DATA: lr_node TYPE REF TO if_wd_context_node,
        lv_vbeln TYPE wd_this->element_input-vbeln,
        lt_vbap TYPE wd_this->elements_vbap.

  lr_node = wd_context->get_child_node( name = wd_this->wdctx_input ).
" Read the VBELN value from input field into a local variable lv_vbeln
  lr_node->get_attribute( EXPORTING name  = 'VBELN'
                          IMPORTING value = lv_vbeln ).
" Use the obtained VBELN value to fetch corresponding VBAP details
  SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE lt_vbap WHERE vbeln = lv_vbeln.
" Check if there are any records in VBAP for the entered VBELN. If yes only then bind to the 2nd table & show ALV
" Or else keep the ALV as hidden & throw an message to the user informing him about the same
  IF lt_vbap IS NOT INITIAL.
    lr_node->set_attribute( EXPORTING name  = 'SHOW_ALV'
                                      value = 'X' ).
    lr_node = wd_context->get_child_node( name = wd_this->wdctx_vbap ).
    lr_node->bind_table( lt_vbap ).
  ELSE.
" Use your message manager logic to throw a message that no item details exist for this document number!
  ENDIF.
ENDMETHOD.

Hope that this helps resolve your problem.

Regards,

Uday

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi ,

Sorry that i havn't given an clear idea, so iam giving my exact requirement here..

1.have an input_node(dictionary:vbak then selected attribute as vbeln)

2.alv_table(type vbap cardinality 0..n and selection as 0..n)

3.now i went to main view and created a container form from context

4.went to componet and aded alv as salv_wd_table

5.mapped alv_table to the data node

with these steps if run my application iam able to get the input with f4 functionality.at the same my alv is getting displayed without any records.now here i don't wanto display the alv by default.when the user press the enter key via keyboard then it has to get all the records and to display in alv.if don't have any records i should not display the empty alv instead i need to get display the message at staus saying there is no data found.

please let me know your views and iam in poor in coding so i need bit detail code....

Regards,

Satti.

uday_gubbala2
Active Contributor
0 Kudos

Hi Satish,

Well I had explained exactly what you were asking for. If you could try go through the same explanation once again it would be more clear for you. You just need to create an additional boolean attribute under your INPUT node and use this to control the visibilty of your ViewContainerUIElement. In my earlier thread I had written as how I created an boolean attribute (type WDY_BOOLEAN) by name SHOW_ALV & given it a default value of space. I bind this attribute to my ViewContainerUIElement's visbility property. Just try up to this point you would end up in not getting the ALV being displayed for you. This is because the visibility property of the ViewContainerUIElement is assigned to the context attribute SHOW_ALV which has a value of space (i.e, false). So you would end up in your ALV not getting displayed ever.

You would want to display the ALV when the user selects an VBELN from the search help, presses enter & has some item details from VBAP. So if you see the properties of your input field it would have an event by name onEnter. Create an action handler against it and within this method, fetch the VBELN value & do a SELECT on VBAP table. If the resultset contains data then bind the internal table to the VBAP context node & also set the boolean attribute SHOW_ALV to 'X'. Now this would mean that you are passing a value of 'X' to the visibility property of the ViewContainerUIElement which would mean that your ALV gets displayed.

Regards,

Uday

Former Member
0 Kudos

Hi, Try going thru Uday's reply once again. It exactly describes what you are looking for. If not probably you havent explained ur requirement clearly. Regards, Radhika.

Former Member
0 Kudos

Hi Satish,

Include you code in Event 'onEnter' in the properties of the input field.

So that your code will execute when enter button is pressed.

uday_gubbala2
Active Contributor
0 Kudos

Hi Satish,

I guess that you want to set the header & footer for your WDA ALV similar to how you do in traditional ALV. Try go through this [article |https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b0ee06d0-d475-2b10-ddad-bc4bf134cfb8]by Suman wherein he discusses exactly the same.

Regards,

Uday

Former Member
0 Kudos

hi Uday,

iam working with that example,let me see how it works.

mean while i need to get disaplay this alv when i will press

enter through key borad but there is no button or no click.

any idea on this please let me know your views.....

Thanks,

Satti.

uday_gubbala2
Active Contributor
0 Kudos

Hi Satish,

I dont get as to what you mean by needing to display ALV when you press on enter. Where exactly are you pressing enter at? If its an input field then you can proceed as follows. Bind the visibility property of your ViewContainerUIElement with an boolean context attribute and set it to false by default. This would result in your ALV being invisible by default. When you press on enter then set the flag value to true so that your ALV then becomes visible.

Regards,

Uday