<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to access dynamic object. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-dynamic-object/m-p/4921173#M1148343</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Venu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Down-cast it into a more specific object ref variable and access its attribute...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA lo_object TYPE REF TO /SCA/CL_SVDELIVERY.

lo_object ?= IP_OBJECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now u can access this &lt;STRONG&gt;lo_object-&amp;gt;MPO_DLV_REF&lt;/STRONG&gt; attribute..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OR&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code like the below example...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*----------------------------------------------------------------------*
*       CLASS c1 DEFINITION                                            *
*----------------------------------------------------------------------*
CLASS c1 DEFINITION.
  PUBLIC SECTION.
    DATA ls_makt TYPE makt.
    METHODS constructor.
ENDCLASS.                    "c1 DEFINITION

*----------------------------------------------------------------------*
*       CLASS c1 IMPLEMENTATION                                        *
*----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
  METHOD constructor.
    SELECT SINGLE * FROM makt INTO ls_makt WHERE spras EQ sy-langu.
  ENDMETHOD.                    "constructor
ENDCLASS.                    "

DATA attribute_name TYPE char40 VALUE 'LS_MAKT' .

DATA generic_obj TYPE REF TO object.

FIELD-SYMBOLS : &amp;lt;attribute&amp;gt;,
                &amp;lt;field&amp;gt;.

START-OF-SELECTION.

  CREATE OBJECT generic_obj TYPE c1.

  ASSIGN  generic_obj-&amp;gt;(attribute_name) TO &amp;lt;attribute&amp;gt;.

  ASSIGN COMPONENT 'MAKTX' OF STRUCTURE &amp;lt;attribute&amp;gt; TO &amp;lt;field&amp;gt;.

  WRITE &amp;lt;field&amp;gt;.   " ls_makt-maktx&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;However in both cases u can access only its public attributes....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Dec 2008 15:13:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-12-08T15:13:42Z</dc:date>
    <item>
      <title>How to access dynamic object.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-dynamic-object/m-p/4921172#M1148342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             I have an issue while working with dynamic obj.actually the scenario is, am implementing one BADI for this object input parameter is ip_object which is type OBJECT (not specific to any class), at runtime class will be assigned this object, here my question is how can i use (attributes and methods) that object in development. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex: A class /SCA/CL_SVDELIVERY is having protected attribute MPO_DLV_REF (MPO_DLV_REF type reff to a structure /SCMB/DM_DELVRY_STR).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to access the above attribute (MPO_DLV_REF) in a BADI /SCMB/BOL_VALFRMWRK method VALIDATE, this VALIDATE method is importing IP_OBJECT which is Type Ref to OBJECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i try to access like this: IP_OBJECT -&amp;gt;MPO_DLV_REF-&amp;gt; (some field name in /SCMB/DM_DELVRY_STR) it is giving error.(Error:MPO_DLV_REF is unknown)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Dec 2008 14:44:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-dynamic-object/m-p/4921172#M1148342</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-08T14:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to access dynamic object.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-dynamic-object/m-p/4921173#M1148343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Venu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Down-cast it into a more specific object ref variable and access its attribute...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA lo_object TYPE REF TO /SCA/CL_SVDELIVERY.

lo_object ?= IP_OBJECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now u can access this &lt;STRONG&gt;lo_object-&amp;gt;MPO_DLV_REF&lt;/STRONG&gt; attribute..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OR&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code like the below example...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*----------------------------------------------------------------------*
*       CLASS c1 DEFINITION                                            *
*----------------------------------------------------------------------*
CLASS c1 DEFINITION.
  PUBLIC SECTION.
    DATA ls_makt TYPE makt.
    METHODS constructor.
ENDCLASS.                    "c1 DEFINITION

*----------------------------------------------------------------------*
*       CLASS c1 IMPLEMENTATION                                        *
*----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
  METHOD constructor.
    SELECT SINGLE * FROM makt INTO ls_makt WHERE spras EQ sy-langu.
  ENDMETHOD.                    "constructor
ENDCLASS.                    "

DATA attribute_name TYPE char40 VALUE 'LS_MAKT' .

DATA generic_obj TYPE REF TO object.

FIELD-SYMBOLS : &amp;lt;attribute&amp;gt;,
                &amp;lt;field&amp;gt;.

START-OF-SELECTION.

  CREATE OBJECT generic_obj TYPE c1.

  ASSIGN  generic_obj-&amp;gt;(attribute_name) TO &amp;lt;attribute&amp;gt;.

  ASSIGN COMPONENT 'MAKTX' OF STRUCTURE &amp;lt;attribute&amp;gt; TO &amp;lt;field&amp;gt;.

  WRITE &amp;lt;field&amp;gt;.   " ls_makt-maktx&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;However in both cases u can access only its public attributes....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Dec 2008 15:13:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-dynamic-object/m-p/4921173#M1148343</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-08T15:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to access dynamic object.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-dynamic-object/m-p/4921174#M1148344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          Thanks for your fast response,it is working fine for public attributes,but how to access protected attributes.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 09:55:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-dynamic-object/m-p/4921174#M1148344</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T09:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to access dynamic object.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-dynamic-object/m-p/4921175#M1148345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Venu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Visibility ( public/protected/private ) is a property of a class... and i don't think it is not possible to view/use a protected component of a class outside it ( exception sub-class/friend )........: (&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jose&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 10:09:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-access-dynamic-object/m-p/4921175#M1148345</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T10:09:16Z</dc:date>
    </item>
  </channel>
</rss>

