Wednesday, December 29, 2010
Retrieve the fieldcatalog stored for the variant.

*----------------------------------------------------------------------*
*       Form  GET_FIELDCAT_FROM_VARIANT
*----------------------------------------------------------------------*
form get_fieldcat_from_variant using disvar    like disvariant
itab_head type c
itab_item type c.

  data: fieldcat_new type kkblo_t_fieldcat.

  CALL FUNCTION 'REUSE_ALV_TRANSFER_DATA'
    EXPORTING
      it_fieldcat = fieldcat
      is_layout   = layout
    IMPORTING
      et_fieldcat = fieldcat_kkb
      es_layout   = layout_kkb.

  CALL FUNCTION 'LT_VARIANT_LOAD'
    EXPORTING
      i_tabname           = itab_head
      i_tabname_slave     = itab_item
      i_dialog            = space
      i_user_specific     = 'X'
    IMPORTING
      et_fieldcat         = fieldcat_new
    CHANGING
      ct_default_fieldcat = fieldcat_kkb
      cs_layout           = layout_kkb
      cs_variant          = disvar
    EXCEPTIONS
      wrong_input         = 1
      fc_not_complete     = 2
      not_found           = 3
      others              = 4.

  if sy-subrc = 0.
    refresh fieldcat.
    CALL FUNCTION 'REUSE_ALV_TRANSFER_DATA_BACK'
      EXPORTING
        it_fieldcat = fieldcat_new
      IMPORTING
        et_fieldcat = fieldcat.

    clear: fieldcat_ln.
    modify fieldcat from fieldcat_ln transporting no_out
    where no_out <> 'X'.
  endif.
endform.                               " GET_FIELDCAT_FROM_VARIANT

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.