ALV Grid, USER_COMMAND logic required.
Hi there,
In my requirement, I display ALV Grid output with check-box as first field, Material no as second field and so on. when I check checkbox and press pushbuton in application tool bar, the control leads to MM02 transaction code. How to implement this logic.
another question: suppose I check 10 checkboxes for 10 Materials and press pushbutton. 10 transaction codes (i.e. MM02) with with the Materials that I have selected comes one after another. Is it possible?
Regards,
Zakir.
Hi Zakir,
Under the field catalog insert chk box logic like this
wa_fieldcat-col_pos = '1'.
wa_fieldcat-seltext_l = 'Check'.
wa_fieldcat-checkbox = 'X'.
append wa_fieldcat to it_fieldcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
* I_CALLBACK_PF_STATUS_SET = ' '
<b> I_CALLBACK_USER_COMMAND = 'IT_USER_COMMAND'</b>* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
i_grid_title = 'Purchase Order Details'
* I_GRID_SETTINGS = I_GRID_SETTINGS
is_layout = wa_layout
it_fieldcat = it_fieldcat
* IT_EXCLUDING = IT_EXCLUDING
* IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
it_sort = it_sort
* IT_FILTER = IT_FILTER
* IS_SEL_HIDE = IS_SEL_HIDE
* I_DEFAULT = 'X'
i_save = w_save
is_variant = i_variant
it_events = it_event
* IT_EVENT_EXIT = IT_EVENT_EXIT
* IS_PRINT = IS_PRINT
* IS_REPREP_ID = IS_REPREP_ID
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
* IT_HYPERLINK = IT_HYPERLINK
* IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
* IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
* IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
* ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
tables
t_outtab = it_final
exceptions
program_error = 1
others = 2
*& Form IT_USER_COMMAND
* text
form it_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
free it_fieldcat.
case r_ucomm.
when '&IC1'.
read table <final internal table>index rs_selfield-tabindex.
perform <action>.
endcase.
endform. "IT_USER_COMMAND
Thanks
Vikranth Khimavath
Similar Messages
-
ALV ...Logic required
Hi every body,
I have one requirement like an alv report will display
output which contains a material number.
<b>If i click On the material number it shud go to MM03...Accounting view
Logic required for this.</b>I am a beginner ...Plz help me...
Thanks in advance.
Message was edited by: raja gurralaHi,
See the code sample,
INCLUDE <icon>.
* Predefine a local class for event handling to allow the
* declaration of a reference variable before the class is defined.
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA : o_alvgrid TYPE REF TO cl_gui_alv_grid ,
o_dockingcontainer TYPE REF TO cl_gui_docking_container ,
o_eventreceiver TYPE REF TO lcl_event_receiver,
wa_layout TYPE lvc_s_layo ,
wa_variant TYPE disvariant.
CONSTANTS : c_a(1) TYPE c VALUE 'A' , " All Layouts
c_x(1) TYPE c VALUE 'X'.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
* Hot Spot Click
handle_hotspot
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id
e_column_id
es_row_no,
* Double Click
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no,
ENDCLASS. "lcl_event_receiver DEFINITION
* Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
*& Method handle_hotspot
* This method is called when the user clicks on a hotspot to drill down.
* The following types are exported from the ALV
* LVC_S_ROW
* LVC_S_COL
* LVC_S_ROID
METHOD handle_hotspot.
* The hotspot processing coded in the form below.
PERFORM f9900_handle_hotspot USING e_row_id
e_column_id
es_row_no.
ENDMETHOD. "handle_hotspot
*& Method handle_double_click
METHOD handle_double_click.
* The double click processing should be coded in the form below.
PERFORM f9901_handle_double_click USING e_row
e_column
es_row_no.
ENDMETHOD. "HANDLE_DOUBLE_CLICK
FORM f9900_handle_hotspot USING p_row_id
p_column_id
p_row_no.
*Read internal table for proper value.
READ TABLE i_output
INDEX p_row_id
INTO wa_output.
* Call the transaction MMBE
SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
ENDFORM. " f9900_handle_hotspot
*& Form f9901_handle_double_click
* Double Click
FORM f9901_handle_double_click USING p_row
p_column
p_row_no.
READ TABLE i_output INDEX p_row INTO wa_output.
CASE p_column.
WHEN 'MATNR'.
IF NOT wa_output-matnr IS INITIAL.
SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
ENDIF.
ENDCASE.
ENDFORM. " f9901_handle_double_click
U can use either hot spot or double click event.
If u r using hotspot set the hotspot = 'X' in fieldcatalog.
Hope this helps.
OR another method without oops concept
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
data:lv_matnr LIKE v_mmim_lc-matnr, "Material
read table i_output into w_output index rs_selfield-tabindex.
lv_matnr = w_output-matnr.
SET PARAMETER ID 'MAT' FIELD lv_matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
Clear: lv_matnr.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
<b> i_callback_user_command = 'USER_COMMAND'</b>
i_background_id = 'ALV_BACKGROUND'
IS_LAYOUT = I_LAYOUT
it_fieldcat = i_fieldcat "field catalog
I_SAVE = 'A'
IS_VARIANT = G_VARIANT
TABLES
t_outtab = i_output "output table
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.
Kindly reward points if this helps u, revert back with queries.
Message was edited by: Judith Jessie Selvi -
How to make OO ALV Grid cell is required on data_changed?
Hi all,
I want to make grid cell is required on data_change method. I have two fields dependent each other, so i insert a value on a field, the other field should be obligatory.
I have tried to solve this with "add_protocol_entry" method. But i don't want to display message log. The second field should be drawn with red border.
My sample code is below:
LOOP AT p_data_changed->mt_good_cells INTO ls_good_cells.
CASE ls_good_cells-fieldname.
WHEN 'FIELD1' .
CASE p_sender.
WHEN g_grid.
CALL METHOD p_data_changed->get_cell_value
EXPORTING
i_row_id = ls_good_cells-row_id
i_fieldname = ls_good_cells-fieldname
IMPORTING
e_value = lv_variable.
*-- On this area the second field should be drawn with red border.
ENDCASE.
ENDCASE.
ENDLOOP.
I'm waiting for your helps.Gutten Tag,
I have an idea, how about that you add one more field in your table structure for obtain information about color about each cell. such as "color TYPE lvc_t_scol " and then in your lvc_s_layo, you should fill CTAB_FNAME = 'COLOR'.
Insert this code into your program. (it's a template)
READ TABLE itab WITH KEY <k1> = ..... ASSIGNING <fs>.
APPEND INITIAL LINE TO <fs>-COLOR ASSIGNING <fs_l>.
<fs_l>-fname = 'XXX' . "字段名
<fs_l>-color-col = 6.
<fs_l>-color-int = 1.
<fs_l>-color-inv = 0 . -
Hi I am displaying an output on ALV Grid.
My requirement is, If i select one record on Alv Grid,with Corresponding fields from ALV i have to populate one screen.
So I should go Interactive ALV ?..
I never worked on Interactive ALV.
Can any one plz help on this...........Hi,
U have to use the Events.
Register the Events or Simply
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc = 0.
SORT it_events BY name.
ENDIF.
FORM user_command USING rucomm TYPE sy-ucomm "#EC CALLED
rs_selfield TYPE slis_selfield .
IF rucomm = '&IC1'.
Endif.
EndForm.
Please let me know for any more solutions.
Affable
Arbind -
Editable data in excel view of alv grid
hi friends..
now i am displaying the data in alv grid..
my requirement is i want to display the data in excel format.. (not in seperate excel..)
i want to display the excel sheet with data within the screen itself.
for this
i tried this scenario by fallowing steps
in layout->view tab->microsoft excel..
(layout button in the application toolbar i.e pf-status)
it show excel sheet within report and data with excel sheet.
now i got data in excel sheet.
but my requirement is if i made any changes in data in excel means
i want those updated or edited data in the another internal table..
this scenario is work in the case of abap list viewer (instead of microsoft excel)
for this i use one button in the pf-status (UPDATE).
after made changes in grid data i export those modified data to abap memory and download to another internal table..
how can i get the same scenario in micosoft excelHi,
Please make sure that you have made a <b>global</b>
<b>declaration</b> for the ALV Grid control.If not try
with this
Please reward points if this explanation is useful.
Regards,
Siva -
Single Click on a Row in ALV Grid
Hello,
I am using 'CL_GUI_ALV_GRID' class for displaying an ALV grid.
The requirement is when an user clicks on a row of the grid, a popup should be displayed with the details of that line, the user can edit/enter some fields there and when clicks on the save button, the updated values should get saved in database.
Which event needs to be used for this? A sample code will be very useful.
Thanks
Indrajit.Hello Indrajit
The same behaviour you see in the IDoc Monitor (transaction WE02, report RSEIDOC2). The event you need to handle is DELAYED_CHANGED_SEL_CALLBACK.
Coding copied from RSEIDOC_ALV_CL:
***INCLUDE CLASS_ALV .
* LOCAL CLASSES: Definition für ALV Ereignisse
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_delayed_changed_sel_cb
FOR EVENT delayed_changed_sel_callback OF cl_gui_alv_grid,
METHOD handle_delayed_changed_sel_cb.
data: lt_rows TYPE lvc_t_row.
data: l_row TYPE lvc_s_row.
CALL METHOD grid->get_selected_rows
IMPORTING et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
read table lt_rows index 1 transporting no fields.
if sy-subrc ne 0.
exit.
endif.
perform fill_special_values tables lt_rows.
need_refresh = 'N'.
set screen 100.
leave screen.
ENDMETHOD.
Regards
Uwe -
How to trigger ENTER event in oo ALV grid
Hi,
Can anybody help me out in catching the ENTER event in the oo ALV Grid. My requirement is as follows,
I have oo ALV Grid displaying hell lot of columns, in that vendor number column is an editable field so when the user enters the vendor number the immediate next cell showing the vendor name should be populated with the corresponding name as soon as he press enter button, I have search help also for vendor field.
Please give me some sample program which i can just do the copy+paste sort of as today is the deadline for the object.
Regards,
SumanHi,
This example is working. Please try this one.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed e_onf4 e_ucomm.
ENDCLASS. "lcl_event_receiver DEFINITION
* CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
DATA : modi TYPE TABLE OF lvc_s_modi ,
modis TYPE lvc_s_modi,
wa LIKE LINE OF git_alv_items,
lv_matnr TYPE matnr.
modi = er_data_changed->mt_mod_cells .
LOOP AT modi INTO modis WHERE fieldname = 'MATNR'.
MOVE modis-value TO lv_matnr.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = lv_matnr
IMPORTING
output = lv_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
READ TABLE git_alv_items INTO wa INDEX modis-row_id .
IF sy-subrc = 0.
SELECT SINGLE maktx FROM makt
INTO wa-maktx
WHERE matnr = lv_matnr
AND spras = sy-langu.
MODIFY git_alv_items FROM wa INDEX modis-row_id.
ENDIF.
ENDLOOP.
IF sy-subrc = 0.
CALL METHOD alv_grid->refresh_table_display
EXPORTING
is_stable = gs_stbl.
ENDIF.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
DATA : eventreceiver TYPE REF TO lcl_event_receiver.
SET HANDLER eventreceiver->handle_data_changed FOR alv_grid.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = layo_alv
i_bypassing_buffer = 'X'
i_buffer_active = ''
CHANGING
it_outtab = git_alv_items
it_fieldcatalog = fcat_alv
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
CALL METHOD alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter. -
Handling Right & Left Click Events in ALV Grid
Hi Friends,
Please give me the idea how to handle Right & Left mouse Click Events in ALV Grid.
My requirement is that when i click on the grid i need to pop up a message.
Eagerly waiting for your replies
Thanks
Satishyou have to Define a class and implement event handler methods for this purpose.
and the following events can help.
LEFT_CLICK_DESIGN
LEFT_CLICK_RUN
Regards
Raja -
Reg: GOING TO SELECTION SCREEN FROM ALV GRID.
Hi all,
Iam using an ALV grid display.
I have called the grid display every times when i select a check box in the grid display.
Then when i click on the back button the screen navigates to the previous ALV grid. My requirement is to go to the first selection screen.
For this I have coded in the Back button as Call selection--screen <screen no>.
When i do this, and after navigation to the selection-screen when i click on the back button on the selection screen its navigating back to the ALV grid.
But i need to exit to the program in this case.
Can anyone Help me on this issue?
Regards
NaveenYou have to use LEAVE TO SCREEN 0.
Regards
Eswar
Addition: Also see that you are releasing the grid with statement like CALL METHOD g_grid->free.
So the code should be something like:
CASE ok_code.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
CALL METHOD g_grid->free.
LEAVE TO SCREEN 0.
ENDCASE.
Edited by: Eswar Rao Boddeti on Feb 19, 2008 1:48 PM -
GOING TO SELECTION SCREEN FROM ALV GRID.
Hi all,
Iam using an ALV grid display.
I have called the grid display every times when i select a check box in the grid display.
Then when i click on the back button the screen navigates to the previous ALV grid. My requirement is to go to the first selection screen.
For this I have coded in the Back button as Call selection--screen <screen no>.
When i do this, and after navigation to the selection-screen when i click on the back button on the selection screen its navigating back to the ALV grid.
But i need to exit to the program in this case.
Can anyone Help me on this issue?
Regards
NaveenNaveen,
Write below code,
DATA ref1 TYPE REF TO cl_gui_alv_grid.
WHEN 'BACK'
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
CALL METHOD ref1->refresh_table_display.
LEAVE TO SCREEN 0.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Aug 8, 2008 4:24 PM -
Function code for dropdown on OO ALV Grid to trigger user_command
Hi Experts,
I know we can add a dropdown to a column of an OO ALV Grid, set values to the dropdown list and allow the user to select some these values.
However , what I'm not sure is that if we can *assign a function code to the dropdown * which would then trigger the event user_command ( PAI ) of the ALV class so I can handle the changes to when a particular value is selected from a dropdown list, just like we do in normal dialogs.
Now I know that I can register the 'Enter' event and handle the data changes in data_changed event, but that is something I want to avoid the user from doing as far as possible to make the report more user friendly.
Awaiting your valuable inputs and would really appreciate your help.
Thanks & regards,
AdvaitHi Advait,
No problem. Yes, this functionality requires changing the focus to other cell.
I think there is other solution. As the dropdown is kind of F4 activity try this way:
data: it_f4 type lvc_t_f4,
wa_f4 type lvc_s_f4.
wa_f4-FIELDNAME = 'CONNID'.
wa_f4-REGISTER = 'X'.
wa_f4-GETBEFORE = 'X'.
wa_f4-CHNGEAFTER = 'X'.
append wa_f4 to it_f4.
"register F4 event
CALL METHOD g_alv_grid_ref->register_f4_for_fields
EXPORTING
it_f4 = it_f4.
"Once you try to pick the value HANDLE_DATA_CHANGED event will be triggered
"Definition
methods:
handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed e_onf4 e_onf4_before e_onf4_after,
"Implementation
METHOD handle_data_changed .
DATA: ls_mod_cells TYPE lvc_s_modi.
IF e_onf4_before = 'X'.
MESSAGE 'Data changed before F4' TYPE 'I'.
ENDIF.
IF e_onf4 = 'X'. "if event triggered by F4
MESSAGE 'Data changed on F4' TYPE 'I'.
ENDIF.
IF e_onf4_after = 'X'.
MESSAGE 'Data changed after F4' TYPE 'I'.
ENDIF.
"here you know which cell was modified
LOOP AT er_data_changed->mt_mod_cells INTO ls_mod_cells.
"just example test case, here you can implement your code for modified cells
IF ls_mod_cells-value >=5.
CALL METHOD er_data_changed->add_protocol_entry
EXPORTING
i_msgid = 'SABAPDOCU'
i_msgty = 'E'
i_msgno = '888'
i_msgv1 = 'Only numbers below 5 are possibe'
i_msgv2 = 'Please correct'
i_fieldname = ls_mod_cells-fieldname
i_row_id = ls_mod_cells-row_id.
CALL METHOD er_data_changed->modify_cell
EXPORTING
i_fieldname = ls_mod_cells-fieldname
i_row_id = ls_mod_cells-row_id
i_value = space.
ENDIF.
ENDLOOP.
ENDMETHOD. "handle_data_changed
This approach works fine for picking value from input help. Never tried it for dropdown list. You have to try it out.
Regards
Marcin -
Pls help me this is an urgent requirement on ALV GRID
Hi all
Here i am sendig my requirement pls help me on coding ..
Report Assignment For ELTPs:
Selection criteria :
Circle id : Select option without interval and mandatory
SPR Id : Select option without interval
Project Status : Parameter
Output required in ALV Grid format with the below structure :
cProjects ID SPR ID Project Name Circle ID Circle Description Delegation Status No. of CU Projects CU-PO Share FLCB FLCB
NAME FLCL ID FLCL Name FLCL Email ID
1232007
1230
ABCD No 0
1242007
1240
ABCD Partial 2
1112007
1241
XYZ
2222007
1242
WXY
1252007
1250
EFGH Full 1
3332007
1251
DEF
Requirement :
1. The report should list all the CFU projects and the corresponding CU projects circle wise based on the circles entered on the selection screen and which have the SPR ids and Project status on the selection screen.
2. If SPR id or Project status is not entered then all the projects to be considered for the given circle/s.
3. It should display the details of the CFU project first. The corresponding CU projects should be listed below that CFU project in the successive rows.
4. For example, project 1232007 is a CFU project which does not have any CU under it. Hence, another CFU project 1242007 is displayed in the second row. It has 2 CU projects under it. The details of those two CU projects are displayed in the 3rd and 4th rows.
5. Total share given to the CU circle (by adding different PO shares to that circle in that project) by the CFU project should be displayed in the field CU-PO Share.
6. For CU projects, the fields Delegation Status, No. of CU projects and CU-PO share should be space.
7. FLCB, FLCL ID, FLCL name and FLCL email need to given for all the projects in all the rows.
Tables to be referred: ZSCP_PROJECT, ZSCP_CIRCLE_M, ZSCP_PJ_CL_PO_MP, ZSCP_PRJ_LINK, USR21,
ADR6, BUT000,CGPL_TEXT.
[<b>b]Here i done the coding the but the error showing that field catolog is not found..
pls check this and kindly send the code .....</b></b>
REPORT Z_64328_TEST .
TYPE-POOLS : SLIS.
TABLES : ZSCP_PROJECT,ZSCP_CIRCLE_M,ZSCP_PJ_CL_PO_MP,ZSCP_PRJ_LINK,
USR21,ADR6, BUT000.
SELECT-OPTIONS : S_CIRID FOR ZSCP_CIRCLE_M-CIRCLE_ID NO INTERVALS.
SELECT-OPTIONS : S_SPR_ID FOR ZSCP_PROJECT-SPR_PROJECT_ID NO INTERVALS.
PARAMETERS : P_STAT LIKE ZSCP_PROJECT-PRJ_STAT.
DATA : GS_LAYOUT1 TYPE SLIS_LAYOUT_ALV,
CT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
G_REPID TYPE SY-REPID,
TEMP_CAT1 TYPE SLIS_FIELDCAT_ALV,
HEADER_ALV1 TYPE SLIS_T_LISTHEADER,
HEADER_ALV_WA1 TYPE SLIS_LISTHEADER,
GT_SORT TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
DATA : SPRID TYPE ZSPR_PROJECT_ID.
DATA : CID TYPE ZCIRCLE_ID.
DATA : ITAB TYPE TABLE OF ZSCP_PROJECT.
DATA : WA TYPE ZSCP_PROJECT.
DATA : ITAB1 TYPE TABLE OF ZSCP_CIRCLE_M.
DATA : WA1 TYPE ZSCP_CIRCLE_M.
SELECT * FROM ZSCP_CIRCLE_M INTO TABLE ITAB1.
SELECT * FROM ZSCP_PROJECT INTO TABLE ITAB WHERE SPR_PROJECT_ID IN S_SPR_ID OR CIRCLE_ID IN S_CIRID.
LOOP AT ITAB INTO WA.
READ TABLE ITAB1 INTO WA1 WITH KEY CIRCLE_ID = WA-CIRCLE_ID.
WRITE : WA1-CIRCLE_DESC.
WRITE : WA-CIRCLE_ID,
WA-PROJECT_ID,
WA-DELEG_STAT,
WA-PRJ_STAT,
WA-FLCB,
WA-FLCL.
ENDLOOP.
*PERFORM FIELD_CATALOG1.
PERFORM alv_display1.
FORM FIELD_CATALOG1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'CIRCLE_ID'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'CIRCLEID'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'SPR_PROJECT_ID'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'CPROJECTID'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'CIRCLE_DESC'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'CIRCLEDESC'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'DELEG_STAT'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'DELGSTAT'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'PRJ_STAT'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'PROJSTAT'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'FLCB'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'FLCB1'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'FLCL'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'FLCL1'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
ENDFORM. "END CATALOG1.
FORM ALV_DISPLAY1.
CALL FUNCTION 'REUSE_ALV_GRID_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_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE1 '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = GS_LAYOUT1
IT_FIELDCAT = CT_FIELDCAT1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A '
TABLES
T_OUTTAB = ITAB
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.
Thanks and regards
Nagendra Kumarhi nagendra,
go through this code.
TYPE-POOLS : SLIS.
TABLES : ZSCP_PROJECT,ZSCP_CIRCLE_M,ZSCP_PJ_CL_PO_MP,ZSCP_PRJ_LINK,
USR21,ADR6, BUT000.
SELECT-OPTIONS : S_CIRID FOR ZSCP_CIRCLE_M-CIRCLE_ID NO INTERVALS.
SELECT-OPTIONS : S_SPR_ID FOR ZSCP_PROJECT-SPR_PROJECT_ID NO INTERVALS.
PARAMETERS : P_STAT LIKE ZSCP_PROJECT-PRJ_STAT.
DATA : GS_LAYOUT1 TYPE SLIS_LAYOUT_ALV,
CT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
G_REPID TYPE SY-REPID,
TEMP_CAT1 TYPE SLIS_FIELDCAT_ALV,
HEADER_ALV1 TYPE SLIS_T_LISTHEADER,
HEADER_ALV_WA1 TYPE SLIS_LISTHEADER,
GT_SORT TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
DATA : SPRID TYPE ZSPR_PROJECT_ID.
DATA : CID TYPE ZCIRCLE_ID.
DATA : ITAB TYPE TABLE OF ZSCP_PROJECT.
DATA : WA TYPE ZSCP_PROJECT.
DATA : ITAB1 TYPE TABLE OF ZSCP_CIRCLE_M.
DATA : WA1 TYPE ZSCP_CIRCLE_M.
SELECT * FROM ZSCP_CIRCLE_M INTO TABLE ITAB1.
SELECT * FROM ZSCP_PROJECT INTO TABLE ITAB WHERE SPR_PROJECT_ID IN S_SPR_ID OR CIRCLE_ID IN S_CIRID.
LOOP AT ITAB INTO WA.
READ TABLE ITAB1 INTO WA1 WITH KEY CIRCLE_ID = WA-CIRCLE_ID.
WRITE : WA1-CIRCLE_DESC.
WRITE : WA-CIRCLE_ID,
WA-PROJECT_ID,
WA-DELEG_STAT,
WA-PRJ_STAT,
WA-FLCB,
WA-FLCL.
ENDLOOP.
PERFORM FIELD_CATALOG1.
PERFORM alv_display1.
FORM FIELD_CATALOG1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'CIRCLE_ID'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'CIRCLEID'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'SPR_PROJECT_ID'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'CPROJECTID'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'CIRCLE_DESC'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'CIRCLEDESC'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'DELEG_STAT'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'DELGSTAT'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'PRJ_STAT'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'PROJSTAT'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'FLCB'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'FLCB1'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
CLEAR TEMP_CAT1.
TEMP_CAT1-TABNAME = 'ITAB'.
TEMP_CAT1-FIELDNAME = 'FLCL'.
TEMP_CAT1-KEY = 'X'.
TEMP_CAT1-SELTEXT_M = 'FLCL1'.
TEMP_CAT1-OUTPUTLEN = 10.
APPEND TEMP_CAT1 TO CT_FIELDCAT1.
ENDFORM. "END CATALOG1.
FORM ALV_DISPLAY1.
CALL FUNCTION 'REUSE_ALV_GRID_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_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE1 '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = GS_LAYOUT1
IT_FIELDCAT = CT_FIELDCAT1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A '
TABLES
T_OUTTAB = ITAB
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.
<b>please reward points if helpfull.</b>
with regards,
radhika kolluru. -
How to use this USER_COMMAND and ALV grid
hi all,
I have requirement.
there are 2 radiobutton in selection screen.
when rad1 is clicked,
some plain report display with button 'SUM" at the application toolbar.
when i click this SUM button , ALV grid report opens
when rad2 is clicked,
ALV grid report opens directly without plain report.
my code:
start-of-selection
if rad1 = 'X"
write """"
at user-command.
case sy-ucomm.
..perform ALV_report.
endcase.
elseif rad2 = 'X"
perform ALV_report.
endif.
I am getting an error " Incorrect nesting: Before the statement "AT, the structure introduced by IF must be concluded by ENDIF"..
kindly help.
points will be rewarded
thanks in advanceHi Jayasree,
As AT User-Command is an event which cannot be used under some condition. Check this sample code.
START-OF-SELECTION.
Perform select_data.
AT USER-COMMAND.
IF l_rad1 EQ 'X'.
CASE sy-ucomm.
WHEN 'ENTR'. "Use your Fcode.
PERFORM alv_report.
ENDCASE.
ELSEIF l_rad2 EQ 'X'.
PERFORM ALV_report.
ENDIF.
Reqard if useful.
Regards,
Ramkumar.K -
Logic required for Sort in ALV
Hi All,
I am dowloding the ALV report layout in excel sheet thorough mailing functionality.
I want to implenemnt the dynamic sort. Here I am writing this.but i want the logic for below code.
CALL FUNCTION 'LT_DBDATA_READ_FROM_LTDX'
EXPORTING
I_TOOL = 'LT'
IS_VARKEY = W_VARKEY_EU
TABLES
T_DBFIELDCAT = IT_DBFIELDCAT_EU
T_DBSORTINFO = IT_DBSORTINFO
T_DBFILTER = IT_FILTER_LAYOUT
T_DBLAYOUT = IT_DB_LAYOUT.
LIT_DBSORTINFO[] = IT_DBSORTINFO[].
SORT LIT_DBSORTINFO[] BY KEY1.
DELETE ADJACENT DUPLICATES FROM LIT_DBSORTINFO[] COMPARING KEY1.
LOOP AT LIT_DBSORTINFO[].
CLEAR: LW_SPOS,
LW_UP,
LW_DOWN,
LW_SUBTOT,
LW_COMP,
LW_EXPA,
LW_GROUP.
CLEAR IT_DBSORTINFO[].
READ TABLE IT_DBSORTINFO WITH KEY
KEY1 = LIT_DBSORTINFO-KEY1
PARAM = 'SPOS'.
IF SY-SUBRC = 0.
LW_SPOS = IT_DBSORTINFO-VALUE.
ENDIF.
CLEAR IT_DBSORTINFO.
READ TABLE IT_DBSORTINFO WITH KEY
KEY1 = LIT_DBSORTINFO-KEY1
PARAM = 'UP'.
IF SY-SUBRC = 0.
LW_UP = IT_DBSORTINFO-VALUE.
ENDIF.
CLEAR IT_DBSORTINFO.
READ TABLE IT_DBSORTINFO WITH KEY
KEY1 = LIT_DBSORTINFO-KEY1
PARAM = 'DOWN'.
IF SY-SUBRC = 0.
LW_DOWN = IT_DBSORTINFO-VALUE.
ENDIF.
CLEAR IT_DBSORTINFO.
READ TABLE IT_DBSORTINFO WITH KEY
KEY1 = LIT_DBSORTINFO-KEY1
PARAM = 'SUBTOT'.
IF SY-SUBRC = 0.
LW_SUBTOT = IT_DBSORTINFO-VALUE.
ENDIF.
CLEAR IT_DBSORTINFO.
READ TABLE IT_DBSORTINFO WITH KEY
KEY1 = LIT_DBSORTINFO-KEY1
PARAM = 'COMP'.
IF SY-SUBRC = 0.
LW_COMP = IT_DBSORTINFO-VALUE.
ENDIF.
CLEAR IT_DBSORTINFO.
READ TABLE IT_DBSORTINFO WITH KEY
KEY1 = LIT_DBSORTINFO-KEY1
PARAM = 'EXPA'.
IF SY-SUBRC = 0.
LW_EXPA = IT_DBSORTINFO-VALUE.
ENDIF.
CLEAR IT_DBSORTINFO.
READ TABLE IT_DBSORTINFO WITH KEY
KEY1 = LIT_DBSORTINFO-KEY1
PARAM = 'GROUP'.
IF SY-SUBRC = 0.
LW_GROUP = IT_DBSORTINFO-VALUE.
ENDIF.
LOOP AT IT_ALV_DATA FROM W_LOOP_FROM_EU TO W_LOOP_TO_EU.
LW_TABIX = SY-TABIX.
READ TABLE IT_FIELDCAT INTO LW_FIELDCAT WITH KEY
FIELDNAME = LIT_DBSORTINFO-KEY1.
IF SY-SUBRC = 0.
ASSIGN COMPONENT SY-TABIX OF
STRUCTURE IT_ALV_DATA TO <LFS>.
IF SY-SUBRC = 0.
CLEAR LW_CHAR.
LW_CHAR = <LFS>.
IF LW_SPOS= 'SPOS'.
LOGIC Required
ENDIF.
ELSEIF LW_OPTION = 'DOWN'.
LOgic required
ENDIF.
ENDIF.
ENDLOOP.
ENDLOOP.
regards,
Ajay reddyHai,
Let
1)general data
2)all customers
3)company code data
4)sales organization data
are the check box names,Then
Just use the piece of code below:
<b>IF general data = 'X'.
COUNT = COUNT + 1.
ENDIF.
IF all_customers = 'X'.
COUNT = COUNT + 1.
ENDIF.
IF company_code_data = 'X'.
COUNT = COUNT + 1.
ENDIF.
IF sales_organization_data = 'X'.
COUNT = COUNT + 1.
ENDIF.</b>
Now check whether more than one Check Boxes are selected or not
<b>IF COUNT GT 1.
"* Do the oprations what ever you want here
ENDIF.</b>
<b>Reward points if it helps you.</b>
Regds,
Rama chary.Pammi -
Require some tutorials to use ALV grids to access database
I am new to ALV grids
I want step by step method to use ALV grids in ABAP reports to access database.Hi,
pls go throgugh this link.
http://www.erpgenie.com/abap/controls/alvgrid.htm
sample program
Sample programs on ALV Grid
report zbnstest.
TABLES AND DATA DECLARATION.
*TABLES: mara,makt.",marc.
data syrepid like sy-repid.
data sydatum(10). " LIKE sy-datum.
data sypagno(3) type n.
WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE
GROUP (TYPE-POOLS--------->SLIS)
type-pools : slis.
INTERNAL TABLE DECLARATION.
INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE
data: begin of t_mara occurs 0,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
matkl like mara-matkl,
end of t_mara.
INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE
data : begin of t_marc occurs 0,
matnr like mara-matnr,
werks like marc-werks,
minbe like marc-minbe.
data: end of t_marc.
INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE.
data : begin of t_makt occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
spras like makt-spras,
end of t_makt.
INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES.
data: begin of itab1 occurs 0,
matnr like mara-matnr,
meins like mara-meins,
maktx like makt-maktx,
spras like makt-spras,
werks like marc-werks,
minbe like marc-minbe,
end of itab1.
THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT
AND THE LAYOUT FOR THE ALV.
HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE
WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT
OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION.
THIS IS DONE TO MAKE THE CODE SIMPLER.
OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP
PROGRAMS.
IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR
MORE TABLES AND CREATE A STRUCTURE
IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS
LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC.
data: fieldcatalog type slis_t_fieldcat_alv with header line,
fieldlayout type slis_layout_alv.
DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE
TOP-OF-PAGE ETC.
data : eventstab type slis_t_event with header line.
DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE
data : heading type slis_t_listheader with header line.
data : heading1 type slis_t_listheader with header line.
data : heading2 type slis_t_listheader with header line.
data : heading3 type slis_t_listheader with header line.
data : heading4 type slis_t_listheader with header line.
data : heading5 type slis_t_listheader with header line.
data : heading6 type slis_t_listheader with header line.
data : heading7 type slis_t_listheader with header line.
data : heading8 type slis_t_listheader with header line.
STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY.
data : colorstruct type slis_coltypes.
INITIALIZATION. *
initialization.
syrepid = sy-repid.
sypagno = sy-pagno.
clear fieldcatalog.
START-OF-SELECTION. *
start-of-selection.
SUBROUTINE TO POPULATE THE COLORSTRUCT
perform fill_colorstruct using colorstruct.
SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE
perform populate_fieldcatalog.
SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE
INTERNAL TABLE.
perform selectdata_and_sort.
SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE.
perform populate_layout using fieldlayout.
SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
perform merge_fieldcatalog.
SUBROUTINE TO POPULATE THE EVENTSTAB.
perform fill_eventstab tables eventstab.
SUBROUTINE TO POPULATE THE HEADING TABLES.
perform fill_headingtable tables heading using 'HEADING'.
perform fill_headingtable tables heading1 using 'HEADING1'.
perform fill_headingtable tables heading2 using 'HEADING2'.
perform fill_headingtable tables heading3 using 'HEADING3'.
perform fill_headingtable tables heading4 using 'HEADING4'.
perform fill_headingtable tables heading5 using 'HEADING5'.
perform fill_headingtable tables heading6 using 'HEADING6'.
perform fill_headingtable tables heading7 using 'HEADING7'.
perform fill_headingtable tables heading8 using 'HEADING8'.
SUBROUTINE TO DISPLAY THE LIST.
perform display_alv_list.
FORMS
IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES
OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND
COLUMN JUSTIFICATION.
form populate_fieldcatalog.
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MATNR' 'X' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MEINS' ' '.
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MAKTX' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MTART' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MATKL' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'SPRAS' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'WERKS' ' ' .
perform fill_fields_of_fieldcatalog tables fieldcatalog
using 'ITAB1' 'MINBE' ' ' .
endform. " POPULATE_FIELDCATALOG
FORM FILL_FIELDS_OF_FIELDCATALOG *
--> FIELDCATALOG *
--> P_TABNAME *
--> P_FIELDNAME *
--> P_KEY *
--> P_KEY *
form fill_fields_of_fieldcatalog tables fieldcatalog
structure fieldcatalog
using p_tabname
p_fieldname
p_key.
p_no_out.
fieldcatalog-tabname = p_tabname.
fieldcatalog-fieldname = p_fieldname.
fieldcatalog-key = p_key.
fieldcatalog-emphasize = '1234'.
*fieldcatalog-no_out = p_no_out.
append fieldcatalog.
endform. " FILL_FIELDSOFFIELDCATALOG
FORM POPULATE_LAYOUT *
--> FIELDLAYOUT *
form populate_layout using fieldlayout type slis_layout_alv.
fieldlayout-f2code = '&ETA' .
fieldlayout-zebra = 'X'.
FOR THE WINDOW TITLE.
fieldlayout-window_titlebar = 'ALV with Events'.
fieldlayout-colwidth_optimize = 'X'.
fieldlayout-no_vline = ' '.
*fieldlayout-no_input = 'X'.
fieldlayout-confirmation_prompt = ''.
fieldlayout-key_hotspot = 'X'.
This removes the column headings if the flag is set to 'X'
fieldlayout-no_colhead = ' '.
*fieldlayout-hotspot_fieldname = 'MAKTX'.
fieldlayout-detail_popup = 'X'.
fieldlayout-coltab_fieldname = 'X'.
endform. " POPULATE_LAYOUT
FORM SELECTDATA_AND_SORT *
form selectdata_and_sort.
select matnr meins mtart matkl from mara
into corresponding fields of t_mara
up to 500 rows .
select matnr maktx spras from makt
into corresponding fields of t_makt
where matnr = t_mara-matnr and
spras = sy-langu.
select matnr werks minbe from marc
into corresponding fields of t_marc
where matnr = t_mara-matnr.
append t_marc.
endselect.
append t_makt.
endselect.
append t_mara.
endselect.
perform populate_itab1.
sort itab1 by matnr.
endform. " SELECTDATA_AND_SORT
FORM MERGE_FIELDCATALOG *
form merge_fieldcatalog.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = syrepid
i_internal_tabname = 'ITAB1'
i_structure_name = 'COLORSTRUCT'
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = syrepid
changing
ct_fieldcat = fieldcatalog[]
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
endform. " MERGE_FIELDCATALOG
IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS
FOLLOWS:-
i_callback_program --> CALLING PROGRAM NAME
i_structure_name --> STRUCTURE NAME.
is_layout --> LAYOUT NAME.
it_fieldcat ---> BODY OF THE FIELD CATALOGUE INTERNAL TABLE
form display_alv_list.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
i_callback_program = syrepid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_structure_name = 'ITAB1'
is_layout = fieldlayout
it_fieldcat = fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD
TOOL BAR
i_save = 'A'
IS_VARIANT = ' '
it_events = eventstab[]
IT_EVENT_EXIT =
IS_PRINT =
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. " DISPLAY_ALV_LIST
*& Form POPULATE_ITAB1
text
--> p1 text
<-- p2 text
form populate_itab1.
loop at t_mara.
loop at t_makt where matnr = t_mara-matnr.
loop at t_marc where matnr = t_mara-matnr.
move-corresponding t_mara to itab1.
move-corresponding t_makt to itab1.
move-corresponding t_marc to itab1.
append itab1.
endloop.
endloop.
endloop.
endform. " POPULATE_ITAB1
*& Form FILL_EVENTSTAB
text
-->P_EVENTSTAB text *
form fill_eventstab tables p_eventstab structure eventstab.
WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE
INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME.
AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14
EVENTS NAME.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_eventstab[]
exceptions
list_type_wrong = 1
others = 2.
BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH
THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW.
WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER.
FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM
IS DYNAMICALY CALLED.
read table p_eventstab with key name = slis_ev_top_of_page.
if sy-subrc = 0 .
move 'TOP_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_top_of_coverpage.
if sy-subrc = 0 .
move 'TOP_OF_COVERPAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_coverpage .
if sy-subrc = 0 .
move 'END_OF_COVERPAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_foreign_top_of_page.
if sy-subrc = 0 .
move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_foreign_end_of_page.
if sy-subrc = 0 .
move 'FOREIGN_END_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_list_modify.
if sy-subrc = 0 .
move 'LIST_MODIFY' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_top_of_list.
if sy-subrc = 0 .
move 'TOP_OF_LIST' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_page.
if sy-subrc = 0 .
move 'END_OF_PAGE' to p_eventstab-form.
append p_eventstab.
endif.
read table p_eventstab with key name = slis_ev_end_of_list .
if sy-subrc = 0 .
move 'END_OF_LIST' to p_eventstab-form.
append p_eventstab.
endif.
endform. " FILL_EVENTSTAB
*& Form FILL_HEADINGTABLE
text
-->P_HEADING text *
form fill_headingtable tables p_heading structure heading
using tablename.
case tablename.
when 'HEADING'.
p_heading-typ = 'H'.
concatenate
' REPORT NAME:-' syrepid
' ABB Industry Pte Ltd' into p_heading-info.
append p_heading.
write sy-datum using edit mask '__/__/____' to sydatum.
concatenate
' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno
into p_heading-info.
append p_heading.
when 'HEADING1'.
p_heading-typ = 'H'.
p_heading-info = 'TOP-OF-COVER-PAGE'.
append p_heading.
when 'HEADING2'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-COVER-PAGE'.
append p_heading.
when 'HEADING3'.
p_heading-typ = 'H'.
p_heading-info = 'FOREIGN-TOP-OF-PAGE'.
append p_heading.
when 'HEADING4'.
p_heading-typ = 'H'.
p_heading-info = 'FOREIGN-END-OF-PAGE'.
append p_heading.
WHEN 'HEADING5'.
P_HEADING-TYP = 'H'.
P_HEADING-INFO = 'LIST-MODIFY'.
APPEND P_HEADING.
when 'HEADING6'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-PAGE'.
append p_heading.
when 'HEADING7'.
p_heading-typ = 'H'.
p_heading-info = 'END-OF-LIST'.
append p_heading.
when 'HEADING8'.
p_heading-typ = 'H'.
p_heading-info = 'TOP-OF-LIST'.
append p_heading.
endcase.
endform. " FILL_HEADINGTABLE
FORM TOP_OF_PAGE *
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading[]
exceptions
others = 1.
endform.
*& Form FILL_COLORSTRUCT
text
-->P_COLORSTRUCT text *
form fill_colorstruct using p_colorstruct type slis_coltypes .
p_colorstruct-heacolfir-col = 6.
p_colorstruct-heacolfir-int = 1.
p_colorstruct-heacolfir-inv = 1.
endform. " FILL_COLORSTRUCT
FORM TOP_OF_COVERPAGE *
form top_of_coverpage.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading1[]
exceptions
others = 1.
endform.
FORM END_OF_COVERPAGE *
form end_of_coverpage.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading2[]
exceptions
others = 1.
endform.
FORM FOREIGN_TOP_OF_PAGE *
form foreign_top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading3[]
exceptions
others = 1.
endform.
FORM FOREIGN_END_OF_PAGE *
form foreign_end_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading4[]
exceptions
others = 1.
endform.
FORM LIST_MODIFY *
*FORM LIST_MODIFY.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEADING5[]
EXCEPTIONS
OTHERS = 1.
*ENDFORM.
FORM END_OF_PAGE *
form end_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading6[]
exceptions
others = 1.
endform.
FORM END_OF_LIST *
form end_of_list.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading7[]
exceptions
others = 1.
endform.
FORM TOP_OF_LIST *
form top_of_list.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = heading8[]
exceptions
others = 1.
endform.
*--- End of Program
Thanks,
Shankar
Maybe you are looking for
-
Multiple DB env with different explain plan
Hi, I have DEV DB and QA DB , both located in USA. There is a table called Customer which contains the respective index , pk, constraints, etc which is available in both the environments. Now In DEV DB we have Customer table with 1000 records, but in
-
XML Transformation while pushing data
I can get an XML file that contains a structure like <order> <onumber>12345</onumber> <customer> <name>Miller</name> <street>XY Street</street> <city>Bristol</city> </customer> <object> <orderno>12345678</orderno> <quant>5</
-
Sales order smartform:Urgent
Hi Can anyone please mail me the preconfigured sales order confirmatiopn sales ordere. we dont have the preconfigured in our server and its urgent. This is my id: [email protected] Thanks in Advance, Srihari.
-
I have been having issues with the iMac and so decided to Erase/Install from scratch after first carrying out a Time Machine backup (which I checked had worked) Once installed I tried to mount the USB drive and it didn't show. I checked all the usual
-
Why can't I use SIRI and dictation on my iPad2 with release 6.1?
Why is SIRI and dictation not available on Ipad2? I have the latest release of IOS 6.1.