Dynamically determine the height of Top-of-page of an ALV report
Hi all,
I wanted to know if there is a way to determine and set the height of an HTML-TOP-OF-PAGE based on it contents?
Thanks in advance
Shabir
this is the final option for you. try with this..
REPORT ZTEST_ALV_001.
TYPE-POOLS: SLIS.
data: it_sort type SLIS_T_SORTINFO_ALV,
wa_sort like line of it_sort.
data: it_flight type standard table of sflight.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FIELDCAT.
data: o_grid TYPE REF TO cl_gui_alv_grid.
start-of-selection.
select * from sflight
into table it_flight
up to 20 rows.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_STRUCTURE_NAME = 'SFLIGHT'
CHANGING
ct_fieldcat = IT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF sy-subrc NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_html_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_STRUCTURE_NAME = 'SFLIGHT'
IT_FIELDCAT = IT_FIELDCAT
TABLES
t_outtab = IT_FLIGHT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM top_of_page USING header TYPE REF TO cl_dd_document.
DATA: ls_text TYPE sdydo_text_element,
meth(14) TYPE c VALUE 'SET_ROW_HEIGHT'.
if o_grid is initial.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = o_grid.
CALL METHOD o_grid->parent->parent->(meth)
EXPORTING
id = 3
height = 14. "<-----set the height here..
"using the add_text method you can show the texts
"in the top of page
ls_text = 'Top of page:'.
CALL METHOD header->add_text
EXPORTING
text = ls_text
sap_emphasis = 'strong'.
"for new lines
CALL METHOD header->new_line.
CALL METHOD header->new_line.
endif.
break-point.
ENDFORM.
Similar Messages
-
How to determine the height of a datatable?
Dear all,
Is it possible that we can know the height of a datatable, which is bound to certain database table?
The reason why I wanted to know of this is that I would like to dynamically change the height of an image according to current datatable height.
Does anyone have any solution to it?
Many thanks,
SeanThis is true unless some of the entries wrap to two or more lines. I've encountered this situation numerous times while developing my web app.
Another issue is if you size the table for, say five rows per page, but the result set contains less than five rows or the number of entries is not a multiple of five (in which case the last page will contain fewer than five rows). -
Dynamic Header(TOP-OF-PAGE) In HIERSEQ ALV
Hi Experts,
My Requirment is to develop a customer ledger in which the top of page is the detailed customer address follwed by list doc no...
please suggest me how to get the Dynamic top-of page in HIERSEQ ALV ...
Thanks in advance,
With regards,
PrakashHi Prakash,
Try this way.
<font color=blue><b><pre>REPORT ZTEST_NOTEPAD.
DATA: BEGIN OF IT_EKKO OCCURS 0,
EBELN TYPE EKKO-EBELN,
BUKRS TYPE EKKO-BUKRS,
BSTYP TYPE EKKO-BSTYP,
BSART TYPE EKKO-BSART,
END OF IT_EKKO.
DATA: BEGIN OF IT_EKPO OCCURS 0,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
LOEKZ TYPE EKPO-LOEKZ,
TXZ01 TYPE EKPO-TXZ01,
MATNR TYPE EKPO-MATNR,
END OF IT_EKPO.
TYPE-POOLS : SLIS.
DATA : IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT LIKE LINE OF IT_FIELDCAT,
LIST_LAYOUT TYPE SLIS_LAYOUT_ALV,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
DATA:PROGRAM TYPE SY-REPID.
START-OF-SELECTION.
PROGRAM = SY-REPID.
SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF TABLE IT_EKKO UP TO 100 ROWS.
IF NOT IT_EKKO[] IS INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_EKPO FROM EKPO FOR ALL ENTRIES IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
ENDIF.
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'TOP_OF_PAGE'.
APPEND WA_EVENTS TO IT_EVENTS.
GS_KEYINFO-HEADER01 = 'EBELN'.
GS_KEYINFO-ITEM01 = 'EBELN'.
DEFINE FIELDCATALOG.
WA_FIELDCAT-COL_POS = &1.
WA_FIELDCAT-FIELDNAME = &2.
WA_FIELDCAT-TABNAME = &3.
WA_FIELDCAT-SELTEXT_M = &4.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
END-OF-DEFINITION.
FIELDCATALOG: '1' 'EBELN' 'IT_EKKO' 'EKKO-EBELN',
'2' 'BUKRS' 'IT_EKKO' 'EKKO-BUKRS',
'3' 'BSTYP' 'IT_EKKO' 'EKKO-BSTYP',
'4' 'BSART' 'IT_EKKO' 'EKKO-BSART'.
FIELDCATALOG: '1' 'EBELN' 'IT_EKPO' 'EKPO-EBELN',
'2' 'EBELP' 'IT_EKPO' 'EKPO-EBELP',
'3' 'LOEKZ' 'IT_EKPO' 'EKPO-LOEKZ',
'4' 'TXZ01' 'IT_EKPO' 'EKPO-TXZ01',
'5' 'MATNR' 'IT_EKPO' 'EKPO-MATNR'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = PROGRAM
IT_FIELDCAT = IT_FIELDCAT
I_TABNAME_HEADER = 'IT_EKKO'
I_TABNAME_ITEM = 'IT_EKPO'
IT_EVENTS = IT_EVENTS
IS_KEYINFO = GS_KEYINFO
TABLES
T_OUTTAB_HEADER = IT_EKKO
T_OUTTAB_ITEM = IT_EKPO.
*& Form TOP-OF-page
FORM TOP_OF_PAGE.
WRITE: SY-TITLE,
/ SY-REPID.
WRITE: SY-DATUM, SY-UZEIT.
WRITE sy-uline.
ENDFORM. "TOP-OF-page</pre></b></font>
Thanks
Venkat.O -
Hi,
Below is a helper method used for calling a server-side function which loops through the inbound bindVars parameter to populate the function's IN parameters. Is there a way to dynamically determine the IN/OUT parameters based on the procedure name in the stmt parameter? No members of the CallableStatement class seemed promising, but the getParameterMetaData() method in the PreparedStatement class seemed like it could be helpful lead. However, I have not found any detailed descriptions (yet) of how to use it.
protected Object callStoredFunction(int sqlReturnType, String stmt,
Object[] bindVars) {
CallableStatement st = null;
try {
// 1. Create a JDBC CallabledStatement
st = getDBTransaction().createCallableStatement(
"begin ? := "+stmt+";end;",0);
// 2. Register the first bind variable for the return value
st.registerOutParameter(1, sqlReturnType);
if (bindVars != null) {
// 3. Loop over values for the bind variables passed in, if any
for (int z = 0; z < bindVars.length; z++) {
// 4. Set the value of user-supplied bind vars in the stmt
st.setObject(z + 2, bindVars[z]);
// 5. Set the value of user-supplied bind vars in the stmt
st.executeUpdate();
// 6. Return the value of the first bind variable
return st.getObject(1);
catch (SQLException e) {
throw new JboException(e);
finally {
if (st != null) {
try {
// 7. Close the statement
st.close();
catch (SQLException e) {}
JamesThe PreparedStatement.getParameterMetaData() object is exactly what you need for this task.
Once you have the ParameterMetaData you can ask it how many parameters are present and which mode they are. The parameters are numbered from 1 to n and you can use ParameterMetaData.getParameterMode(1); to get the mode of the 1st parameter. The modes are defined as static values in the ParameterMetaData object. Check out the doc at http://docs.oracle.com/javase/7/docs/api/java/sql/ParameterMetaData.html
Timo -
How to Print the space in Top-of-Page in ALV output
Hi gurus,
I had a problem in Printing the Spaces in Top-of-Page.
My Requirement is like.
Material no: (space with 18 char) to 5235268
but it is coming like .
Material no: to 5235268
i wrote the code like this.
form Top_of_page.
IF s_matnr IS NOT INITIAL.
wa_header-typ = 'S'.
wa_header-key = 'Material No:' .
IF s_matnr-high IS INITIAL.
MOVE s_matnr-low TO wa_header-info.
ELSE.
CONCATENATE s_matnr-low ' to ' s_matnr-high INTO wa_header-info SEPARATED BY space.
ENDIF.
APPEND wa_header TO tb_header.
CLEAR wa_header.
ENDIF.
Thanks & Regards,
Anil.Hi Anil ,
If u concatenate anything with space , your space will be lost.
Give a try for this if your s_matnr-high is initial.
data : c(21) type c.
IF s_matnr-high IS INITIAL.
Concatenate '(19 spaces )to' into C. concatenate C s_matnr-low into wa_header-info SEPARATED BY space.
endif.
<b>Please Note i wanted to put spaces at "(19 spaces)to" but posting this message is removing those spaces so have put it in words.</b>you have to take Variable c with first 19spaces and then 'to' as shown.
Here the Variable C is with 21 length for 18 spaces , one space to separate the 18 spaces from 'to' , and then 2 chars for 'to'.
I hope this will help you.
Regards,
AShwini -
How can you specify the height of an index page window?
I want to control the height of an index page window when it
loads.
If you look at this page;
http://www.farrowdesign.com/
It has a fixed size onload.
I'm trying to do a basic web page for a friend using
dreamweaver.
see here
http://www.landscapesbyjonstollar.com/
It's a series of horizontal landscape images which are all of
the same height - I want the user to scroll to the right to view
them usiing their browsers scroll bar.
Can anyone clearly explain (I'm very new to this) how I might
do this and if it's javascript - where I should paste the code.
Thanks in advance
Jim"<td width="853" <img src="images/Stollar_01.jpg"
width="853" height="642"
/></td><br>"
You can't be serious....
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"mbarizia" <[email protected]> wrote in
message
news:[email protected]...
>
>
> ok.. it's easy : in dream weaver replace those lines :
>
> <td width="853" <img src="images/Stollar_01.jpg"
width="853" height="642"
> /></td>
> <td width="864"><img
src="images/Stollar_03.jpg" width="864"
> height="642"
> /></td>
> <td width="732"><img
src="images/Stollar_05.jpg" width="732"
> height="642"
> /></td>
> <td width="862"><img
src="images/Stollar_07.jpg" width="862"
> height="642"
> /></td>
> <td width="857"><img
src="images/Stollar_09.jpg" width="857"
> height="642"
> /></td>
> <td width="968"><img
src="images/Stollar_11.jpg" width="968"
> height="642"
> /></td>
> <td width="487"><img
src="images/Stollar_13.jpg" width="487"
> height="642"
> /></td>
> <td width="545"><img
src="images/Stollar_15.jpg" width="545"
> height="642"
> /></td>
> <td width="901"><img
src="images/Stollar_17.jpg" width="901"
> height="642"
> /></td>
>
> By :
>
> <td width="853" <img src="images/Stollar_01.jpg"
width="853" height="642"
> /></td><br>
> <td width="864"><img
src="images/Stollar_03.jpg" width="864"
> height="642"
> /></td><br>
> <td width="732"><img
src="images/Stollar_05.jpg" width="732"
> height="642"
> /></td><br>
> <td width="862"><img
src="images/Stollar_07.jpg" width="862"
> height="642"
> /></td><br>
> <td width="857"><img
src="images/Stollar_09.jpg" width="857"
> height="642"
> /></td><br>
> <td width="968"><img
src="images/Stollar_11.jpg" width="968"
> height="642"
> /></td><br>
> <td width="487"><img
src="images/Stollar_13.jpg" width="487"
> height="642"
> /></td><br>
> <td width="545"><img
src="images/Stollar_15.jpg" width="545"
> height="642"
> /></td><br>
> <td width="901"><img
src="images/Stollar_17.jpg" width="901"
> height="642"
> /></td><br>
>
> any help : [email protected] ;)
> -
Dynamically determining the port number of a deployed application
Hi
How do I dynamically determine the port number of a deployed web application ?
I know HttpRequest.RequestURL() returns us the entire URL but I wanted to just
know the port number .
Is there any API do that ??
Thanks
Kar
kar piyush wrote:
> Hi
>
> How do I dynamically determine the port number of a deployed web application ?
> I know HttpRequest.RequestURL() returns us the entire URL but I wanted to just
> know the port number .
>
> Is there any API do that ??
>
kar,
Here's what I do under WL 7 SP2:
import javax.management.AttributeNotFoundException;
import javax.management.DynamicMBean;
import javax.management.MBeanException;
import javax.management.ReflectionException;
import javax.naming.Context;
import javax.naming.NamingException;
import weblogic.jndi.Environment;
import weblogic.management.MBeanHome;
String domainName,
serverName,
serverPort,
serverUrl;
// Getting the initial context
Environment env = new Environment();
try
Context ctx = env.getInitialContext();
if (ctx == null)
// unable to retrieve a JNDI context
return;
// Retrieving the server-specific MBeanHome interface
MBeanHome home =
(MBeanHome) ctx.lookup(MBeanHome.LOCAL_JNDI_NAME);
if (home == null)
// unable to retrieve the local server MBean
return;
// Get the domain & server name
domainName = home.getDomainName();
serverName = home.getMBeanServer().getServerName();
// The server port and address are a little trickier to extract...
Object mbeanArray[] =
home.getMBeansByType("ServerConfig").toArray();
DynamicMBean mbean = (DynamicMBean) mbeanArray[0];
try
serverPort =
Integer.parseInt(
mbean.getAttribute("ListenPort").toString());
serverUrl =
mbean.getAttribute("ListenAddress").toString();
catch (AttributeNotFoundException thrown)
// caught a AttributeNotFoundException
catch (MBeanException thrown)
// caught a MBeanException
catch (NullPointerException thrown)
// caught a NullPointerException
catch (ReflectionException thrown)
// caught a ReflectionException
catch (NamingException thrown)
log.debug("caught a NamingException", thrown);
-
Dynamically determining the number of cols in Select stmt
Hi,
I was wondering if it is possible to dynamically determine the number of cols in Select stmt.
For example:
If it had:
Select empno, lname from emp where empno = 32
then I'd like it to return 2.
Thanks in advance.
Sincerely,
Nikhil KulkarniHi,
I was wondering if it is possible to dynamically determine the number of cols in Select stmt.
For example:
If it had:
Select empno, lname from emp where empno = 32
then I'd like it to return 2.
Thanks in advance.
Sincerely,
Nikhil Kulkarni -
Hi all,
I use top of page to print page number for ALV report. When i run my report in backgrond and see the spool, the page is always started from page 2.
These does not happen when I use non-ALV report, report prints the header starting from page 1 normally. It is weird.
does anyone of you ever face such of that problem ?
thanks alots
AliaHi Alia,
Page number is usually not set in an ALV display, as compared to List processing.
r u sure this is a requirement?
chk this:
ALV Print page numbers
Regards,
Anjali -
Dynamically Determine the color of graphic
Hi Experts,
Can u plz explain the code how to determine the color of the graphic dynamically.I want black and white graphic on first page and color one on the next page and this must continue
till the last page.....upload two graphics to sap.
one is black and white and other is color.
declare a variable for count type i in global declaration.
before graphic declaration just
declare program lines i.e. move sfsy-page to count.
count the no of pages using sfsy-page.
insert 2 graphic
make 2 graphic as conditional.
i.e. in the condition tab of graphic1 -
> count = 1.
then the black and white image will print.
for the graphic 2 declare ---> count > 1 .
then the color image will print.
or u can directly maintain condition for both graphics.
in the condition tab sfsy-page = 1. block and while
for second image sfsy-page > 1. color image
it will work .
with Regards,
Kiran.G -
Changing the Height of Top Level Navigation
How do I change the height of the Top Level Navigation? I went into the framework page I am using, and then opened the Top Level Navigation iView, and changed the Fixed Height to "100" pixels while leaving the Height Type as "Fixed", but this had no affect.
I am using just one level of TLN, and trying to increase the height of that one level so it is easier to see in the page.
Thanks,
OwenI have already downloaded the PAR file and customized it, and am using it in my custom portal framework. Which part of the code do you recommend I modify? There is the portalapp.xml file, which specifies the height as 45 pixels, but this is just the default size, which should be overridden by the value I specify in the iview, right?
As far as the theme editor, that doesn't help me. I have to increase the size of the top level navigation, not just change the font.
Thanks,
Owen -
Dynamically changing the height and width of Stage
Hi,
I would like to know how can I change the height and width of stage dynamically. I tried it with the following code:
Stage.height = 250;
Stage.width = 250;
during the run time. Initially the Stage is at a height and width of 370 and 450 respectively. Also when I tried to trace the height and width of Stage after resizing the stage width and height, its showing the old value of width and height. That means the width and height not chnaging. Anybody have any idea about this.Hi Ross,
I could understand something about the problem after making a research on this topic. We can't change the width and height of stage from actionscript itself, right? I will explain the way I am planning to do. I don't know whether its right or not. Anyway you just go through it. First the player need to be resized, according to the specified height and width. Then in the object tag, there are two fields named height and width. We should change these value according to the specified height and width of video controller, dynamically. Am I right? But I am confused with two properties of Stage such as: align and scaleMode. The code was actually developed my trainer. There, the scaleMode is set to "noScale" and no align property is used. My doubt is how should I set align and scaleMode properties of Stage. Hope you understood what I meant.
Regards,
Sreelash.S. -
Trying to determine the height and width of an image.
Hi Everyone,
I am currently trying to work out the height and width of a number of pictures. I have tried a couple of techniques. One involved using BufferedImages, which kept on throwing null pointer exceptions. So I am now tring to use the Image class from java.awt.Image. However I need to use an ImageObserver or some such thing, of which I have absolutely no knowledge. If there is anybody out there who knows how to gather the information I speak of from a number of photos, and is feeling kind enough to impart their knowledge to me it will be greatly appreciated. Thanks.
Regards
DavidWell, maybe your problem is loading in the images, but I'm assuming you know what your question is since I don't feel like going into what ImageObserver does (That's what google is for).
Anyways, to get the height and width of an image you do this:
You initialize your image:
Image image = getImage("file.jpg") //I don't remember the if this is correct, it's just my memory.To get the dimensions"
image.getWidth();
image.getHeight();If these return 0 it's more than likely because the image hasn't loaded correctly, which is why you need ImageObserver (IIRC there is a better API in the new ImageIO library, check the API).
Best of luck.
Virum -
I want define a header like Top Of Page proprty of Reuse ALV in my OO ALV. But I can give only grid title. Can I define a logo and a few subheader in my OO ALV? (Set_Table_For_First_Display)
ThanksHi Mehmet,
i did one sample code, just check it, i documented all required things.
REPORT ZTEST1234_ALV_TOP MESSAGE-ID ZZ .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
DATA: IT_ROW_NO TYPE LVC_T_ROID,
X_ROW_NO TYPE LVC_S_ROID.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
END OF ITAB.
"The Below Definitions Must.....
DATA:
* Reference to document
DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
* Reference to split container
DG_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
* Reference to grid container
DG_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
* Reference to html container
DG_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER,
* Reference to html container
DG_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER.
"up to here
* CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO,
TOP_OF_PAGE FOR EVENT TOP_OF_PAGE "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
* END_OF_LIST FOR EVENT end_of_list "event handler
* OF CL_GUI_ALV_GRID
* IMPORTING E_DYNDOC_ID.
ENDCLASS. "lcl_event_handler DEFINITION
* CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
* MESSAGE I000 WITH V_ROW 'clicked'.
CLEAR IT_ROW_NO[].
X_ROW_NO-ROW_ID = V_ROW.
APPEND X_ROW_NO TO IT_ROW_NO .
CALL METHOD G_GRID->SET_SELECTED_ROWS
EXPORTING
IT_ROW_NO = IT_ROW_NO.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW.
V_COLUMN = E_COLUMN.
V_ROW_NUM = ES_ROW_NO.
IF E_COLUMN = 'VBELN'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDIF.
IF E_COLUMN = 'POSNR'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN."
ENDIF.
ENDMETHOD. "handle_double_click
* METHOD END_OF_LIST. "implementation
** Top-of-page event
* PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
* ENDMETHOD. "top_of_page
METHOD TOP_OF_PAGE. "implementation
* Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
data: v_lines type i.
data: v_line(3) type c.
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
* START-OF_SELECTION
START-OF-SELECTION.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
describe table itab lines v_lines.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
* text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"attention.....from here
"split your container here...into two parts
"create the container
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER1.
"this is for top of page
* Create TOP-Document
CREATE OBJECT DG_DYNDOC_ID
EXPORTING STYLE = 'ALV_GRID'.
* Create Splitter for custom_container
CREATE OBJECT DG_SPLITTER
EXPORTING PARENT = G_CUSTOM_CONTAINER
ROWS = 2
COLUMNS = 1.
* Split the custom_container to two containers and move the reference
* to receiving containers g_parent_html and g_parent_grid
"i am allocating the space for grid and top of page
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
* CALL METHOD DG_SPLITTER->GET_CONTAINER
* EXPORTING
* ROW = 2
* COLUMN = 1
* RECEIVING
* CONTAINER = DG_PARENT_HTML.
* CALL METHOD DG_SPLITTER->GET_CONTAINER
* EXPORTING
* ROW = 1
* COLUMN = 1
* RECEIVING
* CONTAINER = DG_PARENT_GRID.
"you can set the height of it
* Set height for g_parent_html
CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
EXPORTING
ID = 1
HEIGHT = 5.
"from here as usual..you need to specify parent as splitter part
"which we alloted for grid
CREATE OBJECT G_GRID
EXPORTING I_PARENT = DG_PARENT_GRID.
* Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
* SET HANDLER G_HANDLER->END_OF_LIST FOR G_GRID.
SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
ENDLOOP.
* setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
PERFORM SET_DRDN_TABLE.
* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
**Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
"do these..{
* Initializing document
CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
* Processing events
CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = DG_DYNDOC_ID.
"end }
* Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
* text
* -->PT_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.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
* Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form SET_DRDN_TABLE
* text
FORM SET_DRDN_TABLE.
DATA:LT_DRAL TYPE LVC_T_DRAL,
LS_DRAL TYPE LVC_S_DRAL.
LOOP AT ITAB .
* First listbox (handle '1').
IF SY-INDEX = 1.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ' '.
LS_DRAL-INT_VALUE = ' '.
ELSE.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ITAB-POSNR.
LS_DRAL-INT_VALUE = ITAB-POSNR.
ENDIF.
APPEND LS_DRAL TO LT_DRAL.
ENDLOOP.
**Setting the Drop down table for Reason Code
CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN_ALIAS = LT_DRAL.
ENDFORM. " set_drdn_table
*& Form EVENT_TOP_OF_PAGE
* text
* -->DG_DYNDOC_ID text
FORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
"this is more clear.....check it
"first add text, then pass it to comentry write fm
DATA : DL_TEXT(255) TYPE C. "Text
* Populating header to top-of-page
CALL METHOD DG_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = 'Test Report'
SAP_STYLE = CL_DD_AREA=>HEADING.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move program ID
CONCATENATE 'Program Name :' SY-REPID
INTO DL_TEXT SEPARATED BY SPACE.
* Add Program Name to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move User ID
CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE
* Add User ID to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move count (no of records).
move v_lines to v_line.
CONCATENATE 'No of records :' v_line INTO DL_TEXT SEPARATED BY SPACE.
* Add Client to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move date
WRITE SY-DATUM TO DL_TEXT.
CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Date to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move time
WRITE SY-UZEIT TO DL_TEXT.
CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Time to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
* Populating data to html control
PERFORM HTML.
ENDFORM. " EVENT_TOP_OF_PAGE
*& Form ADD_TEXT
* To add Text
FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.
* Adding text
CALL METHOD DG_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = P_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING.
ENDFORM. " ADD_TEXT
*& Form HTML
* text
FORM HTML.
DATA : DL_LENGTH TYPE I, " Length
DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id
* Creating html control
IF DG_HTML_CNTRL IS INITIAL.
CREATE OBJECT DG_HTML_CNTRL
EXPORTING
PARENT = DG_PARENT_HTML.
ENDIF.
* Reuse_alv_grid_commentary_set
CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
EXPORTING
DOCUMENT = DG_DYNDOC_ID
BOTTOM = SPACE
IMPORTING
LENGTH = DL_LENGTH.
* Get TOP->HTML_TABLE ready
CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.
* Set wallpaper
CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND
EXPORTING
PICTURE_ID = DL_BACKGROUND_ID.
* Connect TOP document to HTML-Control
DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.
* Display TOP document
CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT
EXPORTING
REUSE_CONTROL = 'X'
PARENT = DG_PARENT_HTML
EXCEPTIONS
HTML_DISPLAY_ERROR = 1.
IF SY-SUBRC NE 0.
MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
ENDIF.
ENDFORM. " HTML
Regards
vijay -
Problem with top of page in interactive ALV
Hello all,
I am displaying 2 level ALV list.
If List heading for the first page is 'First level' and for Second level list is 'Second level'.
but when I come back to first level list from second level using back button first level list shows me top of page as 'Second page'.
How to resolve this?
I am using function module approach.
Thanks and Regards,
AnupHello Clemens,
I've only one top of page event. what I am doing is for the first list I am populating a internal table (say A), slis_listheader with 'First level' and passing this to top-of-page event and outputting using REUSE_ALV_COMMENTARY_WRITE.display using REUSE_ALV_GRID_DISPLAY_LVC.
for the second list (at user command 'Double click' ) I am populating another internal table (say B), and slis_listheader with 'Second level'. display using REUSE_ALV_GRID_DISPLAY_LVC.
It works fine till this point. Problem is when i click back button on second level list I get 'Second level' again in top of page for the first level.
where do i set ps_selfield-refresh = 'X'?
Regards,
Anup
Maybe you are looking for
-
All Background Jobs Are cancelled
Hi all, I make a new server by restoreing backup of our production server and SAP is running well.But when I schedule any back ground jobs all jobs are cancelled.Due to this I am not able to run SGEN.Even when I manually schedule any back ground jobs
-
I am having a lot of trouble with trying to use my debit card on purchase of itune apps or music. Whenever i put my card information in it tells me that this card is invalid. But there is no way that my card is invalid because i just got it last week
-
I am having problems getting the default seuqnecer in the Javax.sound.midi library to play back midi files in time. I have JRE 1.4 and am using a Creative Soundblaster Live card. The timing gives the midi file a 'limp'. Does anyone have the same prob
-
Requested Resource does not exists.
Hello Friends, I am trying to configure Alert triggers through XI for System errors. But I think there is some problem with Runtime Workbench configuration. When I Click on Alert Configuration i get error: 404 Not found. "The requested resource does
-
Blank paper comes out of printer when using Firefox
When trying to print bank statement only blank paper come out, switching I.E. allows me to print.