cancel
Showing results for 
Search instead for 
Did you mean: 

how to read value inside the varient

0 Kudos

hello members,

i got a situation to upload the excel data into alv table.the alv table is having initail view and std view which contains different fields in each view.i want to upload the data based on view selected.problem is that i am not able to read the value of the varient.please find below screen shot and let me know how to read the value of it.

Accepted Solutions (0)

Answers (3)

Answers (3)

harsha_jalakam
Active Contributor
0 Kudos

Hi Rama Krishna,

Please check the below thread, which explains you how to get the variants and the currently selected variant.

Regards,

Harsha

Former Member
0 Kudos

Hi,

Have you tried below code?..


* Get the API reference

    lo_api_interfacecontroller = lo_interfacecontroller->wd_get_api( ).

  ENDIF.

* Get personalization obect

  IF lo_api_interfacecontroller IS NOT INITIAL.

    CALL METHOD lo_api_interfacecontroller->get_personalization_manager

      RECEIVING

        pers_manager = lo_pers.

  ENDIF.

* Get variants

  IF lo_pers IS NOT INITIAL.

    CALL METHOD lo_pers->get_variants

      RECEIVING

        variants = lt_var.

  ENDIF.

* Set the default variant

* Required variant is read

* READ statement can be modified as per the requirement.

* As this application holds only one user variant, first record is read.

##read the respective records based on your condition

  IF lt_var IS NOT INITIAL.

    READ TABLE lt_var INTO wa_var INDEX 1.

    IF sy-subrc EQ 0.

      ls_config_key-config_id    = wa_var-config_id .

      ls_config_key-config_type  = wa_var-config_type.

      ls_config_key-config_var   = wa_var-config_var.

    ENDIF.

    TRY.

        CALL METHOD lo_pers->set_default_variant

          EXPORTING

            config_key = ls_config_key

            set        = abap_true.

      CATCH cx_wd_personalization .

    ENDTRY.

* Get the variant information based on variant id

* Load the variant/ Set the default variant

    CALL METHOD lo_pers->load_config_by_key

      EXPORTING

        config_key            = ls_config_key

        fetch_default_variant = abap_true.

Hope this helps you.

Thanks

KH

Gowtham
Contributor
0 Kudos

Hi Rama Krishna,

It ls Drop down field ,  you can use Get_Static_Attributes to get the selected row from it.


   DATA  lo_nd_attachments_table    TYPE REF TO   if_wd_context_node.

   DATA  lo_el_attachments_table     TYPE REF TO   if_wd_context_element.

   DATA  ls_attachments_table         TYPE                wd_this->element_attachments_table.

  lo_nd_attachments_table = wd_context->get_child_node( name = wd_this->wdctx_attachments_table ).

   lo_el_attachments_table = lo_nd_attachments_table->get_element).

   lo_el_attachments_table->get_static_attributes(

   IMPORTING

   static_attributes = ls_attachments_table ).

- Gowtham

0 Kudos

hi gowtham,

thank you for the response.

what is element_attachments_table here? that drop down was not created by me.it is std varient of alv table. i didnt find any context assigned to that element.