Display tooltip on oops alv report data.
hi friends,
I have a requirement to display tooltip information on OOPS ALV Report data.
I done tooltip for the header but i also want to do for it displaying data.
Eg.
10 material no. display in the list while i took cursor on 1st material no. then it will display me 1 st material description as tooltip.
similarly, for 2, 3 and so on.
Regards,
Narendra
hi,
i think that´s not possible....
but you can try to work with Drop Down fields....
add to output table a table LVC_T_DROP (like colours of a cell )
Values could be your material descriptions...
maybe its also possible to click on a field ( GET_CURRENT_CELL )
after react with same ucomm like Drop Down.....
bestreg
Robert
Similar Messages
-
OOP ALV report custom control performance problem
HI
how to write OOP ALV report without custom control.. Actually with custom control which taking long time... and time out happens for huge selection of data..
Regards
Roops.timeout is not an alv problem. If you try to display a "huge" amount of data, any display technology will fail. Even sap programs fail, their wise solution is to ask user to restrict data to be displayed. Or reduce database selection time, or display amount. Or propose the user to download data as a spool, or output to a file on server.
Otherwise, read some advices about how to handle timeout in [Note 25528 - Parameter rdisp/max_wprun_time|http://service.sap.com/sap/support/notes/25528].
About your question, if you still want to try, look at [example code with alv class cl_salv_table for simple display|http://help.sap.com/saphelp_nw2004s/helpdata/en/f9/1ab54099de3726e10000000a1550b0/frameset.htm] -
Need a sample program for hierarchial oops ALV report
Hello experts,
I Need a sample program for hierarchial oops ALV report.Hi,
Check the following sample code...
T A B L E S
tables : ekko.
data definition
types : begin of ty_ekko,
ebeln type ekko-ebeln,
lifnr type ekko-lifnr,
bsart type ekko-bsart,
aedat type ekko-aedat,
ernam type ekko-ernam,
end of ty_ekko.
types : begin of ty_eket,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
werks type ekpo-werks,
matnr type ekpo-matnr,
menge type eket-menge,
wamng type eket-wamng,
netpr type ekpo-netpr,
end of ty_eket.
data : it_ekko type table of ty_ekko,
it_eket type table of ty_eket.
data: ob_hieralv type ref to cl_salv_hierseq_table.
data: it_binding type salv_t_hierseq_binding,
is_binding type salv_s_hierseq_binding.
S E L C T O P T I O N S
select-options : s_ebeln for ekko-ebeln.
S T A R T O F S E L E C T I O N
start-of-selection.
select ebeln
lifnr
bsart
aedat
ernam from ekko
into corresponding fields of table it_ekko
where ebeln in s_ebeln.
if sy-subrc eq 0.
select aebeln aebelp
awerks amatnr
bmenge bwamng
a~netpr from ekpo as a join eket as b
on amandt = bmandt
and aebeln = bebeln
and aebelp = bebelp
into corresponding fields of table it_eket
where a~ebeln in s_ebeln.
endif.
is_binding-master = 'EBELN'.
is_binding-slave = 'EBELN'.
append is_binding to it_binding.
*TRY.
call method cl_salv_hierseq_table=>factory
exporting
t_binding_level1_level2 = it_binding
importing
r_hierseq = ob_hieralv
changing
t_table_level1 = it_ekko
t_table_level2 = it_eket .
*CATCH cx_salv_data_error .
*CATCH cx_salv_not_found .
*ENDTRY.
call method ob_hieralv->display( ).
Cheers,
Ram -
Problem in display of text in ALV report
Dear experts,
I am working on a MM Report in which I need to display Material Basic data text maintained in MM01,02 Tcodes through ALV report.
I have declared a string type variable for the Basic data text in the Final Internal Table.
For reading the Standard text I am using Read_Text FM, from which I am looping the Text internal table and concatenating it into
String variable.
What I notice is all the content beyond 255 chars is not getting displayed, Even when the ALV report is downloaded to Excel file.
Can you suggest some approach to over come this issue.
Regards,
MurthyHi,
Use the below code
Data : lt_content TYPE TABLE OF tline,
lw_content TYPE tline.
Data : lt_text Type Table of solisti1,
lw_text TYPE solisti1.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = lv_id
language = tdspras
name = lv_name
object = lv_object
archive_handle = 0
local_cat = ' '
TABLES
lines = lt_content
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
loop at lt_content into lw_content.
lw_text-line = lw_content-tdline.
APPEND lw_text TO lt_text.
CLEAR: lw_content, lw_text.
endloop.
Now your whole text is in "lt_text".
Regards,
Avish Mittal -
How to display two lables in alv report
Is there any chance to display two lables in alv report
for example..
AMOUNT
Rs | Ps
|
like that this for an example.
thanks,
JBHai Babu
Go through the following Code
using Classes & Methods
try with the following Code( Just copy the code & try with in SE38 Tcode & Execute it that all)
REPORT ZALV_SALES_HEADER_DETAIL MESSAGE-ID Z50650(MSG) .
TABLES
TABLES: VBAK . "SALES DOCUMENT HEADER
DATA OBJECTS DECLARATION
DATA: IT_VBAK TYPE STANDARD TABLE OF ZVBAK_STRUC,
IT_VBAP TYPE STANDARD TABLE OF ZVBAP_STRUC,
GS_LAYOUT TYPE LVC_S_LAYO,
GS1_LAYOUT TYPE LVC_S_LAYO,
GRID TYPE REF TO CL_GUI_ALV_GRID,
CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
VBAK_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
VBAP_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
WA_VBAK LIKE LINE OF IT_VBAK,
WA_VBAP LIKE LINE OF IT_VBAP,
SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
TOP_OF_PAGE_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
GRID_VBAP TYPE REF TO CL_GUI_ALV_GRID,
TOP_PAGE TYPE REF TO CL_DD_DOCUMENT,
FLAG(1).
*"EVENT RECIEVER CLASS DEFINITION
CLASS LCL_EVENT_RECIEVER DEFINITION DEFERRED.
DATA: OBJ_EVENT TYPE REF TO LCL_EVENT_RECIEVER.
SELECTION-SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
SELECTION-SCREEN: END OF BLOCK B1.
CLASS DEFINITION AND DECLARATIONS
CLASS LCL_EVENT_RECIEVER DEFINITION.
PUBLIC SECTION.
EVENTS:DOUBLE_CLICK,
TOP_OF_PAGE.
METHODS:HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW .
METHODS: HANDLE_TOP_OF_PAGE FOR EVENT TOP_OF_PAGE OF CL_GUI_ALV_GRID.
ENDCLASS. "LCL_EVENT_RECIEVER DEFINITION
CLASS LCL_EVENT_RECIEVER IMPLEMENTATION
CLASS LCL_EVENT_RECIEVER IMPLEMENTATION.
METHOD: HANDLE_DOUBLE_CLICK.
READ TABLE IT_VBAK INDEX E_ROW-INDEX INTO WA_VBAK.
PERFORM FETCH_ITEM_DETAILS USING WA_VBAK.
PERFORM ALV_GRID.
ENDMETHOD. "HANDLE_DOUBLE_CLICK
METHOD: HANDLE_TOP_OF_PAGE.
CALL METHOD TOP_PAGE->ADD_TEXT
EXPORTING
TEXT = 'SALES HEADER & ITEM DETAILS'.
CALL METHOD TOP_PAGE->DISPLAY_DOCUMENT
EXPORTING
PARENT = TOP_OF_PAGE_CONTAINER.
ENDMETHOD. "HANDLER_TOP_OF_PAGE
ENDCLASS. "LCL_EVENT_RECIEVER IMPLEMENTATION
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
IF S_VBELN IS NOT INITIAL.
SELECT COUNT(*)
FROM VBAK
WHERE VBELN IN S_VBELN.
IF SY-DBCNT = 0.
MESSAGE E000 WITH 'NO TABLE ENTRIES FOUND FOR LOW KEY SPECIFIED'.
ENDIF.
ENDIF.
START-OF-SELECTION.
START-OF-SELECTION.
PERFORM FETCH_SALES_HEADER_RECORD.
PERFORM CREATE_CALL. "CREATION OF OBJECTS & CALLING METHODS
END-OF-SELECTION.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form FETCH_SALES_HEADER_RECORD
text
--> p1 text
<-- p2 text
FORM FETCH_SALES_HEADER_RECORD .
SELECT
VBELN
AUDAT
VBTYP
AUART
AUGRU
NETWR
WAERK
FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE IT_VBAK
WHERE VBELN IN S_VBELN
AND VBTYP = P_VBTYP.
ENDFORM. " FETCH_SALES_HEADER_RECORD
*& Form CREATE_CALL
text
--> p1 text
<-- p2 text
FORM CREATE_CALL .
IF CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
PARENT =
CONTAINER_NAME = 'CUSTOM_CONTAINER'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT SPLITTER
EXPORTING
TOP = 5
PARENT = CUSTOM_CONTAINER
ROWS = 3
COLUMNS = 1
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = TOP_OF_PAGE_CONTAINER.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = VBAK_CONTAINER.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 3
COLUMN = 1
RECEIVING
CONTAINER = VBAP_CONTAINER.
CREATE OBJECT GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = VBAK_CONTAINER
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
GS_LAYOUT-GRID_TITLE = 'SALES HEADER DETAILS.'(100).
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'ZVBAK_STRUC'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_VBAK
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CREATE OBJECT OBJ_EVENT .
SET HANDLER OBJ_EVENT->HANDLE_DOUBLE_CLICK FOR GRID.
SET HANDLER OBJ_EVENT->HANDLE_TOP_OF_PAGE FOR GRID.
CREATE OBJECT TOP_PAGE
EXPORTING
STYLE = 'ALV_GRID'
CALL METHOD TOP_PAGE->INITIALIZE_DOCUMENT.
CALL METHOD GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = TOP_PAGE.
CALL SCREEN 100.
ENDFORM. " CREATE_CALL
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form FETCH_ITEM_DETAILS
text
--> p1 text
<-- p2 text
FORM FETCH_ITEM_DETAILS USING WA_VBAK TYPE ZVBAK_STRUC .
SELECT
VBELN
POSNR
MATNR
MATWA
PMATN
CHARG
FROM VBAP
INTO TABLE IT_VBAP
WHERE VBELN = WA_VBAK-VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'NO RECORDS FOUND FOR SPECIFIED KEY'.
ENDIF.
ENDFORM. " FETCH_ITEM_DETAILS
*& Module STATUS_0200 OUTPUT
text
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
MODULE USER_COMMAND_0200 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form alv_grid
text
--> p1 text
<-- p2 text
FORM ALV_GRID .
IF FLAG = ''.
FLAG = 'X'.
CREATE OBJECT GRID_VBAP
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = VBAP_CONTAINER
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
GS1_LAYOUT-GRID_TITLE = 'SALES ITEM DETAILS.'(100).
CALL METHOD GRID_VBAP->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'ZVBAP_STRUC'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = GS1_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_VBAP
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " alv_grid
Thansk & regards
Sreenivasulu P -
Displaying special characters in ALV report.
Hi Experts,
Can we display special characters in ALV reports? Special characters such as tick mark.(Like in character map(Font Bookshelf Symbol 7) of windows ).
I tried with icons in ALV report, I was able to display tick icon in the ALV report, but when we export the report in to a excel, the icons comes in as Hexadecimal code.
Can any we display special characters like tick in ALV report or display the icons in excel aswell?
I will be gratefull for the <urgency reduced by moderator> response.
Regards,
Sharath.
Edited by: Thomas Zloch on May 10, 2011 10:26 AMSharath,
I think it is possible to do so.
Please check this link.
http://www.sapfans.com/forums/viewtopic.php?f=13&t=322569
Thanks,
Guru. -
Oops alv report not getting displayed
Hi experts,
I have REQUIREMENT WHERE I NEED TO DISPLAY THREE REPORTS USING ALAV OOPS.
I have maintained a FM to call alv rport.
,I have two validations to make at to different location in report. The report needs to be displayed only after I perform two different validations.
Issue is
I call this ALV reprt Fm once at : AT SELECTION SCREEN OUTPUT
and second time at : START OF SELECTION...
Now I can see the ALV report ( oops with three reports in one container) very well when i call it from : AT SECETION SCREEN OUTPUT( Here I perform one of teh two validations which I have mentioned above...The validation performed here is of Selction screen valiudation).
ButNow when I perform another validation at START OF SELECTIOn...here I cannot see the ALV report...TEH screen appearing is blank...
I am calling teh SAME OOPS ALV Function Module from both the locations...( START of SEL and AT selc O/p)..
I have debugged teh code and checked teh feidcatalogue genration as well s output table .and also structure
parameteers .. all of tehm are getting populated in both the cases ,,, but dont know why thye output doesnot appear in th last call..
please help ., I am stuck up...
TX a ton in adv...
Regards,
KTHi Kshitija T,
START-OF-SELECTION is processed in PAI of selection screen - as soon as all processing is done, the program flow will return, initialize your program an all of it's objects and display the selection screen again.
I solved this by disabling the default report status EXECUTE button and used AT-SELECTION-SCREEN events.
Regards,
Clemens -
Urgent: about the checkbox in OOP ALV report
Hi Experts,
I had use OOP method to display my ALV report. In the report I have a checkbox for each line. I had set this check box use below statements:
gt_fieldcat_record-tabname = 'GT_ISSUE_INT'.
gt_fieldcat_record-fieldname = 'CHECKBOX'.
gt_fieldcat_record-checkbox = 'X'.
gt_fieldcat_record-edit = 'X'.
APPEND gt_fieldcat_record.
When I press the save button, then I will save the lines to my Z-table which its GT_ISSUE_INT-CHECKBOX = 'X'.
Now I click the checkbox to select several lines in my ALV report and then press save, but it do not work. Then I check the internal table GT_ISSUE_INT in debugger, I found the GT_ISSUE_INT-CHECKBOX = ' '. Above statements is not correct for the checkbox?? Or I need additional statements to move 'X' to GT_ISSUE_INT-CHECKBOX?? Please help!!!Thanks.Hi,
If u want to read check box status from list, need to call function module explicitly.
see the sample code:
case sy-ucomm.
when 'SAVE'.
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 GT_ISSUE_INT to workarea.
____ continue writing ur code.
function module read the data from list . and save the changes that made on list.
when u debug, u can see the check box status as 'X' after exucut\ing this fm and method.
reward if helpful.
regards,
swapna -
OOPs ALV report Fieldcatalog Editing a currency field
Hi all,
I have created an OOP's ALV report. I have made one of the currency field editable. when I am changing the value in any cell and go out of the cell(or move to other cell using arrow keys or click some were in the grid) it is taking '.' after 2 digits from the right.
for example if I take 10 it is converting to 0.10, if I take 100 it is becomnig 1.00, if I take 100.00 it is becoming 1.00. If I take 123.45 I am getting a pop up box with message "Too many decimal places"
the fieldcatalog values are as follows
WA_FIELDCAT-FIELDNAME = 'ORD_VAL'.
WA_FIELDCAT-SCRTEXT_M = 'Ord Value'.
WA_FIELDCAT-COL_POS = 11.
wa_fieldcat-no_zero = 'X'.
WA_FIELDCAT-OUTPUTLEN = 14.
WA_FIELDCAT-CURRENCY = 'INR'.
wa_fieldcat-decimals_o = '2'.
wa_fieldcat-no_zero = 'X'.
WA_FIELDCAT-EDIT = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
Can anybody please help me. As If I edit the field it should take the values what I input.
Thanks in Advance.Hi ,
The CURR field is the currency unit field in the table ITAB.
I am just confused with your answer. in my case the final internal table is T_CHKQTY1 shall I take that or anything else. I have taken WA_FIELDCAT-CTABNAME = 'CURR'. but the system is thrownig an error as The data object has no component with CTABNAME but there is a component called TABNAME.
Can you please currect me. -
Issue in displaying header details in ALV report
Hi,
I have used slis_t_listheader and REUSE_ALV_COMMENTARY_WRITE to display the header details in ALV report.I want the details to be displayed as below.
Requester : ---------------------- Page: 1
Program: ----------------------- Date:---------
Title of Report
But when I use the structure slis_t_listheader to display the header details,all the fields are coming one below the other.
How can I get the fields as shown in the above format
Edited by: Abaper12345 on Jun 25, 2009 7:54 AMHi,
Go through following code... its showing the data exactly the way you want....
REPORT TEST3.
TYPE-POOLS:slis.
TABLES:MARA.
*Type Declaration
TYPES:BEGIN OF t_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
END OF t_mara.
*Internal Table
data:it_mara type standard table of t_mara.
*Work Area
data:wa_mara type t_mara.
DATA:i_repid TYPE sy-repid .
i_repid = sy-repid.
*Declaration for field catalog
DATA : fcat TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv.
*Declaration for Layout
data : WA_LAYOUT type SLIS_LAYOUT_ALV.
*Initializing ColumnWidth_Optimize For Layout
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
START-OF-SELECTION
START-OF-SELECTION.
*Fetching data into internal tables
PERFORM get_data.
*Buil Fieldcatalog
PERFORM build_fcat.
*Display ALV Report
PERFORM alv_display.
*Build Fieldcat
FORM build_fcat .
wa_fcat-tabname = 'IT_MARA'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-inttype = 'C'.
wa_fcat-seltext_m = 'Material Number'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 1.
APPEND wa_fcat TO fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'IT_MARA'.
wa_fcat-fieldname = 'ERSDA'.
wa_fcat-inttype = 'C'.
wa_fcat-seltext_m = 'Date'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 1.
APPEND wa_fcat TO fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'IT_MARA'.
wa_fcat-fieldname = 'ERNAM'.
wa_fcat-inttype = 'C'.
wa_fcat-seltext_m = 'User'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 1.
APPEND wa_fcat TO fcat.
CLEAR wa_fcat.
endform.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form GET_DATA .
select matnr ersda ernam from mara into table it_mara.
endform. " GET_DATA
*& Form ALV_DISPLAY
text
--> p1 text
<-- p2 text
form ALV_DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = i_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = 'HTML_TOP_OF_PAGE'
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = fcat
TABLES
t_outtab = it_mara
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " ALV_DISPLAY
*& Form html_top_of_page " I_CALLBACK_HTML_TOP_OF_PAGE "
FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
CALL METHOD document->add_text
EXPORTING
text = 'Program'
sap_color = document->list_group
sap_fontstyle = document->standard
sap_emphasis = document->strong.
CALL METHOD document->new_line
EXPORTING
repeat = 1
CALL METHOD document->add_text
EXPORTING
text = 'Requester'
sap_color = document->list_group
sap_fontstyle = document->standard
sap_emphasis = document->strong.
CALL METHOD document->new_line
EXPORTING
repeat = 1
CALL METHOD document->add_gap
EXPORTING
width = 125
CALL METHOD document->add_text
EXPORTING
text = 'This Is Test Data'
sap_color = document->list_group
sap_fontsize = document->LARGE
sap_fontstyle = document->standard
sap_emphasis = document->strong.
ENDFORM. "HTML_TOP_OF_PAGE
Thanks & Regards
Ashu SIngh -
How to raise error message from PAI of oops ALV report
Hi All,
I have a requirement to raise error message form editable oops alv . After entering the data and then press SAVE button .
Please help.
Thanks in AdvanceHI SK,
Write a Local class (Event Handeler) to handel the events. In Editable ALV once the user enter a value, CL_GUI_ALV_GRID will raise an event called DATA_CHANGED.
1. Define and Implement a local class to handle that event.
In the implementation of this class you need to get data from imported object to an internal table, then compare the same with the ALV output table.
* Local Class to handler the events raised from the ALV Grid
CLASS LCL_EVENT_HANDLER DEFINITION.
PUBLIC SECTION.
* Method to handel EDIT event, DATA_CHANGED of CL_GUI_ALV_GRID
METHODS : ON_DATA_CHANGE FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED.
ENDCLASS.
* Event handler class Implementation
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
METHOD ON_DATA_CHANGE.
DATA : LT_MODIFY TYPE LVC_T_MODI,
LS_MODIFY TYPE LVC_S_MODI.
* Copying changed data into intenal table from Object
LT_MODIFY = ER_DATA_CHANGED->MT_MOD_CELLS.
* Modifying the ouptut table with the changed values
IF LT_MODIFY[] IS NOT INITIAL.
*Compare the ALV Output table with LT_MODIFY
ENDIF.
ENDMETHOD.
ENDCLASS.
Then raise a message on required condition in the same method.
Note: To trigger the above method, you need to set event handler before displaying ALV (before calling method SET_TABLE_FOR_FIRST_DISPLAY)
* Creating object for the Local event handler class
CREATE OBJECT GR_HANDLER.
* Set handler (call method of Event_handler) to handler Edit event
SET HANDLER GR_HANDLER->ON_DATA_CHANGE FOR GR_GRID.
Regards,
Vijay -
Displaying Header Text in ALV report.
HI Gurus,
I have one sales order which has header Text.
I am displaying that Header Text in my ALV report.
But while displaying in the ALV grid, the text is not coming full.
I have taken the datatype of the column of the ALV grid is string, Still the Header text is not come full.
Please help me.
Thanks in advance.Hi,
If the header text is morethan 60 characters, you can't print with REUSE_ALV_COMMENTARY_WRITE. To overcome above limit we can use dynamic document, which can be implemented through the class CL_DD_DOCUMENT. As dynamic documents use HTML viewer control so instead of triggering the TOP_OF_PAGE event we should trigger event of HTML TOP_OF_PAGE.
First create a subroutine for top of page in HTML format and send that name in I_CALLBACK_HTML_TOP_OF_PAGE parameter of ALV function module. The input parameter for this subroutine will be a variable of class CL_DD_DOCUMENT.
* FORM html_top_of_page *
FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
data: l_text(255) type c.
l_text = '*******************************Hellooooooooooooooooooo************************'.
CALL METHOD top->add_text EXPORTING text = 'Hello world '
sap_style = 'heading' .
CALL METHOD top->add_gap EXPORTING width = 200.
CALL METHOD top->add_picture EXPORTING picture_id = 'ENJOYSAP_LOGO'.
CALL METHOD top->NEW_LINE( ).
CALL METHOD top->add_text EXPORTING
text = l_text.
ENDFORM.
* Display ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE' " Use this event
i_callback_program = g_repid
i_structure_name = 'STRUCTURE'
TABLES
t_outtab = gt_outtab.
Regards
Bala Krishna -
Adding new rows after displaying subtotals in an ALV report by using OOABAP
Dear All,
I am creating an ALV report, displaying subtotals and total by using Classes. I have used classes CL_SALV_AGGREGATIONS (Method : add_aggregation) and CL_SALV_AGGREGATIONS (Method : add_sort) for sorting and doing subtotals.
Output of my report as follows :- (I have used * for displaying spaces between fields)
Materia*******Quantity**SerialNo*Equipment**Value***WBS Element
ISM-DBSVR****1********12363****31872565***2165***Q-0040358945.001010
ISM-DBSVR****1********12364****31872566***2165***Q-0040358945.001010
**************************************Subtotal***********4330
-> If the value of "Quantity" is greater than 1 then the value of subtotal for the field "Value" is to be divided by the Quantity for that line item and needs to be displayed Quantity, SerialNo, Value details information after subtotal .
-> Basically I need to add few more rows for displaying above additional information in the ALV grid after displaying subtotal .
Q: Do we have any methods for change the layout for the above requirement.
I Appreciate your early response.
Thank you.
RajaSekhar.Hi,
For such type of requirement you need to use ALV hierchical table.
You can have your main table in master table.
For quantity greater than 1 you need to move the data into a seperate internal table....this internal table will have material as the key between the main table and the second table.
*... §2 create an ALV hierseq table
try.
cl_salv_hierseq_table=>factory(
exporting
t_binding_level1_level2 = lt_binding
importing
r_hierseq = gr_hierseq
changing
t_table_level1 = gt_master
t_table_level2 = gt_slave ).
catch cx_salv_data_error cx_salv_not_found.
endtry.
you can display both the tables together with the subtotals also.
please refer to program SALV_DEMO_HIERSEQ_SIMPLE to see how to display the hierarchical display.
Plr reward points if found helpful.
Regards,
Mayank -
Display 3 decimal in ALV for data element KBETR
Hi experts,
I've got an ALV report that reports, besides other things, the values stored in KONP-KBETR. The values from KONP-KBETR are passed across to an internal table field which is defined as type KONP-KBETR.
The problem is that KONP-KBETR is displayed to 2 decimal places and this is what the ALV grid shows e.g. 0.05
The users now want the field in the ALV to show the values to 3 decimal places so 0.05 should now appear as 0.053.
Any advice of how to do it?
Thanks all in advance....Hi,
When populating the fieldcat set decimals_out to '3' for the desired field entry.
See here: Re: decimal values for a field in ALV
Here's a sample program I wrote to output KBETR from KONP with three decimal places:
report zz_test_alv.
type-pools: slis.
tables: konp.
data:
it_etab type standard table of konp,
it_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv.
selection-screen begin of block sel with frame title text-t01.
select-options:
s_knumh for konp-knumh,
s_kopos for konp-kopos.
selection-screen end of block sel.
perform select.
perform build_fcat.
perform display.
form build_fcat.
wa_fieldcat-fieldname = 'KBETR'.
wa_fieldcat-decimals_out = '3'.
wa_fieldcat-seltext_l = wa_fieldcat-seltext_m = wa_fieldcat-seltext_s = wa_fieldcat-reptext_ddic = 'Amount'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
endform.
form display.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = 'zz_test_alv'
it_fieldcat = it_fieldcat
tables
t_outtab = it_etab.
endform.
form select.
select * from konp into table it_etab
where
knumh in s_knumh and
kopos in s_kopos.
endform. -
How to Display Page Numbers in ALV Report HTML End of page Event
hai Gurus
Greetings
Please tell me how to get current page noumber and total number of pages in ALV Report (in HTML End of Page Event)
i tried with sy-pagno system field but it is not working
so please guide me
Thanks
Rameshcheck below code....
*Work area for Layout
gf_layout type slis_layout_alv,
*Work area for HEADER FOOTER
gf_header type slis_listheader,
*Work area for Field catalogue
gf_fieldcat type slis_fieldcat_alv.
it_top_page type slis_t_listheader,
*Internal table for Field catalogue
it_fcat type slis_t_fieldcat_alv.
perform:fill_layout,
prepare_header,
field_catlog,
display_report.
Form fill_layout
form fill_layout .
gf_layout-colwidth_optimize = 'X'.
endform. " fill_layout
Form field_catlog
form field_catlog .
data : lf_fcat type line of slis_t_fieldcat_alv,
l_cnt type i.
clear : lf_fcat, l_cnt.
Employee Number
add 1 to l_cnt.
lf_fcat-fieldname = 'EMPLID'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 8.
lf_fcat-seltext_l = text-003.
append lf_fcat to it_fcat.
clear lf_fcat.
*Last Name
add 1 to l_cnt.
lf_fcat-fieldname = 'USERNAME'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 20.
lf_fcat-seltext_l = text-004.
append lf_fcat to it_fcat.
*First Name
add 1 to l_cnt.
lf_fcat-fieldname = 'EMPMAIL'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 40.
lf_fcat-seltext_l = text-005.
append lf_fcat to it_fcat.
*Known As
clear lf_fcat.
add 1 to l_cnt.
lf_fcat-fieldname = 'EMPSTATUS'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 10.
lf_fcat-seltext_l = text-006.
append lf_fcat to it_fcat.
clear lf_fcat.
*System UserID
add 1 to l_cnt.
lf_fcat-fieldname = 'COSTCENTER'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 10.
lf_fcat-seltext_l = text-007.
append lf_fcat to it_fcat.
clear lf_fcat.
*EMail ID
add 1 to l_cnt.
lf_fcat-fieldname = 'DEPTDESC'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 8.
lf_fcat-seltext_l = text-008.
append lf_fcat to it_fcat.
clear lf_fcat.
*Employment Status
add 1 to l_cnt.
lf_fcat-fieldname = 'LOC'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 20.
lf_fcat-seltext_l = text-009.
append lf_fcat to it_fcat.
clear lf_fcat.
*Personnel Area
add 1 to l_cnt.
lf_fcat-fieldname = 'TITLE'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 40.
lf_fcat-seltext_l = text-010.
append lf_fcat to it_fcat.
clear lf_fcat.
*Personnel Area Text
clear lf_fcat.
add 1 to l_cnt.
lf_fcat-fieldname = 'HDATE'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 10.
lf_fcat-seltext_l = text-011.
append lf_fcat to it_fcat.
clear lf_fcat.
*Country Grouping text
add 1 to l_cnt.
lf_fcat-fieldname = 'MGRID'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 10.
lf_fcat-seltext_l = text-012.
append lf_fcat to it_fcat.
clear lf_fcat.
*Cost Center
add 1 to l_cnt.
lf_fcat-fieldname = 'MGRNAME'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 20.
lf_fcat-seltext_l = text-013.
append lf_fcat to it_fcat.
clear lf_fcat.
*Employee Group
add 1 to l_cnt.
lf_fcat-fieldname = 'MGMAIL'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 40.
lf_fcat-seltext_l = text-014.
append lf_fcat to it_fcat.
clear lf_fcat.
*Organizational Unit
add 1 to l_cnt.
lf_fcat-fieldname = 'DIV'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 25.
lf_fcat-seltext_l = text-015.
append lf_fcat to it_fcat.
clear lf_fcat.
*Supervisor
add 1 to l_cnt.
lf_fcat-fieldname = 'BUSUNIT'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 25.
lf_fcat-seltext_l = text-016.
append lf_fcat to it_fcat.
clear lf_fcat.
endform. " field_catlog
Form display_report
form display_report .
data : l_repid type sy-repid.
clear l_repid.
l_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = l_repid
is_layout = gf_layout
it_fieldcat = it_fcat
i_callback_top_of_page = 'TOP-OF-PAGE'
tables
t_outtab = it_employee
exceptions
program_error = 1
others = 2.
endform. " display_report
Form PREPARE_HEADER
form prepare_header.
data:l_header1(20),
l_header2(60).
data:l_header3(20),
l_header4(60).
l_header1 = 'Met Life Census Data'.
l_header2+40(8) = 'Run Date'.
write sy-datum to l_header2+50(10).
header
gf_header-typ = 'S'.
gf_header-key = l_header1.
gf_header-info = l_header2.
append gf_header to it_top_page.
clear gf_header.
endform. " PREPARE_HEADER
form top-of-page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = it_top_page.
endform. "TOP-OF-PAGE
*& Form end_of_list_html
output at the end of the list - not in printed output *
FORM END_OF_LIST_HTML USING END TYPE REF TO CL_DD_DOCUMENT.
DATA: LS_TEXT TYPE SDYDO_TEXT_ELEMENT,
L_GRID TYPE REF TO CL_GUI_ALV_GRID,
F(14) TYPE C VALUE 'SET_ROW_HEIGHT'.
LS_TEXT+0(20) = 'Total Employees'.
LS_TEXT+40(10) = g_count.
CALL METHOD END->ADD_TEXT
EXPORTING
TEXT = LS_TEXT
SAP_EMPHASIS = 'STRONG'.
*adds new line (start new line)
CALL METHOD END->NEW_LINE.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = l_grid.
CALL METHOD l_grid->parent->parent->(f)
EXPORTING
id = 3
height = 10.
ENDFORM.
Maybe you are looking for
-
Hi everyone, i've made several screen recordings and wanted to edit them with the newest version of iMovie. The video clips are all having sound while playing them with QuickTimePlayer and VLC Media Player, but as I imported them with iMovie, the sou
-
Projector Recommendations for Keynote
I would like to get some recommendations from those of you who frequently use Keynote with a projector. I would like to get some help with what projector to purchase. I conduct small group presentations (fewer than 50 people) in typically-sized hotel
-
Send image back - background image
Is anyone else having the issue where the options in the "arrange" section, when having an image selected, does not allow you to send it back or forward. I can't send an image to the background with text appearing on top of it. It's not the case wi
-
MacBook Pro HD Dead for only one portion
Hey everyone, Yesterday night my MacBook Pro was working just fine, when my safari just froze up out of the blue. I couldn't move anything in safari so I just went to the apple button and clicked restart my macintosh. When the computer restarted it d
-
Can iPhoto or Aperture optimize photos? If not, best low cost program?
I know in a program like Adobe (Macromedia) you could take a photo and optimize it and have it be 1/5th the size yet still look the same. Anyone know if any apple products, or something in iLife do this? Thanks!