ABAP Objects Casting error

Hi,
I have declared two classes with names, ZCL_ONE, ZCL_TWO.
ZCL_TWO is inhering ZCL_ONE.
Now i am using them in the se38 program.
While i use it, Narrow casting is working fine, But widening casting is not working.
It is throwing an exception or a dump if i do not catch an exception.
<i>Code:</i>
DATA: OBJ1 TYPE REF TO ZCL_ONE,
           OBJ2 TYPE REF TO ZCL_TWO.
CREATE OBJECT OBJ1.
OBJ2 ?= OBJ1.
The above code is giving me dump. Any guesses about how to solve it.
I am able to work with the Narrow casting.. which is below code.. It is working fine.
DATA: OBJ1 TYPE REF TO ZCL_ONE,
          OBJ2 TYPE REF TO ZCL_TWO.
CREATE OBJECT OBJ2.
OBJ1 = OBJ2.
How to resolve the error.
Thanks in Advance.

obj1 should be the super(inherited) class of obj2....while using widening cast....
example:
INTERFACE i1.
  DATA a1 TYPE ...
ENDINTERFACE.
INTERFACE i2.
  INTERFACES i1.
  ALIASES a1 FOR i1~a1.
  DATA a2 TYPE ...
ENDINTERFACE.
CLASS c1 DEFINITION.
  PUBLIC SECTION.
    INTERFACES i2.
ENDCLASS.
CLASS c2 DEFINITION INHERITING FROM c1.
  PUBLIC SECTION.
    METHODS m1.
ENDCLASS.
DATA: iref TYPE REF TO i2,
      cref TYPE REF TO c1.
CREATE OBJECT iref TYPE c2.
... iref->a1 ...
... iref->a2 ...
TRY.
  cref ?= iref.
  CALL METHOD cref->('M1').
  CATCH cx_sy_move_cast_error
        cx_sy_dyn_call_illegal_method.
ENDTRY.
Message was edited by:
        Muthurajan Ramkumar

Similar Messages

  • BPS Flat file load ABAP objects migration error.

    Hello
    We are trying to load a flat file via the SAP-GUI and BPS and everything works well in DEV based on the HOw-TO guide. When trying to move the ABAP objects to QA, we get a migration error on the type /1sem/_yth_data_260ZBYAPEPL. Of course the 260ZBYAPEP is relevant to our configuration and in QA we do have the equivalent structure /1sem/_yth_data_614ZBYAPEPL.
    How come the type in DEV does not translate to the equivalent type in QA just like any objects we transport to QA? 
    Thank you all.
    YB.

    Dear YB,
    the element /1sem/_yth_data_260ZBYAPEPL has to be changed according to the QA manually only. Sytem can't change the clent no. automaticaaly when u transport to the QA.
    so in /1sem/_yth_data_260ZBYAPEPL replce 260 with ur QA Client no.
    Narendra Reddy

  • Object casting: confusion in ABAP Objects: Complete Reference book

    Hi,
    During Object Assignments using casting, is a Type Test carried out during the syntax check or at runtime?
    A.5.2.2 (page 1008) of 'ABAP Objects: The Complete Reference' says about Widening Cast: "...you must check at runtime...". However on the next page under A.5.3.2 it says of Widening Cast in Data References: "The syntax check precludes...".
    A.5.4 (page 1010) concerns Assignments between Object Reference Variables, but makes no mention of whether checks are carried out by a syntax check or at runtime.
    Also nowhere does it mention when Type Tests for Narrow casting takes place. Can anyone clear my confusion please? Unfortunatly I don't know enough about this stuff to test by writing some code.
    Thanks.

    William,
    Your questions can be answered by the following rule for object references, which I found in the book "ABAP Objects" by Horst Keller and Sascha Krüger:
    "... that the static type of the target variable must be equal to or more general than the dynamic type of the source variable."
    Here "static type" means the type with which an object reference variable is declared. "Dynamic type" is the type that the object reference variable has at runtime. The dynamic type of an object reference is always more special than its static type, otherwise a runtime error occurs.
    With this rule all your questions can be answered:
    1. The Narrowing Cast is always checked during the syntax check. Example:
    DATA o_ref1 TYPE REF TO object.
    DATA o_ref2 TYPE REF TO class_1.
    o_ref1 = o_ref2.  
    Here the reference o_ref2 has a dynamic type "class_1" or a subclass of it, which is narrower than its static type "class_1", which is narrower than the static type "object" of the reference o_ref1. Therefore, the syntax check says that the assignment is OK.
    2. The Widening Cast is always checked at runtime and requires an assignment using the operator ?=. If you use the operator = in the assignment, a syntax error occurs. Therefore the following  example produces a syntax error (try it yourself):
    DATA o_ref1 TYPE REF TO object.
    DATA o_ref2 TYPE REF TO class_1.
    o_ref2 = o_ref1.  
    The correction for this syntax error is:
    DATA o_ref1 TYPE REF TO object.
    DATA o_ref2 TYPE REF TO class_1.
    o_ref2 ?= o_ref1.
    Now the syntax check is satified, and the correctness of the widening cast is checked at runtime.
    Kind regards,
    Michael Kraemer
    Message was edited by: Michael Kraemer

  • Casting in ABAP Objects

    Why the cast error generates only in Widening cast?

    Hi Shyam,
    WELCOME TO SDN!!!
    Please check this link
    http://abapprogramming.blogspot.com/2007/10/oops-abap-8.html
    The widening cast in this case does not cause an error because the reference airplane actually points to an instance in the subclass lcl_cargo_airplane. The dynamic type is therefore u2018REF TO lcl_cargo_airplaneu2019.
    Here the widening cast produces the MOVE_CAST_ERROR runtime error that can be caught with u201CCATCH ... ENDCATCHu201D, because the airplane reference does not point to an instance in the subclass lcl_cargo_airplane, but to a u201Cgeneral airplane objectu201D. Its dynamic type is therefore u2018REF TO lcl_airplaneu2019 and does not correspond to the reference type cargo_airplane.
    The widening cast logically represents the opposite of the narrowing cast. The widening cast cannot be checked statically, only at runtime. The Cast Operator u201C?=u201D (or the equivalent u201CMOVE ... ?TO u2026u201D) must be used to make this visible.
    With this kind of cast, a check is carried out at runtime to ensure that the current content of the source variable corresponds to the type requirements of the target variables. In this case therefore, it checks that the dynamic type of the source reference airplane is compatible with the static type of the target reference cargo_airplane. If it is, the assignment is carried out. Otherwise the catchable runtime error u201CMOVE_CAST_ERRORu201D occurs, and the original value of the target variable remains the same.
    Best regards,
    raam

  • Error : while converting a WD ABAP object into SAP Transaction

    Hi,
    I am trying to converting a WD ABAP object into SAP Transaction but i am getting the following error while executing the transaction :
    Network Access Message: The page cannot be displayed
    Technical Information (for Support personnel)
    Error Code: 502 Proxy Error. The specified Secure Sockets Layer (SSL) port is not allowed. ISA Server is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests. (12204)
    IP Address: 10.114.6.144
    Date: 4/7/2011 10:41:
    Please help.

    > ISA Server is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests. (12204)
    This seems to be your specific network configuration.  It seems that your corporate network is blocking HTTPS requests which don't use port 443. Your ABAP system is configured to use a port other than 443. Either talk to your basis admins about changing your ABAP system configuration to use port 443 or talk to your network administrators to allow whichever port the ABAP system is running on.

  • Error in TP Abap Objects Programs to MiniWAS 6.20

    Hello,
    I have install the MiniWAS 6.20 to my pc and I am trying to transport the ABAP OBJECTS programs by following the instractions. Unfortunately, the tp ended with error code 8 and the message is:
    Program S_ITAB_ACCESS: Syntax error in line 000060
    You cannot specify the component 'TABLE_LINE' fora generic line type in the current statement. allo
    Can someone tell me what to do in order to complete this transport?
    Thanks in advance

    You can ignore this message, S_ITAB_ACCESS has a syntax error (you can check in se38).
    In 46C the syntax was a little bit different:
    when you paste this code to a 46C system, the syntax check will be ok.
    In higher release it won't be ok. So if you copy it to a customer namerange eg ZS_ITAB_ACCESS and modify like this, it will be ok.
    Since you cannot change program S_ITAB_ACCESS, there is not much you can do with the transport.
    *      READ TABLE tab WITH TABLE KEY table_line = key
        READ TABLE tab WITH KEY table_line = key
    Incho

  • Casting error ABAP dump...

    Hello, I am getting issue when casting is done. I get a ABAP dump. In the constructor of call following code is there. I get dump during "refCX_SubRC  ?= Imp_ExcObj_Ref. "" object casting"
      IF EXC_CLASS_NAME CS 'ZCX_AL_SUBRC'.
            refCX_SubRC  ?= Imp_ExcObj_Ref. "" object casting
            tp_app_log-subobject = CO_LOG_SUBOBJ_AL.
          ENDIF.
    It says, "A cast operation tried to assign a object or interface variable to a refernce variable. However the contents of the source variable do not fir the target.
    Source type, "\PROGRAM=Y4MIG_DIT\CLASS=ZCX_AL_SUBRC"
    Target Type, "CLASS=ZCX_AL_SUBRC".
    Regards,
    Jainam

    Hi.
    Please try.
      TRY.
    It is Cast here.
    refCX_SubRC ?= Imp_ExcObj_Ref. "" object casting
        CATCH CX_SALV_MSG INTO GCL_ROOT.   "#EC NO_HANDLER
      ENDTRY.

  • ABAP Object (Up cast, Down Cast)

    Someone should let me know.
    Version 4.70 Enterprise was as follows.
    " Up Cast (Narrowing-Cast)
      superclass = subclass.
    " Down Cast (Widening-Cast)
      subclass ?= superclass.
    It is why the help of F1 is changed as follows from the version ECC 6.0.
    (Widening-Cast and Narrowing-Cast became reverse.)
    " Up Cast (Widening-Cast)
      superclass = subclass.
    " Down Cast (Narrowing-Cast)
      subclass ?= superclass.

    Hello Tayori,
    You are referring to the link: [ABAP Objects: Narrowing Cast (Upcasting) |http://help-abap.blogspot.com/2008/09/abap-objects-narrowing-cast-upcasting.html], than you must have read the discussion between me and Christian.
    I am not clear why SAP has changed the definition.
    I am on ECC 5.0 and in my F1 defintion it says Narrowing Cast = Upcasting.
    It is better not to use Upcasting or Downcasting terms, as they are with the reference of the your view of Inheritence Tree. So, we can stick to the standard terms like Narrowing and Widening Cast.
    Narrowing:  "More Specific view of an object" to "less specific view".
    Like: BMW to CAR
    Widening: "Less Specific View of an ojbect" to "More Specific view"
    Like: CAR to BMW
    Regards,
    Naimesh Patel

  • Logical Database in Abap Objects

    Hi to All
    I want do it a program report using a Logical Database.
    Is this possible ??? But when I make a GET <node>, occurs the following error:
             "" Statement "ENDMETHOD" missing.  ""
    I'm doing the following:
    CLASS MONFIN IMPLEMENTATION.
           METHOD TRAER_DATOS.
                   GET VBRK.
           ENDMETHOD.
    ENDCLASS.
    Please, somebody tell me how I use the logical database in Abap Objects.
    Thank you very much
    Regards
    Dario R.

    Hi there
    Logical databases whilst of "some use" are not really part of OO.
    If you want to use a logical database in an abap OO program I would create a special class which just does the get data from your DB and pass this either at record or table level.
    Techniques such as GET XXXX LATE aren't really part of any OO type of application since at Object Instantiation time you should be able to access ALL the attributes of that object.
    As far as OO is concerned Logical databases are a throwback to "Dinosaur Technology".
    Since however modules such as SD and FI are still heavily reliant on relational structures (i.e linked tables etc)  then there is still some limited life in this stuff but for OO try and solve it by another method.
    If you really must use this stuff in OO then do it via a FMOD call and save the data in a table which your method will pass back to your application program.
    You can't issue a GET command directly in a method.
    Cheers
    Jimbo

  • Exception 'error_message' in ABAP Objects

    I've got a heterogeneous scenario with new program parts in ABAP objects and older parts in classical ABAP.
    In the older parts some R/3 standard functions are called which dump dialog messages which are not allowed at that state of the program flow ('on commit').
    The simple solution in classical ABAP was to use standard exception 'error_message' in the top level 'call function' statement thus catch all dialog messages in lower levels.
    I am looking for an analog solution in object oriented ABAP. But exception 'error_message' is not allowed with 'call method'. It cannot be defined statically in the methods declaration. And the system exception caused by the dialog error message is not included in the set of catchable system errors.
    I would be grateful for any hints concerning this problem.

    Hi
    Excuse me! But I didn't want to sent you my answer.
    Anyway:
    CLASS lcl_my_class DEFINITION.
      PUBLIC SECTION.
        METHODS my_method
                  EXPORTING
                    EXCEPTION TYPE CHAR1
                  EXCEPTIONS error_messages.
    ENDCLASS.                    "LCL_MY_CLASS DEFINITION
    CLASS lcl_my_class IMPLEMENTATION.
      METHOD my_method.
        IF EXCEPTION = 'X'.
          MESSAGE e208(00) WITH 'Message error'
                      RAISING error_messages.
        ELSE.
          MESSAGE I208(00) WITH 'OK!'.
        ENDIF.
      ENDMETHOD.                    "MY_METHOD
    ENDCLASS.                    "LCL_MY_CLASS IMPLEMENTATION
    So you did want to do a call like this:
    CALL METHOD lcl_my_class=>my_method
       EXCEPTIONS
         error_messages = 1
         error_message  = 2
         OTHERS         = 3.
    No! you can't do it, but you try to insert your call in fm where you use ERROR_MESSAGE addition. I think you can do it if your methods are std.
    Max
    Message was edited by: max bianchi

  • How to use LDB PNP with ABAP objects in a program

    Hello,
    I am wondering if anybody has used the HR logical database(LDB) PNP with user defined ABAP objects in a program? I am using the FM- <b>LDB_PROCESS</b> but its not working. Also assigning PNP in the attributes section of the program -- so that I can use predefined fields from the LDB and then invoking the FM doesn't work -- throwing 'Logical database already active' error.
    I suppose even with the ABAP objects and the new FM -- I should still be able to utilize the pre-defined fields of the PNP database -- and also the built in authorizations. I cannot use GET PERNR and REJECT as they give errors. I understand that the use of HR-macros (RP-PROVIDE-FROM-LAST and et al.) are not allowed as they use the table work area -- which is not allowed in ABAP-OOPS.
    I would really appreciate if anyone could show me some insight regarding this. Thank you.
    Kshitij R. Devre

    Hi Kshitij
    It would be really good if we could use both together. But as I know, it is not possible. "GET pernr." is an event-like loop statement and so cannot be used in OO context. And I guess, the same restriction holds for the "LDB_PROCESS" since it uses LDB-specific processing.
    What I suggest you is to use standard and BAPI functions.
    Sorry for giving bad news...
    *--Serdar

  • Cast error in java sound

    Hey, i got a little run-time error:
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: com.sun.media.sound.PortMixer$PortMixerPort
    the code segment it occurs at is here:
    case 0:
          targetDataLine1 = (TargetDataLine)mixer1.getLine(targetInfo);
          targetDataLine2 = targetDataLine1;
    }Some background info: I used getTargetLines() method of Mixer to obtain an arraylist of all the Line.Info objects (for targetLines) in a mixer, then I passed this into a GUI class, and made a vector to display in combo box. once user selects an item, it casts it back into Line.Info, and calls the mixer's "getLine()" method to retrieve the line. But I get the cast error. I know you can cast from Line to TargetDataLine (since TargetDataLine is a subinterface of Line) -- and I saw it on a tutorial, so I don't know what's wrong. Any help?
    If you need more info, just tell me.

    But still, the tutorial I looked at
    (http://java.sun.com/j2se/1.5.0/docs/guide/sound/progr
    ammer_guide/chapter3.html#113154)
    still showed it down-casting from a Line object to a
    TargetDataLine object.
    You need to understand the difference between a reference and an object. The object itself was a TargetDataLine object, otherwise the cast wouldn't have worked. The reference to it was of type Line.
    // obj is a reference of type Object. The object it points to is a String:
    Object obj = "I am a String";
    // Which explains why this works:
    String s = (String)obj;
    // and why this fails:
    Integer i = (Integer)obj;
    Not to mention, the java API says that the
    getLine(Line.Info) object returns an object of type
    Line.
    And I still don't understand why you can't cast from
    a superclass to a subclass. I know intuitively, it
    makes since, since not all RECTANGLES are SQAURES,
    but all SQUARES are RECTANGLES. But still, I know
    enough programming to remember numerous instances of
    casting Object as other classes....
    See above.
    Oh, and what does the $ symbol in
    com.sun.media.sound.PortMixer$PortMixerPort mean?It means that the the class PortMixerPort is an inner class (or nested class, I never remember the difference :-) in the class PortMixer.

  • SAP NetWeaver 2004s ABAP Trial Version - error code = 200

    Hi all,
    installation of SAP NetWeaver 2004s ABAP Trial Version
    which was attached to the book ABAP-Objects ends again and again with
    ProductException: (error code = 200; message="Java error"; exception = java.lang.Exception)
    Attached you find information about
       1) Host-file
       2) Network connections
       4) Error - Log
    It seems that the      [#     [#]
    echo                7/tcp
    echo                7/udp
    discard 
               9/tcp    sink null
    discard             9/udp    sink null
    systat             11/tcp    users            
         #Active users
    systat             11/tcp    users                  #Active users
    daytime            13/tcp
    daytime
               13/udp
    qotd               17/tcp    quote                  #Quote of the day
    qotd               17/udp    quote   
                  #Quote of the day
    chargen            19/tcp    ttytst source          #Character generator
    chargen        
    4) == E R R OR  L O G ================================================
    (Jan 1, 2007 1:07:15 PM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err,
      an error occurred and product installation failed.  Look at the log file D:SAPNSPlog.txt for details.
    (Jan 1, 2007 1:07:15 PM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err,
    ProductException: (error code = 200; message="Java error"; exception = java.lang.Exception)
    STACK_TRACE: 15
    ProductException: (error code = 200; message="Java error"; exception = java.lang.Exception)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.execute(StepWrapperInstallFiles.java:254)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllSteps(StepWrapperInstallFiles.java:224)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllInstallationSteps(StepWrapperInstallFiles.java:177)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.install(StepWrapperInstallFiles.java:268)
         at com.installshield.product.service.product.PureJavaProductServiceImpl.installProductAction(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.getResultForProductAction(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitComponent(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitInstallableComponents(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitProductBeans(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.install(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$Installer.execute(Unknown Source)
         at com.installshield.wizard.service.AsynchronousOperation.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    (Jan 1, 2007 1:12:17 PM), Install, com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct, err,
    An error occurred and product uninstallation failed.  Look at the log file D:SAPNSPlog.txt for details.
    (Jan 1, 2007 1:12:17 PM), Install, com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles, err,
    ProductException: (error code = 200; message="Java error"; exception = java.lang.Exception)
    STACK_TRACE: 15
    ProductException: (error code = 200; message="Java error"; exception = java.lang.Exception)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.execute(StepWrapperInstallFiles.java:254)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllSteps(StepWrapperInstallFiles.java:224)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.executeAllUninstallationSteps(StepWrapperInstallFiles.java:192)
         at com.sap.installshield.sdcstepswrapper.StepWrapperInstallFiles.uninstall(StepWrapperInstallFiles.java:313)
         at com.installshield.product.service.product.PureJavaProductServiceImpl.uninstallProductAction(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.processActionsFailed(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitComponent(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitInstallableComponents(Unknown Source)
         at com.installshield.product.service.product.InstallableObjectVisitor.visitProductBeans(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.install(Unknown Source)
         at com.installshield.product.service.product.PureJavaProductServiceImpl$Installer.execute(Unknown Source)
         at com.installshield.wizard.service.AsynchronousOperation.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source
    == Remark to threads ========================
    Thread a)
    "I found it is very useful to have a clean system" => not applicable to me
    Thread b)
    deals with removing relics of previous installations => hints considered but error still appears
    Thread c)
    not applicable to me

    Hi all
    I've read your entrys.
    Saw that the solution is missing.
    It can be found in the manuals:
    1. Download the "Registry Clean Tool for SAP NetWeaver 2004s ABAP" and use it.
    2. Download the latest Version of "SAP NetWeaver 2004s ABAP" and un-rar it.
    3. Install the "Microsoft Loopback Adapter" an activate it.
    4. Retry to install.
    Summary:
    So the error 200 was caused for the first time from trying an installation without a Loopback Adapter, and after that from trying to re-install without cleaning the registry.
    Now its working fine.
    Thomas

  • ABAP Objects and table processing (with logical databases)

    I have a report that is written right now using procedural abap and a logical database.  The report is structured follows (high level):
    start-of-selection.
    get pernr.
      perform get_it0001 using wtab.
      perform get_it0002 using wtab.
      perform get_it0003 using wtab.
      append wtab to itab.
    end-of-selection.
      call function 'reuse_alv_grid_display'
        exporting
          i_structure_name       = 'itabstructure'
        tables
          t_outtab               = itab.
    So basically I'm going through a bunch of personnel numbers, getting a few infotypes and outputting to ALV.  I don't see where ABAP Objects is going to help me for this particular program. 
    Can somebody show me where OO ABAP would make this easier?  Does it even make sense to use OO when you're processing with a logical database?  (Not just PNP, but any logical database in general).
    Thanks in advance.

    Hello Lee
    I assume that the routines GET_ITnnnn are written by yourself. For reading infotypes ABAP Objects provides us with same very helpful classes as shown below:
    * define data
      DATA:
        gif_employee      type ref to if_pt_employee,
        go_employee       type ref to cl_pt_employee,
        gt_infotypes      TYPE tim_tmw_itlist_tab,
        go_control        TYPE REF TO if_pt_td_control,
        go_data           TYPE REF TO if_pt_td_base,
        go_pnnnn          TYPE REF TO if_pt_td_itnnnn,
        gt_p0001          TYPE TIM_P0001_TAB,
        gt_p0002          TYPE TIM_P0002_TAB,
        gt_p0003          TYPE TIM_P0003_TAB.
    start-of-selection.
    GET pernr.
    <b>* Create employee instance</b>
      gif_employee = cl_pt_employee=>get_employee( pernr ).
      go_employee ?= gif_employee.
    <b>* Get master infotypes (0001, 0002)</b>
      CALL METHOD go_employee->get_master_data
        EXPORTING
          im_begda = id_fromdate
          im_endda = id_todate
        IMPORTING
    *      EX_I0000 =
          EX_I0001 = gt_p0001
          EX_I0002 = gt_p0002
    *      EX_I0007 =
    *      EX_I0008 =
    <b>* Append all other required infotypes to itab</b>
      APPEND '0003' TO gt_infotypes.
      CALL METHOD go_employee->get_infotypes
        EXPORTING
          i_itlist      = gt_infotypes
          i_fromdate    = id_fromdate  " start date
          i_todate      = id_todate    " end date
    *      I_FILTER      =
          i_noauthcheck = 'X'
        IMPORTING
          e_result      = gt_infty_request
          e_retcd       = gd_retcd.
    * Please see documentation of parameter e_retcd...
      LOOP AT gt_infty_request INTO go_control.
        go_data = go_control->data.  <b>" get data object</b>
    *   Casting
        TRY.
            go_pnnnn ?= go_data.
          CATCH cx_sy_move_cast_error.
            CONTINUE.
        ENDTRY.
    <b>*   Convert infotype (semi-transparent -> transparent)</b>
        CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
          EXPORTING
            prelp = lo_pnnnn->prelp
          IMPORTING
            pnnnn = gs_p0003.
        APPEND gs_p0027 TO gt_p0003.
      ENDLOOP.
    The class CL_PT_EMPLOYEE provides us already with very easy access to so-called master infotypes (000, 0001, 0002, 0007 and 0008). All other infotypes can be read using method GET_INFOTYPES.
    Using these classes we have a very convenient and standardized way of accessing all kinds of infotypes.
    Regards
      Uwe

  • Abap objects and selection screen

    Hello everybody,
    I am interested in your ways of implementing selection-screens in the style of ABAP Objects.
    In earlier times (when I used to implement ABAP objects in a procedural way) I just put the selection-screen commands in an include or a form routine of my ABAP report. So it was possible to run the report in background.
    Now I read something about selection-screens/dynpros and "separation of concerns" in the book "ABAP Objects" written by Keller. He advises using function groups to encapsulate presentation from logical matters. (Selection-screen commands are in an automatically generated include now). I implemented this way. (ABAP report with a local class, which has a main method, where function module of the function group is called). It works, but i see no chance to run my report in background now.. but I need to run the report in background.
    Does anybody know a solution without deleting function group?
    What do you think is the best way of using selection-screen-commands and ABAP Objects, especially regarding running in background?
    Thx for your advise in advance.
    Kind regards,
    Anne

    Hi Naimesh,
    thx for explanation. I am not sure, if I understood everything in the right way.
    Where do you write the code for building the selection-screen? (PARAMETERS, SELECT-OPTIONS etc.)
    If you write these commands in a class method, you will get a syntax error ( because it's forbidden per definition of ABAP objects). So, am I right assuming that you put the coding just at the beginning of the ABAP report ? And after START-OF-SELECTION-event you start the processing... ?
    Furthermore, I don't really understand why you create an separate class for ALV. I found your "SAP abap help"-blog, where you explained the concept of MVC ((By the way, well done!), but you didn't mention an "ALV class" there..
    Mh.. another question - have you ever combined MVC with object services?
    At the moment I'm working on a software project where I use object services. I created 2 persistent classes via SE24 and one local class in my ABAP Report.
    I don't really see possibility to implement MVC in this project without change very much of coding and class structure...
    In my opinion the M (data&business logic) are my existing global classes and my local class is kind of Controller class?!
    Thx in advance,
    Anne

Maybe you are looking for

  • Itunes Match is activated on my computer but it is not active on AppleTV (2nd generation).

    On apple tv(2nd gen) the "Music" icon or Itunes Match asks me to turn on imatch on my computer. Ive subscribed to itunes match, its turned on on my Mac desktop. itsbeen on for weeks yet no acknowledgement from appletv. i have the new update for ATV.

  • How to disable block(update allowed) when data are retrive ?

    Dear mates, I have a form where are two blocks one is A_MASTER and A_DETAIL. By default A_DETAIL update allowed property is false. What happen when i insert data ? It's allow data to insert but don't permit to edit the data. So, I write When-New-Reco

  • Imovie takes a long time to export

    I Edited in iMovie a two-hour movie, I added music and transitions. And now takes three hours to export and said that will export the full movie after 94 hours.Is a long time. How can I try trahat it takes fewer time to export. For example 4 hours

  • Using AT USER COMMAND

    good day, i have question in using the at user command, because i want to translate all the text( starting from column 27 onwards) in my report if it is clicked, im using translate syntax, how will my syntax go? at user command. if sy-cucol > 27. tra

  • Gap between columns in sql output

    Dear all, We have the below query : column queue_name format a15 column max_processes format 999 column target_node format a10 column actual_processes format 999 column pending format 999 column running format 999 column onhold format 999 column sche