CL_GUI_DIALOGBOX_CONTAINER
Hi,
I use cl_gui_dialogbox_container to write a help on-line for a project. In this dialog box I can display an help file.
How I can make invisible the screen in background ? I need only a dialog box.
Hi Stefano
U've just post this problem in another post.
Anyway create an custom container directly by screenpainter instead of use the class CL_GUI_DIALOGBOX_CONTAINER.
Just as I said you in your other post, u can hide the screen but u can size the container area in order to use whole space of the screen.
Max
Similar Messages
-
Resize cl_gui_dialogbox_container SIZE_CONTROL
Hello,
In most object oriented languages I can catch an event using the signal to execute some process. Typical events like mouse clicks and mouse movements are usually implemented. So are resizing events for windows ...
I a beginner in ABAP OO programming but I see that the cl_gui_dialogbox_container has a SIZE_CONTROL event which I thought could be handled in the same way as the CLOSE event. But I am unable to use this. Furthermore the other events RIGHT_CLICK LEFT_CLICK_DESIGN MOVE_CONTROL LEFT_CLICK_RUN I can not catch either.
Can someone give me some indication on the way to use these in a program.
Thanks,
PDHi Narin,
I have read this thread before. Its promising but this will not solve the problem I am addressing now. I have created a dialogue box, which in essence is resizable. Inside this box I have output a calander from the SAP calander class, also what I need.
The end user sees the dialogue box and the calander as he expects. However, the dialogue box may be too small.
In such a scenario the user will try to make the dialogue box bigger in order to see the entire calender. But cl_gui_dialogbox_container alows you to stretch the cintainer well beyond the size of its contents and this is what I would like to aqvoid.
I can do this in most OO languages by catching the resize event like this :
on resize
check new width and height.
if new width > fixed value set new width to that value,
if new height > fixed value fix it to that value
otherwise accept new width and new height accordingly.
perhaps this is not possible with this class. I do not know ...
thanks,
PD -
Hello,
Here's quite a tricky problem, which I could need some help for.
I have an object of class cl_gui_dialogbox_container with some HTML in it. The users can resize and move the control on the screen. Now position and size shall be kept in a dictionary table for each user.
I've registered the three events close, move_contol and size_control
CALL METHOD gc_dialogbox->set_registered_events
EXPORTING
events = gt_events
with event_ids 8, 11 and 12 and set the three handlers, e.g.
SET HANDLER cl_event_receiver_tree=>handle_close
FOR gc_dialogbox.
I created three corresponding methods handle_close, handle_move_control and handle_size_control.
Well, so far for what I've done. Now the results:
If I close the dialogue box, ABAP correctly jumps into method handle_close. But at that point, the control has already been closed! So I can't read size and position any more.
If I move or rezise the window, nothing at all happens... Not even the debugger would pop up if I do anything with the box.
Does anyone here know how to do this?
Thanks!
Jan
Edited by: Jan Krohn on Nov 22, 2008 3:17 PMA quick update in case anyone else is looking for a solution:
I've still not found out how to handle the events move_control and size_control.
However, when handling close_control, it's possible to catch size and position:
call the methods to obtain size and/or position
call a cfw flush
only then the parameters will be filled with the correct values.
Important: This must happen after the close button has been pressed, but before the control will be destroyed. So put it in the correct place in your source code. -
Write text with cl_gui_dialogbox_container
Hi all,
I have a dialogbox container cl_gui_dialogbox_container and I need a way to write something inside of it(WRITE 'hello world'), without using alv classes.
Are there some classes to use?
Should i create a dynpro?
can you help me?
Thanks.
TonyHi Tony,
check sample code, which I have used to create a popup with text without creating a dynpro:
* CLASS lcl_dialogbox_handler DEFINITION
* Definition of dialogbox event handler
CLASS lcl_dialogbox_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
close
FOR EVENT close
OF cl_gui_dialogbox_container.
ENDCLASS. "lcl_event_receiver DEFINITION
* CLASS lcl_event_receiver IMPLEMENTATION
* Implementation of dialogbox event handler
CLASS lcl_dialogbox_handler IMPLEMENTATION.
METHOD close.
* I will free textedit control and dialogbox
CALL METHOD gr_textedit->free.
FREE gr_textedit.
CALL METHOD gr_dialogbox->free.
FREE gr_dialogbox.
* finally flush
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
OTHERS = 1.
ENDMETHOD." close
ENDCLASS. "lcl_dialogbox_handler IMPLEMENTATION
DATA: gr_textedit TYPE REF TO cl_gui_textedit,
gr_dialogbox TYPE REF TO cl_gui_dialogbox_container,
gt_text_data TYPE STANDARD TABLE OF char128.
* I will create a dialogbox for displaying text in textedit
CREATE OBJECT gr_dialogbox
EXPORTING
width = 800
height = 400
top = 50
left = 100
caption = 'Close Window to end Display'. "#EC NOTEXT
* I will create a textedit control to display text
CREATE OBJECT gr_textedit
EXPORTING
parent = gr_dialogbox.
* Handler is necessary for closing popup
SET HANDLER lcl_dialogbox_handler=>close FOR gr_dialogbox.
* I will set text to be displayed
CALL METHOD gr_textedit->set_text_as_r3table
EXPORTING
table = gt_text_data
EXCEPTIONS
error_dp = 1
error_dp_create = 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.
* I will make text read-only, changing it is meaningless
gr_textedit->set_readonly_mode( 1 ).
I hope it helps.
Regards
Adrian -
Summing up a Column in ALV report
Hi All,
I have developed an ALV Report which will display Invoices and other details.
Now i need to display the sum of NETWR column, if user wish to select that column and click the "SUM" icon.
As of now, if i select the NETWR column and click 'SUM" column, i am getting Runtime error.
How to resolve this issue?
Regards
PavanHi Pavan,
ALV GRID CONTROL:
This task is performed by the SAP Control Framework.
The R/3 System allows you to create custom controls using ABAP Objects. The application server is the Automation Client, which drives the custom controls (automation server) at the front end.
If custom controls are to be included on the frontend, then the SAPGUI acts as a container for them.
Custom controls can be ActiveX Controls or JavaBeans.
The system has to use a Remote Function Call (RFC) to transfer methods for creating and using a control to the front end.
ABAP objects are used to implement the controls in programs.
An SAP Container can contain other controls (for example, SAP ALV Grid Control, Tree Control, SAP Picture Control, SAP Splitter Control, and so on). It administers these controls logically in one collection and provides a physical area for the display.
Every control exists in a container. Since containers are themselves controls, they can be nested within one another. The container becomes the parent of its control. SAP containers are divided into five groups:
SAP custom container: Displays within an area defined in Screen Painter on screens or sub screens.
Class: CL_GUI_CUSTOM_CONTAINER
SAP dialog box container: Displays in a modeless dialog box or as a full screen. Class:
CL_GUI_DIALOGBOX_CONTAINER
SAP docking container: Displays as docked, resizable sub-window with the option of displaying it as a modeless dialog box. Class: CL_GUI_DOCKING_CONTAINER
SAP splitter container: Displays and groups several controls in one area - that is, splits the area into cells Class: CL_GUI_SPLITTER_CONTAINER
SAP easy splitter container: Displays controls in two cells, which the user can resize using a split bar. Class: CL_GUI_EASY_SPLITTER_CONTAINER.
In the control, you can adjust the column width by dragging, or use the 'Optimum width' function to adjust the column width to the data currently displayed. You can also change the column sequence by selecting a column and dragging it to a new position.
Standard functions are available in the control toolbar. The details display displays the fields in the line on which the cursor is positioned in a modal dialog box.
The sort function in the ALV Control is available for as many columns as required. You can set complex sort criteria and sort columns in either ascending or descending order.
You can use the 'Search' function to search for a string (generic search without *) within a selected area by line or column.
You can use the 'Sum' function to create totals for one or more numeric columns. You can then use the "Subtotals" function to set up control level lists: You can use the 'Subtotal' function to structure control level lists: select the columns (non-numeric columns only) that you want to use and the corresponding control level totals are displayed.
For 'Print' and 'Download' the whole list is always processed, not just the sections displayed on the screen.
You can define display variants to meet your own specific requirements. For information on saving variants, see 'Advanced Techniques'.
The ALV grid control is a generic tool for displaying lists in screens. The control offers standard functions such as sorting by any column, adding numeric columns, and fixed lead columns .
Data collection is performed in the program (with SELECT statements, for example) or by using a logical database. The data records are saved in an internal table and passed on to the ALV control along with a field description.
The field description contains information about the characteristics of each column, such as the column header and output length. This information can defined either globally in the Dictionary (structure in the Dictionary) or in the field catalog in the program itself. You can also merge both techniques.
The ALV link is a standard function of Query and QuickViewer. If multiline queries or Quick View lists have been defined, they will automatically be compressed to a single line and output in the ALV control as a long, single line list.
Use Screen Painter to create a sub screen container for the ALV grid control. The control requires an area where it can be displayed in the screen. You have to create a container control that determines this area.
Use the corresponding icon in the Screen Painter layout to create the container control. The size of area "MY_CONTROL_AREA" determines the subsequent size of the ALV control.
The valid GUI status must be set at the PBO event in the flow logic of the ALV subscreen container.
The OK_CODE processing for the cancel functions must be programmed at the PAI event.
The reference variables for the custom container and the ALV grid control must be declared.
To create reference variables, use ABAP statement TYPE REF TO .
The global classes you need to do this are called cl_gui_custom_container (for the custom container control) and cl_gui_alv_grid (for the ALV grid control).
The global classes are defined in the Class Builder. You can use the Class Builder to display information for the methods, their parameters, exceptions, and so on.
Use ABAP statement CREATE OBJECT to create the objects for the container and the ALV control. Objects Are instances of a class.
When an object is created (CREATE), method CONSTRUCTOR of the corresponding class is executed. The parameters of method CONSTRUCTOR determine which parameters have to be supplied with data when the object is created. In the above example, object alv_grid is given the name of the container control (g_custom_container) in exporting parameter i_parent, which links the two controls. For information on which parameters method CONSTRUCTOR possesses and which of these parameters are required, see the Class Builder.
Objects should only be created once during the program. To ensure that this is the case, enclose the CREATE OBJECT statement(s) in an IF IS INITIAL. ... ENDIF clause. The objects must be generated before the control is displayed for the first time - that is, during the PBO event of the ALV subscreen container.
To display the requested dataset in the ALV control, the data must be passed on to the control as an internal table, and a field description must exist indicating the order in which the columns will be output.
In the simplest case, the field description can use a structure from the Dictionary. The Dictionary also determines the technical field attributes like type and length, as well as the semantic attributes like short and long texts. The ALV control uses this information to determine the column widths and headers. The column sequence is determined by the field sequence in the structure.
If no suitable structure is active in the Dictionary, or you want to output internal program fields in the control, then you will have to define information like the output length and column header in the field catalog.
In a typical program run, the dataset is read first (SELECT ....), the internal table is filled with the data to display (... INTO TABLE ...), and ABAP statement CALL SCREEN is then used to call the ALV sub screen container.
The data transfer to the ALV control takes place during the call of method
set_table_for_first_display from class cl_gui_alv_grid. The method call must be programmed at the PBO event of the ALV subscreen container.
The name of the Dictionary structure that supplies the field description is specified in exporting parameter i_structure_name. The name of the internal table that contains the data records to display is specified in changing parameter it_outtab.
The field description for the ALV control can be ta ken from an active Dictionary structure (fully automatic), by passing a field catalog (manual), or through a mixture of the two options (merge).
The field catalog is in internal table with type lvc_t_fcat. This type is defined globally in the Dictionary.
Each line in the field catalog table corresponds to a column in the ALV control.
The field characteristics (= column characteristics) are defined in the field catalog. The field catalog is in internal table with type lvc_t_fcat. Each line that is explicitly described in the ALV control corresponds to a column in the field catalog table.
The link to the data records to output that are saved in internal table is established through field name . This name must be specified in column "fieldname" in the field catalog.
This field can be classified through a Dictionary reference (ref_table and ref_field) or by specifying an ABAP data type (inttype).
Column headers and field names in the detail view of an ALV control line can be determined in the field catalog in coltext and seltext, respectively.
The position of a field during output can be determined with col_pos in the field catalog.
If you want to hide a column, fill field no_out with an "X" in the field catalog. Hidden fields can be displayed again in a user display variant.
Icons can be displayed in the ALV control. If you want a column to be interpreted as an icon, then the icon name must be known to the program (include .) and icon = "X" must be specified for this column in the field catalog.
The above example shows a semi-automatic field description: Part of the field description comes from the Dictionary structure (sflight), while another part is explicitly defined in the field catalog (gt_fieldcat).
The field catalog (internal table) is filled in the program and is passed on together with the name of the Dictionary structure during the method call. The information is merged accordingly in method set_table_for_first_display.
For a user to save display variants, parameters is_variant and i_save must be passed on during method call set_table_for_first_screen. To assign display variants uniquely to a program, at least the program name must be supplied in the transferred structure (gs_variant).
Program names can be up to 30 characters long.
If you only pass on the current parameters for is_variant, then existing variants can be loaded, but no new ones can be saved. If you use parameter i_save, you must pass on a variant structure with is_variant.
I_SAVE = SPACE No variants can be saved.
I_SAVE = 'U' The user can only save user-specific variants.
I_SAVE = 'X' The user can only save general (shared) variants.
I_SAVE = 'A' The user can save both user-specific and general (shared) variants.
You can use parameter is_layout of method set_table_for_first_display, for example, to define the header in the ALV control and the detail display.
To do this, define a query area in the program in accordance with Dictionary structure lvc_s_layo, and pass on the text to display in field -grid_title or -detailtitl.
If you want to create print lists with zebra stripes, set field -zebra to "X". You can display a print preview for print lists by requesting standard function "Print".
All parameters of method SET_TABLE_FOR_FIRST_DISPLAY from global class
CL_GUI_ALV_GRID are defined in the Class Builder.
Events are defined in global class cl_gui_alv_grid; you can use these events to implement user interaction within the program. To respond to a double -click on a table line, you must respond to event DOUBLE_CLICK.
You receive control in the program, allowing you to implement interactive reporting - such as a full screen details list. The events for cl_gui_alv_grid are located in the Class Builder.
To define an implement a local class in the program, you use a handler method. In this handler method, you program the functionality to trigger by a double -click in the output table.
To activate a handler method at runtime, a class or an object from that class registers itself with an event using command SET HANDLER. The names of the IMPORTING parameters in the handler method correspond to the names of the EXPORTING parameters of the related event.
In the above example, the local class is LCL_ILS and the handler method is ON_DBLCLICK. An object - ALV_DBLCLICK - is created and registers itself for event DOUBLE_CLICK.
You can query parameter e_row-index to determine which output line was requested by the double -click. This parameter corresponds to the line number of the output table (internal table with the data records to output). If you need information for the selected line, you have to read it with READ TABLE itab INDEX e_row-index.
This subsequent read in the output table generally corresponds to the HIDE area in conventional reporting. You first have to make sure that the user has double -clicked a line in the output table (similar to the valid line selection with the HIDE technique).
A field group can contain global data objects, but not data objects that have been defined locally in a subroutine or function module.
You can use INSERT to specify both fields and field symbols. This makes it possible to dynamically insert a data object referred to by a field symbol into a field group at runtime. Any field symbols that have not been assigned are ignored, which means no new field is inserted into the field group.
The EXTRACT statement writes all the fields of a field group as one record to a sequential dataset (transport takes place with similarly named fields). If a HEADER field group is defined, then its fields are placed ahead of each record as sort keys. You can then sort the dataset with SORT and process it with LOOP ...ENDLOOP. In this case, no further EXTRACT is possible.
The INSERT statement is not a declarative statement: This means field groups can also be expanded in the program flow section.
As soon as the first dataset of a field group has been extracted with EXTRACT, that field group can no longer be expanded with INSERT. In particular, the HEADER field group cannot be expanded after the first EXTRACT (regardless of the field group).
When the GET events are processed, the logical database automatically writes hexadecimal zeros in all the fields of a node when it returns to an upper-level node in the hierarchy. Since the HEADER normally contains sort fields for all field groups, these hexadecimal zeros in the HEADER serve as a type of hierarchy key: The more zeros there are, the further up in the control level hierarchy you go.
The SORT statement sorts the extract dataset in accordance with the defined field sequence in field group HEADER. The addition BY ... sets a new sort key.
Each must be either a field of field group HEADER or a field group that consists only of fields of the field group HEADER. You can use the additions ASCENDING and DESCENDING to determine whether the fields are sorted in ascending (default) or descending order.
Fields containing X'00' in the logical databases are always displayed before all other values during a SORT.
Processing of an extract dataset always takes places within a LOOP. The contents of the extract dataset field are placed in program fields with the same names.
The group change always involves the fields of the HEADER. Single record processing for extract datasets is performed using language element AT ( = field group).
CNT() is not a statement, but instead a field that is automatically create d and filled when is a non-numeric field from field group HEADER and is part of the sort key. At the end of the group, CNT() contains the number of different values that the field recorded in this group level.
SUM() is not a statement, but instead a field that is automatically created and filled when is a numeric field of an extract dataset. At the end of the group, SUM() contains the control total of field .
*** and CNT are only available at the end of the group level or at AT LAST.
Single record processing for extract datasets AT WITH is only performed when field group is immediately followed by field group in the temporary dataset.
Loops over an extract dataset cannot be nested. However, several contiguous loops are permitted.
The sequence of the control level changes within the LOOP must correspond to the sort sequence.
Totals can only be calculated within control footer processing.
Extracts allow only appends (EXTRACT), sorting (SORT) and sequential processing (LOOP).
Once a SORT or LOOP has occurred, the intermediate dataset is frozen and cannot be expanded with EXTRACT. Operations that insert into or delete from EXTRACT datasets are not supported.
Extracts allow for several record types (FIELD-GROUPS) with fields that can be set dynamically (INSERT is not a declarative statement!). Internal tables have a single, statically-defined line type.
Internal tables use the sequence of table fields according to the declaration for the hierarchy of the control leve l. The control level structure for internal tables is therefore static, and is independent of which criteria were used to sort the internal table.
Extracts do not depend on the field sequence for control level processing: a re-sort or a completely different control level process can take place. The control level structure for extract datasets is therefore dynamic. It corresponds exactly to the sort key of the extract dataset. The sort key is the sequence of fields from the field group HEADER, and is used to sort the extract dataset.
Extracts rely on the compiler to determine which combinations of group levels and a cumulating field the control level totals desire. The desired control level totals are determined by the processing of LOOP ... ENDLOOP blocks. Internal tables build the control level total with the SUM statement.
This procedure leads to high resource depletion for totaling control levels in internal tables.
Regards,
Chandru -
Hi,
Could any one tell how to use cl_gui_dialogbox_container to display pdf in a ALV top of pageHi,
It is not possible to change the color in ALV top of page.
Thanks,
Sriram Ponna. -
Why this code is not working for alv
Dear
Regards,
i have implemented the same program for ALV which i have used earlier in the reports. but now it is showing no output:
*& Report ZTCT1_ALV2 *
REPORT ztct1_alv2 .
CLASS lcl_event_receiver DEFINITION DEFERRED.
* INCLUDING TABLES.
TABLES: vbrk,
vbrp,
kna1,
t001w,
makt.
* DECLARATION OF INTERNAL TABLES.
DATA: BEGIN OF itab OCCURS 0, "Including the fields of VBRK and VBRP
kunag LIKE vbrk-kunag, "Customer Code
name1 LIKE kna1-name1, "Customer Name
vbeln LIKE vbrk-vbeln, "Invoice #
fkdat LIKE vbrk-fkdat, "Invoice Date
werks LIKE vbrp-werks, "Plant
name2 LIKE t001w-name1,"Plant Description
matnr LIKE vbrp-matnr, "Material #
maktx LIKE makt-maktx, "Material Description
meins LIKE vbrp-meins, "Unit of Measure
fklmg LIKE vbrp-fklmg, "Quantity
netwr LIKE vbrp-netwr, "Amount
END OF itab,
BEGIN OF itnm OCCURS 0, "Including the fields of VBRK and KNA1
kunag LIKE vbrk-kunag, "Customer Code
name1 LIKE kna1-name1, "Customer Name
END OF itnm,
BEGIN OF itpt OCCURS 0, "Including the fields of VBRP and T001W
werks LIKE vbrp-werks, "Plant
name1 LIKE t001w-name1,"Plant Description
END OF itpt,
BEGIN OF itmt OCCURS 0, "Including the fields of VBRP and MAKT
matnr LIKE vbrp-matnr, "Material #
maktx LIKE makt-maktx, "Material description
END OF itmt,
BEGIN OF itsm OCCURS 0,
kunag LIKE kna1-kunnr,
name1 LIKE kna1-name1,
fklmg LIKE vbrp-fklmg,
netwr LIKE vbrp-netwr,
END OF itsm,
ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm,
g_max TYPE i VALUE 100,
g_repid LIKE sy-repid,
gs_layout TYPE lvc_s_layo,
g_container TYPE scrfname VALUE 'CUST_CONT',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
grid2 TYPE REF TO cl_gui_alv_grid,
gt_sort TYPE lvc_t_sort,
gt_fieldcatalog TYPE lvc_t_fcat,
w_tot_qty LIKE vbrp-fklmg,
w_tot_amt LIKE vbrp-netwr,
* Reference to Dialogbox Container.
dialogbox_container TYPE REF TO cl_gui_dialogbox_container,
* Reference to local class that handles events of GRID1 and
* DIALOGBOX_CONTAINER
event_receiver TYPE REF TO lcl_event_receiver.
* SELECT-OPTIONS
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK input WITH FRAME TITLE text-000.
SELECT-OPTIONS: s_werks FOR vbrp-werks, "Plant
s_kunag FOR vbrk-kunag, "Customer
s_matnr FOR vbrp-matnr, "Material Number
s_fkdat FOR vbrk-fkdat. "Invoice Date
SELECTION-SCREEN END OF BLOCK input .
SELECTION-SCREEN SKIP 1.
* START-OF-SELECTION
START-OF-SELECTION.
SET SCREEN 100.
* CLEARING INTERNAL TABLES.
CLEAR: itab,
itnm,
itmt,
itpt.
* QUERY FOR JOINING TABLES VBRK AND VBRP
SELECT vbrk~kunag
vbrk~vbeln
vbrk~fkdat
vbrp~werks
vbrp~matnr
vbrp~meins
vbrp~fklmg
vbrp~netwr
INTO CORRESPONDING FIELDS OF TABLE itab
FROM vbrk
INNER JOIN vbrp
ON vbrk~vbeln = vbrp~vbeln
WHERE vbrk~kunag IN s_kunag
AND vbrk~fkdat IN s_fkdat
AND vbrp~matnr IN s_matnr
AND vbrp~werks IN s_werks.
* QUERY FOR JOINING TABLES VBRK AND KNA1
SELECT kna1~kunnr AS kunag
kna1~name1
INTO TABLE itnm
FROM kna1
WHERE kna1~kunnr IN s_kunag.
* QUERY FOR JOINING TABLES VBRP AND T001W
SELECT t001w~werks
t001w~name1
INTO TABLE itpt
FROM t001w
WHERE t001w~werks IN s_werks.
* QUERY FOR JOINING TABLES VBRP AND MAKT
SELECT makt~matnr
makt~maktx
INTO TABLE itmt
FROM makt
WHERE makt~matnr IN s_matnr.
* SORTING INTERNAL TABLES.
SORT itab BY kunag.
* LOOP AT itab.
* CLEAR: itmt, itnm, itpt.
* READ TABLE itnm WITH KEY kunag = itab-kunag.
* READ TABLE itmt WITH KEY matnr = itab-matnr.
* READ TABLE itpt WITH KEY werks = itab-werks.
* itab-name1 = itnm-name1.
* itab-maktx = itmt-maktx.
* itab-name2 = itpt-name1.
* MODIFY itab.
* ENDLOOP.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'KUNAG' 'C' 'Customer Code'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME1' 'C' 'Customer Name'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'VBELN' 'C' 'Invoice #'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKDAT' 'DATS' 'Invoice Date'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'WERKS' 'C' 'Plant'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME2' 'C' 'Plant Description'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MATNR' 'C' 'Material #'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MAKTX' 'C' 'Material Description'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MEINS' 'C' 'UoM'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKLMG' 'QUAN' 'Quantity'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NETWR' 'CURR' 'Amount'.
LOOP AT itab.
CLEAR itsm.
READ TABLE itnm WITH KEY kunag = itab-kunag.
itsm-kunag = itab-kunag.
itsm-name1 = itnm-name1.
itsm-fklmg = itab-fklmg.
itsm-netwr = itab-netwr.
COLLECT itsm.
ENDLOOP.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'KUNAG' 'C' 'Customer Code'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME1' 'C' 'Customer Name'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKLMG' 'QUAN' 'Quantity'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NETWR' 'CURR' 'Amount'.
PERFORM sort_build USING gt_sort[].
PERFORM layout_init USING gs_layout.
* LOCAL CLASSES: Definition
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column,
handle_close
FOR EVENT close OF cl_gui_dialogbox_container
IMPORTING sender.
PRIVATE SECTION.
DATA: dialogbox_status TYPE c. "'X': does exist, SPACE: does not ex.
ENDCLASS. "lcl_event_receiver DEFINITION
* LOCAL CLASSES: Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
* §3.At doubleclick(1): The event DOUBLE_CLICK provides
* parameters of the clicked row and column.
* Use row parameter to select a line of the
* corresponding internal table.
METHOD handle_double_click.
DATA: ls_sm LIKE LINE OF itsm,
wa_itab LIKE ITAB.
* read selected row from internal table gt_sflight
READ TABLE itsm INDEX e_row-index INTO ls_sm.
* §4.At Doubleclick(2): Select booking data
* READ TABLE ITAB WITH KEY KUNAG = LS_SM-KUNAG. .
READ TABLE ITAB INTO WA_ITAB WITH KEY KUNAG = LS_SM-KUNAG.
* §5.At doubleclick(3): Create dialogbox to show detail list
* (if not already existent)
IF dialogbox_status IS INITIAL.
dialogbox_status = 'X'.
PERFORM create_detail_list.
ELSE.
CALL METHOD dialogbox_container->set_visible
EXPORTING
visible = 'X'.
CALL METHOD grid2->refresh_table_display.
ENDIF.
ENDMETHOD. "handle_double_click
METHOD handle_close.
* §6.Handle the CLOSE-button of the dialogbox
* set dialogbox invisible
* (the dialogbox is destroyed outomatically when the user
* switches to another dynpro).
CALL METHOD sender->set_visible
EXPORTING
visible = space.
* In this example closing the dialogbox leads
* to make it invisible. It is also conceivable to destroy it
* and recreate it if the user doubleclicks a line again.
* Displaying a great amount of data has a greater impact on performance.
ENDMETHOD. "handle_close
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
* lcl_event_receiver (Implementation)
*=====================================================================
* FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD g_custom_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
* add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
LEAVE TO SCREEN 0.
ENDFORM. "exit_program
* MODULE PBO_ALV OUTPUT
MODULE pbo_alv OUTPUT.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'MAIN100'.
g_repid = sy-repid.
IF g_custom_container IS INITIAL.
READ TABLE itsm.
CREATE OBJECT g_custom_container
EXPORTING
container_name = g_container
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
CREATE OBJECT grid1
EXPORTING
i_parent = g_custom_container.
gs_layout-grid_title = 'Invoice Summary'.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = itsm[]
it_fieldcatalog = gt_fieldcatalog
it_sort = gt_sort.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR grid1.
ENDIF.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid1.
ENDMODULE. "PBO_ALV OUTPUT
* MODULE PAI_ALV INPUT
MODULE pai_alv INPUT.
CALL METHOD cl_gui_cfw=>dispatch.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "PAI_ALV INPUT
*& Form fieldcatalog_init
* text
* -->LT_FIELDCATtext
* -->VALUE(FIELDtextE)
* -->VALUE(FIELDtextE)
* -->VALUE(FIELDtextT)
FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat
value(field_name) value(field_type) value(field_text).
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = field_name.
ls_fieldcatalog-datatype = field_type.
ls_fieldcatalog-reptext = field_text.
ls_fieldcatalog-coltext = field_text.
ls_fieldcatalog-seltext = field_text.
ls_fieldcatalog-tooltip = field_text.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ENDFORM. "fieldcatalog_init
*& Form sort_build
* text
* -->LT_SORT text
FORM sort_build USING lt_sort TYPE lvc_t_sort.
DATA: ls_sort TYPE lvc_s_sort.
ls_sort-fieldname = 'KUNAG'. "Fieldname on which to sort
ls_sort-up = 'X'. "Sort Ascending
APPEND ls_sort TO lt_sort.
ls_sort-fieldname = 'NAME1'. "Fieldname on which to sort
ls_sort-up = 'X'. "Sort Ascending
APPEND ls_sort TO lt_sort.
ENDFORM. "sort_build
*& Form layout_init
* text
* -->LS_LAYOUT text
FORM layout_init USING ls_layout TYPE lvc_s_layo.
ls_layout-zebra = 'X'.
ls_layout-grid_title = 'Customer Details'.
ls_layout-sel_mode = 'A'.
ls_layout-cwidth_opt = 'X'.
ENDFORM. "layout_init
*& Form create_detail_list
* text
* --> p1 text
* <-- p2 text
FORM create_detail_list.
* create dialogbox container as dynpro-instance
* When the user switches to another screen, it is
* destroyed by lifetime mangagement of CFW
CREATE OBJECT dialogbox_container
EXPORTING
top = 150
left = 150
lifetime = cntl_lifetime_dynpro
caption = 'INVOICE DETAILS'(200)
width = 800
height = 200.
CREATE OBJECT grid2
EXPORTING i_parent = dialogbox_container.
* Register ABAP OO event 'CLOSE'. It is not necessary to register this
* event at the frontend (this is done during creation).
SET HANDLER event_receiver->handle_close FOR dialogbox_container.
* display data
gs_layout-grid_title = 'Invoice Details'(100).
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'itab'
is_layout = gs_layout
CHANGING
it_outtab = itab[]
it_fieldcatalog = gt_fieldcatalog
it_sort = gt_sort.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid2.
ENDFORM. " create_detail_list[code][/
code]Hi,
I also copied and pasted the same code check once again by copying this code and create screens by double clicking on 100.
CLASS lcl_event_receiver DEFINITION DEFERRED.
* INCLUDING TABLES.
TABLES: vbrk,
vbrp,
kna1,
t001w,
makt.
* DECLARATION OF INTERNAL TABLES.
DATA: BEGIN OF itab OCCURS 0, "Including the fields of VBRK and VBRP
kunag LIKE vbrk-kunag, "Customer Code
name1 LIKE kna1-name1, "Customer Name
vbeln LIKE vbrk-vbeln, "Invoice #
fkdat LIKE vbrk-fkdat, "Invoice Date
werks LIKE vbrp-werks, "Plant
name2 LIKE t001w-name1,"Plant Description
matnr LIKE vbrp-matnr, "Material #
maktx LIKE makt-maktx, "Material Description
meins LIKE vbrp-meins, "Unit of Measure
fklmg LIKE vbrp-fklmg, "Quantity
netwr LIKE vbrp-netwr, "Amount
END OF itab,
BEGIN OF itnm OCCURS 0, "Including the fields of VBRK and KNA1
kunag LIKE vbrk-kunag, "Customer Code
name1 LIKE kna1-name1, "Customer Name
END OF itnm,
BEGIN OF itpt OCCURS 0, "Including the fields of VBRP and T001W
werks LIKE vbrp-werks, "Plant
name1 LIKE t001w-name1,"Plant Description
END OF itpt,
BEGIN OF itmt OCCURS 0, "Including the fields of VBRP and MAKT
matnr LIKE vbrp-matnr, "Material #
maktx LIKE makt-maktx, "Material description
END OF itmt,
BEGIN OF itsm OCCURS 0,
kunag LIKE kna1-kunnr,
name1 LIKE kna1-name1,
fklmg LIKE vbrp-fklmg,
netwr LIKE vbrp-netwr,
END OF itsm,
ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm,
g_max TYPE i VALUE 100,
g_repid LIKE sy-repid,
gs_layout TYPE lvc_s_layo,
g_container TYPE scrfname VALUE 'CUST_CONT',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
grid2 TYPE REF TO cl_gui_alv_grid,
gt_sort TYPE lvc_t_sort,
gt_fieldcatalog TYPE lvc_t_fcat,
w_tot_qty LIKE vbrp-fklmg,
w_tot_amt LIKE vbrp-netwr,
* Reference to Dialogbox Container.
dialogbox_container TYPE REF TO cl_gui_dialogbox_container,
* Reference to local class that handles events of GRID1 and
* DIALOGBOX_CONTAINER
event_receiver TYPE REF TO lcl_event_receiver.
* SELECT-OPTIONS
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK input WITH FRAME TITLE text-000.
SELECT-OPTIONS: s_werks FOR vbrp-werks, "Plant
s_kunag FOR vbrk-kunag, "Customer
s_matnr FOR vbrp-matnr, "Material Number
s_fkdat FOR vbrk-fkdat. "Invoice Date
SELECTION-SCREEN END OF BLOCK input .
SELECTION-SCREEN SKIP 1.
* START-OF-SELECTION
START-OF-SELECTION.
SET SCREEN 100.
* CLEARING INTERNAL TABLES.
CLEAR: itab,
itnm,
itmt,
itpt.
* QUERY FOR JOINING TABLES VBRK AND VBRP
SELECT vbrk~kunag
vbrk~vbeln
vbrk~fkdat
vbrp~werks
vbrp~matnr
vbrp~meins
vbrp~fklmg
vbrp~netwr
INTO CORRESPONDING FIELDS OF TABLE itab
FROM vbrk
INNER JOIN vbrp
ON vbrk~vbeln = vbrp~vbeln
WHERE vbrk~kunag IN s_kunag
AND vbrk~fkdat IN s_fkdat
AND vbrp~matnr IN s_matnr
AND vbrp~werks IN s_werks.
* QUERY FOR JOINING TABLES VBRK AND KNA1
SELECT kna1~kunnr AS kunag
kna1~name1
INTO TABLE itnm
FROM kna1
WHERE kna1~kunnr IN s_kunag.
* QUERY FOR JOINING TABLES VBRP AND T001W
SELECT t001w~werks
t001w~name1
INTO TABLE itpt
FROM t001w
WHERE t001w~werks IN s_werks.
* QUERY FOR JOINING TABLES VBRP AND MAKT
SELECT makt~matnr
makt~maktx
INTO TABLE itmt
FROM makt
WHERE makt~matnr IN s_matnr.
* SORTING INTERNAL TABLES.
SORT itab BY kunag.
LOOP AT itab.
CLEAR itsm.
READ TABLE itnm WITH KEY kunag = itab-kunag.
itsm-kunag = itab-kunag.
itsm-name1 = itnm-name1.
itsm-fklmg = itab-fklmg.
itsm-netwr = itab-netwr.
COLLECT itsm.
ENDLOOP.
* END-OF-SELECTION.
* If not itsm[] is initial.
* CALL SCREEN 100.
* endif.
* LOCAL CLASSES: Definition
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column,
handle_close
FOR EVENT close OF cl_gui_dialogbox_container
IMPORTING sender.
PRIVATE SECTION.
DATA: dialogbox_status TYPE c. "'X': does exist, SPACE: does not ex
ENDCLASS. "lcl_event_receiver DEFINITION
* LOCAL CLASSES: Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
* §3.At doubleclick(1): The event DOUBLE_CLICK provides
* parameters of the clicked row and column.
* Use row parameter to select a line of the
* corresponding internal table.
METHOD handle_double_click.
DATA: ls_sm LIKE LINE OF itsm,
wa_itab LIKE ITAB.
* read selected row from internal table gt_sflight
READ TABLE itsm INDEX e_row-index INTO ls_sm.
* §4.At Doubleclick(2): Select booking data
* READ TABLE ITAB WITH KEY KUNAG = LS_SM-KUNAG. .
READ TABLE ITAB INTO WA_ITAB WITH KEY KUNAG = LS_SM-KUNAG.
* §5.At doubleclick(3): Create dialogbox to show detail list
* (if not already existent)
IF dialogbox_status IS INITIAL.
dialogbox_status = 'X'.
PERFORM create_detail_list.
ELSE.
CALL METHOD dialogbox_container->set_visible
EXPORTING
visible = 'X'.
CALL METHOD grid2->refresh_table_display.
ENDIF.
ENDMETHOD. "handle_double_click
METHOD handle_close.
* §6.Handle the CLOSE-button of the dialogbox
* set dialogbox invisible
* (the dialogbox is destroyed outomatically when the user
* switches to another dynpro).
CALL METHOD sender->set_visible
EXPORTING
visible = space.
* In this example closing the dialogbox leads
* to make it invisible. It is also conceivable to destroy it
* and recreate it if the user doubleclicks a line again.
* Displaying a great amount of data has a greater impact on
*performance.
ENDMETHOD. "handle_close
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
* lcl_event_receiver (Implementation)
*=====================================================================
* FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD g_custom_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
* add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
LEAVE TO SCREEN 0.
ENDFORM. "exit_program
*& Module STATUS_0100 OUTPUT
* text
module STATUS_0100 output.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'MAIN100'.
g_repid = sy-repid.
IF g_custom_container IS INITIAL.
READ TABLE itsm.
CREATE OBJECT g_custom_container
EXPORTING
container_name = g_container
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
CREATE OBJECT grid1
EXPORTING
i_parent = g_custom_container.
gs_layout-grid_title = 'Invoice Summary'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'KUNAG' 'C'
'Customer Code'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME1' 'C'
'Customer Name'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKLMG' 'QUAN'
'Quantity'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NETWR' 'CURR'
'Amount'.
PERFORM sort_build USING gt_sort[].
PERFORM layout_init USING gs_layout.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = itsm[]
it_fieldcatalog = gt_fieldcatalog
it_sort = gt_sort.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR grid1.
ENDIF.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid1.
endmodule. " STATUS_0100 OUTPUT
* MODULE PAI_ALV INPUT
MODULE USER_COMMAND_0100.
CALL METHOD cl_gui_cfw=>dispatch.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANC'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "PAI_ALV INPUT
*& Form fieldcatalog_init
* text
* -->LT_FIELDCATtext
* -->VALUE(FIELDtextE)
* -->VALUE(FIELDtextE)
* -->VALUE(FIELDtextT)
FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat
value(field_name) value(field_type)
value(field_text).
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = field_name.
ls_fieldcatalog-datatype = field_type.
ls_fieldcatalog-reptext = field_text.
ls_fieldcatalog-coltext = field_text.
ls_fieldcatalog-seltext = field_text.
ls_fieldcatalog-tooltip = field_text.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ENDFORM. "fieldcatalog_init
*& Form sort_build
* text
* -->LT_SORT text
FORM sort_build USING lt_sort TYPE lvc_t_sort.
DATA: ls_sort TYPE lvc_s_sort.
ls_sort-fieldname = 'KUNAG'. "Fieldname on which to sort
ls_sort-up = 'X'. "Sort Ascending
APPEND ls_sort TO lt_sort.
ls_sort-fieldname = 'NAME1'. "Fieldname on which to sort
ls_sort-up = 'X'. "Sort Ascending
APPEND ls_sort TO lt_sort.
ENDFORM. "sort_build
*& Form layout_init
* text
* -->LS_LAYOUT text
FORM layout_init USING ls_layout TYPE lvc_s_layo.
ls_layout-zebra = 'X'.
ls_layout-grid_title = 'Customer Details'.
ls_layout-sel_mode = 'A'.
ls_layout-cwidth_opt = 'X'.
ENDFORM. "layout_init
*& Form create_detail_list
* text
* --> p1 text
* <-- p2 text
FORM create_detail_list.
* create dialogbox container as dynpro-instance
* When the user switches to another screen, it is
* destroyed by lifetime mangagement of CFW
CREATE OBJECT dialogbox_container
EXPORTING
top = 150
left = 150
lifetime = cntl_lifetime_dynpro
caption = 'INVOICE DETAILS'(200)
width = 800
height = 200.
CREATE OBJECT grid2
EXPORTING i_parent = dialogbox_container.
* Register ABAP OO event 'CLOSE'. It is not necessary to register this
* event at the frontend (this is done during creation).
SET HANDLER event_receiver->handle_close FOR dialogbox_container.
* display data
gs_layout-grid_title = 'Invoice Details'(100).
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'itab'
is_layout = gs_layout
CHANGING
it_outtab = itab[]
it_fieldcatalog = gt_fieldcatalog
it_sort = gt_sort.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid2.
ENDFORM. " create_detail_list
Nothing wrong in the code i am able to see the output with five records and the pop-up screen on double clicking a value.
Kindly close the thread or revert back -
How can I importing when create object?
Hi Gurus,
Im beginner with OO Abap. Please give me a hand with this.
Im using the programming interface REPORT Z_TEST_ST_TEXT_EDITOR for text editor found on /people/igor.barbaric/blog/2005/06/06/the-standard-text-editor-oo-abap-cfw-class which is good and useful for me (highly recommended) but I need to import the text created (t_text) in method constructor in order to send it via e.mail.
Could anybody tell me how to get/import the text created?
Thank you in advance.
Below is the coding. (program which uses the developed class and method consisting the created text)
DATA: o_txe TYPE REF TO <b>zcl_standard_text_editor</b>,
v_caption TYPE char100,
s_thead TYPE thead.
call screen
CALL SCREEN 0100.
MODULE s0100_start
MODULE s0100_start OUTPUT.
SET PF-STATUS 'BASIC'.
s_thead-tdname = 'VENDOR0000000011'.
s_thead-tdid = 'ST'.
s_thead-tdobject = 'TEXT'.
s_thead-tdspras = sy-langu.
CONCATENATE 'Standard text:' s_thead-tdname
INTO v_caption SEPARATED BY space.
IF o_txe IS INITIAL.
<b> CREATE OBJECT o_txe</b>
EXPORTING i_thead = s_thead
i_caption = v_caption.
<b>IMPORTING????</b>
ENDIF.
ENDMODULE.
<b>method CONSTRUCTOR</b>.
DATA: o_dialogbox TYPE REF TO cl_gui_dialogbox_container,
t_text TYPE STANDARD TABLE OF tdline,
s_event TYPE cntl_simple_event,
t_events TYPE cntl_simple_events,
t_lines TYPE STANDARD TABLE OF tline,
v_text TYPE tdline,
v_text_temp TYPE tdline,
v_line_temp TYPE tdline,
v_line_len TYPE i,
v_index TYPE i.
FIELD-SYMBOLS: <line> TYPE tline.
me->thead = i_thead.
me->caption = i_caption.
*------ containers
IF i_container IS INITIAL.
CREATE OBJECT o_dialogbox
EXPORTING top = 50
left = 200
height = 150
width = 500
caption = i_caption.
me->main_container = o_dialogbox.
SET HANDLER me->on_container_close FOR o_dialogbox.
ELSE.
me->main_container = i_container.
ENDIF.
IF me->splitter IS INITIAL.
CREATE OBJECT me->splitter
EXPORTING
parent = me->main_container
orientation = me->splitter->orientation_vertical
sash_position = 10. "percentage of containers
------ toolbar
CREATE OBJECT me->toolbar
EXPORTING parent = me->splitter->top_left_container.
CALL METHOD me->toolbar->add_button
EXPORTING fcode = me->c_save
is_disabled = ' '
icon = '@2L@' "icon_system_save
butn_type = cntb_btype_button.
CALL METHOD me->toolbar->add_button
EXPORTING fcode = me->c_close
is_disabled = ' '
icon = '@3X@' "icon_close
butn_type = cntb_btype_button.
*------ register events
REFRESH t_events.
s_event-eventid = cl_gui_toolbar=>m_id_function_selected.
s_event-appl_event = ' '.
APPEND s_event TO t_events.
CALL METHOD me->toolbar->set_registered_events
EXPORTING events = t_events.
SET HANDLER: me->on_toolbar_func_sel FOR me->toolbar.
*------ create textedit control
CREATE OBJECT me->textedit
EXPORTING parent = me->splitter->bottom_right_container.
ENDIF.
get text
CALL FUNCTION 'READ_TEXT'
EXPORTING ID = me->thead-tdid
LANGUAGE = me->thead-tdspras
NAME = me->thead-tdname
OBJECT = me->thead-tdobject
TABLES LINES = t_lines
EXCEPTIONS ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
*------- convert text to text editor format
LOOP AT t_lines ASSIGNING <line>.
IF <line>-tdformat = space OR <line>-tdformat = '=' OR sy-tabix = 1.
v_line_temp = <line>-tdline.
CONCATENATE v_text v_line_temp INTO v_text_temp.
ELSE.
CONCATENATE: cl_abap_char_utilities=>cr_lf <line>-tdline
INTO v_line_temp.
CONCATENATE v_text v_line_temp INTO v_text_temp.
ENDIF.
IF sy-subrc = 0.
v_text = v_text_temp.
ELSE.
APPEND v_text TO t_text.
v_text = v_line_temp.
ENDIF.
ENDLOOP.
IF sy-subrc = 0.
APPEND v_text TO <b>t_text</b>.
ENDIF.
*------- display text
CALL METHOD me->textedit->set_text_as_stream
EXPORTING text = t_text.
me->t_initial_text = t_text.
endmethod.good book on ABAP objects(OOPS)
http://www.esnips.com/doc/bc475662-82d6-4412-9083-28a7e7f1ce09/Abap-Objects---An-Introduction-To-Programming-Sap-Applications
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sap-img.com/
http://www.sapgenie.com/
http://help.sap.com
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
these links
http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
For funtion module to class
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
for classes
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
for methods
http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
for inheritance
http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
for interfaces
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
For Materials:
1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
1) http://www.erpgenie.com/sap/abap/OO/index.htm
2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
Rewards if useful......................
Minal -
Splash screen ABAP (Was 6.20) SAPGui 6.20
I love splash screens. A small pop-up window with a picture should come for say 5 to 10 seconds and disappear by a timer task.
Giving such timer splash screens at START or END makes the application attractive. I do it in VB PB & Java.
How to do Slash screen in ABAP SAP GUI 6.20 WAS 6.20?
Should be thrown up as a "floating" popup.
Regards & Hopeful
-jncWith good tips from Thomas Jung
I made 2 function modules to suit my whims.
SAP being a serious Businesss Software you cannot have too many JPGs floating around! One or two is fun.
In Function group uou need two screens 0806 & 2009 which are essentially blank.
I put 2 title Bars - 0806 "SAP - JOB in Progress"; 2009 - "SAP - JOB OVER!!"
Code listing for function: ZJNC_START_SPLASH
Description: Show Splash at Start
FUNCTION zjnc_start_splash.
""Local interface:
*" IMPORTING
*" REFERENCE(IMAGEFILE) TYPE C DEFAULT 'THANKS.JPG'
*" REFERENCE(WIDTH) TYPE I DEFAULT 415
*" REFERENCE(HEIGHT) TYPE I DEFAULT 274
*" REFERENCE(TIMEOUT) TYPE I DEFAULT 3
*" REFERENCE(CALLBACK) TYPE C
Global data declarations
MOVE imagefile TO g_name.
MOVE width TO picwidth.
MOVE height TO picheight.
MOVE timeout TO pictimeout.
MOVE callback TO piccallback.
TRANSLATE piccallback TO UPPER CASE.
PERFORM getpicurl.
CALL SCREEN 0806.
ENDFUNCTION.
Code listing for function: ZJNC_END_SPLASH
Description: Show Splash at End
FUNCTION ZJNC_END_SPLASH.
""Local interface:
*" IMPORTING
*" REFERENCE(IMAGEFILE) TYPE C DEFAULT 'THANKS.JPG'
*" REFERENCE(WIDTH) TYPE I DEFAULT 415
*" REFERENCE(HEIGHT) TYPE I DEFAULT 274
*" REFERENCE(TIMEOUT) TYPE I DEFAULT 3
Global data declarations
MOVE imagefile TO g_name.
MOVE width TO picwidth.
MOVE height TO picheight.
MOVE timeout TO pictimeout.
PERFORM getpicurl.
CALL SCREEN 2009.
ENDFUNCTION.
Code listing for: LZUTILTOP
TOP level Include of Function Group ZUTIL
Author Jayanta Narayan Choudhuri
Flat 302
395 Jodhpur Park
Kolkata 700 068
Email [email protected]
URL: http://www.geocities.com/ojnc
FUNCTION-POOL zutil. "MESSAGE-ID ..
TYPE-POOLS: abap.
DATA: graphic_url(255),
g_result TYPE i,
g_linesz TYPE i,
g_filesz TYPE i,
g_name(100).
TYPES: t_graphic_line(256) TYPE x.
DATA: graphic_line TYPE t_graphic_line,
graphic_table TYPE TABLE OF t_graphic_line.
DATA: picwidth TYPE i,
picheight TYPE i,
pictimeout TYPE i,
piccallback(60) TYPE c,
first TYPE boolean.
CLASS ZCL_ES_SPLASH_SCREEN DEFINITION
CLASS zcl_es_splash_screen DEFINITION.
PUBLIC SECTION.
EVENTS on_close.
METHODS constructor
IMPORTING
!i_num_secs TYPE i DEFAULT 5
!i_url TYPE c
!i_width TYPE i
!i_height TYPE i.
PROTECTED SECTION.
METHODS handle_end_of_timer
FOR EVENT finished OF cl_gui_timer.
PRIVATE SECTION.
DATA container TYPE REF TO cl_gui_dialogbox_container.
DATA image TYPE REF TO cl_gui_picture.
DATA timer TYPE REF TO cl_gui_timer.
ENDCLASS. "ZCL_ES_SPLASH_SCREEN DEFINITION
CLASS ZCL_ES_SPLASH_SCREEN IMPLEMENTATION
CLASS zcl_es_splash_screen IMPLEMENTATION.
METHOD constructor.
DATA: image_width TYPE i,
image_height TYPE i.
COMPUTE image_width = i_width + 30.
COMPUTE image_height = i_height + 50.
CREATE OBJECT container
EXPORTING
width = 10
height = 10
top = 10
left = 10
name = 'DialogSplash'.
CALL METHOD container->set_caption
EXPORTING
caption = g_name.
CREATE OBJECT image
EXPORTING
parent = container.
CALL METHOD image->load_picture_from_url
EXPORTING
url = i_url.
image->set_display_mode( image->display_mode_normal_center ).
cl_gui_cfw=>flush( ).
container->set_metric( EXPORTING metric = image->metric_pixel ).
DATA: myleft TYPE i,
mytop TYPE i.
COMPUTE myleft = ( 800 - image_width ) / 2.
COMPUTE mytop = ( 600 - image_height ) / 2.
IF myleft < 0.
MOVE 0 TO myleft.
ENDIF.
IF mytop < 0.
MOVE 0 TO mytop.
ENDIF.
container->set_position(
EXPORTING
height = image_height
left = myleft
top = mytop
width = image_width ).
cl_gui_cfw=>update_view( ).
CREATE OBJECT timer.
timer->interval = i_num_secs.
SET HANDLER me->handle_end_of_timer FOR timer.
timer->run( ).
cl_gui_cfw=>flush( ).
ENDMETHOD. "constructor
METHOD handle_end_of_timer.
I wanted NAMASTE to remain until JOB was complete.
IF container IS NOT INITIAL.
container->free( ).
CLEAR container.
FREE container.
ENDIF.
IF timer IS NOT INITIAL.
timer->free( ).
CLEAR timer.
FREE timer.
ENDIF.
cl_gui_cfw=>flush( ).
RAISE EVENT on_close.
ENDMETHOD. "handle_end_of_timer
ENDCLASS. "ZCL_ES_SPLASH_SCREEN IMPLEMENTATION
CLASS lcl_event_handler DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_close FOR EVENT on_close OF zcl_es_splash_screen.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_close.
IF sy-dynnr = 2009.
LEAVE PROGRAM.
ELSE.
MOVE abap_false TO first.
PERFORM (piccallback) IN PROGRAM (sy-cprog).
ENDIF.
ENDMETHOD. "on_close
ENDCLASS. "lcl_event_handler IMPLEMENTATION
DATA: splash TYPE REF TO zcl_es_splash_screen.
*& Module STATUS_0806 OUTPUT
MODULE status_0806 OUTPUT.
IF first IS INITIAL.
first = abap_true.
SET TITLEBAR 'TITLE0806'.
CREATE OBJECT splash
EXPORTING
i_num_secs = pictimeout
i_url = graphic_url
i_width = picwidth
i_height = picheight.
SET HANDLER lcl_event_handler=>on_close FOR splash.
ENDIF.
ENDMODULE. " STATUS_0806 OUTPUT
*& Module STATUS_2009 OUTPUT
MODULE status_2009 OUTPUT.
IF first IS INITIAL.
first = abap_true.
SET TITLEBAR 'TITLE2009'.
CREATE OBJECT splash
EXPORTING
i_num_secs = pictimeout
i_url = graphic_url
i_width = picwidth
i_height = picheight.
SET HANDLER lcl_event_handler=>on_close FOR splash.
ENDIF.
ENDMODULE. " STATUS_2009 OUTPUT
*& Form getpicurl
FORM getpicurl.
OPEN DATASET g_name FOR INPUT IN BINARY MODE.
REFRESH graphic_table.
CLEAR g_filesz.
DO.
CLEAR graphic_line.
READ DATASET g_name INTO graphic_line ACTUAL LENGTH g_linesz.
ADD g_linesz TO g_filesz.
APPEND graphic_line TO graphic_table.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET g_name.
CLEAR graphic_url.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'IMAGE'
subtype = 'GIF'
TABLES
data = graphic_table
CHANGING
url = graphic_url
EXCEPTIONS
dp_invalid_parameter = 1
dp_error_put_table = 2
dp_error_general = 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.
EXIT.
ENDIF.
ENDFORM. "getpicurl
Extracted by Direct Download Enterprise version 1.2 - E.G.Mellodew. 1998-2004 UK. -
In smartform word document convert into pdf file
Hi Experts,
I have issue on smartform, i have done two page smartform in preview its coming properly but
when i give to print its not coming properly...output is not coming properly...so please sugest me
even how to covert smartform word document into PDF file...im waiting for your replay. Thanks in
Advance....
Regards
AshwiniHi,
I hope its printer problem check with u r basis, and for Smartform to PDF bewlow is my coding in which by using OTF data from Smartform it ill veiw in PDF.
*& Report ZSAP_PDF_VIEWER_DEMO_2
REPORT ZSAP_PDF_VIEWER.
DATA: LT_PDF TYPE TABLE OF TLINE,
LS_PDF LIKE LINE OF LT_PDF,
LV_URL TYPE CHAR255,
PDF_FSIZE TYPE I,
LV_CONTENT TYPE XSTRING,
LT_DATA TYPE STANDARD TABLE OF X255.
DATA : L_JOB_OUTPUT_INFO TYPE SSFCRESCL.
DATA : LS_CONTROL_PARAM TYPE SSFCTRLOP.
DATA : G_HTML_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_HTML_CONTROL TYPE REF TO CL_GUI_HTML_VIEWER.
DATA: LO_DIALOG_CONTAINER TYPE REF TO CL_GUI_DIALOGBOX_CONTAINER.
DATA: LO_DOCKING_CONTAINER TYPE REF TO CL_GUI_DOCKING_CONTAINER.
DATA : P_VBELN TYPE VBELN_VL.
FIELD-SYMBOLS <FS_X> TYPE X.
INITIALIZATION.
LS_CONTROL_PARAM-GETOTF = 'X'.
LS_CONTROL_PARAM-NO_DIALOG = 'X'.
START-OF-SELECTION.
CALL FUNCTION '/1BCDWB/SF00000034'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = LS_CONTROL_PARAM
P_VBELN = P_VBELN
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO = L_DOCUMENT_OUTPUT_INFO
JOB_OUTPUT_INFO = L_JOB_OUTPUT_INFO
JOB_OUTPUT_OPTIONS = L_JOB_ OUTPUT_OPTIONS
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 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.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = PDF_FSIZE
TABLES
OTF = L_JOB_OUTPUT_INFO-OTFDATA
LINES = LT_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
convert pdf to xstring string
LOOP AT LT_PDF INTO LS_PDF.
ASSIGN LS_PDF TO <FS_X> CASTING.
CONCATENATE LV_CONTENT <FS_X> INTO LV_CONTENT IN BYTE MODE.
ENDLOOP.
CALL SCREEN 100.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '100'.
**CREATE OBJECT LO_DOCKING_CONTAINER
EXPORTING
REPID = SY-REPID
DYNNR = '100'"SY-DYNNR
SIDE = LO_DOCKING_CONTAINER->DOCK_AT_LEFT
EXTENSION = 1200.
CREATE OBJECT g_html_container
EXPORTING
container_name = 'HTML'.
*CREATE OBJECT G_HTML_CONTROL
EXPORTING
PARENT = LO_DOCKING_CONTAINER.
CREATE OBJECT G_HTML_CONTAINER
EXPORTING
CONTAINER_NAME = 'HTML'.
CREATE OBJECT G_HTML_CONTROL
EXPORTING
PARENT = G_HTML_CONTAINER.
Convert xstring to binary table to pass to the LOAD_DATA method
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = LV_CONTENT
TABLES
BINARY_TAB = LT_DATA.
*application/
Load the HTML
CALL METHOD G_HTML_CONTROL->LOAD_DATA(
EXPORTING
TYPE = 'application'
SUBTYPE = 'pdf' "
IMPORTING
ASSIGNED_URL = LV_URL
CHANGING
DATA_TABLE = LT_DATA
EXCEPTIONS
DP_INVALID_PARAMETER = 1
DP_ERROR_GENERAL = 2
CNTL_ERROR = 3
OTHERS = 4 ).
CALL METHOD G_HTML_CONTROL->show_url
EXPORTING url = lv_url
in_place = 'X'
EXCEPTIONS cntl_error = 1.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE user_command_0100 INPUT.
DATA ok_code LIKE sy-ucomm.
MOVE sy-ucomm TO ok_code.
CASE ok_code.
WHEN 'BACK' OR 'EXIT'.
CALL METHOD LO_DOCKING_CONTAINER->free.
CALL METHOD g_html_control->free.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USE -
How to upload image to the progrogram...
I am trying to upload the image to the function module but it says the "sunset.jpg" is feild unkonwn it is not defined by the data...
and when i am passing this image stuff at the runtime... it gives me the memory dum.. would you like to help me... i am creating a splash screen with this code....
i am giving you the code below...
Regards
Naim
Code listing for function: ZJNC_START_SPLASH
Description: Show Splash at Start
FUNCTION zjnc_start_splash.
""Local interface:
*" IMPORTING
*" REFERENCE(IMAGEFILE) TYPE C DEFAULT 'THANKS.JPG'
*" REFERENCE(WIDTH) TYPE I DEFAULT 415
*" REFERENCE(HEIGHT) TYPE I DEFAULT 274
*" REFERENCE(TIMEOUT) TYPE I DEFAULT 3
*" REFERENCE(CALLBACK) TYPE C
Global data declarations
MOVE imagefile TO g_name.
MOVE width TO picwidth.
MOVE height TO picheight.
MOVE timeout TO pictimeout.
MOVE callback TO piccallback.
TRANSLATE piccallback TO UPPER CASE.
PERFORM getpicurl.
CALL SCREEN 0806.
ENDFUNCTION.
Code listing for function: ZJNC_END_SPLASH
Description: Show Splash at End
FUNCTION ZJNC_END_SPLASH.
""Local interface:
*" IMPORTING
*" REFERENCE(IMAGEFILE) TYPE C DEFAULT 'THANKS.JPG'
*" REFERENCE(WIDTH) TYPE I DEFAULT 415
*" REFERENCE(HEIGHT) TYPE I DEFAULT 274
*" REFERENCE(TIMEOUT) TYPE I DEFAULT 3
Global data declarations
MOVE imagefile TO g_name.
MOVE width TO picwidth.
MOVE height TO picheight.
MOVE timeout TO pictimeout.
PERFORM getpicurl.
CALL SCREEN 2009.
ENDFUNCTION.
Code listing for: LZUTILTOP
TOP level Include of Function Group ZUTIL
Author Jayanta Narayan Choudhuri
Flat 302
395 Jodhpur Park
Kolkata 700 068
Email [email protected]
URL: http://www.geocities.com/ojnc
FUNCTION-POOL zutil. "MESSAGE-ID ..
TYPE-POOLS: abap.
DATA: graphic_url(255),
g_result TYPE i,
g_linesz TYPE i,
g_filesz TYPE i,
g_name(100).
TYPES: t_graphic_line(256) TYPE x.
DATA: graphic_line TYPE t_graphic_line,
graphic_table TYPE TABLE OF t_graphic_line.
DATA: picwidth TYPE i,
picheight TYPE i,
pictimeout TYPE i,
piccallback(60) TYPE c,
first TYPE boolean.
CLASS ZCL_ES_SPLASH_SCREEN DEFINITION
CLASS zcl_es_splash_screen DEFINITION.
PUBLIC SECTION.
EVENTS on_close.
METHODS constructor
IMPORTING
!i_num_secs TYPE i DEFAULT 5
!i_url TYPE c
!i_width TYPE i
!i_height TYPE i.
PROTECTED SECTION.
METHODS handle_end_of_timer
FOR EVENT finished OF cl_gui_timer.
PRIVATE SECTION.
DATA container TYPE REF TO cl_gui_dialogbox_container.
DATA image TYPE REF TO cl_gui_picture.
DATA timer TYPE REF TO cl_gui_timer.
ENDCLASS. "ZCL_ES_SPLASH_SCREEN DEFINITION
CLASS ZCL_ES_SPLASH_SCREEN IMPLEMENTATION
CLASS zcl_es_splash_screen IMPLEMENTATION.
METHOD constructor.
DATA: image_width TYPE i,
image_height TYPE i.
COMPUTE image_width = i_width + 30.
COMPUTE image_height = i_height + 50.
CREATE OBJECT container
EXPORTING
width = 10
height = 10
top = 10
left = 10
name = 'DialogSplash'.
CALL METHOD container->set_caption
EXPORTING
caption = g_name.
CREATE OBJECT image
EXPORTING
parent = container.
CALL METHOD image->load_picture_from_url
EXPORTING
url = i_url.
image->set_display_mode( image->display_mode_normal_center ).
cl_gui_cfw=>flush( ).
container->set_metric( EXPORTING metric = image->metric_pixel ).
DATA: myleft TYPE i,
mytop TYPE i.
COMPUTE myleft = ( 800 - image_width ) / 2.
COMPUTE mytop = ( 600 - image_height ) / 2.
IF myleft < 0.
MOVE 0 TO myleft.
ENDIF.
IF mytop < 0.
MOVE 0 TO mytop.
ENDIF.
container->set_position(
EXPORTING
height = image_height
left = myleft
top = mytop
width = image_width ).
cl_gui_cfw=>update_view( ).
CREATE OBJECT timer.
timer->interval = i_num_secs.
SET HANDLER me->handle_end_of_timer FOR timer.
timer->run( ).
cl_gui_cfw=>flush( ).
ENDMETHOD. "constructor
METHOD handle_end_of_timer.
I wanted NAMASTE to remain until JOB was complete.
IF container IS NOT INITIAL.
container->free( ).
CLEAR container.
FREE container.
ENDIF.
IF timer IS NOT INITIAL.
timer->free( ).
CLEAR timer.
FREE timer.
ENDIF.
cl_gui_cfw=>flush( ).
RAISE EVENT on_close.
ENDMETHOD. "handle_end_of_timer
ENDCLASS. "ZCL_ES_SPLASH_SCREEN IMPLEMENTATION
CLASS lcl_event_handler DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_close FOR EVENT on_close OF zcl_es_splash_screen.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_close.
IF sy-dynnr = 2009.
LEAVE PROGRAM.
ELSE.
MOVE abap_false TO first.
PERFORM (piccallback) IN PROGRAM (sy-cprog).
ENDIF.
ENDMETHOD. "on_close
ENDCLASS. "lcl_event_handler IMPLEMENTATION
DATA: splash TYPE REF TO zcl_es_splash_screen.
*& Module STATUS_0806 OUTPUT
MODULE status_0806 OUTPUT.
IF first IS INITIAL.
first = abap_true.
SET TITLEBAR 'TITLE0806'.
CREATE OBJECT splash
EXPORTING
i_num_secs = pictimeout
i_url = graphic_url
i_width = picwidth
i_height = picheight.
SET HANDLER lcl_event_handler=>on_close FOR splash.
ENDIF.
ENDMODULE. " STATUS_0806 OUTPUT
*& Module STATUS_2009 OUTPUT
MODULE status_2009 OUTPUT.
IF first IS INITIAL.
first = abap_true.
SET TITLEBAR 'TITLE2009'.
CREATE OBJECT splash
EXPORTING
i_num_secs = pictimeout
i_url = graphic_url
i_width = picwidth
i_height = picheight.
SET HANDLER lcl_event_handler=>on_close FOR splash.
ENDIF.
ENDMODULE. " STATUS_2009 OUTPUT
*& Form getpicurl
FORM getpicurl.
OPEN DATASET g_name FOR INPUT IN BINARY MODE.
REFRESH graphic_table.
CLEAR g_filesz.
DO.
CLEAR graphic_line.
READ DATASET g_name INTO graphic_line ACTUAL LENGTH g_linesz.
ADD g_linesz TO g_filesz.
APPEND graphic_line TO graphic_table.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET g_name.
CLEAR graphic_url.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'IMAGE'
subtype = 'GIF'
TABLES
data = graphic_table
CHANGING
url = graphic_url
EXCEPTIONS
dp_invalid_parameter = 1
dp_error_put_table = 2
dp_error_general = 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.
EXIT.
ENDIF.
ENDFORM. "getpicurlUse this program..
create object cust_container
exporting
container_name = 'MYCONTAINER1'
CREATE OBJECT split_container
EXPORTING
LINK_DYNNR =
LINK_REPID =
SHELLSTYLE =
LEFT =
TOP =
WIDTH = 10
HEIGHT = 40
METRIC = cntl_metric_dynpro
ALIGN = 15
PARENT = cust_container
ROWS = 2
COLUMNS = 2
NO_AUTODEF_PROGID_DYNNR =
NAME =
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 split_container->get_container
EXPORTING
row = 1
column = 1
receiving
container = cus_cont.
create object picture
exporting
parent = cus_cont
clear url.
path = 'ZNAVEEN'.
perform get_url using path.
CALL METHOD picture->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_fit
EXCEPTIONS
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.
Use this Perform to load Picture
form get_url using p_path.
DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
DATA html_table LIKE w3html OCCURS 1.
DATA return_code LIKE w3param-ret_code.
DATA content_type LIKE w3param-cont_type.
DATA content_length LIKE w3param-cont_len.
DATA pic_data LIKE w3mime OCCURS 0.
DATA pic_size TYPE i.
REFRESH query_table.
query_table-name = '_OBJECT_ID'.
query_table-value = p_path.
APPEND query_table.
CALL FUNCTION 'WWW_GET_MIME_OBJECT'
TABLES
query_string = query_table
html = html_table
mime = pic_data
CHANGING
return_code = return_code
content_type = content_type
content_length = content_length
EXCEPTIONS
object_not_found = 1
parameter_not_found = 2
OTHERS = 3.
IF sy-subrc = 0.
pic_size = content_length.
ENDIF.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = cndp_sap_tab_unknown
size = pic_size
lifetime = cndp_lifetime_transaction
TABLES
data = pic_data
CHANGING
url = url
EXCEPTIONS
OTHERS = 1. -
ALV Error: Fieldcatalog not found...
Hello Experts,
I am currently creating a new report that uses object oriented ALV with
custom control. But when I run my program it always gives me that there is no fieldcatalog
found. I will paste my code below so you can see. Hope you can help me out here guys.
Thank you and take care!
*=====================================================================
* Program Name : ZSD_ORDERSTAGE
* Author : Aris Hidalgo
* Date Created : May 4, 2007
* Description : Display sales orders for a given customer on a given
* date range
*=====================================================================
REPORT zsd_orderstage
NO STANDARD PAGE HEADING.
* Data Dictionary Table/s *
TABLES: vbak.
* Global Structure/s *
TYPES: BEGIN OF t_vbak,
vbeln TYPE vbak-vbeln,
posnr TYPE vbap-posnr,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
auart TYPE vbak-auart,
kunnr TYPE vbak-kunnr,
vkgrp TYPE vbak-vkgrp,
END OF t_vbak.
TYPES: BEGIN OF t_vbfa,
vbelv TYPE vbfa-vbelv,
posnv TYPE vbfa-posnv,
vbtyp_n TYPE vbfa-vbtyp_n,
vbtyp_v TYPE vbfa-vbtyp_v,
vbeln TYPE vbfa-vbeln,
END OF t_vbfa.
TYPES: BEGIN OF t_likp,
vgbel TYPE lips-vgbel,
vgpos TYPE lips-vgpos,
vbeln TYPE likp-vbeln,
posnr TYPE lips-posnr,
kunnr TYPE likp-kunnr,
END OF t_likp.
TYPES: BEGIN OF t_vbrk,
aubel TYPE vbrp-aubel,
aupos TYPE vbrp-aupos,
vbeln TYPE vbrk-vbeln,
END OF t_vbrk.
TYPES: BEGIN OF t_output,
salesorder TYPE vbak-vbeln,
salesitem TYPE vbap-posnr,
salesgroup TYPE vbak-vkgrp,
custcode TYPE vbak-kunnr,
shipto TYPE likp-kunnr,
creation_date TYPE vbak-erdat,
created_by TYPE vbak-ernam,
delorder TYPE likp-vbeln,
invnumber TYPE vbrk-vbeln,
END OF t_output.
* Global Internal Table/s *
DATA: gt_vbak TYPE STANDARD TABLE OF t_vbak,
gt_vbfa TYPE STANDARD TABLE OF t_vbfa,
gt_likp TYPE STANDARD TABLE OF t_likp,
gt_vbrk TYPE STANDARD TABLE OF t_vbrk,
gt_output TYPE STANDARD TABLE OF t_output.
* SELECTION-SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_kunnr TYPE vbak-kunnr OBLIGATORY.
SELECT-OPTIONS: s_vkgrp FOR vbak-vkgrp,
s_auart FOR vbak-auart,
s_erdat FOR vbak-erdat OBLIGATORY,
s_ernam FOR vbak-ernam.
SELECTION-SCREEN END OF BLOCK b1.
CLASS lcl_event_receiver DEFINITION DEFERRED.
* Data Declaration/s *
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm,
g_max TYPE i VALUE 100,
g_repid TYPE sy-repid,
gs_layout TYPE lvc_s_layo,
cont_for_flights TYPE scrfname VALUE 'BCALV_GRID_02_100',
grid1 TYPE REF TO cl_gui_alv_grid,
custom_container TYPE REF TO cl_gui_custom_container,
grid2 TYPE REF TO cl_gui_alv_grid,
* reference to dialogbox container.
dialogbox_container TYPE REF TO cl_gui_dialogbox_container,
event_receiver TYPE REF TO lcl_event_receiver.
* CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column,
handle_close
FOR EVENT close OF cl_gui_dialogbox_container
IMPORTING sender,
create_detail_list.
PRIVATE SECTION.
DATA: dialogbox_status TYPE c. "'X': does exist, SPACE: does not ex.
ENDCLASS. "lcl_event_receiver DEFINITION
* CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
* §3.At doubleclick(1): The event DOUBLE_CLICK provides
* parameters of the clicked row and column.
* Use row parameter to select a line of the
* corresponding internal table.
METHOD handle_double_click.
* DATA: ls_sflight LIKE LINE OF gt_sflight.
* read selected row from internal table gt_sflight
* READ TABLE gt_sflight INDEX e_row-index INTO ls_sflight.
* §4.At Doubleclick(2): Select booking data
* PERFORM select_table_sbook USING ls_sflight
* CHANGING gt_sbook.
* §5.At doubleclick(3): Create dialogbox to show detail list
* (if not already existent)
IF dialogbox_status IS INITIAL.
dialogbox_status = 'X'.
* PERFORM create_detail_list.
CALL METHOD me->create_detail_list.
ELSE.
CALL METHOD dialogbox_container->set_visible
EXPORTING
visible = 'X'.
CALL METHOD grid2->refresh_table_display.
ENDIF.
ENDMETHOD. "handle_double_click
METHOD handle_close.
* §6.Handle the CLOSE-button of the dialogbox
* set dialogbox invisible
* (the dialogbox is destroyed outomatically when the user
* switches to another dynpro).
CALL METHOD sender->set_visible
EXPORTING
visible = space.
* In this example closing the dialogbox leads
* to make it invisible. It is also conceivable to destroy it
* and recreate it if the user doubleclicks a line again.
* Displaying a great amount of data has a greater impact on performance.
ENDMETHOD. "handle_close
METHOD create_detail_list.
* create dialogbox container as dynpro-instance
* When the user switches to another screen, it is
* destroyed by lifetime mangagement of CFW
CREATE OBJECT dialogbox_container
EXPORTING
top = 150
left = 150
lifetime = cntl_lifetime_dynpro
caption = 'Sales Orders'(200)
width = 800
height = 200.
CREATE OBJECT grid2
EXPORTING i_parent = dialogbox_container.
* Register ABAP OO event 'CLOSE'. It is not necessary to register this
* event at the frontend (this is done during creation).
SET HANDLER event_receiver->handle_close FOR dialogbox_container.
* display data
gs_layout-grid_title = space.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'T_OUTPUT'
is_layout = gs_layout
CHANGING
it_outtab = gt_output.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid2.
ENDMETHOD. "create_detail_list
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
* CLASS lcl_get_so DEFINITION
CLASS lcl_get_so DEFINITION.
PUBLIC SECTION.
METHODS: get_sales_orders
EXPORTING
ex_vbak LIKE gt_vbak.
ENDCLASS. "lcl_get_so DEFINITION
* CLASS lcl_get_so IMPLEMENTATION
CLASS lcl_get_so IMPLEMENTATION.
METHOD get_sales_orders.
SELECT vbak~vbeln vbap~posnr vbak~erdat
vbak~ernam vbak~auart vbak~kunnr
vbak~vkgrp
FROM vbak
INNER JOIN vbap
ON vbak~vbeln = vbap~vbeln
INTO TABLE gt_vbak
WHERE vbak~erdat IN s_erdat
AND vbak~ernam IN s_ernam
AND vbak~auart IN s_auart
AND vbak~vkgrp IN s_vkgrp
AND vbak~kunnr = p_kunnr.
IF NOT gt_vbak[] IS INITIAL.
ex_vbak[] = gt_vbak[].
ENDIF.
ENDMETHOD. "get_sales_orders
ENDCLASS. "lcl_get_so IMPLEMENTATION
* CLASS lcl_get_do DEFINITION
CLASS lcl_get_do DEFINITION.
PUBLIC SECTION.
METHODS: get_delivery_orders
IMPORTING
value(im_vbak) LIKE gt_vbak
EXPORTING
value(ex_likp) LIKE gt_likp.
ENDCLASS. "lcl_get_do DEFINITION
* CLASS lcl_get_do IMPLEMENTATION
CLASS lcl_get_do IMPLEMENTATION.
METHOD get_delivery_orders.
IF NOT im_vbak[] IS INITIAL.
SELECT lips~vgbel lips~vgpos
likp~vbeln lips~posnr
likp~kunnr
FROM likp
INNER JOIN lips
ON likp~vbeln = lips~vbeln
INTO TABLE gt_likp
FOR ALL ENTRIES IN im_vbak
WHERE vgbel = im_vbak-vbeln
AND vgpos = im_vbak-posnr.
ENDIF.
IF NOT gt_likp[] IS INITIAL.
ex_likp[] = gt_likp[].
ENDIF.
ENDMETHOD. "get_delivery_orders
ENDCLASS. "lcl_get_do IMPLEMENTATION
* CLASS lcl_get_bd DEFINITION
CLASS lcl_get_bd DEFINITION.
PUBLIC SECTION.
METHODS: get_billing_documents
IMPORTING
value(im_vbak) LIKE gt_vbak
EXPORTING
value(ex_vbrk) LIKE gt_vbrk.
ENDCLASS. "lcl_get_bd DEFINITION
* CLASS lcl_get_bd IMPLEMENTATION
CLASS lcl_get_bd IMPLEMENTATION.
METHOD get_billing_documents.
IF NOT im_vbak[] IS INITIAL.
SELECT vbrp~aubel vbrp~aupos vbrk~vbeln
FROM vbrk
INNER JOIN vbrp
ON vbrk~vbeln = vbrp~vbeln
INTO TABLE gt_vbrk
FOR ALL ENTRIES IN im_vbak
WHERE aubel = im_vbak-vbeln
AND aupos = im_vbak-posnr.
ENDIF.
IF NOT gt_vbrk[] IS INITIAL.
ex_vbrk[] = gt_vbrk[].
ENDIF.
ENDMETHOD. "get_billing_documents
ENDCLASS. "lcl_get_bd IMPLEMENTATION
* CLASS lcl_combine_data DEFINITION
CLASS lcl_combine_data DEFINITION.
PUBLIC SECTION.
METHODS: combine_data
IMPORTING
value(im_vbak) LIKE gt_vbak
value(im_likp) LIKE gt_likp
value(im_vbrk) LIKE gt_vbrk
EXPORTING
value(ex_output) LIKE gt_output.
ENDCLASS. "lcl_combine_data DEFINITION
* CLASS lcl_combine_data IMPLEMENTATION
CLASS lcl_combine_data IMPLEMENTATION.
METHOD combine_data.
FIELD-SYMBOLS: <fs_vbak> LIKE LINE OF im_vbak,
<fs_likp> LIKE LINE OF im_likp,
<fs_vbrk> LIKE LINE OF im_vbrk.
DATA: wa_output LIKE LINE OF ex_output.
SORT im_vbak ASCENDING BY: vbeln posnr.
SORT im_likp ASCENDING BY: vgbel vgpos.
SORT im_vbrk ASCENDING BY: aubel aupos.
LOOP AT im_vbak ASSIGNING <fs_vbak>.
READ TABLE im_likp ASSIGNING <fs_likp>
WITH KEY vgbel = <fs_vbak>-vbeln
vgpos = <fs_vbak>-posnr
BINARY SEARCH.
IF sy-subrc = 0.
MOVE: <fs_vbak>-vbeln TO wa_output-salesorder,
<fs_vbak>-posnr TO wa_output-salesitem,
<fs_vbak>-vkgrp TO wa_output-salesgroup,
<fs_vbak>-kunnr TO wa_output-custcode,
<fs_likp>-kunnr TO wa_output-shipto,
<fs_vbak>-erdat TO wa_output-creation_date,
<fs_vbak>-ernam TO wa_output-created_by,
<fs_likp>-vbeln TO wa_output-delorder.
ENDIF.
READ TABLE im_vbrk ASSIGNING <fs_vbrk>
WITH KEY aubel = <fs_vbak>-vbeln
aupos = <fs_vbak>-posnr
BINARY SEARCH.
IF sy-subrc = 0.
MOVE <fs_vbrk>-vbeln TO wa_output-invnumber.
ENDIF.
APPEND wa_output TO ex_output.
CLEAR wa_output.
ENDLOOP.
DELETE ex_output WHERE salesorder IS INITIAL.
ENDMETHOD. "combine_data
ENDCLASS. "lcl_combine_data IMPLEMENTATION
* START-OF-SELECTION *
START-OF-SELECTION.
DATA: lt_vbak_dum LIKE gt_vbak,
lt_likp_dum LIKE gt_likp,
lt_vbrk_dum LIKE gt_vbrk.
DATA: o_get_so TYPE REF TO lcl_get_so,
o_get_do TYPE REF TO lcl_get_do,
o_get_bd TYPE REF TO lcl_get_bd,
o_combine_data TYPE REF TO lcl_combine_data.
CREATE OBJECT: o_get_so,
o_get_do,
o_get_bd,
o_combine_data.
END-OF-SELECTION.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
* SET TITLEBAR 'xxx'.
g_repid = sy-repid.
IF custom_container IS INITIAL.
CALL METHOD o_get_so->get_sales_orders
IMPORTING
ex_vbak = lt_vbak_dum.
CALL METHOD o_get_do->get_delivery_orders
EXPORTING
im_vbak = lt_vbak_dum
IMPORTING
ex_likp = lt_likp_dum.
CALL METHOD o_get_bd->get_billing_documents
EXPORTING
im_vbak = lt_vbak_dum
IMPORTING
ex_vbrk = lt_vbrk_dum.
CALL METHOD o_combine_data->combine_data
EXPORTING
im_vbak = lt_vbak_dum
im_likp = lt_likp_dum
im_vbrk = lt_vbrk_dum
IMPORTING
ex_output = gt_output.
*Create a custom container control for our ALV Control
CREATE OBJECT custom_container
EXPORTING
container_name = cont_for_flights
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
*Add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
*Create an instance of alv control
CREATE OBJECT grid1
EXPORTING i_parent = custom_container.
*Set a titlebar for the grid control
gs_layout-grid_title = 'List of Sales Orders'(100).
CALL METHOD grid1->set_table_for_first_display
EXPORTING
* i_structure_name = 'T_OUTPUT'
is_layout = gs_layout
CHANGING
it_outtab = gt_output.
*Create Object to receive events and link them to handler methods.
*When the ALV Control raises the event for the specified instance
*the corresponding method is automatically called.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR grid1.
ENDIF.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid1.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CASE save_ok.
WHEN 'BACK'.
CALL METHOD custom_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc <> 0.
*Add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
LEAVE PROGRAM.
WHEN 'EXIT'.
CALL METHOD custom_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc <> 0.
*Add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
LEAVE PROGRAM.
WHEN 'CANCEL'.
CALL METHOD custom_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc <> 0.
*Add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
LEAVE PROGRAM.
ENDCASE.
CLEAR save_ok.
ENDMODULE. " USER_COMMAND_0100 INPUTHi Viraylab,
You need to craete a fieldcat to print data in ALV and pass this table to the method written below :
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'T_OUTPUT'
is_layout = gs_layout
CHANGING
it_outtab = gt_output.
i_fieldcat = gt_fieldcat
u can bulid afield catlog table like this :
form FIELDCAT using p_i_fieldcat TYPE SLIS_T_FIELDCAT_ALV.
DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
FOR MATERIAL NO
CLEAR L_FIELDCAT.
L_FIELDCAT-COL_POS = '1'.
L_FIELDCAT-FIELDNAME = 'MATNR'.
L_FIELDCAT-TABNAME = 'IT_MATSTOCK'.
L_FIELDCAT-seltext_l = 'MATERIAL NO'. " LONG TEXT FOR HEADER.
L_FIELDCAT-seltext_m = 'MAT NO'. " MEDIUM TEXT FOR HEADER.
L_FIELDCAT-seltext_s = 'MATNO'. " SHORT TEXT FOR HEADER.
L_FIELDCAT-EMPHASIZE = 'C410'. " COLOR OF THIS COLUMN.
L_FIELDCAT-OUTPUTLEN = '20'.
APPEND L_FIELDCAT TO P_I_FIELDCAT.
FOR MATERIAL TYPE
CLEAR L_FIELDCAT.
L_FIELDCAT-COL_POS = '2'.
L_FIELDCAT-FIELDNAME = 'MTART'.
L_FIELDCAT-TABNAME = 'IT_MATSTOCK'.
L_FIELDCAT-seltext_l = 'MATERIAL TYPE'. " LONG TEXT FOR HEADER.
L_FIELDCAT-seltext_m = 'MAT TYPE'. " MEDIUM TEXT FOR HEADER.
L_FIELDCAT-seltext_s = 'MAT TYP'. " SHORT TEXT FOR HEADER.
L_FIELDCAT-EMPHASIZE = 'C510'. " COLOR OF THIS COLUMN.
L_FIELDCAT-OUTPUTLEN = '6'.
APPEND L_FIELDCAT TO P_I_FIELDCAT.
FOR MATERIAL DESCRIPTION
CLEAR L_FIELDCAT.
L_FIELDCAT-COL_POS = '3'.
L_FIELDCAT-FIELDNAME = 'MAKTX'.
L_FIELDCAT-TABNAME = 'IT_MATSTOCK'.
L_FIELDCAT-seltext_l = 'MAT DESCRIP'. " LONG TEXT FOR HEADER.
L_FIELDCAT-seltext_m = 'M DESCRIP'. " MEDIUM TEXT FOR HEADER.
L_FIELDCAT-seltext_s = 'MDESCRIP'. " SHORT TEXT FOR HEADER.
L_FIELDCAT-EMPHASIZE = 'C310'. " COLOR OF THIS COLUMN.
L_FIELDCAT-OUTPUTLEN = '40'.
APPEND L_FIELDCAT TO P_I_FIELDCAT.
Reward points if helpful.
Regards,
Hemant -
1000 CHARACTER TEXT IN ALV FIELD
Hi Experts,
I have a String type variable containing 1000 character text that I am passing in a field on ALV. But ALV field can display on 132 characters. So now my requirement is that when a user double clicks on that field... then a popup or a screen appears where the user can read the entire text of that field.
I have tried some FMs (like POPUP_TO_CONFIRM, POPUP_TO_INFORM, POPUP_DISPLAY_TEXT etc...), but all have length restriction.
Please suggest if there is any FM to get the entire 1000 character text on a popup.... OR if there is any other way to do this...
Thanks in advance
Regards,
Ashish GoyalI am using this code provided by you, facing error : Field "OB_GUI_DIALOGBOX_CONTAINER" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.
Please take a look and suggest.
Using REUSE ALV GRID to display ALV.
TYPES: BEGIN OF tp_text_x .
TYPES: tdname TYPE thead-tdname ,
tdobject TYPE thead-tdobject ,
tdid TYPE thead-tdid ,
tdspras TYPE thead-tdspras ,
tdtxtlines TYPE thead-tdtxtlines .
TYPES: tdline TYPE tline-tdline ,
it_tline TYPE tline_tab .
TYPES: END OF tp_text_x .
CLASS cl_event_reciever DEFINITION DEFERRED.
DATA v_event_reciever TYPE REF TO cl_event_reciever.
CLASS cl_event_receiver DEFINITION .
PRIVATE SECTION.
METHODS: close
FOR EVENT close OF cl_gui_dialogbox_container
IMPORTING sender.
METHODS: init_container .
METHODS: display_textedit
IMPORTING value(st_text_x) TYPE tp_text_x .
ENDCLASS . "cl_event_receiver DEFINITION
CLASS cl_event_receiver IMPLEMENTATION.
METHOD close .
CALL METHOD sender->set_visible
EXPORTING
visible = abap_false.
ENDMETHOD . "handle_close
METHOD init_container .
* DATA: ob_gui_dialogbox_container TYPE REF TO cl_gui_dialogbox_container.
IF ob_gui_dialogbox_container IS NOT INITIAL .
* IF EDITOR_CONTAINER IS NOT INITIAL .
me->close( EXPORTING sender = ob_gui_dialogbox_container ) . " EDITOR_CONTAINER ).
ENDIF .
CREATE OBJECT ob_gui_dialogbox_container
EXPORTING
parent = cl_gui_container=>screen0
top = 40
left = 200
lifetime = cntl_lifetime_dynpro
width = 600
height = 100.
ENDMETHOD. "init_container
METHOD display_textedit .
me->init_container( ) .
DATA: ob_gui_textedit TYPE REF TO cl_gui_textedit .
* DATA: ob_gui_dialogbox_container TYPE REF TO cl_gui_dialogbox_container.
CREATE OBJECT ob_gui_textedit
EXPORTING
parent = ob_gui_dialogbox_container.
CALL METHOD ob_gui_textedit->set_readonly_mode
EXPORTING
readonly_mode = cl_gui_textedit=>true.
DATA: it_tdline TYPE TABLE OF tdline .
DATA: st_tdline LIKE LINE OF it_tdline .
FIELD-SYMBOLS: <st_tline> LIKE LINE OF st_text_x-it_tline .
LOOP AT st_text_x-it_tline ASSIGNING <st_tline> .
APPEND <st_tline>-tdline TO it_tdline .
ENDLOOP .
CALL METHOD ob_gui_textedit->set_text_as_stream
EXPORTING
text = it_tdline.
ENDMETHOD. "display_textedit
ENDCLASS . "cl_event_receiver IMPLEMENTATION
INITIALIZATION.
CREATE OBJECT v_event_reciever.
DATA: ob_gui_dialogbox_container TYPE REF TO cl_gui_dialogbox_container.
CREATE OBJECT ob_gui_dialogbox_container.
START-OF-SELECTION.
v_event_reciever->display_textedit( EXPORTING st_text_x = <st_alv_data_1>-text_1 ) . -
Hi Abapers,
I have written the code like this.
CLASS lcl_event_receiver DEFINITION
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN,
HANDLE_CLOSE FOR EVENT CLOSE OF CL_GUI_DIALOGBOX_CONTAINER
IMPORTING SENDER.
DATA CHECK_BOX TYPE C.
ENDCLASS.
CLASS LCL_EVENT_RECEIVER IMPLENTATION
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_DOUBLE_CLICK.
READ TABLE ALV_ITAB INDEX E_ROW-INDEX INTO WA_ITAB.
PERFORM DATARETRIEVALTAB2 USING WA_ITAB.
IF CHECK_BOX IS INITIAL.
CHECK_BOX = 'x'.
PERFORM CREATE_DETAIL_LIST.
ELSE.
CALL METHOD CL_DIALOGBOX_OBJ->SET_VISIBLE
EXPORTING
VISIBLE = 'x'.
CALL METHOD CL_ALV_OBJ1->REFRESH_TABLE_DISPLAY.
ENDIF.
ENDMETHOD.
METHOD HANDLE_CLOSE.
CALL METHOD SENDER->SET_VISIBLE
EXPORTING
VISIBLE = SPACE.
ENDMETHOD.
ENDCLASS.
but when I am creating the object
data event_obj type ref to lcl_event_receiver.
It is showing error that type lcl_event_receiver is unknown.
Kindly tell me the reason.
Regards
AnsumanHi Ansuman,
go through following piece of code and define accordingly...
i hope u will get the solution..
*& Class Declaration
class lcl_event_receiver definition deferred.
class lcl_event_receiver1 definition deferred.
data gr_events_reciever type ref to lcl_event_receiver.
data gr_events_reciever1 type ref to lcl_event_receiver1.
*& Class Definition
class lcl_event_receiver definition.
public section.
methods:
double_click
for event double_click of cl_gui_alv_grid
importing e_row e_column .
endclass. "lcl_event_receiver DEFINITION
class lcl_event_receiver1 definition.
public section.
methods:
handle_double_click1
for event double_click of cl_gui_alv_grid
importing e_row e_column .
endclass. "lcl_event_receiver DEFINITION
*& CLASS IMPLEMETATION
class lcl_event_receiver implementation.
method double_click.
perform event_double_click using e_row e_column.
endmethod. "handle_double_click
endclass. "lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver1 IMPLEMENTATION
class lcl_event_receiver1 implementation.
method handle_double_click1.
perform event_double_click1 using e_row e_column.
endmethod. "handle_double_click
endclass. "lcl_event_receiver1
Thanks& Regards
Ashu Singh. -
Function Module to download Raw data as a PDF file
Hi,
Is there any function module which will allow to convert raw data to pdf and download in the local system.
The requirement is to download a payslip as a pdf format.
Function Module 'CONVERT_PAYSLIP_TO_PDF' converts the data into a raw format. The output of this FM is of type XSTRING.
Can this be downloaded as a pdf.Hi
Please below coding
REPORT ZSAP_PDF_VIEWER.
DATA: LT_PDF TYPE TABLE OF TLINE,
LS_PDF LIKE LINE OF LT_PDF,
LV_URL TYPE CHAR255,
PDF_FSIZE TYPE I,
LV_CONTENT TYPE XSTRING,
LT_DATA TYPE STANDARD TABLE OF X255.
DATA : L_JOB_OUTPUT_INFO TYPE SSFCRESCL.
DATA : LS_CONTROL_PARAM TYPE SSFCTRLOP.
DATA : G_HTML_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_HTML_CONTROL TYPE REF TO CL_GUI_HTML_VIEWER.
DATA: LO_DIALOG_CONTAINER TYPE REF TO CL_GUI_DIALOGBOX_CONTAINER.
DATA: LO_DOCKING_CONTAINER TYPE REF TO CL_GUI_DOCKING_CONTAINER.
DATA : P_VBELN TYPE VBELN_VL.
FIELD-SYMBOLS <FS_X> TYPE X.
INITIALIZATION.
LS_CONTROL_PARAM-GETOTF = 'X'.
LS_CONTROL_PARAM-NO_DIALOG = 'X'.
START-OF-SELECTION.
CALL FUNCTION '/1BCDWB/SF00000034'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = LS_CONTROL_PARAM
P_VBELN = P_VBELN
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO = L_DOCUMENT_OUTPUT_INFO
JOB_OUTPUT_INFO = L_JOB_OUTPUT_INFO
JOB_OUTPUT_OPTIONS = L_JOB_ OUTPUT_OPTIONS
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 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.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = PDF_FSIZE
TABLES
OTF = L_JOB_OUTPUT_INFO-OTFDATA
LINES = LT_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
convert pdf to xstring string
LOOP AT LT_PDF INTO LS_PDF.
ASSIGN LS_PDF TO <FS_X> CASTING.
CONCATENATE LV_CONTENT <FS_X> INTO LV_CONTENT IN BYTE MODE.
ENDLOOP.
CALL SCREEN 100.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '100'.
**CREATE OBJECT LO_DOCKING_CONTAINER
EXPORTING
REPID = SY-REPID
DYNNR = '100'"SY-DYNNR
SIDE = LO_DOCKING_CONTAINER->DOCK_AT_LEFT
EXTENSION = 1200.
CREATE OBJECT g_html_container
EXPORTING
container_name = 'HTML'.
*CREATE OBJECT G_HTML_CONTROL
EXPORTING
PARENT = LO_DOCKING_CONTAINER.
CREATE OBJECT G_HTML_CONTAINER
EXPORTING
CONTAINER_NAME = 'HTML'.
CREATE OBJECT G_HTML_CONTROL
EXPORTING
PARENT = G_HTML_CONTAINER.
Convert xstring to binary table to pass to the LOAD_DATA method
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = LV_CONTENT
TABLES
BINARY_TAB = LT_DATA.
*application/
Load the HTML
CALL METHOD G_HTML_CONTROL->LOAD_DATA(
EXPORTING
TYPE = 'application'
SUBTYPE = 'pdf' "
IMPORTING
ASSIGNED_URL = LV_URL
CHANGING
DATA_TABLE = LT_DATA
EXCEPTIONS
DP_INVALID_PARAMETER = 1
DP_ERROR_GENERAL = 2
CNTL_ERROR = 3
OTHERS = 4 ).
CALL METHOD G_HTML_CONTROL->show_url
EXPORTING url = lv_url
in_place = 'X'
EXCEPTIONS cntl_error = 1.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE user_command_0100 INPUT.
DATA ok_code LIKE sy-ucomm.
MOVE sy-ucomm TO ok_code.
CASE ok_code.
WHEN 'BACK' OR 'EXIT'.
CALL METHOD LO_DOCKING_CONTAINER->free.
CALL METHOD g_html_control->free.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USE
Maybe you are looking for
-
I've been trying to create a new tender, but my Client hangs and i just noticed i get disconnected every time i click the Payment button. Also i realized this 3 bunch of lines in my orpos.log file: INFO 2009-11-03 17:02:49,930 225374 (StaticCacheThre
-
In Yosemite, Airport Utility Fails
When I open Airport Utility 6.3.4 in OS 10.10.1, I get a green light on Internet, but never see the Basestation. Thus I cannot update or configure it. Anyone have a clue how to get Airport Utility to work in Yosemite?
-
ok- I need facts about color correction. anything you know really. what levels are the legal levels for colors, how you do certain basic things... anything really. BIG job interview coming up and I just need to sound like I know the SPECS of color co
-
How to build a package from sources
hi all, Can someone please give some advices regarding making binaries from sources. I have found that a lot of programs on Snow Leopard can be also run in terminal and are in source form and need to be build. I have installed Xcode already and I hav
-
Introduction: You want a help system distributed over several CHM files. The topic map means that you may enter via any one of the CHMs but, once in the help system, you want access to the complete ToC. RoboHelp does not provide this by default; here