ABAP OO Doubt - validate call method.

Hi experts
I'm beginer in ABAP OO and i created this code :
output-cep = ch_adrc_struc-post_code1.
             TRY.
                 CREATE OBJECT lr_cep.
               CATCH cx_ai_system_fault .
             ENDTRY.
             TRY.
                 CALL METHOD lr_cep->si_servico_cep_out
                   EXPORTING
                     output = output
                   IMPORTING
                     input  = input.
               CATCH cx_ai_system_fault .
             ENDTRY.
My doubt is : How to know the call method worked?
In call function i use = if sy-subrc = 0 for check the return but can i use it after call method ?
thanks a lot.

there is an importing which is used to get back data.
once you process input then you can decide whether method worked or not.

Similar Messages

  • Doubt in call method program

    hi,
    I am getting error as i marked BOLD in this program...can u give solutions for that..
    REPORT  YSBDC6.
    TABLES:LFA1.
    DATA:BEGIN OF ITAB OCCURS 0,
         LIFNR LIKE LFA1-LIFNR,
         LAND1 LIKE LFA1-LAND1,
         NAME1 LIKE LFA1-NAME1,
         END OF ITAB.
    DATA:BEGIN OF JTAB OCCURS 0.
         INCLUDE STRUCTURE BDCDATA.
    DATA:END OF JTAB.
    DATA:BEGIN OF KTAB OCCURS 0.
         INCLUDE STRUCTURE BDCMSGCOLL.
    DATA:END OF KTAB.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
      FILENAME = 'C:\PRABA.TXT'
      FILETYPE = 'ASC'
      HAS_FIELD_SEPARATOR = 'X'
      CHANGING
        DATA_TAB = ITAB[].
       LOOP AT ITAB[] INTO ITAB.
        REFRESH JTAB.
        PERFORM SUB USING 'YVTRANS' '100'.
        PERFORM SUB1 USING:'LFA1-LIFNR' ITAB-LIFNR,
                           'LFA1-LAND1' ITAB-LAND1,
                           'LFA1-NAME1' ITAB-NAME1.
        PERFORM SUB1 USING 'BDC_OKCODE' 'INSERT'.
        CALL TRANSACTION 'YVTRANS' USING JTAB MODE 'A' MESSAGES INTO KTAB.
        LOOP AT KTAB.
        IF KTAB-MSGTYP = 'I' OR KTAB-MSGNR = 000.
          WRITE: /1 'vendor', 15 ITAB-LIFNR, 25 'INSERTED'.
          ELSEIF
            KTAB-MSGTYP ='E' OR KTAB-MSGNR = 001.
            WRITE: /1 'vendor', 15 ITAB-LIFNR, 25 'NOT INSERTED'.
            ENDIF.
            <b>REFRESH KTAB."ERROR IN THIS LINE 'YOU MAY NOT
            "Delete or overwrite table 'ktab' with in a loop through itself</b>
          ENDLOOP. 
       ENDLOOP.
            FORM SUB USING A B.
            CLEAR JTAB.
            JTAB-PROGRAM = A.
            JTAB-DYNPRO = B.
            JTAB-DYNBEGIN = 'X'.
            APPEND JTAB.
            ENDFORM.
        FORM SUB1 USING C D.
          CLEAR JTAB.
          JTAB-FNAM = C.
          JTAB-FVAL = D.
          APPEND JTAB.
          ENDFORM.

    HI,
    thanks for both..for immediate response..my PC got struck up that why i could not
    after editing this program i got error like YVTRANS not found..that means i have written seperate code for YVTRANS like below..is it correct..can u give solution for this..
    REPORT  YVTRANS.
    TABLES:LFA1.
    *DATA: WA TYPE LFA1.
    *ITAB TYPE TABLE OF LFA1.
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'INSERT'.
          INSERT LFA1.
          IF SY-SUBRC = 0.
            MESSAGE I000(0) WITH 'RECORD INSERTED'.
            ELSE.
              MESSAGE E001(0) WITH 'NOT INSERTED'.
              ENDIF.
              WHEN 'EXIT'.
                LEAVE PROGRAM.
                ENDCASE.
                ENDMODULE.
    orginal program
    REPORT  YSBDC6.
    TABLES:LFA1.
    DATA:BEGIN OF ITAB OCCURS 0,
         LIFNR LIKE LFA1-LIFNR,
         LAND1 LIKE LFA1-LAND1,
         NAME1 LIKE LFA1-NAME1,
         END OF ITAB.
    DATA:BEGIN OF JTAB OCCURS 0.
         INCLUDE STRUCTURE BDCDATA.
    DATA:END OF JTAB.
    DATA:BEGIN OF KTAB OCCURS 0.
         INCLUDE STRUCTURE BDCMSGCOLL.
    DATA:END OF KTAB.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
      FILENAME = 'C:\PRABA.TXT'
      FILETYPE = 'ASC'
      HAS_FIELD_SEPARATOR = 'X'
      CHANGING
        DATA_TAB = ITAB[].
       LOOP AT ITAB[] INTO ITAB.
        REFRESH JTAB.
        PERFORM SUB USING 'YVTRANS' '100'.
        PERFORM SUB1 USING:'LFA1-LIFNR' ITAB-LIFNR,
                           'LFA1-LAND1' ITAB-LAND1,
                           'LFA1-NAME1' ITAB-NAME1.
        PERFORM SUB1 USING 'BDC_OKCODE' 'INSERT'.
        CALL TRANSACTION 'YVTRANS' USING JTAB MODE 'A' MESSAGES INTO KTAB.
        LOOP AT KTAB.
        IF KTAB-MSGTYP = 'I' OR KTAB-MSGNR = 000.
          WRITE: /1 'vendor', 15 ITAB-LIFNR, 25 'INSERTED'.
          ELSEIF
            KTAB-MSGTYP ='E' OR KTAB-MSGNR = 001.
            WRITE: /1 'vendor', 15 ITAB-LIFNR, 25 'NOT INSERTED'.
            ENDIF.
            ENDLOOP.
          REFRESH KTAB.
       ENDLOOP.
            FORM SUB USING A B.
            CLEAR JTAB.
            JTAB-PROGRAM = A.
            JTAB-DYNPRO = B.
            JTAB-DYNBEGIN = 'X'.
            APPEND JTAB.
            ENDFORM.
        FORM SUB1 USING C D.
          CLEAR JTAB.
          JTAB-FNAM = C.
          JTAB-FVAL = D.
          APPEND JTAB.
          ENDFORM.

  • CALL METHOD ABAP run SQL wrong

    Dear All
             I have a problem in ABAP connect SQL,Below is my code snippet sentence.
    CONCATENATE 'Insert Into [timportcortrol]'
                    '(zucode,zstate,zdate,zkind) Values('''
                      VG_PCID ''','''
                      '1'','''
                      SY-DATUM ''','''
                      '1' ''')'
                     INTO SQL.
        CALL METHOD OF REC 'Execute'
         EXPORTING #1 = SQL
         #2 = CON
         #3 = '1'.
    IF NOT SY-SUBRC = 0.
        MESSAGE I000 WITH 'Download  to [timportcortrol] failure,Please Check the SQL Connect!!! '.
        EXIT.
      ENDIF.
    Con:is the connect SQL String ,the connect SQL is Okay.
    I debug this code,when I used u2018Select u2026sentenceu2019,the program can work.if I  use u2018insert intou2019 then canu2019t work,but I copied the SQL of the u2018inset Into sentenceu2026u2019run it into SQL server then it can work also.
    And I found the SY-SUBRC eq u20182u2019.whatu2019s mean about of the sy-subrc eq u20182u2019.
    I think the insert into sentence in abap I have write the wrong ,but I canu2019t assurance.
    The Insert Into Sentence is:u2019 Insert Into [timportcortrol](zucode,zstate,zdate,zkind) Values('20080807094713','1','20080807','1')u2019
    Could you give me some advice for this issue?
    Thanks of all
    Sun.

    Have you checked whether it's a problem with mixed case?  Some SQL dialects are case sensitive.
    The not very helpful meanings of the sy-subrc value can be found in ABAP help.
    0 Successful processing of the method meth.
    1 Communication Error to SAP GUI.
    2 Error when calling method meth.
    3 Error when setting a property.
    4 Error when reading a property
    matt

  • Calling method of a custom infotype from ABAP

    Hi Experts,
    I am working on an application where i need to call a method of a custom defined infotype.
    I have done this -->
    1. Create a custom infotype 9111
    2. SAP creates a class of that infotype ZCL_HRPA_INFOTYPE_9111
    3. Inside this method there are few inherited method which provide me functionality of insert , update , delete
    i want to call methods IF_HRPA_INFTY_BL~MODIFY,
    IF_HRPA_INFTY_BL~INSERT
    However when i call these method from abap report this method does not work.
    where as when i try to insert an entry using PA30 transaction it works.
    Does anyone know why does this happen and what is the solution?
    Regards,
    Ashish Shah

    Had the same problem (probably copied from the same program). The answer is that you need to commit the work at the end using something like
    * Commit
    CALL METHOD busilog->flush
      EXPORTING
        no_commit = space.
    Here is an example of my code for IT0002 which works.
    *& Report  Z_TEST2
    REPORT  z_test2.
    DATA: a_masterdata_bl TYPE REF TO if_hrpa_masterdata_bl,
          p0002         TYPE p0002,
          lo_0002 TYPE REF TO cl_hrpa_infotype_0002,
          ls_p0002_ref TYPE REF TO data,
          container_tab    TYPE hrpad_infty_container_tab,
          container  TYPE REF TO if_hrpa_infty_container,
          message_handler TYPE REF TO cl_hrpa_message_list,
          infotype_logic TYPE REF TO if_hrpa_infty_bl,
          update_mode TYPE hrpad_update_mode VALUE 'XXX',
          lt_0002_container TYPE REF TO cl_hrpa_infotype_container,
          key TYPE pskey,
          l_is_ok          TYPE boole_d.
    FIELD-SYMBOLS <p0002> TYPE p0002.
    * get business logic from masterdata factory
    CALL METHOD cl_hrpa_masterdata_factory=>get_business_logic
      IMPORTING
        business_logic = a_masterdata_bl.
    * CATCH cx_hrpa_violated_assertion .
    *ENDTRY.
    *TRY.
    CALL METHOD a_masterdata_bl->read
      EXPORTING
        tclas           = 'A'
        pernr           = '508'
        infty           = '0002'
        begda           = sy-datum
        endda           = sy-datum
        no_auth_check   = 'X'
        message_handler = message_handler
      IMPORTING
        container_tab   = container_tab
        is_ok           = l_is_ok
    * CATCH cx_hrpa_violated_assertion .
    *ENDTRY.
    READ TABLE container_tab INTO container INDEX 1.
    lt_0002_container ?= container.
    TRY.
        CALL METHOD lt_0002_container->primary_record_ref
          IMPORTING
            pnnnn_ref = ls_p0002_ref.
      CATCH cx_hrpa_violated_assertion.
    ENDTRY.
    ASSIGN ls_p0002_ref->* TO <p0002>.
    MOVE-CORRESPONDING <p0002> TO key.
    break stantric.
    <p0002>-vorna = 'Rick'.
    container ?= lt_0002_container->modify_primary_record( <p0002> ).
    TRY.
        CREATE OBJECT lo_0002
          EXPORTING
            tclas = 'A'
            infty = '0002'.
      CATCH cx_hrpa_violated_assertion .
    ENDTRY.
    CREATE OBJECT message_handler.
    TRY.
        CALL METHOD lo_0002->get_specific_bl
          EXPORTING
            versionid      = '01'
            tclas          = 'A'
            pskey          = key
          IMPORTING
            infotype_logic = infotype_logic.
      CATCH cx_hrpa_violated_assertion .
    ENDTRY.
    TRY.
        CALL METHOD infotype_logic->modify
          EXPORTING
            old_container   = lt_0002_container
            massn           = space
            massg           = space
            update_mode     = update_mode
            no_auth_check   = 'X'
            message_handler = message_handler
          IMPORTING
            is_ok           = l_is_ok
          CHANGING
            container       = container.
      CATCH cx_hrpa_violated_assertion .
    ENDTRY.
    * Commit
    CALL METHOD a_masterdata_bl->flush
      EXPORTING
        no_commit = space.

  • Is it possible to call methods of JAVA objects from ABAP?

    Hi all,
    Does anyone know if it is possible to call methods of java classes from ABAP?
    Regards,
    Sukru

    Hi,
    Yes we can access the classes of JAVA in ABP.
    This is posible from version ECC 6 onward with NETWEAVER atrhcitecuture.
    Pls go through this link-
    http://help.sap.com/saphelp_nw04s/helpdata/en/84/54953fc405330ee10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/e1/b5443e02a9ab4186a6e1240a9a2455/frameset.htm
    Here also we use the JCO connector  objects
    These clearly show the methods to use JAVA.
    <removed_by_moderator_together_with_points>
    Regards
    Chandralekha
    Edited by: Julius Bussche on Jul 8, 2008 5:58 PM

  • ABAP OOP / Calling Method  ...Help

    Trying out few oop codes....
    While calling class instance methods and passing parameters, when to use the following syntax.
    data: cvar  type ref to class1.
             cvar->method( exporting variable1 = value )
           (or) some time i see sample codes with out key  word 'exporting'
                  cvar->method(  variable1 = value  ) .
           (or)
                  cvar->method(  value  ) .
           (or) some times with key word CALL  METHOD
       CREATE OBJECT cvar
       CALL METHOD cvar->method
       EXPORTING
       variable1 = value. 
    Tried out a uniform way of calling ,but getting errors.Any inputs please..
    Thanks,
    Bvan

    Bhavan,
      First  declare the class.
      Implement the class.
    Declare the Class reference variable
    Create the class object.
    call the method.
      data: cvar type ref to class1.
              CREATE OBJECT cvar
    Calling Methods
    To call a method, use the following statement:
    CALL METHOD <meth> EXPORTING... <ii> =.<f i>...
                       IMPORTING... <ei> =.<g i>...
                       CHANGING ... <ci> =.<f i>...
                       RECEIVING         r = h
                       EXCEPTIONS... <ei> = rc i...
    The way in which you address the method <method> depends on the method itself and from where you are calling it. Within the implementation part of a class, you can call the methods of the same class directly using their name <meth>.
    CALL METHOD <meth>...
    Outside the class, the visibility of the method depends on whether you can call it at all. Visible instance methods can be called from outside the class using
    CALL METHOD <ref>-><meth>...
    where <ref> is a reference variable whose value points to an instance of the class. Visible instance methods can be called from outside the class using
    CALL METHOD <class>=><meth>...
    where <class> is the name of the relevant class.
    When you call a method, you must pass all non-optional input parameters using the EXPORTING or CHANGING addition in the CALL METHOD statement. You can (but do not have to) import the output parameters into your program using the IMPORTING or RECEIVING addition. Equally, you can (but do not have to) handle any exceptions triggered by the exceptions using the EXCEPTIONS addition. However, this is recommended.
    You pass and receive values to and from methods in the same way as with function modules, that is, with the syntax:
    ... <Formal parameter> = <Actual parameter>
    after the corresponding addition. The interface parameters (formal parameters) are always on the left-hand side of the equals sign. The actual parameters are always on the right. The equals sign is not an assignment operator in this context; it merely serves to assign program variables to the interface parameters of the method.
    If the interface of a method consists only of a single IMPORTING parameter, you can use the following shortened form of the method call:
    CALL METHOD <method>( f).
    The actual parameter <f> is passed to the input parameters of the method.
    If the interface of a method consists only of IMPORTING parameters, you can use the following shortened form of the method call:
    CALL METHOD <method>(....<ii> =.<f i>...).
    Each actual parameter <f i > is passed to the corresponding formal parameter <i i >.
    Pls. mark if useful

  • How to call methods at selection screen?

    Hi all,
    I am developing a program in object oriented abap.
    i have defined a class and implementated, and we have to instantiate the class in start of selection.
    now the problem is how to call a method at selection screen event.
    i want to validate the inputs entered by users. so can i create a static method which can be called without instantiating a class?
    please guide me
    thanks

    Hello Mr A,
    Define the method as a Static Method and that will solve your problem. Static methods can be called directly and does not need the class to be instantiated before it can be called.
    Data: my_class type ref to zcl_report_utilities.
    At Selection-Screen.
    Call Method zcl_report_utilities=>check_selections
           exporting
              iv_repnm    = sy-cprog
            importing
              et_messages = lt_msgs.
    Start-Of-Selection.
      Create Object my_class
             exporting
                im_pernr  = ls_e1plogi-objid
                im_begda = c_lowdate
                im_endda = c_hidate.
       Call Method my_class->read_infotypes
              exporting
                 im_infty = c_org_assn
              changing
                 et_infty  = it_infty.
    Here you can see how the method check_selections is called before the class zcl_report_utilities is instantiated. The best part about the Static Methods is if you are writing the class in the Class Library (SE24), any other programs can call them directly (if they need to) without needing to instantiating the entire class before the call.
    Also note the difference in syntax when calling the static method check_selections to when calling the Instance method read_infotypes.
    Hope this solves your issue and please do not forget to reward points.
    Cheers,
    Sougata.
    p.s. if you are defining your class locally (program specific) then use Class-Methods to define a static method.
    Edited by: Sougata Chatterjee on May 1, 2008 9:53 AM

  • Calling methods of business objects

    hi
    pls post some docs on calling methods in business obj's from abap programs.
    thkx
    P.S

    Do you share your solution?
    For other people interested, example for FMPSO object:
    INCLUDE <cntn01>.
      DATA : l_lotkz TYPE bkpf-lotkz,
             l_order TYPE swc_object,
             lt_fimsg LIKE fimsg1 OCCURS 0.
      DATA : BEGIN OF ls_key,
            sourcecompanycode LIKE vbkpf-ausbk,
            requestnumber LIKE vbkpf-lotkz,
             END OF ls_key.
        swc_container lt_container.
        ls_key-sourcecompanycode = 'value'.
        ls_key-requestnumber     = 'value'.
        swc_create_object l_order 'FMPSO' ls_key.
        IF sy-subrc EQ 0.
    * Validate
          swc_call_method l_order 'FlagReleaseSet' lt_container.
          IF sy-subrc NE 0.
            MESSAGE  e000(zz).
          ELSE.
    * Post
            swc_call_method l_order 'PostAll' lt_container.
            swc_get_table lt_container 'TFimsg' lt_fimsg.
            IF sy-subrc NE 4 AND sy-subrc NE 0.
               MESSAGE  e000(zz).
           ENDIF.
         ENDIF.
       ENDIF.

  • Error calling methods CL_GUI_FRONTEND_SERVICES

    Hi all,
    I have a requirement in BAPI (integrating solman to portal) to download file from app. server to local directory. I used the below FM to get temp directory of presntation server.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_TEMP_DIRECTORY
       CHANGING
         TEMP_DIR             =  LV_TEMP_DIR
       EXCEPTIONS
         CNTL_ERROR           = 1
         ERROR_NO_GUI         = 2
         NOT_SUPPORTED_BY_GUI = 3
         others               = 4.
       CALL METHOD cl_gui_cfw=>flush.
    It works fine in R3, but when i called it from portal it shows Access not possible using 'NULL' object reference with a short dump .
    st22 shows
    Error in ABAP application program.
    The current ABAP program "CL_GUI_FRONTEND_SERVICES======CP" had to be
    terminated because one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    An exception occurred. This exception is dealt with in more detail belo
    . The exception, which is assigned to the class 'CX_SY_REF_IS_INITIAL',
    neither
    caught nor passed along using a RAISING clause, in the procedure
    "GET_TEMP_DIRECTORY" "(METHOD)"
    Since the caller of the procedure could not have expected this exceptio
    to occur, the running program was terminated.
    The reason for the exception is:
    Attempt to access a component using 'NULL' object reference (points
    to nothing).
    An object reference must point to an object (an instance of a class)
    before you can use it to access components (variable:
    "CL_GUI_FRONTEND_SERVICES=>HANDLE").
    Either the reference has not yet been set, or it has been reset to
    'NULL' by a CLEAR statement.
    When i put external break point and the dump comes during execution of CALL METHOD cl_gui_cfw=>flush.
    Is it not possible to use CL_GUI_FRONTEND_SERVICES in RFC ??.
    thanks and regards
    Jijo

    Hi,
    the dump is because you cannot use that function from a BSP application, which runs in internet or intranet. The procedure in this case is different:
    DATA: flights  TYPE flighttab,
            flight   LIKE LINE OF flights,
            appl     TYPE string,
            filetype TYPE string,
            output   TYPE string,
            output2  TYPE xstring,
            response     TYPE REF TO if_http_response,
            l_len        TYPE i,
            seatsmax     TYPE string,
            seatsocc     TYPE string.
      appl = 'application/msexcel'.
      filetype = 'attachment;filename=mi archivo.xls'.
      SELECT * FROM sflight
         INTO TABLE flights
         UP TO 20 ROWS.
      LOOP AT flights INTO flight.
        seatsmax = flight-seatsmax. CONDENSE seatsmax.
        seatsocc = flight-seatsocc. CONDENSE seatsocc.
        CONCATENATE output
        flight-carrid cl_abap_char_utilities=>horizontal_tab
        flight-connid cl_abap_char_utilities=>horizontal_tab
        flight-fldate cl_abap_char_utilities=>horizontal_tab
        flight-planetype cl_abap_char_utilities=>horizontal_tab
        seatsmax cl_abap_char_utilities=>horizontal_tab
        seatsocc cl_abap_char_utilities=>horizontal_tab
        cl_abap_char_utilities=>cr_lf
        INTO output.
      ENDLOOP.
      response = runtime->server->response.
      response->delete_header_field( name = if_http_header_fields=>cache_control ).
      response->delete_header_field( name = if_http_header_fields=>expires ).
      response->delete_header_field( name = if_http_header_fields=>pragma ).
      response->set_header_field( name = if_http_header_fields=>content_type
                                  value = appl ).
      response->set_header_field( name = 'content-disposition'
                                  value = filetype ).
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text     = output
          mimetype = 'text/unicode; charset=utf-16le'
        IMPORTING
          buffer   = output2.
      CONCATENATE cl_abap_char_utilities=>byte_order_mark_little
                  output2 INTO output2 IN BYTE MODE.
      l_len = XSTRLEN( output2 ).
      response->set_data( data = output2
                          length = l_len ).
      navigation->response_complete( ).
    This is the code for downloading an Excel file.

  • "Implicit" Binding in ABAP OO?: the ALV method grid- check_changed_data

    In this thread here:
    Where/how would you add the actual DB update to BCALV_EDIT_03?
    Uwe Schieferstein was kind enough to show that anyone can see the effect or outcome of the ALV check_changed_data method if they just add this code to the PAI of the SAP demo program BCALV_EDIT_03:
    MODULE pai INPUT.
      TRANSLATE ok_code TO UPPER CASE.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN 'SAVE'.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
            EXPORTING
              I_STRUCTURE_NAME                  = 'SFLIGHT'
              I_GRID_TITLE                      =
                  'Before CHECK_DATA_CHANGED -> changes not yet retrieved'
            TABLES
              t_outtab                          = gt_outtab
            EXCEPTIONS
              OTHERS                            = 99.
          g_grid->check_changed_data( ).
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
            EXPORTING
              I_STRUCTURE_NAME                  = 'SFLIGHT'
              I_GRID_TITLE                      =
                  'After CHECK_DATA_CHANGED -> changes retrieved'
            TABLES
              t_outtab                          = gt_outtab
            EXCEPTIONS
              OTHERS                            = 99.
          PERFORM save_data.
        WHEN OTHERS.
    *     do nothing
      ENDCASE.
    ENDMODULE.                    "pai INPUT
    When looking at this code, the following question occurred to me:
    <b>Question: How does check_changed_data know the itab to bring the changed back to, since it is called in the PAI with no arguments.</b>
    The only answer I can see is that when the grid is first loaded in the PBO of BCALV_EDIT_03 in the usual way:
      if g_custom_container is initial.
        perform create_and_init_alv changing gt_outtab
                                             gt_fieldcat
                                             gs_layout.
      endif.
    the ABAP OO engine implicitly "binds" the back-end table gt_outtab to the ALV contol (i.e. the instance of CL_GUI_ALV_GRID that the program creates.)
    So, if you answer this question, please do one of two things:
    a) confirm that check_changed_data "knows" the correct itab to bring the data back to because the ABAP OO engine has, in fact, implicitly "bound" the control to the itab gt_outtab;
    or
    b) if this is not true, explain how check_changed_data knows what itab to bring the data back to.
    Thanks very much in advance for whatever time anyone can afford to spend on this question.
    djh

    Hello David
    I have modified my previous sample report again to +demonstrate +that the
    grid instance knows exactly which itab is displayed. Unfortunately it is already a few years ago when I attended the excellent SAP course BC412 (Dialog Programming using EnjoyControls, held by a chinese SAP employee with a beautiful Palatine dialect). Thus, I +cannot explain +the technical details (which are somehow related to the automation queue and the control framework). 
    Here are the new modifications:
    (1) Inbetween the data definitions and the local class definition I have added two parameters:
    DATA: gt_outtab TYPE TABLE OF sflight.
    PARAMETERS:
      p_byref    RADIOBUTTON GROUP rad1,  " pass itab by reference
      p_byval    RADIOBUTTON GROUP rad1.  " pass itab by value
    * LOCAL CLASS Definition
    (2) The parameters are evaluated in PBO module PBO:
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF g_custom_container IS INITIAL.
        IF ( p_byval = 'X' ).
          PERFORM create_and_init_alv_byval
                               CHANGING gt_outtab
                                        gt_fieldcat
                                        gs_layout.
        ELSE.  " ( p_byref = 'X' ).
          PERFORM create_and_init_alv CHANGING gt_outtab
                                               gt_fieldcat
                                               gs_layout.
        ENDIF.
      ENDIF.
    ENDMODULE.                    "pbo OUTPUT
    (3) And here is the difference between the two routines:
    *&      Form  create_and_init_alv_byval
    *       text
    *      <--P_GT_OUTTAB  text
    *      <--P_GT_FIELDCAT  text
    *      <--P_GS_LAYOUT  text
    FORM create_and_init_alv_byval
                      CHANGING
                            value(pt_outtab)  LIKE gt_outtab[]  " by value
                            pt_fieldcat TYPE lvc_t_fcat
                            ps_layout TYPE lvc_s_layo.
      PERFORM create_and_init_alv CHANGING pt_outtab
                                           pt_fieldcat
                                           ps_layout.
    ENDFORM.                    " create_and_init_alv_byval
    *&      Form  CREATE_AND_INIT_ALV
    *       text
    *      <--P_GT_OUTTAB  text
    *      <--P_GT_FIELDCAT  text
    *      <--P_GS_LAYOUT  text
    FORM create_and_init_alv
                      CHANGING
                            pt_outtab  LIKE gt_outtab[]  " by reference
                            pt_fieldcat TYPE lvc_t_fcat
                            ps_layout TYPE lvc_s_layo.
      DATA: lt_exclude TYPE ui_functions.
    Now the crucial point is that the globally visible itab gt_outtab is passed
    (a) by value to method g_grid->set_table_for_first_display (routine CREATE_AND_INIT_ALV_BYVAL)
    (b) by reference to method g_grid->set_table_for_first_display (routine CREATE_AND_INIT_ALV_BYVAL)
    If you run the report with the default (p_byref = 'X') then the report behave exactly like the original sample report.
    However, if you choose p_byval = 'X' then the reports dumps as soon as you try to change the values of the ALV list (e.g. change a planetype and hit ENTER or even sorting is sufficient).
    Why? The itab passed by value to the grid instance is not the same like gt_outtab!
    Conclusion: Do not try to fool the grid instance...
    Regards
      Uwe
    PS: The entire coding of the adjusted sample reports is shown below:
    report ZUS_SDN_BCALV_EDIT_03_SAVE_1.
    **PROGRAM bcalv_edit_03.
    * Purpose:
    * ~~~~~~~~
    * In this example the user may change values of fields
    * SEATSOCC (occupied seats) and/or PLANETYPE. The report checks
    * the input value(s) semantically and provides protocol
    * messages in case of error.
    * To check program behavior
    * ~~~~~~~~~~~~~~~~~~~~~~~~~
    * Change values of the column "occupied seats" or "Planetype" or
    * both (in the same line). Try to provocate errors.
    * Click on the check symbol or press return to initiate checking.
    * (ALV also checks input before any functions like sorting,
    * filtering or doubleclick are processed. These functions are
    * only active if the input does not contain any errors).
    * The ALV Grid Control first checks if the input is correct
    * according to DDIC-Information (Type, lenght). Then semantic
    * checks are made by the application using event handler method
    * HANDLE_DATA_CHANGED.
    * Essential steps (search for '§')
    * ~~~~~~~~~~~~~~~
    * 1.Set status of columns PLANETYPE and SEATSOCC to editable.
    * 2.Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
    * 3.Optionally register ENTER to raise event DATA_CHANGED.
    *   (Per default the user may check data by using the check icon).
    * 4.Define and implement event handler to handle event DATA_CHANGED.
    * 5.Loop over table MT_GOOD_CELLS to check all values that are
    *   valid due to checks according to information of the DDIC.
    * 6.Within a check cycle:
    * 6a.Get new cell value to check it using method GET_CELL_VALUE.
    *    (In this case SEATSOCC).
    * 6b.If the value is valid you may want to change values of
    *    other cells.
    * 6c.If the value is not valid create an protocol entry in
    *    the application log.
    * 6d.To access old values (which where not changed in this check cycle)
    *    use your output table GT_OUTTAB.
    * 7.Display application log if an error has occured.
    DATA: ok_code LIKE sy-ucomm,
          save_ok LIKE sy-ucomm,
          g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
          g_grid  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          gt_fieldcat TYPE lvc_t_fcat,
          gs_layout TYPE lvc_s_layo,
          g_max TYPE i VALUE 100.
    * local class to handle semantic checks
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    DATA: g_event_receiver TYPE REF TO lcl_event_receiver.
    DATA: gt_outtab TYPE TABLE OF sflight.
    PARAMETERS:
      p_byref    RADIOBUTTON GROUP rad1,  " pass itab by reference
      p_byval    RADIOBUTTON GROUP rad1.  " pass itab by value
    * LOCAL CLASS Definition
    *§4.Define and implement event handler to handle event DATA_CHANGED.
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
    * This flag is set if any error occured in one of the
    * following methods:
        DATA: error_in_data TYPE c  READ-ONLY.
        METHODS:
          handle_data_changed
             FOR EVENT data_changed OF cl_gui_alv_grid
                 IMPORTING er_data_changed.
      PRIVATE SECTION.
    *** This flag is set if any error occured in one of the
    *** following methods:
    **    DATA: error_in_data TYPE c.
    * Methods to modularize event handler method HANDLE_DATA_CHANGED:
        METHODS: check_planetype
         IMPORTING
            ps_good_planetype TYPE lvc_s_modi
            pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
        METHODS: ch_new_plane_v_new_seatsocc
               IMPORTING
                  psg_plane TYPE lvc_s_modi
                  psg_socc TYPE lvc_s_modi
                  ps_saplane TYPE saplane
                  pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
        METHODS: ch_new_plane_v_old_seatsocc
               IMPORTING
                  psg_plane TYPE lvc_s_modi
                  ps_saplane TYPE saplane
                  pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
        METHODS: check_seatsocc
               IMPORTING
                  ps_good TYPE lvc_s_modi
                  pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
    * This is a suggestion how you could comment your checks in each method:
    * CHECK: fieldname(old/new value) !<comp> fieldname(old/new value)
    * IF NOT: (What to tell the user is wrong about the input)
    * Remarks:
    *  fieldname:       fieldname of table for the corresponding column
    *  (old/new value): ckeck with value of GT_OUTTAB or MT_GOOD_CELLS.
    *  !<comp>        : the value is valid if the condition <comp> holds.
    * Example:
    *  CHECK seatsocc(new) !>= seatsmax(old)
    *  IF NOT: There are not enough number of seats according to this
    *          planetype.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
        DATA: ls_good TYPE lvc_s_modi.
        error_in_data = space.
    * semantic checks
    * Identify columns which were changed and check input
    * against output table gt_outtab or other new input values of one row.
    * Table er_data_changed->mt_good_cells holds all cells that
    * are valid according to checks against their DDIC data.
    * No matter in which order the input was made this table is
    * ordered by rows (row_id). For each row, the entries are
    * sorted by columns according to their order in the fieldcatalog
    * (not the defined order using field COL_POS but the order
    * given by the position of the record in the fieldcatalog).
    * The order is relevant if new inputs in several columns of
    * the same row are dependent. In this example,
    * method 'ch_new_plane_v_new_seatsocc' needs only to be called
    * once since we know that the corresponding check is already done
    * when checking column PLANETYPE (see also method 'check_seatsocc').
    *§5.Loop over table MT_GOOD_CELLS to check all values that are
    *   valid due to checks according to information of the DDIC.
        LOOP AT er_data_changed->mt_good_cells INTO ls_good.
          CASE ls_good-fieldname.
    * check if column PLANETYPE of this row was changed
            WHEN 'PLANETYPE'.
              CALL METHOD check_planetype
                EXPORTING
                  ps_good_planetype = ls_good
                  pr_data_changed   = er_data_changed.
    * check if column SEATSOCC of this row was changed
            WHEN 'SEATSOCC'.
              CALL METHOD check_seatsocc
                EXPORTING
                  ps_good         = ls_good
                  pr_data_changed = er_data_changed.
          ENDCASE.
        ENDLOOP.
    *§7.Display application log if an error has occured.
        IF error_in_data EQ 'X'.
          CALL METHOD er_data_changed->display_protocol.
        ENDIF.
      ENDMETHOD.                    "handle_data_changed
      METHOD check_planetype.
    * Overview of checks according to field PLANETYPE
    * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    * a) Does the Planetype exists? (check against check table SAPLANE)
    * b) Are the number of seats (SEATSMAX) of the new planetype
    *    sufficient to fullfill requested bookings (SEATSOCC)?
    *    b1) SEATSOCC (occupied seats) also changed within
    *        this check cycle.
    *    b2) SEATSOCC has not changed within this cycle.
        DATA: l_planetype TYPE s_planetye,
              ls_saplane TYPE saplane,
              ls_good_seatsocc TYPE lvc_s_modi.
    * Get new cell value to check it.
    * (In this case: PLANETYPE).
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING
            i_row_id    = ps_good_planetype-row_id
            i_fieldname = ps_good_planetype-fieldname
          IMPORTING
            e_value     = l_planetype.
    * existence check: Does the plane exists?
        SELECT SINGLE * FROM saplane INTO ls_saplane WHERE
                                         planetype = l_planetype.
        IF sy-subrc NE 0.
    * In case of error, create a protocol entry in the application log.
    * Possible values for message type ('i_msgty'):
    *    'A': Abort (Stop sign)
    *    'E': Error (red LED)
    *    'W': Warning (yellow LED)
    *    'I': Information (green LED)
          CALL METHOD pr_data_changed->add_protocol_entry
            EXPORTING
              i_msgid     = '0K'
              i_msgno     = '000'
              i_msgty     = 'E'
              i_msgv1     = text-m03           "Flugzeugtyp
              i_msgv2     = l_planetype
              i_msgv3     = text-m05           "exitstiert nicht
              i_fieldname = ps_good_planetype-fieldname
              i_row_id    = ps_good_planetype-row_id.
          error_in_data = 'X'.
          EXIT. "plane does not exit, so we're finished here!
        ENDIF.
    * Check if other relevant fields of this row have been changed, too.
        READ TABLE pr_data_changed->mt_good_cells INTO ls_good_seatsocc
                           WITH KEY row_id    = ps_good_planetype-row_id
                                    fieldname = 'SEATSOCC'.
        IF sy-subrc = 0.
          CALL METHOD ch_new_plane_v_new_seatsocc
            EXPORTING
              psg_plane       = ps_good_planetype
              psg_socc        = ls_good_seatsocc
              ps_saplane      = ls_saplane
              pr_data_changed = pr_data_changed.
        ELSE.
          CALL METHOD ch_new_plane_v_old_seatsocc
            EXPORTING
              psg_plane       = ps_good_planetype
              ps_saplane      = ls_saplane
              pr_data_changed = pr_data_changed.
        ENDIF.
      ENDMETHOD.                           " CHECK_PLANETYPE
      METHOD ch_new_plane_v_new_seatsocc.
        DATA: l_seatsocc TYPE s_seatsocc.
    *§5a.Get new cell value to check it using method GET_CELL_VALUE.
    * (In this case SEATSOCC).
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING
            i_row_id    = psg_socc-row_id
            i_fieldname = psg_socc-fieldname
          IMPORTING
            e_value     = l_seatsocc.
    * CHECK:  SEATSMAX(of new planetype) !>= SEATSOCC(new value)
    * IF NOT: Message for wrong planetype
        IF ps_saplane-seatsmax GE l_seatsocc.
    *§5b.If the value is valid you may want to change values of
    *    other cells.
          CALL METHOD pr_data_changed->modify_cell
            EXPORTING
              i_row_id    = psg_plane-row_id
              i_fieldname = 'SEATSMAX'
              i_value     = ps_saplane-seatsmax.
        ELSE.
    *§5c.If the value is not valid create an protocol entry in
    *    the application log.
    * Possible values for message type ('i_msgty'):
    *    'A': Abort (Stop sign)
    *    'E': Error (red LED)
    *    'W': Warning (yellow LED)
    *    'I': Information (green LED)
          CALL METHOD pr_data_changed->add_protocol_entry
            EXPORTING
              i_msgid     = '0K'
              i_msgno     = '000'
              i_msgty     = 'E'
              i_msgv1     = text-m03               "Flugzeugtyp
              i_msgv2     = ps_saplane-planetype
              i_msgv3     = text-m04             "hat nicht genug Sitzplätze
              i_fieldname = psg_plane-fieldname
              i_row_id    = psg_plane-row_id.
          error_in_data = 'X'.
        ENDIF.
      ENDMETHOD.                    "ch_new_plane_v_new_seatsocc
      METHOD ch_new_plane_v_old_seatsocc.
        DATA: l_old_seatsocc TYPE s_seatsocc,
              ls_outtab TYPE sflight.
    *§5d.To access old values (which where not changed in this check cycle)
    *    use your output table GT_OUTTAB.
        READ TABLE gt_outtab INTO ls_outtab INDEX psg_plane-row_id.
        l_old_seatsocc = ls_outtab-seatsocc.
    * CHECK:  SEATSMAX(of new planetype) !>= SEATSOCC(old value)
    * IF NOT: Message for wrong planetype
        IF ps_saplane-seatsmax GE l_old_seatsocc.
    * ok->field seatsmax can be changed
          CALL METHOD pr_data_changed->modify_cell
            EXPORTING
              i_row_id    = psg_plane-row_id
              i_fieldname = 'SEATSMAX'
              i_value     = ps_saplane-seatsmax.
        ELSE.
          CALL METHOD pr_data_changed->add_protocol_entry
            EXPORTING
              i_msgid     = '0K'
              i_msgno     = '000'
              i_msgty     = 'E'
              i_msgv1     = text-m03                "Flugzeugtyp
              i_msgv2     = ps_saplane-planetype
              i_msgv3     = text-m04             "hat nicht genug Sitzplätze
              i_fieldname = psg_plane-fieldname
              i_row_id    = psg_plane-row_id.
          error_in_data = 'X'.
        ENDIF.
      ENDMETHOD.                    "ch_new_plane_v_old_seatsocc
    *&      Form  CHECK_SEATSOCC
    *       text
    *      -->P_LS_GOOD  text
    *      -->P_ER_DATA_CHANGED  text
      METHOD check_seatsocc.
        DATA: l_seatsocc TYPE s_seatsocc,
              l_old_seatsmax TYPE s_seatsmax,
              ls_outtab TYPE sflight,
              ls_good TYPE lvc_s_modi.
    * Check if the planetype has changed, too.
        READ TABLE pr_data_changed->mt_good_cells INTO ls_good
                           WITH KEY row_id    = ps_good-row_id
                                    fieldname = 'PLANETYPE'.
        IF sy-subrc EQ 0.
    * remark: the check
    *   seatsocc (new value) <= seatsmax (new value)
    * was already handled by form 'ch_new_plane_v_new_seatsocc'.
    * so we are finished here.
          EXIT.
        ENDIF.
    * CHECK: seatsocc (new value) <= seatsmax (old value)
    * IF NOT: Message that SEATSOCC is to high.
    * get new cell value of SEATSOCC.
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING
            i_row_id    = ps_good-row_id
            i_fieldname = ps_good-fieldname
          IMPORTING
            e_value     = l_seatsocc.
    * get old cell value of SEATSMAX
        READ TABLE gt_outtab INTO ls_outtab INDEX ps_good-row_id.
        l_old_seatsmax = ls_outtab-seatsmax.
        IF l_seatsocc > l_old_seatsmax.
          CALL METHOD pr_data_changed->add_protocol_entry
            EXPORTING
              i_msgid     = '0K'
              i_msgno     = '000'
              i_msgty     = 'E'
              i_msgv1     = text-m01  "Die Anzahl der belegten Plätze
              i_msgv2     = text-m02 "übersteigt die Kapazität des Flugzeugs
              i_msgv3     = ls_outtab-planetype
              i_fieldname = ps_good-fieldname
              i_row_id    = ps_good-row_id.
          error_in_data = 'X'.
        ENDIF.
      ENDMETHOD.                           " CHECK_SEATSOCC
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    *       MAIN                                                          *
    END-OF-SELECTION.
      CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF g_custom_container IS INITIAL.
        IF ( p_byval = 'X' ).
          PERFORM create_and_init_alv_byval
                               CHANGING gt_outtab
                                        gt_fieldcat
                                        gs_layout.
        ELSE.  " ( p_byref = 'X' ).
          PERFORM create_and_init_alv CHANGING gt_outtab
                                               gt_fieldcat
                                               gs_layout.
        ENDIF.
      ENDIF.
    ENDMODULE.                    "pbo OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      TRANSLATE ok_code TO UPPER CASE.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN 'SAVE'.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
            EXPORTING
              i_structure_name                  = 'SFLIGHT'
              i_grid_title                      =
                  'Before CHECK_DATA_CHANGED -> changes not yet retrieved'
            TABLES
              t_outtab                          = gt_outtab
            EXCEPTIONS
              OTHERS                            = 99.
          g_grid->check_changed_data( ).
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
            EXPORTING
              i_structure_name                  = 'SFLIGHT'
              i_grid_title                      =
                  'After CHECK_DATA_CHANGED -> changes retrieved'
            TABLES
              t_outtab                          = gt_outtab
            EXCEPTIONS
              OTHERS                            = 99.
          PERFORM save_data.
        WHEN OTHERS.
    *     do nothing
      ENDCASE.
    ENDMODULE.                    "pai INPUT
    *&      Form  SAVE_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM save_data .
      IF ( g_event_receiver->error_in_data = 'X' ).
        MESSAGE 'Error in data -> saving not possible' TYPE 'S'.
      ELSE.
        MESSAGE 'Data saved' TYPE 'S'.  " simulates DB update
      ENDIF.
    ENDFORM.                    " SAVE_DATA
    *       FORM EXIT_PROGRAM                                             *
    FORM exit_program.
      LEAVE PROGRAM.
    ENDFORM.                    "exit_program
    *&      Form  BUILD_FIELDCAT
    *       text
    *      <--P_GT_FIELDCAT  text
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'SFLIGHT'
        CHANGING
          ct_fieldcat      = pt_fieldcat.
      LOOP AT pt_fieldcat INTO ls_fcat.
        IF    ls_fcat-fieldname EQ 'PLANETYPE'
           OR ls_fcat-fieldname EQ 'SEATSOCC'.
    *§1.Set status of columns PLANETYPE and SEATSOCC to editable.
          ls_fcat-edit = 'X'.
    * Field 'checktable' is set to avoid shortdumps that are caused
    * by inconsistend data in check tables. You may comment this out
    * when the test data of the flight model is consistent in your system.
          ls_fcat-checktable = '!'.  "do not check foreign keys
          MODIFY pt_fieldcat FROM ls_fcat.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "build_fieldcat
    *&      Form  create_and_init_alv_byval
    *       text
    *      <--P_GT_OUTTAB  text
    *      <--P_GT_FIELDCAT  text
    *      <--P_GS_LAYOUT  text
    FORM create_and_init_alv_byval
                      CHANGING
                            value(pt_outtab)  LIKE gt_outtab[]  " by value
                            pt_fieldcat TYPE lvc_t_fcat
                            ps_layout TYPE lvc_s_layo.
      PERFORM create_and_init_alv CHANGING pt_outtab
                                           pt_fieldcat
                                           ps_layout.
    ENDFORM.                    " create_and_init_alv_byval
    *&      Form  CREATE_AND_INIT_ALV
    *       text
    *      <--P_GT_OUTTAB  text
    *      <--P_GT_FIELDCAT  text
    *      <--P_GS_LAYOUT  text
    FORM create_and_init_alv
                      CHANGING
                            pt_outtab  LIKE gt_outtab[]  " by reference
                            pt_fieldcat TYPE lvc_t_fcat
                            ps_layout TYPE lvc_s_layo.
      DATA: lt_exclude TYPE ui_functions.
      CREATE OBJECT g_custom_container
             EXPORTING container_name = g_container.
      CREATE OBJECT g_grid
             EXPORTING i_parent = g_custom_container.
    * Build fieldcat and set columns PLANETYPE and SEATSOCC
    * edit enabled.
      PERFORM build_fieldcat CHANGING pt_fieldcat.
    *§2.Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
      PERFORM exclude_tb_functions CHANGING lt_exclude.
      SELECT * FROM sflight INTO TABLE pt_outtab UP TO g_max ROWS.
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          is_layout            = ps_layout
          it_toolbar_excluding = lt_exclude
        CHANGING
          it_fieldcatalog      = pt_fieldcat
          it_outtab            = pt_outtab.
    * set editable cells to ready for input
      CALL METHOD g_grid->set_ready_for_input
        EXPORTING
          i_ready_for_input = 1.
    *§3.Optionally register ENTER to raise event DATA_CHANGED.
    *   (Per default the user may check data by using the check icon).
      CALL METHOD g_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter.
      CREATE OBJECT g_event_receiver.
      SET HANDLER g_event_receiver->handle_data_changed FOR g_grid.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
    *       text
    *      <--P_LT_EXCLUDE  text
    FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      DATA ls_exclude TYPE ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
      APPEND ls_exclude TO pt_exclude.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS

  • ABAP Proxy to JDBC syncronous method

    Hi Experts,
    I am very new to ABAP Proxy to JDBC syncronous method.
    I have used 4 DT, 4 MT, 2 MI, 2 MM and 1 IM.
    I have used reference from
    SYNCHRONOUS SOAP TO JDBC - END TO END WALKTHROUGH
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3928. [original link is broken] [original link is broken]
    My question is in Integration Directory how many sender agrement, receiver agrement, receiver determination and interface determination should i use?
    Is my above DT , MT , MI , MM and IM is correct?
    I am not using any BPM.
    Thank you in advanced.
    regards,
    S.Saravannan

    mrsaravannan wrote:
    > My question is in Integration Directory how many sender agrement, receiver agrement, receiver determination and interface determination should i use?
    for a Sync sceanrio, you will create
    1 RD
    1 ID
    1 SA (since its a ABAP proxy call this is optional)
    1 RA
    >
    > Is my above DT , MT , MI , MM and IM is correct?
    Yes

  • Call Method using RFC -

    Hi,
    is it possible to call a method of a class from a remote system without using a RFC enabled function module?
    I mean without calling a class method instantiated in a function module.
    Michael

    Unfortunately no. This is one of the areas not covered by ABAP OO.
    The list of missing features (as of 7.0 ehp 2) is outlined in "Official ABAP Programming Guidelines" book:
    - remote method invocation as a replacement for rfc
    - replacement for update FMs (CALL FUNCTIOn IN UPDATE TASK)
    - replacement for call of subroutines during COMMIT WORK and ROLLBACK
    - OO handling of classic screens
    - dynamic generation of programs (GENERATE SUBROUTINE POOL)
    - direct support of background processing (SUBMIT VIA JOB)

  • Abap Objects doubts.

    Hi Experts.
    Plz give me some details for the following questions.
    1. what is abstract class.
    2. give me some example program using inheritance.
    3. Some sample programs using events.
    4. Narrow casting & wide casting.. And describe the use of it.
    5. How to declare internal table in ABAP OOPS.
    6. What is the use of table type.?
    7. What is instance.?
    8. Explain friend class.
    Thank in advance.
    Points will be given for the answers.
    regards,
    J.Joe

    HI
    <b>1. what is abstract class.</b>
    Abstract classes are normally used as an incomplete blueprint for concrete (that is, non-abstract) subclasses, for example to define a uniform interface.
    Classes with at least one abstract method are themselves abstract.
    Static methods and constructors cannot be abstract.
    You can specify the class of the instance to be created explicitly: CREATE OBJECT <RefToAbstractClass> TYPE <NonAbstractSubclassName>.
    Abstarct classes themselves can’t be instantiated ( althrough their subclasses can)
    Reference to abstract classes can refer to instance of subclass
    Abstract (instance) methods are difined in the class , but not implemented
    They must be redefined in subclasses
    CLASS LC1 DEFINAITION ABSTARCT
    PUBLIC SECTION
    METHODS ESTIMATE ABSTARCT IMPORTING…
    ENDCLASS.
    <b>2. give me some example program using inheritance.</b>
    The following simple example shows the principle of inheritance within ABAP Objects. It is based on the Simple Introduction to Classes. A new class counter_ten inherits from the existing class counter.
    REPORT demo_inheritance.
    CLASS counter DEFINITION.
      PUBLIC SECTION.
        METHODS: set IMPORTING value(set_value) TYPE i,
                 increment,
                 get EXPORTING value(get_value) TYPE i.
       PROTECTED SECTION .
        DATA count TYPE i.
    ENDCLASS.
    CLASS counter IMPLEMENTATION.
      METHOD set.
        count = set_value.
      ENDMETHOD.
      METHOD increment.
        ADD 1 TO count.
      ENDMETHOD.
      METHOD get.
        get_value = count.
      ENDMETHOD.
    ENDCLASS.
    CLASS counter_ten DEFINITION INHERITING FROM counter.
      PUBLIC SECTION.
        METHODS increment REDEFINITION .
        DATA count_ten.
    ENDCLASS.
    CLASS counter_ten IMPLEMENTATION.
      METHOD increment.
        DATA modulo TYPE I.
         CALL METHOD super->increment .
        write / count.
        modulo = count mod 10.
        IF modulo = 0.
          count_ten = count_ten + 1.
          write count_ten.
        ENDIF.
      ENDMETHOD.
    ENDCLASS.
    DATA: count TYPE REF TO counter,
          number TYPE i VALUE 5.
    START-OF-SELECTION.
       CREATE OBJECT count TYPE counter_ten .
      CALL METHOD count->set EXPORTING set_value = number.
      DO 20 TIMES.
        CALL METHOD count->increment.
      ENDDO.
    The class COUNTER_TEN is derived from COUNTER. It redefines the method INCREMENT. To do this, you must change the visibility of the COUNT attribute from PRIVATE to PROTECTED. The redefined method calls the obscured method of the superclass using the pseudoreference SUPER->. The redefined method is a specialization of the inherited method.
    The example instantiates the subclass. The reference variable pointing to it has the type of the superclass. When the INCREMENT method is called using the superclass reference, the system executes the redefined method from the subclass.
    <b>3. Some sample programs using events.</b>
    Events in ABAP Objects - Example
    The following example shows how to declare, call, and handle events in ABAP Objects.
    Overview
    This object works with the interactive list displayed below. Each user interaction triggers an event in ABAP Objects. The list and its data is created in the class C_LIST. There is a class STATUS for processing user actions. It triggers an event BUTTON_CLICKED in the AT USER-COMMAND event. The event is handled in the class C_LIST. It contains an object of the class C_SHIP or C_TRUCK for each line of the list. Both of these classes implement the interface I_VEHICLE. Whenever the speed of one of these objects changes, the event SPEED_CHANGE is triggered. The class C_LIST reacts to this and updates the list.
    Constraints
    The ABAP statements used for list processing are not yet fully available in ABAP Objects. However, to produce a simple test output, you can use the following statements:
    WRITE [AT] /<offset>(<length>) <f>
    ULINE
    SKIP
    NEW-LINE
    Note: The behavior of formatting and interactive list functions in their current state are not guaranteed. Incompatible changes could occur in a future release.
    Declarations
    This example is implemented using local interfaces and classes. Below are the declarations of the interfaces and classes:
    Interface and Class declarations
    INTERFACE I_VEHICLE.
      DATA     MAX_SPEED TYPE I.
      EVENTS SPEED_CHANGE EXPORTING VALUE(NEW_SPEED) TYPE I.
      METHODS: DRIVE,
               STOP.
    ENDINTERFACE.
    CLASS C_SHIP DEFINITION.
      PUBLIC SECTION.
      METHODS CONSTRUCTOR.
      INTERFACES I_VEHICLE.
      PRIVATE SECTION.
      ALIASES MAX FOR I_VEHICLE~MAX_SPEED.
      DATA SHIP_SPEED TYPE I.
    ENDCLASS.
    CLASS C_TRUCK DEFINITION.
      PUBLIC SECTION.
      METHODS CONSTRUCTOR.
      INTERFACES I_VEHICLE.
      PRIVATE SECTION.
      ALIASES MAX FOR I_VEHICLE~MAX_SPEED.
      DATA TRUCK_SPEED TYPE I.
    ENDCLASS.
    CLASS STATUS DEFINITION.
      PUBLIC SECTION.
       CLASS-EVENTS BUTTON_CLICKED EXPORTING VALUE(FCODE) LIKE SY-UCOMM.
      CLASS-METHODS: CLASS_CONSTRUCTOR,
                    USER_ACTION.
    ENDCLASS.
    CLASS C_LIST DEFINITION.
      PUBLIC SECTION.
      METHODS: FCODE_HANDLER FOR EVENT BUTTON_CLICKED OF STATUS
                                 IMPORTING FCODE,
               LIST_CHANGE   FOR EVENT SPEED_CHANGE OF I_VEHICLE
                                 IMPORTING NEW_SPEED,
               LIST_OUTPUT.
      PRIVATE SECTION.
      DATA: ID TYPE I,
            REF_SHIP  TYPE REF TO C_SHIP,
            REF_TRUCK TYPE REF TO C_TRUCK,
            BEGIN OF LINE,
              ID TYPE I,
              FLAG,
              IREF  TYPE REF TO I_VEHICLE,
              SPEED TYPE I,
            END OF LINE,
            LIST LIKE SORTED TABLE OF LINE WITH UNIQUE KEY ID.
    ENDCLASS.
    The following events are declared in the example:
    The instance event SPEED_CHANGE in the interface I_VEHICLE
    The static event BUTTON_CLICKED in the class STATUS.
    The class C_LIST contains event handler methods for both events.
    Note that the class STATUS does not have any attributes, and therefore only works with static methods and events.
    Implementations
    Below are the implementations of the methods of the above classes:
    Implementations
    CLASS C_SHIP IMPLEMENTATION.
      METHOD CONSTRUCTOR.
        MAX = 30.
      ENDMETHOD.
      METHOD I_VEHICLE~DRIVE.
        CHECK SHIP_SPEED < MAX.
        SHIP_SPEED = SHIP_SPEED + 10.
        RAISE EVENT I_VEHICLE~SPEED_CHANGE
                    EXPORTING NEW_SPEED = SHIP_SPEED.
      ENDMETHOD.
      METHOD I_VEHICLE~STOP.
        CHECK SHIP_SPEED > 0.
        SHIP_SPEED = 0.
        RAISE EVENT I_VEHICLE~SPEED_CHANGE
                    EXPORTING NEW_SPEED = SHIP_SPEED.
      ENDMETHOD.
    ENDCLASS.
    CLASS C_TRUCK IMPLEMENTATION.
      METHOD CONSTRUCTOR.
        MAX = 150.
      ENDMETHOD.
      METHOD I_VEHICLE~DRIVE.
        CHECK TRUCK_SPEED < MAX.
        TRUCK_SPEED = TRUCK_SPEED + 50.
        RAISE EVENT I_VEHICLE~SPEED_CHANGE
                    EXPORTING NEW_SPEED = TRUCK_SPEED.
      ENDMETHOD.
      METHOD I_VEHICLE~STOP.
        CHECK TRUCK_SPEED > 0.
        TRUCK_SPEED = 0.
        RAISE EVENT I_VEHICLE~SPEED_CHANGE
                    EXPORTING NEW_SPEED = TRUCK_SPEED.
      ENDMETHOD.
    ENDCLASS.
    CLASS STATUS IMPLEMENTATION.
      METHOD CLASS_CONSTRUCTOR.
        SET PF-STATUS 'VEHICLE'.
        WRITE 'Click a button!'.
      ENDMETHOD.
      METHOD USER_ACTION.
        RAISE EVENT BUTTON_CLICKED EXPORTING FCODE = SY-UCOMM.
      ENDMETHOD.
    ENDCLASS.
    CLASS C_LIST IMPLEMENTATION.
      METHOD FCODE_HANDLER .
        CLEAR LINE.
        CASE FCODE.
          WHEN 'CREA_SHIP'.
            ID = ID + 1.
            CREATE OBJECT REF_SHIP.
            LINE-ID = ID.
            LINE-FLAG = 'C'.
            LINE-IREF = REF_SHIP.
            APPEND LINE TO LIST.
          WHEN 'CREA_TRUCK'.
            ID = ID + 1.
            CREATE OBJECT REF_TRUCK.
            LINE-ID = ID.
            LINE-FLAG = 'T'.
            LINE-IREF = REF_TRUCK.
            APPEND LINE TO LIST.
          WHEN 'DRIVE'.
            CHECK SY-LILLI > 0.
            READ TABLE LIST INDEX SY-LILLI INTO LINE.
            CALL METHOD LINE-IREF->DRIVE.
          WHEN 'STOP'.
            LOOP AT LIST INTO LINE.
              CALL METHOD LINE-IREF->STOP.
            ENDLOOP.
          WHEN 'CANCEL'.
            LEAVE PROGRAM.
        ENDCASE.
        CALL METHOD LIST_OUTPUT.
      ENDMETHOD.
      METHOD LIST_CHANGE .
        LINE-SPEED = NEW_SPEED.
        MODIFY TABLE LIST FROM LINE.
      ENDMETHOD.
      METHOD LIST_OUTPUT.
        SY-LSIND = 0.
        SET TITLEBAR 'TIT'.
        LOOP AT LIST INTO LINE.
          IF LINE-FLAG = 'C'.
            WRITE / ICON_WS_SHIP AS ICON.
          ELSEIF LINE-FLAG = 'T'.
            WRITE / ICON_WS_TRUCK AS ICON.
          ENDIF.
          WRITE: 'Speed = ', LINE-SPEED.
        ENDLOOP.
      ENDMETHOD.
    ENDCLASS.
    The static method USER_ACTION of the class STATUS triggers the static event BUTTON_CLICKED. The instance methods I_VEHICLEDRIVE and I_VEHICLESTOP trigger the instance event I_VEHICLE~SPEED_CHANGE in the classes C_SHIP and C_TRUCK.
    Using the Classes in a Program
    The following program uses the above classes:
    REPORT OO_EVENTS_DEMO NO STANDARD PAGE HEADING.
    Global data of program
    DATA LIST TYPE REF TO C_LIST.
    Program events
    START-OF-SELECTION.
      CREATE OBJECT LIST.
      SET HANDLER: LIST->FCODE_HANDLER,
                  LIST->LIST_CHANGE FOR ALL INSTANCES.
    AT USER-COMMAND.
      CALL METHOD STATUS=>USER_ACTION.
    The program creates an object of the class C_LIST and registers the event handler method FCODE_HANDLER of the object for the class event BUTTON_CLICKED, and the event handler method LIST_CHANGE for the event SPEED_CHANGE of all instances that implement the interface I_VEHICLE.
    <b>4. Narrow casting & wide casting.. And describe the use of it.</b>
    <b>Narrowing Cast</b>
    The assignment of a subclass instance to a reference variable of the type "reference to superclass" is described as a narrowing cast, because you are switching from a more detailed view to a one with less detail.
    Description up-cast is also used.
    <b>use</b>
    A user who is not interested in the finer points of cars, trucks, and busses (but only, for example, in the fuel consumption and tank gauge) does not need to know about them. This user only wants and needs to work with (references to) the lcl_vehicle class. However, in order to allow the user to work with cars, busses, or trucks, you generally need a narrowing cast.
    <b>Widening cast</b>
    The widening cast logically represents the opposite of the narrowing cast. The widening cast cannot be checked statically, only at runtime. The Cast Operator ?= (or the equivalent MOVE ... ?TO … ) must be used to make this visible.
    It changes from a less detailed view to one with more detail.
    <b>use</b>
    The client, the car rental company  wants to execute a function for specific vehicles form the list (vehicle_list).  For example, the client wants to ascertain the truck with the largest cargo capacity.  However, not all vehicles are in the trucks list, it also includes references to cars and busses.
    <b>5. How to declare internal table in ABAP OOPS.</b>
    BEGIN OF LINE,
              ID TYPE I,
              FLAG,
              IREF  TYPE REF TO I_VEHICLE,
              SPEED TYPE I,
            END OF LINE,
    <b>6. What is the use of table type.?</b>
    Please check the SAP help , as all these things are provided in detail in it .
    In case you find it difficult to find it or search for it here is the link
    http://help.sap.com/saphelp_nw04/helpdata/en/90/8d7304b1af11d194f600a0c929b3c3/frameset.htm
    <b>7. What is instance.?</b>
    Instance methods are called using CALL METHOD <reference>-><instance_method>.
    Static methods (also referred to as class methods) are called using CALL METHOD <classname>=><class_method>.
    If you are calling a static method from within the class, you can omit the class name.
    You access instance attributes using <instance>-><instance_attribute>
    <b>8. Explain friend class.</b>
    In rare cases, classes have to work together so closely that they need access to their protected and private components. To avoid making these components available to all users, there is the concept of friendship between classes.
    To do this you use the FRIENDS additions to the CLASS statement, in which all classes and interfaces that are to be provided friendship are listed
    In principle, providing friendship is one-sided: A class providing friendship is not automatically a friend of its friends. If a class providing friendship wants to access the non-public components of a friend, this friend has to explicitly provide friendship to it.
    Classes that inherit from friends and interfaces that contain a friend as a component interface also become friends. However, providing friendship, unlike the attribute of being a friend, is not inherited. A friend of a superclass is therefore not automatically a friend of its subclasses.
    <b>Reward if usefull</b>

  • ABAP HR: Exit ZXPADU02 and Method cl_hr_pnnnn_type_cast= pnnnn_to_prelp

    Hi ABAP HR Gurus,
    Good day.
    In Transaction PA20 Infotype 2, there's a field Sexual Orientation (P3346-SEXORIENT) from IT3346.  In change mode, when a value is chosen in the dropdown list for Sexual Orientation and enter is pressed, the chosen Sexual Orientation is cleared.
    I have debugged this and the issue seems to be coming from Exit EXIT_SAPFP50M_002 / ZXPADU02.  In this exit, cl_hr_pnnnn_type_cast=>prelp_to_pnnnn and cl_hr_pnnnn_type_cast=>pnnnn_to_prelp are being used.    Below is the related code:
    WHEN '0002'.
    *    MOVE innnn TO i0002.
         CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
           EXPORTING
             prelp = innnn
           IMPORTING
             pnnnn = i0002.
         IF i0002-rufnm IS INITIAL.
           i0002-rufnm = i0002-vorna.
         ENDIF.
    *   Check suffix of NI number
         IF NOT i0002-perid IS INITIAL.
           IF i0002-perid+8(1) = ' '.
             MESSAGE e513(zhr).
           ENDIF.
         ENDIF.
    *    MOVE i0002 TO innnn.
         CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
           EXPORTING
             pnnnn = i0002
           IMPORTING
             prelp = innnn.
    I noticed that Call cl_hr_pnnnn_type_cast=>pnnnn_to_prelp deletes the data of Sexual Orientation found in INNNN+990(1) in the exit.
    With this, when using cl_hr_pnnnn_type_cast=>pnnnn_to_prelp, can you kindly confirm if there's a way to not lose the value in INNNN+990(1) which corresponds to value of Sexual Orientation (P3346-SEXORIENT) in our Infotype 02 Screen?  If there's none, can you kindly provide the appropriate solution to the issue.
    Additional Note: I'm thinking that maybe I should get the value of INNNN+990(1) and then put it back again to INNNN+990(1)  after calling cl_hr_pnnnn_type_cast=>pnnnn_to_prelp but this might not be the appropriate solution to the issue. 
    Thank you.
    Best regards,
    Brando

    Program ZXPADTOP
    data:   i0002 like p0002.      "Personal data infotype
    Program ZXPADU02
    * Decision on infotype being processed
    case innnn-infty.
    * Default 'known as' field to employee first name is the user has left the
    * field blank
       when '0002'.
    *    MOVE innnn TO i0002.
         call method cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
           exporting
             prelp = innnn
           importing
             pnnnn = i0002.
         if i0002-rufnm is initial.
           i0002-rufnm = i0002-vorna.
         endif.
    *   Check suffix of NI number
         if not i0002-perid is initial.
           if i0002-perid+8(1) = ' '.
             message e513(zhr).
           endif.
         endif.
    *    MOVE i0002 TO innnn.
         call method cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
           exporting
             pnnnn = i0002
           importing
             prelp = innnn.
    endcase.
    Additional Note: innnn is declated under Import Parameters of EXIT_SAPFP50M_002:
    INNNN
    LIKE
    PRELP
    Current Infotype Record

  • Call method cl_crm_documents- create_with_file not creating attachment

    Hi,
    I am trying to create attachment in a transaction type using cl_crm_documents->create_with_file. But it is not creating the same, instead gives error "Error loading file &".
    I am uploading a file with fields object_id, text, file name, description  and category.
    I have passed the parameters as follows:
    data: gref_obj           type ref to cl_crm_documents.
    create object gref_obj.
              gw_prop_attr-name           = 'BDS_KEYWORD'.
              gw_prop_attr-value          = gw_attach-category.
              append gw_prop_attr to gt_prop_attr.
              gs_business_object-instid   = gw_guid-guid.(object guid)
              gs_business_object-typeid   = gv_object_type.(object type)
              gs_business_object-catid    = 'BO'.
              call method gref_obj->create_with_file
                exporting
                  file_name       = gw_attach-f_name (name as provided in my uploaded file, in my case it is test)
                  directory       = p_floder (C:\Attachment\)
                  properties      = gt_prop_attr
                  business_object = gs_business_object
                importing
                  phio            = gs_phio_id
                  loio            = gs_loio_id
                  error           = ls_error.
    Please help me on this. I doubt the directory that I am giving is wrong.
    Thanks.

    Hi,
    Please go through this...
    Re: Problem attach document with the FileUpload UI.
    Cheers,
    Kris.

Maybe you are looking for