ALV FROM KRUPA
in alv program when we run then output secreen display at that time i want field name instead of desc. then how can i do
with out change progrm.
Hi,
Please look at the code below, this will solve your problem :
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
* i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
* IT_EVENTS = GT_XEVENTS
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
Thanks,
Sriram Ponna.
Similar Messages
-
hello all expert,
i have requirement display alv report in screen painter. select options and report display on same screen.
iam taking custom control for display alv report .but when i click on button alv not displayed in custom control.
plz help me anyone /
there is no hurry.
Thanks in advance,
sandeep.
Edited by: Thomas Zloch on Jan 22, 2011 1:00 PM - urgency reducedThanks for reply ,
now i write my code in pbo and pbi event but report not displayed yet.
now this is the code.
*& Report ZTEST_SCREEN1 *
REPORT ZTEST_SCREEN1 .
DATA :
gr_EBELN TYPE RANGE OF EKKO-EBELN,
grs_EBELN LIKE LINE OF gr_EBELN.
DATA:
gs_fieldcatalog TYPE lvc_s_fcat OCCURS 0,
gv_fcat LIKE LINE OF gs_fieldcatalog,
gs_layout TYPE lvc_s_layo.
TYPES :
BEGIN OF gty_item,
mandt LIKE EKKO-mandt,
EBELN LIKE EKKO-EBELN,
lifnr LIKE EKKO-lifnr,
matnr LIKE EKPO-matnr,
desc_text LIKE zEKPO-desc_text,
END OF gty_item,
BEGIN OF gty_EKKO,
mandt LIKE EKKO-mandt,
EBELN LIKE EKKO-EBELN,
lifnr LIKE EKKO-lifnr,
END OF gty_EKKO,
BEGIN OF gty_EKPO,
EBELN LIKE EKPO-EBELN,
matnr LIKE EKPO-matnr,
END OF gty_EKPO.
DATA :
gs_item TYPE gty_item,
gt_item TYPE TABLE OF gty_item.
DATA :
gs_EKKO TYPE gty_EKKO,
gt_EKKO TYPE TABLE OF gty_EKKO,
gs_EKPO TYPE gty_EKPO,
gt_EKPO TYPE TABLE OF gty_EKPO.
DATA :
g_Container TYPE scrfname VALUE 'CC_CONTAINER_GRID',
g_Custom_Container TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
g_Grid TYPE REF TO CL_GUI_ALV_GRID.
DATA :
OK_CODE LIKE sy-ucomm,
SAVE_OK LIKE sy-ucomm.
START-OF-SELECTION.
call screen 100.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'TITLE'.
IF g_Custom_Container IS INITIAL.
"Create CONTAINER object with reference to container name in the screen
CREATE OBJECT g_Custom_Container EXPORTING CONTAINER_NAME =
g_Container.
" Create GRID object with reference to parent name
CREATE OBJECT g_Grid EXPORTING I_PARENT = g_Custom_Container.
PERFORM u_prepare_fieldcatalog.
gs_layout-ZEBRA = 'X'.
"gs_layout-edit = 'X'. " Makes all Grid editable
" SET_TABLE_FOR_FIRST_DISPLAY
CALL METHOD g_Grid->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
is_layout = gs_layout
CHANGING
it_fieldcatalog = gs_fieldcatalog
IT_OUTTAB = gt_item. " Data
ELSE.
CALL METHOD g_Grid->REFRESH_TABLE_DISPLAY.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'EXIT' OR 'BACK' OR 'CNCL'.
LEAVE PROGRAM.
WHEN 'LIST'.
PERFORM u_filter_EKKO.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form u_filter_EKKO
text
--> p1 text
<-- p2 text
FORM u_filter_EKKO .
REFRESH gt_EKKO.
Define Range Criteria
grs_EBELN-SIGN = 'I'.
grs_EBELN-OPTION = 'EQ'.
grs_EBELN-low = '6000000004'.
grs_EBELN-high = ekko-ebeln.
APPEND grs_EBELN to gr_EBELN.
CHECK gr_EBELN[] IS NOT INITIAL.
SELECT mandt EBELN kunnr
FROM EKKO INTO TABLE gt_EKKO
WHERE EBELN IN gr_EBELN.
CHECK gt_EKKO[] IS NOT INITIAL.
SELECT EBELN matnr
FROM EKPO INTO TABLE gt_EKPO
FOR ALL ENTRIES IN gt_EKKO
WHERE EBELN EQ gt_EKKO-EBELN.
IF gt_EKKO[] IS NOT INITIAL.
LOOP AT gt_EKPO INTO gs_EKPO.
READ TABLE gt_EKKO INTO gs_EKKO WITH KEY EBELN = gs_EKPO-EBELN.
gs_item-mandt = gs_EKKO-mandt.
gs_item-EBELN = gs_EKKO-EBELN.
APPEND gs_item TO gt_item.
CLEAR gs_item.
CLEAR gs_EKKO.
CLEAR gs_EKPO.
ENDLOOP.
ENDIF.
ENDFORM. " u_filter_EKKO
FORM U_PREPARE_FIELDCATALOG .
CLEAR gv_fcat.
gv_fcat-fieldname = 'MANDT'.
gv_fcat-tabname = 'EKPO'.
gv_fcat-col_pos = 0.
gv_fcat-coltext = 'MANDT'.
gv_fcat-no_out = 'X'. " Do not Display Column
INSERT gv_fcat INTO TABLE gs_fieldcatalog.
CLEAR gv_fcat.
gv_fcat-fieldname = 'EBELN'.
gv_fcat-tabname = 'EKPO'.
gv_fcat-col_pos = 1.
gv_fcat-coltext = 'EBELN'.
INSERT gv_fcat INTO TABLE gs_fieldcatalog.
CLEAR gv_fcat.
gv_fcat-fieldname = 'ERDAT'.
gv_fcat-tabname = 'EKPO'.
gv_fcat-col_pos = 2.
gv_fcat-coltext = 'ERDAT'.
INSERT gv_fcat INTO TABLE gs_fieldcatalog.
CLEAR gv_fcat.
gv_fcat-fieldname = 'KUNNR'.
gv_fcat-tabname = 'EKPO'.
gv_fcat-col_pos = 3.
gv_fcat-coltext = 'KUNNR'.
INSERT gv_fcat INTO TABLE gs_fieldcatalog.
CLEAR gv_fcat.
gv_fcat-fieldname = 'MATNR'.
gv_fcat-tabname = 'EKPO'.
gv_fcat-col_pos = 5.
gv_fcat-coltext = 'MATNR'.
INSERT gv_fcat INTO TABLE gs_fieldcatalog.
ENDFORM. " U_PREPARE_FIELDCATALOG -
Return to ALV from function module
Hi to all,
I'm new in this forum. My name is Guido and I'm working with Abap from 6 months ago and I whish to greet all of you. Now I have a problem that I try to explain simply. I have created a report with 2 screens: the first one is a selction screen and the second one is an ALV.
In the ALV I have added a button "Details" and on pressing it a new screen is opened. This screen is "created" in a function module developed by me.
All works fine but there is a problem: I'm not able to return from the screen of the function module to the ALV(second screen of my report). I try to use "Leave to transaction" or "Submit" calls but in all cases the screen displayed is the selection screen(first screen of my report).
Note also that the selction screen has some obligatory fields so I can't use the "Leave to tansaction..AND SKIP FIRST SCREEN" or "Call tansaction..AND SKIP FIRST SCREEN" call.
There is a way to solve this problem? Any suggestion?
Thanks in advance for the help!One thing I don't catch here. You said you have two screens - one selection screen and another with ALV. Then you said that you have added details buton which trigger new screen. So how many screen do you really have. Where is the ALV placed - is it selection screen?
If so than whenever you return from FG screen your program ends and shows initial screen which is selection screen.
You need something like
"selection screen
call screen 100. "next screen also set as 100
"pbo screen 100
ALV here
"pai screen 100
call function ....
"in function
call screen 200 with ALV details
"pai screen 200
LEAVE TO SCREEN 0.
Doing it like that you will get the processing back to ALV.
Regards
Marcin -
Hi Experts,
I have a module pool screen, in which I have an input field and under that I have OOPS alv grid control.
I want to select a value from search help for that input field. The moment I select the value in that input field,
according to the input field value, the content of ALV should be changed and it should be refreshed.
How to get it, when PBO is not called, as we call POV.
Thanks and regards,
Venkat.Hi,
Well actually SAPGUI_SET_FUNCTIONCODE is ok as soon as you are correctly refreshing your ALV in PBO...
MODULE pbo.
IF gr_alv IS NOT BOUND.
"Create ALV object
ELSE.
gr_alv->refresh( ).
ENDIF.
ENDMODULE.
MODULE pov.
CALL FUNCTION 'SAPGUI_SET_FUNCTIONCODE'
ENDMODULE.
works perfectly on my side...
This is also working with the use of CL_GUI_CFW=>SET_NEW_OK_CODE indeed...
Cheers,
m.
Edited by: Manu D'Haeyer on Oct 14, 2011 1:45 PM -
Populate data into standard component alv from Zcomponent popup data selected
HI All
I have to call Zcomponent in standard component and need to pass value into Zcomponent (table) and from Zcomponent select row and pass back to standard component.
Steps
1) Created Zcomponent with interface node
2) Enhanced the standard component and create used components for Zcomponent and make it available at component controllers and view controllers.
When I click on Button in standard component I am calling this Zcomponent as popup window.
My problem I when I select data in Zcomponent I need to populate the data in ALV of standard component.
I thought of 2 methods to take my selected back and populate data into standard component ALV.
1) Create event: EVENT1 and Interface method Method1 and link to EVENT1
So that I can raise this event in Zcomponent and populate the data into standard component ALV
Problem: Under events interface checkbox is visible, when I select my enhancement implementation the interface checkbox not visible under events tab?.
2) Create Interface method Method1 write logic to populate data into standard component ALV
But here to when I select my enhancement implementation the interface checkbox not visible under?
Can anyone please help me why interface checkbox is not visible or any better solution to populate the data back to standard component alv?
Thanks
GopalHi Gopal,
You can achieve your requirement by using EVENTS as below
Create an event SET_DATA in component controller of zcomponent and mark it as interface and also include the parameters like context_element( type ref to if_wd_context_element), etc as below
Now, create an action for the event onLeadSelect of your zcomp Table and write the below code
DATA lo_ctx_element TYPE REF TO if_wd_context_element.
"get the selected row
lo_ctx_element = wdevent->get_context_element( name =
'NEW_ROW_ELEMENT' ).
"Raise the event with parameter
wd_comp_controller->fire_set_data_evt( context_element = lo_ctx_element ).
Use the Zcomponent in your standard component and make available in std. view's properties
Create an event handler SET_DATA method for your Zcomp's event as below
Now, inside this method, you get the parameter CONTEXT_ELEMENT and get the data from this context element as below
context_element->get_attrribute( ) or
context_element->get_static_attributes( )
You can populate the data into standard component based on the obtained value from Zcomponent.
Hope this helps you.
Regards,
Rama -
ALV from Display to Change Mode
Hello,
I created an application that starts with a selection screen and then the user selects either a Create/Change/Display. Then a call screen is done in which i added an ALV with some editable fields.
The point is that when the user first selects 'Display' the ALV is all in the display mode. If he makes a BACK then goes to 'Change' the ALV is still displayed in the output mode. and vice-versa.
Is there a reason for this??
Please helphi emym,
try this it may be helpful
Making ALV Grid Editable
->To make a column editable, it will be sufficient to set the field EDIT in the field catalog. The ALV Grid perceives if there are some editable fields and adds buttons for editing purposes. If you do not need these new buttons, you know how to exclude them.
->To make individual cells editable, we will utilize the table we used for making a cell a pushbutton. As you remember, it was of type LVC_T_STYL. If you have not added this inner table, add it now. For this procedure; add the name of the field to the field FIELDNAME, and pass cl_gui_alv_grid=>mc_style_enabled to make a field editable and cl_gui_alv_grid=>mc_style_disabled to make a field non-editable, to the field STYLE. You can use the one with disable when you make an entire column editable and want just a few of cells along it non-editable.
ps_layout-stylefname = CELLSTYLES .
If we want our column SEATSMAX entirely editable except the case CARRID is XY which is a rare case and we want our cells along the column PLANETYPE editable if their respective CONNID fields contain the value 02.
Assume we have added our style table (CELLSTYLES) to our list data table and tell the layout structure about it and we adjust the field catalog so that the column SEATSMAX has the property EDIT set to X.
refer this:
FORM adjust_editables USING pt_list LIKE gt_list[] .
DATA ls_listrow LIKE LINE OF pt_list .
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
LOOP AT pt_list INTO ls_listrow .
IF ls_listrow-carrid = 'XY' .
ls_stylerow-fieldname = 'SEATSMAX' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled .
APPEND ls_stylerow TO lt_styletab .
ENDIF .
IF ls_listrow-connid = '02' .
ls_stylerow-fieldname = 'PLANETYPE' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled .
APPEND ls_stylerow TO lt_styletab .
ENDIF .
INSERT LINES OF lt_styletab INTO ls_listrow-cellstyles .
MODIFY pt_list FROM ls_listrow .
ENDLOOP .
ENDFORM
Conditionally setting fields to be editable or non-editable
->As usual, cell based settings override entire column settings. You can dynamically switch between cases in any proper part of your execution. Just fill your inner table as required and refresh table display; for entire column settings, set or unset the property EDIT of the field catalog for the column and reset the field catalog using set_frontend_fieldcatalog.
->As the last condition to be met for editability, you must call the method set_ready_for_input passing 1 to the parameter i_ready_for_input.
Using this method you can switch between editable and non-editable mode. As you guess, passing 0 to the parameter while calling the method, switches to non-editable mode.
rewrad if helpful
regards,
sravanthi -
Callinfg ALV from another component
Hi all,
We have a main component in which on press of a button we need to show alv which is in another component.
I am trying to follow these steps but i need your inputs
1. I have declared the component which calls alv in used components
2. In the main view of my component i have placed a VCU
3. In the window of the main component i have embedded that VCU and embedded the view of the component which calls the alv.
Now how can i call alv on press of that button ?
Please let me know your suggestions
Regards
BhanuHi,
Aditya has the right idea in my opinion. I always do things this way (altering visibility) because 1. it's easiest and 2. you don't have initializing problems. Here's how you can do it:
First of all, set your ViewContainer invisible in design time.
1. Go to the Component controller of your main component (where your ViewContainer is in), go to attributes
2. Add an attribute Z_GO_VIEW, Public, Type ref to, IF_WD_VIEW.
3. Go to your View of the CC where the VC actually is in.
4. Go to hook method WDDOMODIFYVIEW
5. Add the following code:
IF first_time = abap_true.
wd_comp_controller->z_go_view = view.
ENDIF.
--> now you have the instance of your view interface.
6. Make a button
7. In the event handler method of the button, code something alike to this:
DATA:
lo_el_ui_root TYPE REF TO cl_wd_uielement_container,
lo_el_trans_cont1 TYPE REF TO cl_wd_uielement_container,
lo_el_button1 TYPE REF TO cl_wd_button.
DATA: lv_visibility TYPE WDUI_VISIBILITY.
lo_el_ui_root ?= wd_comp_controller->z_go_view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lo_el_trans_cont1 ?= lo_el_ui_root->get_child( ID = 'TC_ONE' ).
lo_el_button1 ?= lo_el_trans_cont1->get_child( ID = 'I_AM_THE_MIGHTY_BUTTON' ).
lv_visibility = '02'.
lo_el_button1->set_visible( value = lv_visibility ).
This isn't exactly what you'll need but you get the picture: Get the View Instance, Downcast the UI tree for the Element you want to dynamically alter, use the right method for alterations.
This should solve your problem. If it doesn't, ask us again
regards, Lukas -
Deleting Personal views of ALV from database
Hi All,
Is there any database table where we store the personal views of user for ALV?
If there is one how can we delete it?
Best Regards,
Arti.I'm sure it is stored in the DB and you can always do a SQL trace to find out where. SQL trace is a great way to find out where anything is stored. I did a quick SQL trace and it appears that the views are stored in WDY_CONF_USER and WDY_CONF_USERT (for the language depend text description). The component name is SALV_WD_TABLE.
However direct manipulation of this table by your own coding would not be supported by SAP and could potentially be quite dangerous. I can't recommend that you should write your own program to remove entries. There is a Web Dynpro ABAP application however that lets you do some editing and deleting of user configuration. It is WD_ANALYZE_CONFIG_USER. It looks like you can mark several entries and delete them in mass. You can also transport entries. Just search for all configs for component SALV_WD_TABLE. You can also search by user. -
Help: Dynamic ALV from an dynamic Node
Hi Expart,
I have a question. I need to create an dynamic context node, and depending upon that dynamic context node, I need to create an dynamic ALV in the View. Is it possible to create two level of dynamic implimentation in case of ALV ?
if possibel in that case, can ayn one give some hint, how to create ? or some document link to help me out. Any kind of help is mostly welcome.
thanks in advance.
Regards
Satrajit.Yes it is possible.
To create the dynamic node you can use the method ADD_NEW_CHILD_NODE of the node info object. You can use a ddic structure/table or an RTTI instance to supply the information for the node attributes.
rootnode_info = wd_context->get_node_info( ).
* Create dynamic sub node name TEST1 of structure (tablename)
dyn_node_info = rootnode_info->add_new_child_node(
static_element_type = tablename
name = tablename ). " Web Dynpro: Name of Context Node
You can then bind to the dynamic context node like normal:
* get instance of new node
dyn_node = wd_context->get_child_node( name = tablename ).
* Bind internal table to context node
dyn_node->bind_table( <tab> ).
Then connect the dynamic context node to an ALV component usage:
* Connect to the component Usage of the ALV
if wd_this->wd_cpuse_alv( )->has_active_component( ) is initial.
wd_this->wd_cpuse_alv( )->create_component( ).
endif.
* Through the interface controller of the ALV Component set the DATA node dynamically
wd_this->wd_cpifc_alv( )->set_data( r_node_data = dyn_node ). -
Display "Classic ALV" from CL_GUI_ALV_GRID
Hi,
When using ALV using the Class CL_GUI_ALV_GRID, you can click on the "Views" button and you get a list of "List Output", "Excel inplace", "Lotus inplace" and "Crystal Reports preview".
If you select the "List Output" it seems to display the ALV as if it were called using the FM REUSE_ALV_LIST_DISPLAY.
Now I was wondering if there was a way to still use the ALV Objects but by default use the "List Output" option?
Cheers,
Pat.Howdy,
Are you refreshing the ALV grid after you apply the style change?
Cheers
Alex -
How to print all pages using ALV from CL_SALV_TABLE?
Dear friends,
I have a report which displays a dynamic internal table using CL_SALV_TABLE. The display format is normal list.
And since this dynamic internal table is big, I have divided it into a sub internal table which displays 10 columns in one page at one time. And each page is displayed using a customized button that I set as MyFunction.
The problem is, when I click List->Print or Ctrl-P, the system will only send to spool the current page even though in the Print dialog box, I choose Print All option.
Is there a way to rectify this? Thanks.Hi,
Try this..code...the above FM expects purchasing organization..revised code below mentioned..
please try..
DATA: kdy_val(8) VALUE '/110'.
SET PARAMETER ID 'LIF' FIELD 'VENDOR'. " Pass the vendor
SET PARAMETER ID 'KDY' FIELD KDY_VAL.
CALL TRANSACTION 'XK03' AND SKIP FIRST SCREEN.
Thanks
Naren -
How to optimize the width of column in PDF downloaded from ALV?
Hi Gurus,
I have an ALV from where i am downloading PDF, i have optimized the field catalog length as well in layout.
The problem is The first column of ALV is not fully visible in downloaded PDF instead it is displayed as 800000.. actual value is 8000006.
The field is LIFNR field and it is also referring the same data element.
Can anybody suggest a work around for this?
Regards
S.Janagar.done with fix width option in catalog
-
List not showing in oops alv .
Hi expert
I am new in oops ,I have tried to show the list in oops alv from bkpf table and followed all steps but could not got any solution.
While I will give the debugger point after call screen 1010 .It directly shows the screen .
I can not understand ,what value filled up in fieldcat .
Please help me ,it's urgent .
I have paste exact code is in bellow .
TABLES: bkpf.
TYPE-POOLS: slis, icon.
TYPES: BEGIN OF ty_bkpf,
bukrs TYPE bukrs ,
belnr TYPE belnr_d ,
gjahr TYPE gjahr ,
END OF ty_bkpf .
DATA : wa_bkpf TYPE ty_bkpf.
DATA : it_bkpf TYPE STANDARD TABLE OF ty_bkpf.
DATA: container TYPE REF TO cl_gui_custom_container,
alv_grid TYPE REF TO cl_gui_alv_grid,
ok_code LIKE sy-ucomm,
fieldcat TYPE lvc_t_fcat,
ls_fcat TYPE lvc_s_fcat.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE t1.
PARAMETERS:p_bukrs TYPE bukrs .
SELECTION-SCREEN END OF BLOCK b1 .
START-OF-SELECTION .
SELECT bukrs
belnr
gjahr
INTO TABLE it_bkpf
FROM bkpf
WHERE bukrs = p_bukrs .
CALL SCREEN 1010 .
* Create Controls
CREATE OBJECT container
EXPORTING container_name = 'CUSTOM'.
CREATE OBJECT alv_grid
EXPORTING i_parent = container.
PERFORM display_fieldcat .
CALL METHOD alv_grid->set_table_for_first_display
CHANGING
it_outtab = it_bkpf
it_fieldcatalog = fieldcat.
FORM display_fieldcat .
CLEAR: ls_fcat.
ls_fcat-reptext = 'BUKRS'.
ls_fcat-fieldname = 'BUKRS'.
ls_fcat-ref_table = 'it_bkpf'.
ls_fcat-outputlen = '18'.
APPEND ls_fcat TO fieldcat.
CLEAR: ls_fcat.
ls_fcat-reptext = 'BELNR'.
ls_fcat-fieldname = 'BELNR'.
ls_fcat-ref_table = 'it_bkpf'.
ls_fcat-outputlen = '18'.
APPEND ls_fcat TO fieldcat.
CLEAR: ls_fcat.
ls_fcat-reptext = 'GJAHR'.
ls_fcat-fieldname = 'GJAHR'.
ls_fcat-ref_table = 'it_bkpf'.
ls_fcat-outputlen = '18'.
APPEND ls_fcat TO fieldcat.
ENDFORM. " display_fieldcat
module STATUS_1010 output.
SET PF-STATUS 'ZTEST_SCREEN'.
SET TITLEBAR text-002.
endmodule. " STATUS_1010 OUTPUT
*& Module USER_COMMAND_1010 INPUT
* text
module USER_COMMAND_1010 input.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM .
WHEN 'CANCEL'.
LEAVE PROGRAM .
WHEN OTHERS.
ENDCASE.
endmodule. " USER_COMMAND_1010 INPUTHi,
dont dispaly data directly,after creating the both objects for containers and code for fcat and lay out ,
then execute the report , if you able tos see small grid in corner, u can dispaly internal table by using settable_for_first_display.
Thanks
Srini -
How to display Internal Table in ALV?
Hi all,
can anyone teach me the simple way to insert my internal table records to ALV by providing me the sample codes from the start of declaration to the end? Below is how i define my internal table:
DATA: DOM_NAME(40) TYPE C,
P_TABLE(40) TYPE C.
TYPES: BEGIN OF ITAB6,
FIELDNAME TYPE DD03M-FIELDNAME,
END OF ITAB6.
P_TABLE = 'ABC'
DOM_NAME = 'TRY'
DATA: ITAB6 TYPE STANDARD TABLE OF ITAB6 WITH HEADER LINE.
SELECT FIELDNAME FROM DD03M INTO TABLE ITAB6 WHERE TABNAME = P_TABLE AND
DOMNAME = DOM_NAME.
Hope that anyone can just start the part of alv from the continuation of my codes. cus i went through others thread but it seem to be confusing me. thx! hope to get replies asap.hai
copy this program and past in to the wk bench....(se38)
thn execute it...
REPORT ZALVTEST2_RNJ .
*ABAP LIST VIEWER
This is a basic ALV with the followings:-
- Page Heading
- Page No
- Sub-Total
- Grand Total
*REPORT ZALV.
TYPE-POOLS: SLIS.
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
COL_POS TYPE I.
DATA: BEGIN OF ITAB,
FIELD1(5) TYPE C,
FIELD2(5) TYPE C,
FIELD3(5) TYPE P DECIMALS 2,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB_FIELDCAT.
Print Parameters
PARAMETERS:
P_PRINT AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
P_RESERV TYPE I. "NO OF FOOTER LINE
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
START-OF-SELECTION.
TEST DATA
MOVE 'TEST1' TO ITAB1-FIELD1.
MOVE 'TEST1' TO ITAB1-FIELD2.
MOVE '10.00' TO ITAB1-FIELD3.
APPEND ITAB1.
MOVE 'TEST2' TO ITAB1-FIELD1.
MOVE 'TEST2' TO ITAB1-FIELD2.
MOVE '20.00' TO ITAB1-FIELD3.
APPEND ITAB1.
DO 50 TIMES.
APPEND ITAB1.
ENDDO.
END-OF-SELECTION.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
FORM BUILD.
DATA FIELD CATALOG
Explain Field Description to ALV
DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD1'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
*FIELDCAT_LN-NO_OUT = 'X'. "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD2'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-NO_OUT = 'X'.
FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD3'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
FIELDCAT_LN-REF_TABNAME = 'MSEG'. "<- REF TABLE IN THE DICTIONNARY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-DO_SUM = 'X'. "SUM UPON DISPLAY
APPEND FIELDCAT_LN TO GT_FIELDCAT.
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM.
FORM CALL_ALV.
ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT = GS_PRINT
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM.
HEADER FORM
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
define END_OF_PAGE event
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM.
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'HEADER 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-KEY = 'STATUS 1'.
GS_LINE-INFO = 'INFO 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
GS_LINE-KEY = 'STATUS 2'.
GS_LINE-INFO = 'INFO 2'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'A'.
GS_LINE-INFO = 'ACTION'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
ENDFORM.
FORM END_OF_PAGE.
WRITE at (sy-linsz) sy-pagno CENTERED.
ENDFORM.
PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = P_PRINT. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = P_NOSINF. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = P_NOCOVE. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = P_NONEWP.
LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = P_RESERV.
ENDFORM.
*END OF ZALV PROGRAM
regard
nawa -
hi all, i have a few problems here.
Firstly, i need to display records in an ALV from an internal table.
Secondly, i need to include checkboxes beside each and every records for the user to choose which records he wants to see.
Thirdly, after the user has checked the fieldss that he wants, i need to display the details of all the records based on the ticked checkboxes in another screen.
please help me if anyone knows.
thx!Hi Meei,
Thats very simple ....
1 . In the internal table where you are displaying declare some thing like below.
Data : begin of i_department occurs 0,
vbeln like ztmsh-vbeln, "Sales and Distribution Docu No
deprt like ztmsh-deprt, "Department
meala like ztmsd-meala, "Meal Allowance
sitea like ztmsd-sitea, "Site Allowance($)
CHECKBOX(1) TYPE C,declare some thing here for creating check box
end of i_department.
2. Build a field catlog for the check box something like below..
i_temp-fieldname = 'CHECKBOX'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-col_pos = 1.
i_temp-CHECKBOX = 'X'.
i_temp-outputlen = 4.
i_temp-seltext_l = 'Flag'.
i_temp-input = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
3. Now u can see the checkbox in the output once you select it will automatically flag in your internal table.and using the USer-command u can play around.
I have pasted a entire coding here pls check the flow.
REPORT Z_TIME_SHEET_REPT.
TABLES
Tables : ztmsh, "Time Sheet Header
ztmsd, "Time Sheet Data
zempy. "Employee
Data Definations
Internal Table for Employee input data
Data : begin of i_employee occurs 0,
vbeln like ztmsh-vbeln, "Sales and Distribution Document Number
deprt like ztmsh-deprt, "Department
tmsdt like ztmsh-tmsdt, "Date
jbcpl like ztmsh-jbcpl, "Job Complete
empid like zempy-empid, "Employee ID
empnam(50) type c , "Employee Name
nmltm like ztmsd-nmltm, "Normal Time
ovrtm like ztmsd-ovrtm, "Over Time
meala like ztmsd-meala, "Meal Allowance
sitea like ztmsd-sitea, "Site Allowance($)
end of i_employee.
Internal Table For Department Input Data
Data : begin of i_department occurs 0,
vbeln like ztmsh-vbeln, "Sales and Distribution Document Number
deprt like ztmsh-deprt, "Department
tmsdt like ztmsh-tmsdt, "Date
jbcpl like ztmsh-jbcpl, "Job Complete
nmltm like ztmsd-nmltm, "Normal Time
ovrtm like ztmsd-ovrtm, "Over Time
hlftm like ztmsd-hlftm, "1.5 Time
dbltm like ztmsd-dbltm, "Double Time
meala like ztmsd-meala, "Meal Allowance
sitea like ztmsd-sitea, "Site Allowance($)
CHECKBOX(1) TYPE C,
end of i_department.
Temp Internal tablee for holding department values
Data : begin of i_t_dept occurs 0,
vbeln like ztmsh-vbeln, "Sales and Distribution Document Number
deprt like ztmsh-deprt, "Department
tmsdt like ztmsh-tmsdt, "Date
jbcpl like ztmsh-jbcpl, "Job Complete
nmltm like ztmsd-nmltm, "Normal Time
ovrtm like ztmsd-ovrtm, "Over Time
end of i_t_dept.
internal table for detailed data
data : begin of i_detail occurs 0 ,
vbeln like ztmsh-vbeln, "Sales and Distribution Document Number
deprt like ztmsh-deprt, "Department
tmsdt like ztmsh-tmsdt, "Date
jbcpl like ztmsh-jbcpl, "Job Complete
nmltm like ztmsd-nmltm, "Normal Time
ovrtm like ztmsd-ovrtm, "Over Time
cadsv like ztmsh-cadsv, "CAD Services
stsvy like ztmsh-stsvy, "SiteSurvey
cstdw like ztmsh-cstdw, "Construction Drawing
sppln like ztmsh-sppln, "Space Planning
dsndw like ztmsh-dsndw, "Design Drawings
drw3d like ztmsh-drw3d, "3D Drawings
dwplt like ztmsh-dwplt, "Drawing Plots
otamt like ztmsh-otamt, "Others
inact like ztmsh-inact, "In store Activity type
ictnq like ztmsh-ictnq, "In store Activity Quantity
inctn like ztmsh-inctn, "In store Activity Loading
mitim like ztmsh-mitim, "Movement Volume in Type
mivlm like ztmsh-mivlm, "Movement Volume in Loading
motim like ztmsh-motim, "Movement Volume Out Type
movlm like ztmsh-movlm, "Movement Volume Out Loading
outtm like ztmsh-outtm, "Out of Store Activity Type
outact like ztmsh-outact, "Out of Store Activity Loading
frklft like ztmsh-frklft, "Forklift
strpt like ztmsh-strpt, "Storage Protection
rbbsh like ztmsh-rbbsh, "Rubbish
crtes like ztmsh-crtes, "Crates
vhlhr like ztmsh-vhlhr, "Vechile
toll like ztmsh-toll, "Toll
park like ztmsh-park, "Parking
hrdwr like ztmsh-hrdwr, "Hardware
trlly like ztmsh-trlly, "# of Trollys
dolly like ztmsh-dolly, "# of Dollies
oepno like ztmsh-oepno, "# of Other Equipment
oteqp like ztmsh-oteqp, "Other Eqipment
end of i_detail.
ALV Field Catlog declaration
TYPE-POOLS : slis.
data : i_depart TYPE slis_t_fieldcat_alv,
i_emp TYPE slis_t_fieldcat_alv,
i_design TYPE slis_t_fieldcat_alv,
i_warehouse TYPE slis_t_fieldcat_alv,
i_transport TYPE slis_t_fieldcat_alv,
i_install TYPE slis_t_fieldcat_alv,
i_temp TYPE slis_fieldcat_alv,
l_layout TYPE slis_layout_alv.
Events
DATA: v_events TYPE slis_t_event,
wa_event TYPE slis_alv_event.
Tempary Variables
data: wa_nmltm type p decimals 2,
wa_ovrtm type p decimals 2,
wa_meala type p decimals 2,
wa_sitea type p decimals 2,
wa_HLFTM type p decimals 2,
wa_DBLTM type p decimals 2,
w_nmltm(5) type c,
w_ovrtm(5) type c,
w_meala(5) type c,
w_sitea(5) type c,
wa_first(25) type c,
wa_last(25) type c.
data : repid type sy-repid.
Selection Screen
*Select options
selection-screen begin of block blk1.
select-options : s_vbeln for ztmsh-vbeln,
s_tmsdt for ztmsh-tmsdt.
selection-screen end of block blk1.
Radio Buttons
selection-screen begin of block blk2 WITH FRAME TITLE TLT1.
Parameters: dept radiobutton GROUP SX,
emp radiobutton GROUP SX.
selection-screen end of block blk2.
Intialization
INITIALIZATION.
TLT1 = 'Time Sheet Summary Report'.
repid = sy-repid.
s_tmsdt-low = sy-datum.
s_tmsdt-high = sy-datum.
append s_tmsdt.
START-OF-SELECTION.
START-OF-SELECTION.
if dept = 'X'.
perform 100_time_sheet.
perform 200_build_field_catlog.
perform 400_ALV_Display.
elseif emp = 'X'.
perform 100_time_sheet.
perform 500_build_field_catlog.
Perform 600_ALV_display.
endif.
*& Form 100_time_sheet
text
FORM 100_time_sheet.
select * from ztmsh
where vbeln in s_vbeln
and tmsdt in s_tmsdt.
if ztmsh-vbeln ne space.
perform empl_calcuation .
if emp = 'X'.
clear i_employee.
elseif dept = 'X'.
clear i_department.
endif.
ENDIF.
endselect.
ENDFORM. " 100_time_sheet
*& Form 200_build_field_catlog
Department Wise Summary Report
FORM 200_build_field_catlog .
refresh i_depart.
i_temp-fieldname = 'CHECKBOX'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-col_pos = 1.
i_temp-fix_column = 'X'.
i_temp-CHECKBOX = 'X'.
i_temp-outputlen = 4.
i_temp-seltext_l = 'Flag'.
i_temp-input = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
i_temp-ref_fieldname = 'VBELN'.
i_temp-ref_tabname = 'ZTMSH'.
i_temp-fieldname = 'VBELN'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-seltext_l = 'Work Order No'.
i_temp-col_pos = 2.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
i_temp-ref_fieldname = 'DEPRT'.
i_temp-ref_tabname = 'ZTMSH'.
i_temp-fieldname = 'DEPRT'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-seltext_l = 'Department'.
i_temp-col_pos = 3.
i_temp-outputlen = 15.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
i_temp-ref_fieldname = 'TMSDT'.
i_temp-ref_tabname = 'ZTMSH'.
i_temp-fieldname = 'TMSDT'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-seltext_l = 'Time Sheet Date'.
i_temp-col_pos = 4.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
i_temp-ref_fieldname = 'JBCPL'.
i_temp-ref_tabname = 'ZTMSH'.
i_temp-fieldname = 'JBCPL'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-seltext_l = 'Time Sheet Status'.
i_temp-col_pos = 5.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
i_temp-ref_fieldname = 'NMLTM'.
i_temp-ref_tabname = 'ZTMSD'.
i_temp-fieldname = 'NMLTM'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-seltext_l = 'Total NH'.
i_temp-col_pos = 6.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
i_temp-ref_fieldname = 'OVRTM'.
i_temp-ref_tabname = 'ZTMSD'.
i_temp-fieldname = 'OVRTM'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-seltext_l = 'Total AH'.
i_temp-col_pos = 7.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
i_temp-ref_fieldname = 'HLFTM'.
i_temp-ref_tabname = 'ZTMSD'.
i_temp-fieldname = 'HLFTM'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-seltext_l = 'Total 1.5 Time'.
i_temp-col_pos = 8.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
i_temp-ref_fieldname = 'DBLTM'.
i_temp-ref_tabname = 'ZTMSD'.
i_temp-fieldname = 'DBLTM'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-seltext_l = 'Total 2.0 Time'.
i_temp-col_pos = 9.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
i_temp-ref_fieldname = 'MEALA'.
i_temp-ref_tabname = 'ZTMSD'.
i_temp-fieldname = 'MEALA'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-seltext_l = 'Tot Meal Allowence'.
i_temp-col_pos = 10.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
i_temp-ref_fieldname = 'SITEA'.
i_temp-ref_tabname = 'ZTMSD'.
i_temp-fieldname = 'SITEA'.
i_temp-tabname = 'I_DEPARTMENT'.
i_temp-seltext_l = 'Tot Site Allowence($)'.
i_temp-col_pos = 11.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_DEPART.
CLEAR i_temp.
ENDFORM. " 200_build_field_catlog
*& Form 300_populate_events
Top Of Page Events for Warehouse Report
FORM 300_populate_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = v_events.
READ TABLE v_events
INTO wa_event
WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
MODIFY v_events
FROM wa_event TRANSPORTING form
WHERE name = wa_event-form.
endif.
ENDFORM. " 300_populate_events
*& Form 400_ALV_Display
Department ALV Display
FORM 400_ALV_Display .
sort i_department by vbeln deprt tmsdt.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
I_CALLBACK_PF_STATUS_SET = 'PO_STATUS '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME = 'i_department'
IS_LAYOUT = l_layout
IT_FIELDCAT = i_depart
IT_EVENTS = v_events
TABLES
T_OUTTAB = i_department
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " 400_ALV_Display
*& Form 500_build_field_catlog
Employee wise Summary Report
FORM 500_build_field_catlog .
refresh i_depart.
i_temp-ref_fieldname = 'VBELN'.
i_temp-ref_tabname = 'ZTMSH'.
i_temp-fieldname = 'VBELN'.
i_temp-tabname = 'I_EMPLOYEE'.
i_temp-seltext_l = 'Work Order No'.
i_temp-col_pos = 1.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_emp.
CLEAR i_temp.
i_temp-ref_fieldname = 'DEPRT'.
i_temp-ref_tabname = 'ZTMSH'.
i_temp-fieldname = 'DEPRT'.
i_temp-tabname = 'I_EMPLOYEE'.
i_temp-seltext_l = 'Department'.
i_temp-col_pos = 2.
i_temp-outputlen = 15.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_emp.
CLEAR i_temp.
i_temp-ref_fieldname = 'TMSDT'.
i_temp-ref_tabname = 'ZTMSH'.
i_temp-fieldname = 'TMSDT'.
i_temp-tabname = 'I_EMPLOYEE'.
i_temp-seltext_l = 'Time Sheet Date'.
i_temp-col_pos = 3.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_emp.
CLEAR i_temp.
i_temp-ref_fieldname = 'JBCPL'.
i_temp-ref_tabname = 'ZTMSH'.
i_temp-fieldname = 'JBCPL'.
i_temp-tabname = 'I_EMPLOYEE'.
i_temp-seltext_l = 'Time Sheet Status'.
i_temp-col_pos = 4.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_emp.
CLEAR i_temp.
i_temp-ref_fieldname = 'EMPID'.
i_temp-ref_tabname = 'ZEMPY'.
i_temp-fieldname = 'EMPID'.
i_temp-tabname = 'I_EMPLOYEE'.
i_temp-seltext_l = 'Employee ID'.
i_temp-col_pos = 5.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_emp.
CLEAR i_temp.
i_temp-ref_fieldname = 'JBCPL'.
i_temp-ref_tabname = 'ZTMSH'.
i_temp-fieldname = 'EMPNAM'.
i_temp-tabname = 'I_EMPLOYEE'.
i_temp-seltext_l = 'Employee Name'.
i_temp-col_pos = 6.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_emp.
CLEAR i_temp.
i_temp-ref_fieldname = 'NMLTM'.
i_temp-ref_tabname = 'ZTMSD'.
i_temp-fieldname = 'NMLTM'.
i_temp-tabname = 'I_EMPLOYEE'.
i_temp-seltext_l = 'Total NH'.
i_temp-col_pos = 7.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_emp.
CLEAR i_temp.
i_temp-ref_fieldname = 'OVRTM'.
i_temp-ref_tabname = 'ZTMSD'.
i_temp-fieldname = 'OVRTM'.
i_temp-tabname = 'I_EMPLOYEE'.
i_temp-seltext_l = 'Total AH'.
i_temp-col_pos = 8.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_emp.
CLEAR i_temp.
i_temp-ref_fieldname = 'MEALA'.
i_temp-ref_tabname = 'ZTMSD'.
i_temp-fieldname = 'MEALA'.
i_temp-tabname = 'I_EMPLOYEE'.
i_temp-seltext_l = 'Tot Meal Allowence'.
i_temp-col_pos = 9.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_emp.
CLEAR i_temp.
i_temp-ref_fieldname = 'SITEA'.
i_temp-ref_tabname = 'ZTMSD'.
i_temp-fieldname = 'SITEA'.
i_temp-tabname = 'I_EMPLOYEE'.
i_temp-seltext_l = 'Tot Site Allowence($)'.
i_temp-col_pos = 10.
i_temp-fix_column = 'X'.
APPEND i_temp TO i_emp.
CLEAR i_temp.
ENDFORM. " 500_build_field_catlog
*& Form 600_ALV_display
Employee Wise ALV Display
FORM 600_ALV_display .
sort i_employee by vbeln deprt tmsdt.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
I_CALLBACK_PF_STATUS_SET = 'PO_STATUS '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME = 'i_employee'
IS_LAYOUT = l_layout
IT_FIELDCAT = i_emp
IT_EVENTS = v_events
TABLES
T_OUTTAB = i_employee
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " 600_ALV_display
*& Form Po-Status.
FORM po_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZBUTTON' EXCLUDING rt_extab.
ENDFORM. "po_status
*& Form User_command.
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
data : valid type i,
cnt like ztmsh-deprt.
clear i_department.
loop at i_department where CHECKBOX = 'X'.
on change of i_department-deprt.
if cnt ne space.
if valid ne 0.
message 'Please select same department' type 'I'.
valid = 2.
exit.
cnt = i_department-deprt.
endif.
endon.
valid = 1.
endloop.
if valid = 1.
case ucomm.
when 'DESIGN' .
perform transfer_table.
perform design_report.
perform des_build_field_catlog.
Perform design_ALV_display.
when 'WAREHOUSE'.
perform transfer_table.
perform design_report.
perform war_build_field_catlog.
perform 300_populate_events.
perform warehouse_ALV_display.
when 'TRANSPORT'.
perform transfer_table.
perform design_report.
perform tran_build_field_catlog.
perform top_of_page.
perform Transport_ALV_display.
when 'INSTALLAT'.
perform transfer_table.
perform design_report.
perform inst_build_field_catlog.
perform Install_ALV_display.
endcase.
elseif valid = 0.
message 'Please select a department' type 'I' .
endif.
endform. "user_command
*& Form empl_calcuation
Employee total hours calculation
FORM empl_calcuation .
data : w_hours(3) type C,
w_min(3) type c,
w_hours1(3) type c,
w_min1(3) type c,
w_hours2(3) type c,
w_min2(3) type c,
w_hours3(3) type c,
w_min3(3) type c,
w_hours4(3) type c,
w_min4(3) type c,
t_nmltm(5) type c,
t_ovrtm(5) type c,
t_meala(5) type c,
t_sitea(5) type c,
t_HLFTM(5) type c,
t_DBLTM(5) type c,
temp type i.
clear :wa_nmltm,
wa_ovrtm,
wa_meala,
wa_sitea,
wa_HLFTM,
wa_DBLTM.
To convert into Minutes
select * from ztmsd
where vbeln = ztmsh-vbeln
and tmsdt = ztmsh-tmsdt
and deprt = ztmsh-deprt.
*uncommenting the below code between the select and endselect will work
*for normal time scenario (eg: 2.55+3.55 =6.50) *
Normal Time
t_nmltm = ztmsd-nmltm.
SPLIT t_nmltm at '.' into w_hours w_min.
temp = w_hours.
w_hours = temp.
w_hours = w_hours * 60.
wa_nmltm = wa_nmltm + t_nmltm.
Over Time
t_ovrtm = ztmsd-ovrtm.
SPLIT t_ovrtm at '.' into w_hours1 w_min1.
temp = w_hours1.
w_hours1 = temp.
w_hours1 = w_hours1 * 60.
wa_ovrtm = wa_ovrtm + t_ovrtm.
Meal Allowence
t_meala = ztmsd-meala.
SPLIT t_meala at '.' into w_hours2 w_min2.
temp = w_hours2.
w_hours2 = temp.
w_hours2 = w_hours2 * 60.
wa_meala = wa_meala + t_meala .
Site Allowence
t_sitea = ztmsd-sitea.
wa_sitea = wa_sitea + t_sitea.
if dept = 'X'.
1.5 Time
t_HLFTM = ztmsd-HLFTM.
SPLIT t_HLFTM at '.' into w_hours3 w_min3.
temp = w_hours3.
w_hours3 = temp.
w_hours3 = w_hours3 * 60.
wa_HLFTM = wa_HLFTM + t_hlftm.
Double Time
t_DBLTM = ztmsd-DBLTM.
SPLIT t_DBLTM at '.' into w_hours4 w_min4.
temp = w_hours4.
w_hours4 = temp.
w_hours4 = w_hours4 * 60.
wa_DBLTM = wa_DBLTM + t_dbltm.
endif.
endselect.
if sy-subrc = 0.
uncommenting the below will work for normal time scenario
(eg: 2.55+3.55 =6.50)
and change in the appending coloum wa_ to t_
to convert into Hours
perform min_to_hrs_nmltm using wa_nmltm changing t_nmltm.
perform min_to_hrs_ovrtm using wa_ovrtm changing t_ovrtm.
perform min_to_hrs_meala using wa_meala changing t_meala.
perform min_to_hrs_sitea using wa_sitea changing t_sitea.
if emp = 'X'. "Report By Employee
Employee Id
select single empid deprt into ztmsd
from ztmsd
where vbeln = ztmsh-vbeln.
if sy-subrc = 0.
Employee Name
select single empye_f empye_l
into (wa_first,wa_last )
from zempy
where empid = ztmsd-empid.
if sy-subrc = 0 .
concatenate wa_first
wa_last
into i_employee-empnam.
Appending To internal Table
i_employee-empid = ztmsd-empid.
i_employee-deprt = ztmsh-deprt.
i_employee-nmltm = wa_nmltm.
i_employee-ovrtm = wa_ovrtm.
i_employee-meala = wa_meala.
i_employee-sitea = wa_sitea.
i_employee-vbeln = ztmsh-vbeln.
i_employee-tmsdt = ztmsh-tmsdt.
i_employee-jbcpl = ztmsh-jbcpl.
APPEND i_employee.
endif.
endif.
elseif dept = 'X'. "Report By Department
uncommenting the below will work for normal time scenario
(eg: 2.55+3.55 =6.50)
and change in the appending coloum wa_ to t_
perform min_to_hrs_HLFTM using wa_HLFTM changing t_HLFTM.
perform min_to_hrs_DBLTM using wa_DBLTM changing t_DBLTM.
Appending To internal Table
i_department-deprt = ztmsh-deprt.
i_department-nmltm = wa_nmltm.
i_department-ovrtm = wa_ovrtm.
i_department-meala = wa_meala.
i_department-sitea = wa_sitea.
i_department-vbeln = ztmsh-vbeln.
i_department-tmsdt = ztmsh-tmsdt.
i_department-jbcpl = ztmsh-jbcpl.
i_department-hlftm = t_hlftm.
i_department-dbltm = t_dbltm.
APPEND i_department.
endif.
endif.
ENDFORM. " empl_calcuation
*& Form min_to_hrs_nmltm
text
-->P_WA_NMLTM text
FORM min_to_hrs_nmltm USING P_WA_NMLTM
CHANGING P_T_nmltm.
data : hours(2) type c,
minutes_n(2) type c,
nmltm(10) type c.
if p_wa_nmltm >= 60.
hours = P_WA_NMLTM / 60.
endif.
minutes_n = P_WA_NMLTM MOD 60.
concatenate hours
minutes_n
into P_T_nmltm.
ENDFORM. " min_to_hrs_nmltm
*& Form min_to_hrs_ovrtm
text
FORM min_to_hrs_ovrtm USING P_WA_OVRTM
CHANGING P_T_OVRTM.
data : hours(2) type c,
minutes_n(2) type c.
if p_wa_ovrtm >= 60.
hours = P_WA_OVRTM / 60.
endif.
minutes_n = P_WA_OVRTM MOD 60.
concatenate hours
minutes_n
into P_T_OVRTM.
ENDFORM. " min_to_hrs_ovrtm
*& Form min_to_hrs_meala
FORM min_to_hrs_meala USING P_WA_meala
CHANGING P_T_MEALA.
data : hours(2) type c,
minutes_n(2) type c.
if p_wa_meala >= 60.
hours = P_WA_meala / 60.
endif.
minutes_n = P_WA_meala MOD 60.
concatenate hours
minutes_n
into P_T_meala.
ENDFORM. " min_to_hrs_meala
*& Form min_to_hrs_sitea
FORM min_to_hrs_sitea USING P_WA_sitea
CHANGING P_T_SITEA.
data : hours(2) type c,
minutes_n(2) type c.
if p_wa_sitea >= 60.
hours = P_WA_sitea / 60.
endif.
minutes_n = P_WA_sitea MOD 60.
concatenate hours
minutes_n
into P_T_sitea.
ENDFORM. " min_to_hrs_sitea
*& Form min_to_hrs_HLFTM
FORM min_to_hrs_HLFTM USING P_WA_HLFTM
CHANGING P_T_HLFTM.
data : hours(2) type c,
minutes_n(2) type c.
if p_wa_hlftm >= 60.
hours = P_WA_HLFTM / 60.
endif.
minutes_n = P_WA_HLFTM MOD 60.
concatenate hours
minutes_n
into P_T_HLFTM.
ENDFORM. " min_to_hrs_HLFTM
*& Form min_to_hrs_DBLTM
FORM min_to_hrs_DBLTM USING P_WA_DBLTM
CHANGING P_T_DBLTM.
data : hours(2) type c,
minutes_n(2) type c.
if p_wa_dbltm >= 60.
hours = P_WA_DBLTM / 60.
endif.
minutes_n = P_WA_DBLTM MOD 60.
concatenate hours
minutes_n
into P_T_DBLTM.
ENDFORM. " min_to_hrs_DBLTM
*& Form design_report
FORM design_report .
select * into corresponding fields of table i_detail
from ztmsh for all entries in i_t_dept
where vbeln = i_t_dept-vbeln
and deprt = i_t_dept-deprt
and tmsdt = i_t_dept-tmsdt .
loop at i_detail.
read table i_t_dept with key vbeln = i_detail-vbeln
deprt = i_detail-deprt
tmsdt = i_detail-tmsdt .
if sy-subrc = 0.
i_detail-nmltm = i_t_dept-nmltm.
i_detail-ovrtm = i_t_dept-ovrtm.
modify i_detail.
endif.
endloop.
ENDFORM. " design_report
*& Form transfer_table
Doin some operation using the checkbox
FORM transfer_table .
clear i_t_dept[].
loop at i_department where checkbox = 'X'.
move-corresponding : i_department to i_t_dept.
append i_t_dept.
endloop.
ENDFORM. " transfer_table
Regards,
karthik.
Edited by: karthikeyan sukumar on Jan 3, 2008 9:46 AM
Maybe you are looking for
-
Okay, so I have tried everything listed on Apple's website to get my IPOD to be recognized in ITUNES. When I plug my IPOD into the USB port, the "do not disconnect" screen pops up. Nothing happens in ITUNES. Windows Vista pops up and says "Do you wan
-
HP DVDWBD TS-LB23L stopped detecting DVD/BLU-RAY
Laptop info: HP Pavillion dv8-1190eo (5 months old) OS: Windows 7 Home Premium 64 bit In the middle of watching a DVD movie, the player stopped working. The movie "froze", didn't start on its own, so I removed the DVD from the tray to check for scra
-
SAP Business One Client Not Install In Windows 7 Proffesional
HI Expert, I Have Not Able To Install SAP Business One Client Version : SAP Business One 8.8 (8.80.229) SP: 00 PL: 10 Windows 7 Proffesional Error Massage : 1628 Best Regards, Srujal Patel
-
Why is the free space different in iTunes and iPhone?
I can not download an app update because I don't have enough room on my iiPhone. I plug it into iTunes and it says I have 3.23 GB free. Why the difference? I have synced several times.Also, I think I remember in the past the iPhone has kept some old
-
Which is better MBPr for music production? 8gb or 16gb
Hi everyone: I am seeking suggestions here from fellow music artists/ DJs and tech wizards to help me make the "right" decision in where to invest my money. I don't know wether to buy the base model MBPr 15inch with 2.0Ghz Quad Core i7, 8gb ram and 2