Excerpt for SAP ABAP Objects Interview Questions by Equity Press , available in its entirety at Smashwords

SAP ABAP Objects Interview Questions



Equity Press

Compiled By Terry Sanchez-Clark

Edited by Jim Stewart



ABAP Objects Interview Questions



ISBN: 978-1-06332-298-0



Smashwords Edition



Edited by: Jamie Fisher



Copyright© 2008 Equity Press all rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording or otherwise) without either the prior written permission of the publisher or a license permitting restricted copying in the United States or abroad.



The scanning, uploading and distribution of this book via the internet or via any other means without the permission of the publisher is illegal and punishable by law. Please purchase only authorized electronic editions, and do not participate in or encourage piracy of copyrighted materials.



The programs in this book have been included for

instructional value only.

The publisher does not offer any warranties or

representations and does not accept any liabilities with

respect to the programs.



Trademarks: All trademarks are the property of their respective owners. Equity Press is not associated with any product or vendor mentioned in this book.



Please visit our website at www.sapcookbook.com



Table of Contents

Introduction



ALV

Question 1: ALV Control - Field Catalog Dump

Question 2: ALV List generation

Question 3: Select rows in ALV grid with

Question 4: Getting the sum for each currency in ALV Report

Question 5: Event handling in ALV OOPS with buttons

Question 6: ALV Regdg

Question 7: ALV using ABAP Classes and Objects

Question 8: Display Logo on ALV Grid Report

Question 9: ALV Header Regdg

Question 10: Change the status in ALV

Question 11: Delete function

Question 12: Hold Multiple Selections in ALV Lists with cl_salv_table

Question 13: Sorting some columns in ALV Grid

Question 14: ALV Tree

Question 15: ALV in output using Object Oriented Model

Question 16: ALV Reports using ABAP Objects

Question 17: Code stuck

Question 18: Checkboxes in ALV Output and table updating

Question 19: Checkboxes in ALV Output

Question 20: ALV - OOPS Related Query

Question 21: ALV - access to protected method

Question 22: Bring ‘Top_of_page’ in OOPS ALV

Question 23: Node_Double_Click won’t trigger ALV TREE

Question 24: Create ALV using Methods (oo)

Question 25: Definition and use of ALV

Question 26: Disable standard buttons from ALV display

Question 27: Displaying ALV tree in the first ouput

Question 28: Method Classification

Question 29: Use of other methods

Question 30: cl_gui_alv_tree

Question 31: Find next behavior in ALV container

Question 32: Problem in changing to Excel

Question 33: Tree in OOPS ALV

Question 34: Showing header for ALV tree



Other Areas

Question 35: IDOCS

Question 36: Transporting Segments and IDOC

Question 37: Invoice Idoc - user exit

Question 38: Trigger User Exit

Question 39: Fetch Data from an Object

Question 40: CRM BADI ORDER_SAVE

Question 41: BAPI return parameter

Question 42: Error while creating Sales Order using BAPI

Question 43: SO is having multiple items

Question 44: Additional codes

Question 45: Controlling objects

Question 46: Save object in memory

Question 47: Business Objects

Question 48: Create object

Question 49: Client dependent objects in ABAP/SAP

Question 50: Object released

Question 51: Function Module versus Object Oriented Programming (OOP's)

Question 52: Cannot create object

Question 53: "create object"

Question 54: Infotype 21

Question 55: Data of infotype 0031

Question 56: User Input as an Excel File

Question 57: Problem while trying to execute Excel macro

Question 58: Create graphic in MS-Excel with DOI

Question 59: Handling mandatory import parameters

Question 60: The F.M: NUMBER_GET_NEXT

Question 61: Methods implemented

Question 62: Creating class and methods

Question 63: Changing methods or read-only attributes

Question 64: Switch the ‘md_activity’

Question 65: Object ‘go_rental_object’

Question 66: Bound but empty

Question 67: Problem with local class, static private attribute, and public method

Question 68: Calling a method

Question 69: ABAP OO chain method call

Question 70: Strings in ABAP

Question 71: ABAP Mapping

Question 72: WE05 - hide the Tree

Question 73: CL_SALV_TREE

Question 74: Add 3rd child in simple tree

Question 75: Error: Program " " not found

Question 76: Standard table into Z table

Question 77: Problem in selection from data base with RANGE-TABLE

Question 78: Kind of table

Question 79: Changing an internal table

Question 80: Refresh cluster table "INDX"

Question 81: Sorted table of ref to if_ixml_element

Question 82: Internal table as an OO way of handling data in a report/program

Question 83: User exit not triggered

Question 84: GUI_DOWNLOAD inside a BSP METHOD

Question 85: Field catalogs with an example

Question 86: Use of link method in ‘cl_gui_custom_container’

Question 87: Issue with CL_BCS

Question 88: In need of a push button event handler for a cl_gui_custom_container

Question 89: BAPI_MATERIAL_SAVEDATA cost currency issue

Question 90: CX_SHM_EXTERNAL_REFERENCE exc. when passing Class instance to Shared memory

Question 91: Moving a BOR ".bmp" attachment (objtyp message) to a Picture Control

Question 92: CL_GUI_TOOLBAR button doesn't fire from custom subscreen



General Information FAQ

Question 93: Update was terminated in VF02

Question 94: Type problems

Question 95: Spool Generation problem

Question 96: Workflow

Question 97: Modularization Techniques Tutorial

Question 98: Sub-routine

Question 99: Problem in PF status

Question 100: Adding new field to Me21n transaction

Question 101: Make text edit visible/invisible

Question 102: Use of sy-dynnr and sy-prog

Question 103: Send mail step of workflow

Question 104: Change public instance attribute

Question 105: Docking container and SAP standard transaction

Question 106: Description of matnr (maktx)

Question 107: “is bound”

Question 108: SPAU without modification assistant

Question 109: Grid and List display

Question 110: Make an input field inactive

Question 111: Overloading & overriding

Question 112: Workbench request

Question 113: Conditional statements

Question 114: Link the container and screen

Question 115: Demo program

Question 116: Scripts

Question 117: Call transaction

Question 118: Smart forms

Question 119: Dynamic documents format cells

Question 120: Internal and external email

Question 121: Functionality of GOS Toolbox for IW22 code-driven or config-driven

Question 122: Container refresh

Question 123: Returning values

Question 124: Reverse Method

Question 125: Macro



Introduction



What Is ABAP Objects?



ABAP Objects is a new concept in R/3 Release 4.0. The term has two meanings. On the one hand, it stands for the entire ABAP runtime environment. On the other hand, it represents the object-oriented extension of the ABAP language.



The Runtime Environment



The new name ABAP Objects for the entire ABAP runtime environment is an indication of the way in which SAP has, for some time, been moving towards object orientation, and of its commitment to pursuing this line further. The ABAP Workbench allows you to create R/3 Repository objects such as programs, authorization objects, lock objects, Customizing objects, and so on. Using function modules, you can encapsulate functions in separate programs with a defined interface. The Business Object Repository (BOR) allows you to create SAP Business Objects for internal and external use (DCOM/CORBA). Until now, object-oriented techniques have been used exclusively in system design, and have not been supported by the ABAP language.



The Object-Oriented Language Extension



ABAP Objects is a complete set of object-oriented statements that has been introduced into the ABAP language. This object-oriented extension of ABAP builds on the existing language, and is fully compatible with it. You can use ABAP Objects in existing programs, and can also use "conventional" ABAP in new ABAP Objects programs.

ABAP Objects supports object-oriented programming. Object orientation (OO), also know as the object-oriented paradigm, is a programming model that unites data and functions in objects. The rest of the ABAP language is primarily intended for structured programming, where data is stored in a structured form in database tables and function-oriented programs access and work with it.

The object-oriented enhancement of ABAP is based on the models of Java and C++. It is compatible with external object interfaces such as DCOM and CORBA. The implementation of object-oriented elements in the kernel of the ABAP language has considerably increased response times when you work with ABAP Objects. SAP Business Objects and GUI objects - already object-oriented themselves - will also profit from being incorporated in ABAP Objects.



ABAP Objects



Object orientation in ABAP is an extension of the ABAP language that makes available the advantages of object-oriented programming, such as encapsulation, interfaces, and inheritance. This helps to simplify applications and make them more controllable.

ABAP Objects is fully compatible with the existing language, so you can use existing statements and modularization units in programs that use ABAP Objects, and can also use ABAP Objects in existing ABAP programs.



ALV

Questions and Answers



Question 1: ALV Control - Field Catalog Dump



I have a local structure ‘st_duty’ (prepared from 2 tables) and an internal table ‘it_duty’.



When I am preparing the ‘Field’ catalog for this, it is giving a dump.



The code given is as follows:



DATA: it_fcat1 TYPE TABLE OF lvc_s_fcat,

wa_fcat1 TYPE lvc_s_fcat.



clear wa_fcat1.

wa_fcat1-coltext = 'Duty code'.

wa_fcat1-REF_FIELD = 'DUTCODE'.

wa_fcat1-REF_TABLE = '/OBIZ/ZMB_BEDUT'.

wa_fcat1-FIELDNAME = 'DUTCODE'.

wa_fcat1-col_pos = 1.

MODIFY it_fcat1 FROM wa_fcat1.



clear wa_fcat1. "At this Point it is giving short dump"

wa_fcat1-coltext = 'Description'.

wa_fcat1-REF_FIELD = 'CODDESC'.

wa_fcat1-REF_TABLE = '/OBIZ/ZCM_CODMAS'.

wa_fcat1-FIELDNAME = 'CODDESC'.

wa_fcat1-col_pos = 2.

MODIFY it_fcat1 FROM wa_fcat1.



Short Dump Message as given below:



Error analysis:

You attempted to change, delete or create a line in the internal table "\PROGRAM=SAPMZ_BOE_DETAILS_OBIZ\DATA=IT_FCAT1", but no valid

cursor exists for the table.



Possible reasons:



1. The relevent ABAP/4 statement does not include the addition

"...INDEX...", although the statement is not

inside a "LOOP...ENDLOOP" loop processing this table.



2. The relevent ABAP/4 statement was called from within a

"LOOP...ENDLOOP" loop after a DELETE

"\PROGRAM=SAPMZ_BOE_DETAILS_OBIZ\DATA=IT_FCAT1".



What can be the reason for this?



A: You can try the following to modify the field catalog:



Use APPEND Field catalog.



Append “wa_fcat” into “it_fcat”.



When looping through the field catalog, use modify.



Question 2: ALV List generation



I am generating a basic list and from that, I am generating an ALV for detailed list.



The problem is when I am coming back to the basic list and choose a different value, it is always showing the first value that I selected.



What is the solution for this?



A: Check the value coming in the variable at the stament. Just check in the debugging portion.



READ LINE SY-CUROW FIELD VALUE WA_ITAB-S_CARRID INTO T_CARRID

WA_ITAB-S_CONNID INTO T_CONNID.



Also try this:

clear wa_itab2.

APPEND WA TO WA_ITAB2.



CALL SCREEN 100.



After calling the screen, you need to give the “Clear” command.



Question 3: Select rows in ALV grid with



I'm using class “CL_GUI_ALV_GRID” and I want the buttons at the beginning of every row to select it. With the classic function “REUSE_ALV_GRID_DISPLAY”, I used the layout parameter box_fieldname:



layout-box_fieldname = 'CBOX'.

Where ‘CBOX’ is the name field of my internal table in the first position (char1),

and it worked.



With the “CL_GUI_ALV_GRID”, there's no parameter ‘box_fieldname’ but ‘BOX_FNAME’.

layout_alv-BOX_FNAME = 'CBOX'.

When I call the method –



call method grid->set_table_for_first_display

EXPORTING

is_layout = layout_alv

CHANGING

IT_FIELDCATALOG = it_fieldcat_voci

it_sort = gt_sort_grid[]

it_outtab = gt_voci[].



– it doesn't work.

Why did this happen? How can I fix this?



A: It’s a little different using the class. First, you need to set the selection module before calling the “SET_TABLE_FOR_FIRST_DISPLAY” method.



Question 4: Getting the sum for each currency in ALV Report



A column has amounts with various currencies.



How can I get the sum quantity for each currency in the ALV Report?



A: Currency value column should have reference to currency code column.



Question 5: Event handling in ALV OOPS with buttons



What is the procedure on handling events in OOPS like interactive reports using events?



A: You can use the event ‘HOTSPOT_CLICK’ and ‘BUTTON_CLICK’. For the sake of simplicity, use the column for the company code as "button" column. Of course you would add an additional column in a real-time report.



Question 6: ALV Regdg



I have to develop a report which has one main heading and that heading is further split into 2/3 more sub headings.



Is it possible to develop this kind of report using ALV?



A sample format is given below:



---------------

| Column 1 |

---------------



--------------------------------

| Column 1a | Column 1b |

--------------------------------



If it’s not possible using ALV, is there any other option?



A: Try using the top of the page event in ALV. You can also check this example code, there are multiple headers displayed.



Question 7: ALV using ABAP Classes and Objects



I am trying to print the values in my internal table using ALV, and using ABAP classes and objects. The title for columns was picked based on the title specified in the data element. I want to set the title of my columns by my own.



How can I achieve this? A sample code will be of help.



A: You have to build an ALV field catalog for this. You can check the online help:

http://help.sap.com/saphelp_47x200/helpdata/en/52/5f060de02d11d2b47d006094192fe3/frameset.htm



Question 8: Display Logo on ALV Grid Report



I am displaying data as ALV Grid using “CALL METHOD CL_SALV_TABLE=>FACTORY”.

I am having trouble on how to display the logo on top of the page event.



How can I do that?



A: You can use the class ‘cl_salv_form_picture’ when writing your headers. Implement the following and pay attention to the FORM ‘create_header_and_footer’.



Question 9: ALV Header Regdg



I am using Class ‘CL_SALV_TABLE’ to generate my ALV report. I also want to display a header for this report.



Is there any method which would help me to achieve this functionality?



A: Here are some code snippets to give you an idea of what you can use. You could also refer to demo program ‘SALV_TEST_TABLE’ which has everything.



data: gr_table type ref to cl_salv_table.



data:

lr_display type ref to cl_salv_display_settings,

header type lvc_title.



header = 'test header'.



lr_display = gr_table->get_display_settings( ).



lr_display->set_list_header( header ).



Question 10: Change the status in ALV



I call an ALV in a subscreen. In the catalog, there are 2 checkbox in edit mode, so the default status GUI is diferent if I call it with no editable fields.



I want to change the default status GUI than the ALV OO sets automatically. There are two (2) kinds of standard status, the read mode and the editable mode with different controls for each. If the ALV detects any editable field in the catalog, it automatically sets the edit mode status GUI. If there's none, then it sets the basic status GUI. I just want to set the basic status GUI when my list have editable fields.



I want to set the status in read mode, is there any way?



A: You can use field catalog edit = 'X'.



You also have to do this logic yourself. Assuming that you have created your ALV grid instance already, and then you have to code in the PBO module where you set your GUI status.



Take note that method ‘IS_READY_FOR_INPUT’ has optional parameter for row number and column number. Thus, it appears that you can specifically ask the grid instance whether a certain column (your checkbox column) is editable or not.



Question 11: Delete function



I find the event TOOLBAR in the class ‘CL_GUI_ALV_GRID’ in the application which stated: "Change, delete or add GUI elements in the toolbar". I want to delete elements, but there's no information about. There's the example report BCALV_GRID_05, but this one just inserted new elements. I want to delete the standard ones like CL_GUI_ALV_GRID=>MC_FC_DETAIL.



How can I do it?



A: I think you may need to use the option of excluding toolbar buttons from the ALV grid (IT_TOOLBAR_EXCLUDING) while using the ‘SET_TABLE_FOR_FIRST_DISPLAY’. Here, you can specify what buttons you want to exclude from display on the ALV grid. With the TOOLBAR event, I think you can only disable the buttons from usage though they are still visible on the toolbar.



Question 12: Hold Multiple Selections in ALV Lists with cl_salv_table



I developed an ALV report using the SALV classes.



I noticed that it creates the lateral selection bar that makes you choose one or more records in the list. But changing the selections on the sidebar, I see that it doesn't hold the previously chosen record. I tried to choose contiguous records making drag-and-drop on the sidebar, and it works as well.



I tried to choose not-contiguous records keeping pressed the "Ctrl" key, and it works too.

So I think that the client would want to select contiguous and not-contiguous records only by a single mouse click.



Is it possible to do it, keeping selected the clicked rows one-by-one?



A: No, this is not possible. The GUI controls this and was designed to work like Excel, so you know that this functionality doesn't exist in Excel either. You must hold the CTRL to do random selections.



It is not possible to do editable ALV using the new object model. In order to do this, you would have to revert back to the ‘CL_GUI_ALV_GRID’ class, or the function module ‘REUSE_ALV_GRID_DISPLAY’.



Question 13: Sorting some columns in ALV Grid



I want to tell to the method ‘set_table_for_first_display’ to make one of the columns not sortable. Let's say the column name is "My Icon".



When the User will highlight column "My icon" and then click on sort buttons in the toolbar, no sort will happen on this column.



I was trying to identify a field in ‘lvc_s_sort’ which would say "do not sort this column". Is there any?



A: Set the following flags in the ‘field catalog’ entry for your fixed columns:



ls_fcat-key = 'X'.

ls_fcat-fix_column = 'X'.



However, fixed columns are always at the left side of the ALV list. You cannot fix columns in the middle or on the right side of the ALV list.



You would need to remove the SORT buttons and then create Custom buttons that do the sorting. You would trigger your SORT code in the PAI of the screen containing the ALV grid.



First thing is that you need a local class as your event handler, copy and paste this code. Here, we are using the name ‘ALV_GRID’ for your ALV object.



Question 14: ALV Tree



I'm using ‘CL_GUI_ALV_TREE’. When I build the hierarchy and set the parameters of a node, I also put IS_NODE_LAYOUT-ISFOLDER = 'X'.



In an event, I have the ‘node_key’ and I want the characteristic of this node, and in particular if this node is a folder or not.



How can I do this? What is the method to get the layout?



A: I think the method TREE_GET_NODE_LAYOUT is useful. In here, you have the node layout info in ‘ES_NODE_LAYOUT’ when you supply the node key to ‘I_NODE_KEY’.

The method TREE_GET_NODE_LAYOUT is called from method GET_OUTTAB_LINE that returns ES_NODE_LAYOUT.



Question 15: ALV in output using Object Oriented Model



I want to display two ALV in my report output. I have two internal tables and I want one ALV for each internal table.



It will be better if the ALV output is in grid format. How can I do this?



A: You have to define two screen areas as containers for each of the 2 ALVs. Then, construct the ALV grid on each of the areas using the CREATE OBJECT statement passing the container references.



Then use the ‘SET_TABLE_FOR_FIRST_DISPLAY’, using each of the 2 ALV grid references and passing your internal tables.



Question 16: ALV Reports using ABAP Objects



I am trying to print the values in my internal table using ALV, ABAP classes and objects. In here, I am able to get the total successfully. But I need to get subtotals also, like based on the carrid in table ‘sflight’. I need the subtotal of the price for every carrid like 'LH' and 'SQ'.



Here is my code:

REPORT znav_report.



DATA: alv TYPE REF TO cl_salv_table,

value1 TYPE REF TO cl_salv_aggregations,

value2 TYPE REF TO cl_salv_aggregation.



DATA: BEGIN OF itab_flight OCCURS 0,

carrid LIKE sflight-carrid,

connid LIKE sflight-connid,

fldate LIKE sflight-fldate,

price LIKE sflight-price,

paymentsum LIKE sflight-paymentsum,

currency LIKE sflight-currency,

END OF itab_flight.

SELECT carrid

connid

fldate

price

paymentsum

currency

FROM sflight INTO TABLE itab_flight

WHERE carrid = 'LH' OR carrid = 'SQ'.



cl_salv_table=>factory( IMPORTING r_salv_table = alv

CHANGING t_table = itab_flight[] ).



CALL METHOD alv->get_aggregations

RECEIVING

value = value1.



CALL METHOD value1->add_aggregation

EXPORTING

columnname = 'PAYMENTSUM'

aggregation = if_salv_c_aggregation=>total

RECEIVING

value = value2.



alv->display( ).



How can I get the subtotals for every different carrid?



A: Go through the following:



DATA: alv TYPE REF TO cl_salv_table,

value1 TYPE REF TO cl_salv_aggregations.



data: itab_flight type table of sflight.



data: gr_sorts type ref to cl_salv_sorts.

data: gr_agg type ref to cl_salv_aggregations.



start-of-selection.



select * into table itab_flight from sflight.



cl_salv_table=>factory( IMPORTING r_salv_table = alv

CHANGING t_table = itab_flight[] ).



CALL METHOD alv->get_aggregations

RECEIVING

value = value1.



gr_sorts = alv->get_sorts( ).

gr_sorts->add_sort( columnname = 'CARRID' subtotal = abap_true ).

value1->add_aggregation( 'PAYMENTSUM' ).



alv->display( ).



Question 17: Code stuck



My code is stuck – what is the problem?



data : begin of itab_flight occurs 0,

carrid type sflight-carrid,

connid type sflight-connid,

fldate type sflight-fldate,

price type sflight-price,

currency type sflight-currency,

planetype type sflight-planetype,

end of itab_flight.



Then, when I perform a select query, it stated “select carrid connid fldate price currency plane type into corresponding fields of table itab_flight from sflight”, it gives me a dump.



How can I resolve this?



A: Make use of one of these statements:



Either:

(a) Select ‘carrid connid fldate price currency planetype’ into ‘table itab_flight from sflight’.

or

(b) Select * into corresponding fields of table ‘itab_flight’ from ‘sflight’.



(a) is better in performance than (b).



But before that, please take note of some performance related issues with OO Context.



1. When defining an Internal table, avoid occurring specification. It is obsolete, instead make use of Initial Size n.



2. Declare ‘Work area’ separately since Internal table is defined along with the header line being obsolete in OO Context. It’s better and more robust to fill the itab and fetch the values from itab using a separate ‘Work area’ rather than the header line. So, avoid header lines.



3. When defining an internal table, follow this way:

Define a Linetype (Field String) using the TYPES Statement:

TYPES: begin of ty_line,

f1 type i,

f2 type i,

end of ty_line.



Then, define a Table type using TYPES Statement:

TYPES: ty_lines type standard table of ty_line with default key.



"There is difference between line and lines, so make it clear."



Then, define the internal table and its work area using a DATA statement as shown below:



DATA: i_lines type ty_lines,

wa_lines like line of i_lines



This is the standard way of defining the internal table under OO Context.



Your definition is creating a default header line that should be avoided.



Question 18: Checkboxes in ALV Output and table updating



I've made a report whose ALV output is as follows:



name skill rating handler reviewer



gp script 8

abc workflow 6



The handler and reviewer are 2 checkboxes. The user will click on the checkbox and make one person as handler and the other person as reviewer. After clicking the checkbox, when the user clicks on 'save' button, the data needs to be saved in a ztable.



I've done all the coding, but the problem is that after clicking the 'save' button, it’s not recognized in the internal table when the checkbox was clicked. It’s showing the old internal table in the debugging mode. If it can be recognized somehow, I can update my ztable.



What’s the solution for this?



A: You can refer to the following example:

loop at ls_outtab-celltab into ls_celltab.

if ls_celltab-fieldname eq 'CHECKBOX'.

* §B4.Switch the style to dis- or enable a cell for input

if ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.

ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.

else.

ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.

endif.

modify ls_outtab-celltab from ls_celltab.

endif.

endloop.

modify gt_outtab from ls_outtab index es_row_no-row_id.

call method sender->refresh_table_display.

From ex: BCALV_EDIT_05



You can also do it like the following:



WHEN 'UPDATE'.



DATA REF1 TYPE REF TO CL_GUI_ALV_GRID.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = REF1.

CALL METHOD REF1->CHECK_CHANGED_DATA.



LOOP AT G_T_OUTTAB WHERE CHECK = 'X'.

" Update the Ztable

EnDLOOP:



Question 19: Checkboxes in ALV Output



I got an internal table as follows:



name skill rating

Gaurav Workflow 8

abc script 4

def ALV 5



I want to generate an ALV output of the above the internal table. I want to add 2 checkboxes like below in the ALV Output:



name skill rating handler reviewer

Gaurav Workflow 8 x

abc script 4 x

def ALV 5 x



In the above report, the output is as follows:



Gaurav is a handler of the ticket related to workflow.

abc is reviewer of the ticket related to script.

def is a handler of the ticket related to alv.



These checkboxes are not fixed. Anyone can be made reviewer and handler. One person can't play both roles simultaneously. This data will be saved in a z table.



I believe this can be handled through OOPS ALV.

What can be the coding for this?



Secondly, when the output list comes and the user selects the buttons after pressing the 'save' button, I want this data to be saved in the ztable.



How can I recognize which checkbox is clicked at the user command?



A: Add a field for check box in your itab, CHECK(1), and the field catalog for the field.

L_FIELDCAT-INPUT = 'X'.

L_FIELDCAT-EDIT = 'X'.

L_FIELDCAT-CHECKBOX = 'X'.



For your second question, in the user command routine, use the following:



LOOP AT ITAB into wa_itab WHERE NOT CHECK IS INITIAL.

MODIFY ZTABLE FROM WA_ITAB.

ENDLOOP.



Question 20: ALV - OOPS Related Query



What is this class ‘lcl_event_receiver’ and its importing parameters (e_row e_column)?



In the class ‘CL_GUI_ALV_GRID’ (used to implement ALV Grids), there are some events defined to utilize some additional functionalities of the ALV Grid. For these types of functionalities, we require a class to be implemented (generally local in our program e.g. lcl_event_receiver in your program) to be the event handler for the ALV Grid instance.



The import parameters of the handler methods defined in the local class are basically nothing but the parameters of the events defined in global class ‘CL_GUI_ALV_GRID’. So you can check it using SE24 transaction. Select the event and press "PARAMETERS" button to see what parameters the event have, and the same can be imported in the handler method of the event.



Question 21: ALV - access to protected method



I have an object from class "CL_GUI_ALV_GRID" and want to change the protected attribute "EVT_DELAYED_CHANGE_SELECTION Constant Protected" with the method:



CALL METHOD alv_grid->SET_DELAY_CHANGE_SELECTION

EXPORTING

time = lv_delay.



How can I access this protected attribute?



A: You could try to sub-class ‘CL_GUI_ALV_GRID’ and add a public method (e.g. SET_DELAY_CHANGE_SELECTION_PUBL) to your sub-class which will call the protected method.



Another suggestion is to define a sub-class inheriting the superclass, where the protected attributes and methods exist. Then you can access the protected methods and attributes.



Question 22: Bring ‘Top_of_page’ in OOPS ALV



Is there a sample coding to bring “Top_of_page” in OOPS ALV?



A: One important thing is to split the screen into two parts using the splitter container and then use the first part to TOP_OF_PAGE and the second one to show the Grid data.



Question 23: Node_Double_Click won’t trigger ALV TREE



My class has an event that is triggered by (at least was supposed to be) ‘Node_Double_Click’. I even tried ‘Item_Double_Click’ event and mark 'X' in ‘item_selection’ parameter when creating my instance of ‘CL_GUI_ALV_TREE’, but that event won’t trigger too.


Purchase this book or download sample versions for your ebook reader.
(Pages 1-21 show above.)