Tuesday, July 16, 2013
IF_WD_CONTEXT_NODE_INFO Interface: This interface is used to modify controller contexts at runtime. The interface is the interface of the metadata of a Context node and is used to describe what the data looks like.
Example: Let us take one statically defined context.
Example: Let us take one statically defined context.
Steps to create Context node and underneath attributes
- Get the reference to the meta data of the context node that will act as the new node's parent.It means we are getting reference to the meta data of the root node.
DATA LO_ROOT_NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO. "Get meta data info of ROOT context node LO_ROOT_NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).
- To define new node, call method LO_ROOT_NODE_INFO->add_new_child_node.
DATA LO_ROOT_NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO. DATA LO_IT001_NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO. "Get meta data info of ROOT context node LO_ROOT_NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ). "Create node with name 'IT0001' without any attributes CALL METHOD LO_ROOT_NODE_INFO->ADD_NEW_CHILD_NODE EXPORTING NAME = 'IT0001' IS_MANDATORY = ABAP_FALSE IS_MANDATORY_SELECTION = ABAP_FALSE IS_MULTIPLE = ABAP_FALSE IS_MULTIPLE_SELECTION = ABAP_FALSE IS_SINGLETON = ABAP_FALSE IS_INITIALIZE_LEAD_SELECTION = ABAP_TRUE IS_STATIC = ABAP_TRUE RECEIVING CHILD_NODE_INFO = LO_IT001_NODE_INFO.
- Node IT0001 is ready now. We need to create context attributes in the node IT0001.
DATA LO_ROOT_NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO. DATA LO_IT001_NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO. DATA LS_ATTRIBUTE TYPE WDR_CONTEXT_ATTRIBUTE_INFO. "Get meta data info of ROOT context node LO_ROOT_NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ). "Create node with name 'IT0001' without any attributes CALL METHOD LO_ROOT_NODE_INFO->ADD_NEW_CHILD_NODE EXPORTING NAME = 'IT0001' IS_MANDATORY = ABAP_FALSE IS_MANDATORY_SELECTION = ABAP_FALSE IS_MULTIPLE = ABAP_FALSE IS_MULTIPLE_SELECTION = ABAP_FALSE IS_SINGLETON = ABAP_FALSE IS_INITIALIZE_LEAD_SELECTION = ABAP_TRUE IS_STATIC = ABAP_TRUE RECEIVING CHILD_NODE_INFO = LO_IT001_NODE_INFO. "Define Attribute PERNR LS_ATTRIBUTE-NAME = 'PERNR'. LS_ATTRIBUTE-TYPE_NAME = 'PERNR_D'. LS_ATTRIBUTE-VALUE_HELP_MODE = '0'. CALL METHOD LO_IT001_NODE_INFO->ADD_ATTRIBUTE EXPORTING ATTRIBUTE_INFO = LS_ATTRIBUTE. "Define Attribute BUKRS LS_ATTRIBUTE-NAME = 'BUKRS'. LS_ATTRIBUTE-TYPE_NAME = 'BUKRS'. LS_ATTRIBUTE-VALUE_HELP_MODE = '0'. CALL METHOD LO_IT001_NODE_INFO->ADD_ATTRIBUTE EXPORTING ATTRIBUTE_INFO = LS_ATTRIBUTE. "Define Attribute PERNR LS_ATTRIBUTE-NAME = 'ENAME'. LS_ATTRIBUTE-TYPE_NAME = 'EMNAM'. LS_ATTRIBUTE-VALUE_HELP_MODE = '0'. CALL METHOD LO_IT001_NODE_INFO->ADD_ATTRIBUTE EXPORTING ATTRIBUTE_INFO = LS_ATTRIBUTE.
Creating a Context Node and Context Attributes from a Structure:
An ABAP Dictionary flat structure type (structure, database view or transparent table) can be passed to the method using the parameter static_element_type. All attributes for this structure are created automatically.
- Get the reference(LO_ROOT_NODE_INFO) to the meta data of the context node that will act as the new node's parent.It means we are getting reference to the meta data of the root node.
- To define new node, call method LO_ROOT_NODE_INFO->ADD_NEW_CHILD_NODE.
- Use parameter STATIC_ELEMENT_TYPE to pass the name of DDIC structure(PA0001) to the method LO_ROOT_NODE_INFO->ADD_NEW_CHILD_NODE.
DATA LO_ROOT_NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO. DATA LO_IT001_NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO. DATA LS_ATTRIBUTE TYPE WDR_CONTEXT_ATTRIBUTE_INFO. " Get meta data info of ROOT context node LO_ROOT_NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ). " Create node with name 'IT0001' of DDIC type PA0001 with all attributes CALL METHOD LO_ROOT_NODE_INFO->ADD_NEW_CHILD_NODE EXPORTING STATIC_ELEMENT_TYPE = 'PA0001' NAME = 'IT0001' IS_MANDATORY = ABAP_FALSE IS_MANDATORY_SELECTION = ABAP_FALSE IS_MULTIPLE = ABAP_FALSE IS_MULTIPLE_SELECTION = ABAP_FALSE IS_SINGLETON = ABAP_FALSE IS_INITIALIZE_LEAD_SELECTION = ABAP_TRUE RECEIVING CHILD_NODE_INFO = LO_IT001_NODE_INFO.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Step by step tutorial on Smart Forms - Template Node
- ABAP - Sending email with pdf attachment
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.