Skip to Content

* —————————————————————————-

Append New Component: RPLM_QIMT_CODSELECT_COMP (ex : CODESELECT)

/wp-content/uploads/2012/11/img_01_155800.png

* —————————————————————————-

Propriety   Controller 

/wp-content/uploads/2012/11/img_02_155813.jpg

* —————————————————————————-

Add component in Input Help of context (ex: CODESELECT for fields MNGRP & MNCOD – from table QMMA)

/wp-content/uploads/2012/11/img_03_155814.jpg

* —————————————————————————-

Add Attribute: IF_WD_CONTEXT_ELEMENT (ex: LV_CURRENT_ELEMENT)

/wp-content/uploads/2012/11/img_04_155815.jpg

* —————————————————————————-

Append 2 Methods

1 Open (from CODESELECT component)

                Select default values (and save context in attribute LV_CURRENT_ELEMENT)  

2 Close (from CODESELECT component)

                                Return values selected (and use this user selection)

/wp-content/uploads/2012/11/img_05_155816.jpg

Open method:

  DATA: L_REF_CMP_USAGE           TYPE REF TO IF_WD_COMPONENT_USAGE.
 
DATA: L_REF_INTERFACECONTROLLER TYPE REF TO IWCI_RPLM_QIMT_CODSELECT_COMP.


 
DATA: LT_CODE_IN     TYPE RPLM_TT_QPK1CODEGRP.


 
DATA: LR_VH_ELEMENT             TYPE REF TO IF_WD_CONTEXT_ELEMENT,
        LV_VH_ATTRIBUTE_INFO     
TYPE WDR_CONTEXT_ATTRIBUTE_INFO.

  L_REF_CMP_USAGE = WD_THIS->WD_CPUSE_CODESELECT( ).
  IF L_REF_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
    L_REF_CMP_USAGE->CREATE_COMPONENT( ).
 
ENDIF.
  L_REF_INTERFACECONTROLLER = WD_THIS->WD_CPIFC_CODESELECT( ).

  CLEAR: LR_VH_ELEMENT.
 
CALL METHOD L_REF_INTERFACECONTROLLER->GET_CONTEXT
   
IMPORTING
      ER_F4_CONTEXT_ELEMENT = LR_VH_ELEMENT
      EV_F4_ATTRIBUTE_INFO  = LV_VH_ATTRIBUTE_INFO.
  WD_THIS->LV_CURRENT_ELEMENT   = LR_VH_ELEMENT.


 
CLEAR LT_CODE_IN.
  APPEND YOUR CODEGROUP TO LT_CODE_IN[].


  L_REF_INTERFACECONTROLLER->START_CODE_SELECT(
    IV_CODE             =
‘*’
    IV_CODEGRUPPE       =
‘*’
    IV_KATALOGART       =
‘A’   => A = Activity, …
    IV_MULTISELECT      = ABAP_FALSE
    IT_CODEGRUPPEN      = LT_CODE_IN ).

Close method:

 

DATA: L_REF_CMP_USAGE           TYPE REF TO IF_WD_COMPONENT_USAGE.
 
DATA: L_REF_INTERFACECONTROLLER TYPE REF TO IWCI_RPLM_QIMT_CODSELECT_COMP .

  DATA: LT_CODES_SELECTED TYPE RPLM_TT_QIMT_CODE,
        LS_CODES_SELECTED
TYPE RPLM_TS_QIMT_CODE.

  DATA:  LR_ELEMENT   TYPE REF TO IF_WD_CONTEXT_ELEMENT.
 
DATA:  DV_INDEX     TYPE I.   “  Index ALV for Ex

  DATA LO_ND_IT_QMMA TYPE REF TO IF_WD_CONTEXT_NODE.
 
DATA LT_IT_QMMA TYPE WD_THIS->ELEMENTS_IT_QMMA.
 
DATA LS_IS_QMMA TYPE WD_THIS->ELEMENT_IT_QMMA.

* —————————————————————————-
  L_REF_CMP_USAGE = WD_THIS->WD_CPUSE_CODESELECT( ).
 
IF L_REF_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
    L_REF_CMP_USAGE->CREATE_COMPONENT( ).
 
ENDIF.
  L_REF_INTERFACECONTROLLER = WD_THIS->WD_CPIFC_CODESELECT( ).

  CALL METHOD L_REF_INTERFACECONTROLLER->RETURN_CODES
   
IMPORTING
      ET_CODES = LT_CODES_SELECTED.
 
CHECK LT_CODES_SELECTED IS NOT INITIAL.

  CLEAR LS_CODES_SELECTED.
 
READ TABLE LT_CODES_SELECTED INTO LS_CODES_SELECTED INDEX 1.
 
CHECK SY-SUBRC EQ 0.
 
CHECK LS_CODES_SELECTED IS NOT INITIAL.

* —————————————————————————-

* Ex for ALV – LT_IT_QMMA

* —————————————————————————- 
 
CLEAR: LR_ELEMENT.
  LR_ELEMENT   = WD_THIS->LV_CURRENT_ELEMENT.
 
CHECK LR_ELEMENT IS NOT INITIAL.

  CLEAR DV_INDEX.
 
CHECK LR_ELEMENT IS NOT INITIAL .
 
CALL METHOD LR_ELEMENT->GET_INDEX
    RECEIVING
      MY_INDEX = DV_INDEX.
 
CHECK DV_INDEX IS NOT INITIAL.


  LO_ND_IT_QMMA = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_IT_QMMA ).
 
CHECK LO_ND_IT_QMMA IS NOT INITIAL.
 
CLEAR LT_IT_QMMA.
  LO_ND_IT_QMMA->GET_STATIC_ATTRIBUTES_TABLE(
IMPORTING TABLE = LT_IT_QMMA ).

  CLEAR LS_IS_QMMA.
 
READ TABLE LT_IT_QMMA INTO LS_IS_QMMA INDEX DV_INDEX.
 
CHECK SY-SUBRC EQ 0.
 
CHECK LS_IS_QMMA IS NOT INITIAL.


 
MOVE : SY-MANDT                     TO LS_IS_QMMA-MANDT,
         LV_QMNUM                    
TO LS_IS_QMMA-QMNUM,
         LS_CODES_SELECTED-KATALOGART
TO LS_IS_QMMA-MNKAT,
         LS_CODES_SELECTED-CODEGRUPPE
TO LS_IS_QMMA-MNGRP,
         LS_CODES_SELECTED-
CODE       TO LS_IS_QMMA-MNCOD,
         LS_CODES_SELECTED-KURZTEXTCD
TO LS_IS_QMMA-MATXT.

  MODIFY LT_IT_QMMA FROM LS_IS_QMMA INDEX DV_INDEX.
 
CHECK SY-SUBRC EQ 0.
  LO_ND_IT_QMMA->BIND_TABLE( NEW_ITEMS = LT_IT_QMMA SET_INITIAL_ELEMENTS = ABAP_TRUE ).

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Sumanth Kristam

    Thanks for the document.

    I have small issue,it displays inactive records as well and don’t see any parameter or something to control those records..

    do you know a way to achieve the same?

    (0) 

Leave a Reply