RE: ALV DISPALY
Hi All,
I have a alv display which has SAVE and EDIT button in ouput pf-satus edit button is clicked and then i get second alv display which has two fields in editable mode when these two field are edited i get third alv dispaly which is called by clicking the SAVE button that has updated field values which were chaged earlier now whenever i press a back button and go back to editable alv dispaly and chnage the values and come to third alv dispaly the row gets appended to eariler row but i want that whenever a change is made and saved i should get a fresh alv dispaly.
Please help,
Satisfactory answers will be highly rewarded.
Thanks,
Naveen
to check the values changed on screen or not use the variable SY-DATAR ,
IF SY-DATAR eq 'X'.
* then only append the value
endif.
Similar Messages
-
How to color a line in ALV Dispaly
Hi Abaper,
As of my requirement i want to display output of the report for certain lines in a color iam using ALV method,
Plz help me ASAP
answer will be reward.
Thanks in advance
hemaHi Hema..
this is The code for Applying the colors For Lines or Cells also..
report yacpr0007.
This must be included in order to create the fieldcatalog.
type-pools: slis.
parameters: p_dummy type c.
types: begin of ty_data,
select type c,
f1 type i,
f2 type i,
f3 type i,
color_line(4) type c, " Line color
color_cell type lvc_t_scol, " Cell color
end of ty_data.
constants: c_true type boolean_flg value 'X',
c_false type boolean_flg value space.
data: i_data type table of ty_data,
i_field_cat type slis_t_fieldcat_alv,
s_layout type slis_layout_alv.
start-of-selection.
perform f_create_field_cat.
perform f_set_layout.
perform f_create_data.
end-of-selection.
perform f_display_grid.
*& @FORMS
*& Form f_create_data
Create some sample data.
form f_create_data.
data: lw_data type ty_data,
lw_color_cell like line of lw_data-color_cell.
do 15 times.
clear lw_data.
lw_data-f1 = sy-index.
case sy-index.
when 3.
**/ Set the row or cell to color
lw_data-color_line = 'C410'.
when 8.
lw_color_cell-color-col = 6.
lw_color_cell-fname = 'F1'.
append lw_color_cell to lw_data-color_cell. "/ .
endcase.
lw_data-f2 = sy-index * 2.
lw_data-f3 = lw_data-f1 + lw_data-f2.
append lw_data to i_data.
enddo.
endform. "f_create_data
*& Form f_create_field_cat
Create the fieldcatalog. This needs to contain a minimum of
the names of the fields you wish to display. However there are
numerous other things which can be added such as position, colour etc.
form f_create_field_cat.
**/ Add data to the field catalog
perform f_append_row using: 'F1' 'field one' 3,
'F2' 'field two' 2,
'F3' 'field three' 1. "/ .
endform. "f_create_field_cat
*& Form f_append_row
Append a single row to the field catalog.
-->L_NAME The name of the field to be added.
-->L_DESC The description for the column heading.
-->L_POS The column number for the field.
form f_append_row using pv_name pv_desc pv_pos.
data: lw_field_cat like line of i_field_cat.
**/ Append the field catalog record.
lw_field_cat-fieldname = pv_name.
lw_field_cat-seltext_l = pv_desc.
lw_field_cat-col_pos = pv_pos.
append lw_field_cat to i_field_cat. "/ .
endform. "f_append_row
*& Form f_set_layout
Set the layout including the field names used to indicate the
cells or rows should be coloured.
form f_set_layout.
s_layout-colwidth_optimize = space.
s_layout-no_colhead = space.
s_layout-zebra = space.
s_layout-no_vline = space.
**/ Field that identify color line in internal table
s_layout-info_fieldname = 'COLOR_LINE'.
Field that identify cell color in inetrnal table
s_layout-coltab_fieldname = 'COLOR_CELL'. "/ .
endform. "f_create_layout
*& Form f_display_grid
Call the function to display the grid.
form f_display_grid.
**/ You need to pass in a minimum of the fieldcatalog and the table of data
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
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 =
I_GRID_SETTINGS =
is_layout = s_layout
**/ the field catalog. Tells SAP what to display
it_fieldcat = i_field_cat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
**/ The table of data and exceptions
tables
t_outtab = i_data
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. "f_display_grid
<b>reward if Helpful</b> -
Problem related to ALV dispaly
Hi Gurus,
Actually i need to display records in ALV and i am using
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat[]
TABLES
t_outtab = lt_zca_serv_techlog
but since my internal table will be carrying millions of records so it will fail in production.
I am taking all these records from a databas table. Please tell me the solution so that i can display all the records without the table failing.
Regards,
Nikesh KumarYou can add code to allow the ALV to be run in background. That way if you have a background job for your program, your ALV results will be written to the spool in the classic format.
* Grid definitions
DATA: gr_alv TYPE REF TO cl_gui_alv_grid,
g_container TYPE REF TO cl_gui_custom_container.
* Background container
DATA: g_dock TYPE REF TO cl_gui_docking_container.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
* Create custom container instance
CREATE OBJECT g_container
EXPORTING
container_name = 'G_CONTAINER'.
* Create ALV instance whole screen
CREATE OBJECT gr_alv
EXPORTING
i_parent = g_container.
ELSE.
* Create ALV instance for totals in background
CREATE OBJECT gr_alv
EXPORTING i_parent = g_dock.
ENDIF.
* Call grid for first time
CALL METHOD gr_alv->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = gt_exclude
CHANGING
it_outtab = gt_report
it_fieldcatalog = gt_fieldcat
it_sort = gt_sort.
Give it a try,
Regards
Larissa Maryniuk -
Problem in alv dispaly filedcat-edit
Dear,
i am using filedcat-edit to change the output of alv display but after changing the quantity and when i pressing save button it is converting quantity 8.000 to 0.008 . kindly help me.
thannk u,Dear,
data : inv_qty type menge .
IS_FIELDCAT-COL_POS = V_COL_POS .
IS_FIELDCAT-FIELDNAME = P_FLD .
IS_FIELDCAT-TABNAME = P_TABLE .
IS_FIELDCAT-SELTEXT_L = P_SEL_TEXT.
IS_FIELDCAT-edit = 'X'.
is_fieldcat-input = 'X'.
if p_fld = 'INV_QTY' .
is_fieldcat-decimals_out = 3.
endif
in output it is showing 8.000 and if i change to 5.000 and after saving it is giving 0.005 .
thanking u. -
Data : Begin of it_data,
kunnr type kunnr,
name1 type name1,
amt1 type btrt01, " CURR 15,2
end of it_data.
loop at it_data into wa_data
endloop.
Hello friends,
I am developing one ALV report with 20 rows.
I have filled one internal table with some fileds like amount.
I want to get total of all amount1 in AMT1 field.
So, How to get total of amount in same internal table in ALV report ?
It is ok if i get duplicate rows in internal table.
note : i need not data in field catlog
Points 'll be awarded soon.
Regards,Hai,
While Defining Field Catalog,Specify do_sum = 'X' for the field which you want the Total.Before that u have to sort that Values.
JUST CHECK THIS SAMPLE PROG
TABLES : STKO,STPO,MAKT,MAST.
TYPE-POOLS : SLIS.
DATA : BEGIN OF ISTKO OCCURS 0,
STLNR LIKE STKO-STLNR,
DATUV LIKE STKO-DATUV,
MATNR LIKE MAST-MATNR,
BMENG LIKE STKO-BMENG,
BMEIN LIKE STKO-BMEIN,
END OF ISTKO.
DATA : BEGIN OF ISTPO OCCURS 0,
STLNR LIKE STPO-STLNR,
IDNRK LIKE STPO-IDNRK,
MENGE LIKE STPO-MENGE,
MEINS LIKE STPO-MEINS,
MAKTX LIKE MAKT-MAKTX,
END OF ISTPO.
DATA : BEGIN OF IMAKT OCCURS 0,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
END OF IMAKT.
DATA : BEGIN OF IMAST OCCURS 0,
MATNR LIKE MAST-MATNR,
STLNR LIKE MAST-STLNR,
END OF IMAST.
DATA : IFIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WFIELDCAT TYPE SLIS_FIELDCAT_ALV,
ILAYOUT TYPE SLIS_LAYOUT_ALV,
IKEYINFO TYPE SLIS_KEYINFO_ALV,
IEVENT TYPE SLIS_T_EVENT,
WEVENT TYPE SLIS_ALV_EVENT,
ISORT TYPE SLIS_T_SORTINFO_ALV,
WSORT TYPE SLIS_SORTINFO_ALV.
PARAMETERS : P_NUM TYPE I DEFAULT 10.
START-OF-SELECTION.
PERFORM GETDATA.
PERFORM GETHEADERMAT.
PERFORM GET_MAT_DESC.
PERFORM BUILD_FCAT_HEAD.
PERFORM BUILD_FCAT_ITEM.
PERFORM BUILD_KEYINFO.
PERFORM BUILD_EVENT_TAB.
PERFORM BUILD_SORT_TAB.
PERFORM BUILD_LAYOUT.
PERFORM DISPLAY_DATA.
*& Form GETDATA
text
--> p1 text
<-- p2 text
FORM GETDATA .
SELECT STLNR DATUV BMENG BMEIN INTO CORRESPONDING FIELDS OF TABLE ISTKO
FROM STKO UP TO P_NUM ROWS.
IF NOT ISTKO[] IS INITIAL.
SELECT STLNR IDNRK MENGE MEINS INTO TABLE ISTPO FROM STPO FOR ALL ENTRIES IN ISTKO
WHERE STLNR = ISTKO-STLNR AND POSTP = 'L'.
ENDIF.
ENDFORM. " GETDATA
*& Form BUILD_FCAT_HEAD
text
--> p1 text
<-- p2 text
FORM BUILD_FCAT_HEAD .
WFIELDCAT-TABNAME = 'ISTKO'.
WFIELDCAT-FIELDNAME = 'STLNR'.
WFIELDCAT-SELTEXT_L = 'BOM no'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTKO'.
WFIELDCAT-FIELDNAME = 'DATUV'.
WFIELDCAT-SELTEXT_L = 'BOM date'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTKO'.
WFIELDCAT-FIELDNAME = 'MATNR'.
WFIELDCAT-SELTEXT_L = 'Header mat no'.
WFIELDCAT-OUTPUTLEN = 18.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTKO'.
WFIELDCAT-FIELDNAME = 'BMENG'.
WFIELDCAT-SELTEXT_L = 'Base qty'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTKO'.
WFIELDCAT-FIELDNAME = 'BMEIN'.
WFIELDCAT-SELTEXT_L = 'UOM'.
WFIELDCAT-OUTPUTLEN = 3.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
ENDFORM. " BUILD_FCAT_HEAD
*& Form BUILD_FCAT_ITEM
text
--> p1 text
<-- p2 text
FORM BUILD_FCAT_ITEM .
WFIELDCAT-TABNAME = 'ISTPO'.
WFIELDCAT-FIELDNAME = 'STLNR'.
WFIELDCAT-SELTEXT_L = 'BOM no'.
WFIELDCAT-NO_OUT = 'X'.
*WFIELDCAT-HOTSPOT = 'X'.
WFIELDCAT-OUTPUTLEN = 10.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTPO'.
WFIELDCAT-FIELDNAME = 'IDNRK'.
WFIELDCAT-SELTEXT_L = 'Material no'.
*WFIELDCAT-HOTSPOT = 'X'.
WFIELDCAT-OUTPUTLEN = 18.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTPO'.
WFIELDCAT-FIELDNAME = 'MAKTX'.
WFIELDCAT-SELTEXT_L = 'Material desc'.
WFIELDCAT-JUST = 'C'.
WFIELDCAT-OUTPUTLEN = 30.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTPO'.
WFIELDCAT-FIELDNAME = 'MENGE'.
WFIELDCAT-SELTEXT_L = 'Item qty'.
WFIELDCAT-OUTPUTLEN = 15.
WFIELDCAT-DO_SUM = 'X'.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTPO'.
WFIELDCAT-FIELDNAME = 'MEINS'.
WFIELDCAT-SELTEXT_L = 'UOM'.
WFIELDCAT-OUTPUTLEN = 3.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
ENDFORM. " BUILD_FCAT_ITEM
*& Form BUILD_KEYINFO
text
--> p1 text
<-- p2 text
FORM BUILD_KEYINFO .
IKEYINFO-HEADER01 = 'STLNR'.
IKEYINFO-ITEM01 = 'STLNR'.
ENDFORM. " BUILD_KEYINFO
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
FORM DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COM'
IS_LAYOUT = ILAYOUT
IT_FIELDCAT = IFIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = ISORT
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IEVENT[]
IT_EVENT_EXIT =
I_TABNAME_HEADER = 'ISTKO'
I_TABNAME_ITEM = 'ISTPO'
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
IS_KEYINFO = IKEYINFO
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB_HEADER = ISTKO
T_OUTTAB_ITEM = ISTPO
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_DATA
*& Form GET_MAT_DESC
text
--> p1 text
<-- p2 text
FORM GET_MAT_DESC .
IF NOT ISTPO[] IS INITIAL.
SELECT MATNR MAKTX INTO TABLE IMAKT FROM MAKT FOR ALL ENTRIES IN ISTPO
WHERE MATNR = ISTPO-IDNRK.
ENDIF.
LOOP AT ISTPO.
READ TABLE IMAKT WITH KEY MATNR = ISTPO-IDNRK.
IF SY-SUBRC = 0.
ISTPO-MAKTX = IMAKT-MAKTX.
ENDIF.
MODIFY ISTPO.
ENDLOOP.
ENDFORM. " GET_MAT_DESC
*& Form BUILD_LAYOUT
text
--> p1 text
<-- p2 text
FORM BUILD_LAYOUT .
ILAYOUT-ZEBRA = 'X'.
ILAYOUT-COLWIDTH_OPTIMIZE = 'X'.
ENDFORM. " BUILD_LAYOUT
*FORM USER_COM USING PUCOM LIKE SY-UCOMM PSELFIELD TYPE SLIS_SELFIELD.
*CASE PUCOM.
*WHEN '&IC1'.
SET PARAMETER ID 'MAT' FIELD PSELFIELD-VALUE.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
*ENDCASE.
*ENDFORM.
*& Form BUILD_EVENT_TAB
text
--> p1 text
<-- p2 text
FORM BUILD_EVENT_TAB .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IEVENT
EXCEPTIONS
LIST_TYPE_WRONG = 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.
READ TABLE IEVENT INTO WEVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC = 0.
WEVENT-FORM = 'TOPOFPAGE'.
MODIFY IEVENT FROM WEVENT INDEX SY-TABIX.
ENDIF.
ENDFORM. " BUILD_EVENT_TAB
*& Form TOPOFPAGE
text
FORM TOPOFPAGE.
DATA : ILISTHEAD TYPE SLIS_T_LISTHEADER,
WLISTHEAD TYPE SLIS_LISTHEADER.
WLISTHEAD-INFO = 'Its a test hierarchical sequential alv dispaly'.
WLISTHEAD-TYP = 'H'.
APPEND WLISTHEAD TO ILISTHEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = ILISTHEAD
I_LOGO = ''
I_END_OF_LIST_GRID =
ENDFORM.
*& Form GETHEADERMAT
text
--> p1 text
<-- p2 text
FORM GETHEADERMAT .
IF NOT ISTKO[] IS INITIAL.
SELECT MATNR STLNR INTO TABLE IMAST FROM MAST FOR ALL ENTRIES IN ISTKO
WHERE STLNR = ISTKO-STLNR.
ENDIF.
LOOP AT ISTKO.
READ TABLE IMAST WITH KEY STLNR = ISTKO-STLNR.
IF SY-SUBRC = 0.
ISTKO-MATNR = IMAST-MATNR.
ENDIF.
MODIFY ISTKO.
ENDLOOP.
ENDFORM. " GETHEADERMAT
*& Form BUILD_SORT_TAB
text
--> p1 text
<-- p2 text
FORM BUILD_SORT_TAB .
WSORT-FIELDNAME = 'STLNR'.
WSORT-TABNAME = 'ISTPO'.
WSORT-UP = 'X'.
WSORT-SUBTOT = 'X'.
WSORT-GROUP = 'UL'.
APPEND WSORT TO ISORT.
ENDFORM. " BUILD_SORT_TAB -
How to hide Print and Filter option from dynamic ALV
Hi,
I have created the dynamic ALV. now User don't wan't Filter , export,print Option on the ALV dispaly.
Could you please tell me How to hide Print and Filter option from dynamic ALV.
Thanks and regards
Amita.Hi,
Please go through the following link to get an better idea on ALV.
[https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9&overridelayout=true]
This is the code which you have to write in WDDOINIT
DATA LO_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.
LO_CMP_USAGE = WD_THIS->WD_CPUSE_ALV_TEST( ).
IF LO_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
LO_CMP_USAGE->CREATE_COMPONENT( ).
ENDIF.
DATA LO_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
LO_INTERFACECONTROLLER = WD_THIS->WD_CPIFC_ALV_TEST( ).
DATA LO_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
LO_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
lo_value->IF_SALV_WD_STD_FUNCTIONS~SET_EXPORT_ALLOWED( abap_false ).
lo_value->IF_SALV_WD_STD_FUNCTIONS~SET_PDF_ALLOWED( abap_false ).
lo_value->IF_SALV_WD_STD_FUNCTIONS~SET_VIEW_LIST_ALLOWED( abap_false ). -
How to adjust ALV size in ITS application? Please Help!
Hi Experts,
I have a ABAP program that shows a ALV report using function module - REUSE_ALV_GRID_DISPLAY.
This ABAP program I have web enabled using ITS (SICF transaction).
When I see the ALV on the browser, It has only 10 rows but still vertical and horizontal scrollbars are dislayed for the ALV itself. Moreover the horizontal scrollbar is shown near the browser status bar. So Unnecessarily blank space is shown in the ALV after 10 rows.
I have even tried ~ALVGRIDPAGESIZE = 10. But it has no affect. I am using SAP 6.20.
So how to control the scrolling and ALV dispaly size?
Please help!
Thanks
Gopalhi
good
go through these links, i hope these ll help you to solve your problem,
http://www7.sap.com/sweden/pdf/coursecatalog.pdf#search=%22ADJUST%20THE%20ALV%20SIZE%20IN%20INTERNET%20TRANSACTION%20SERVER%20APPLICATION%20%2C%20SAP%22
thanks
mrutyun^ -
How to obtain the alv reports in the dilog programing.
how to obtain the alv reports in the dialog programming, that is when the push button in the screen in clicked it must be directed to the report, where to write the code for the report.
Hi
Use LEAVE TO LIST PROCESSING and develop your normal ALV dispaly as usual. System automatically takes care of this.
I tried for normal report but try above even in the case of ALV reports
Cheerz
Ram -
REUSE_ALV_HIERSEQ_LIST_DISPLAY and new Page
Hi all,
I am using FM REUSE_ALV_HIERSEQ_LIST_DISPLAY to display ALV List. Now, i want to print a New page on every Header record , is it possible?if Yes, then how?
thanks in advance.Hi VIpin,
Please find the code and function module ..
*& Report Z8AS_PROGRAM_ALV
REPORT Z8AS_PROGRAM_ALV.
TABLES : STKO,STPO,MAKT,MAST.
TYPE-POOLS : SLIS.
DATA : BEGIN OF ISTKO OCCURS 0,
STLNR LIKE STKO-STLNR,
DATUV LIKE STKO-DATUV,
MATNR LIKE MAST-MATNR,
BMENG LIKE STKO-BMENG,
BMEIN LIKE STKO-BMEIN,
END OF ISTKO.
DATA : BEGIN OF ISTPO OCCURS 0,
STLNR LIKE STPO-STLNR,
IDNRK LIKE STPO-IDNRK,
MENGE LIKE STPO-MENGE,
MEINS LIKE STPO-MEINS,
MAKTX LIKE MAKT-MAKTX,
END OF ISTPO.
DATA : BEGIN OF IMAKT OCCURS 0,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
END OF IMAKT.
DATA : BEGIN OF IMAST OCCURS 0,
MATNR LIKE MAST-MATNR,
STLNR LIKE MAST-STLNR,
END OF IMAST.
DATA : IFIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WFIELDCAT TYPE SLIS_FIELDCAT_ALV,
ILAYOUT TYPE SLIS_LAYOUT_ALV,
IKEYINFO TYPE SLIS_KEYINFO_ALV,
IEVENT TYPE SLIS_T_EVENT,
WEVENT TYPE SLIS_ALV_EVENT.
PARAMETERS : P_NUM TYPE I .
START-OF-SELECTION.
PERFORM GETDATA.
PERFORM GETHEADERMAT.
PERFORM GET_MAT_DESC.
PERFORM BUILD_FCAT_HEAD.
PERFORM BUILD_FCAT_ITEM.
PERFORM BUILD_KEYINFO.
PERFORM BUILD_EVENT_TAB.
PERFORM BUILD_LAYOUT.
PERFORM DISPLAY_DATA.
*& Form GETDATA
text
--> p1 text
<-- p2 text
FORM GETDATA .
SELECT STLNR DATUV BMENG BMEIN INTO CORRESPONDING FIELDS OF TABLE ISTKO
FROM STKO UP TO P_NUM ROWS.
IF NOT ISTKO[] IS INITIAL.
SELECT STLNR IDNRK MENGE MEINS INTO TABLE ISTPO FROM STPO FOR ALL ENTRIES IN ISTKO
WHERE STLNR = ISTKO-STLNR AND POSTP = 'L'.
ENDIF.
ENDFORM. " GETDATA
*& Form BUILD_FCAT_HEAD
text
--> p1 text
<-- p2 text
FORM BUILD_FCAT_HEAD .
WFIELDCAT-TABNAME = 'ISTKO'.
WFIELDCAT-FIELDNAME = 'STLNR'.
WFIELDCAT-SELTEXT_L = 'BOM no'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTKO'.
WFIELDCAT-FIELDNAME = 'DATUV'.
WFIELDCAT-SELTEXT_L = 'BOM date'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTKO'.
WFIELDCAT-FIELDNAME = 'MATNR'.
WFIELDCAT-SELTEXT_L = 'Header mat no'.
WFIELDCAT-OUTPUTLEN = 18.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTKO'.
WFIELDCAT-FIELDNAME = 'BMENG'.
WFIELDCAT-SELTEXT_L = 'Base qty'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTKO'.
WFIELDCAT-FIELDNAME = 'BMEIN'.
WFIELDCAT-SELTEXT_L = 'UOM'.
WFIELDCAT-OUTPUTLEN = 3.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
ENDFORM. " BUILD_FCAT_HEAD
*& Form BUILD_FCAT_ITEM
text
--> p1 text
<-- p2 text
FORM BUILD_FCAT_ITEM .
WFIELDCAT-TABNAME = 'ISTPO'.
WFIELDCAT-FIELDNAME = 'IDNRK'.
WFIELDCAT-SELTEXT_L = 'Material no'.
*WFIELDCAT-HOTSPOT = 'X'.
WFIELDCAT-OUTPUTLEN = 18.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTPO'.
WFIELDCAT-FIELDNAME = 'MAKTX'.
WFIELDCAT-SELTEXT_L = 'Material desc'.
WFIELDCAT-JUST = 'C'.
WFIELDCAT-OUTPUTLEN = 30.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTPO'.
WFIELDCAT-FIELDNAME = 'MENGE'.
WFIELDCAT-SELTEXT_L = 'Item qty'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
WFIELDCAT-TABNAME = 'ISTPO'.
WFIELDCAT-FIELDNAME = 'MEINS'.
WFIELDCAT-SELTEXT_L = 'UOM'.
WFIELDCAT-OUTPUTLEN = 3.
APPEND WFIELDCAT TO IFIELDCAT.
CLEAR WFIELDCAT.
ENDFORM. " BUILD_FCAT_ITEM
*& Form BUILD_KEYINFO
text
--> p1 text
<-- p2 text
FORM BUILD_KEYINFO .
IKEYINFO-HEADER01 = 'STLNR'.
IKEYINFO-ITEM01 = 'STLNR'.
ENDFORM. " BUILD_KEYINFO
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
FORM DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COM'
IS_LAYOUT = ILAYOUT
IT_FIELDCAT = IFIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IEVENT[]
IT_EVENT_EXIT =
I_TABNAME_HEADER = 'ISTKO'
I_TABNAME_ITEM = 'ISTPO'
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
IS_KEYINFO = IKEYINFO
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB_HEADER = ISTKO
T_OUTTAB_ITEM = ISTPO
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_DATA
*& Form GET_MAT_DESC
text
--> p1 text
<-- p2 text
FORM GET_MAT_DESC .
IF NOT ISTPO[] IS INITIAL.
SELECT MATNR MAKTX INTO TABLE IMAKT FROM MAKT FOR ALL ENTRIES IN ISTPO
WHERE MATNR = ISTPO-IDNRK.
ENDIF.
LOOP AT ISTPO.
READ TABLE IMAKT WITH KEY MATNR = ISTPO-IDNRK.
IF SY-SUBRC = 0.
ISTPO-MAKTX = IMAKT-MAKTX.
ENDIF.
MODIFY ISTPO.
ENDLOOP.
ENDFORM. " GET_MAT_DESC
*& Form BUILD_LAYOUT
text
--> p1 text
<-- p2 text
FORM BUILD_LAYOUT .
ILAYOUT-ZEBRA = 'X'.
ILAYOUT-COLWIDTH_OPTIMIZE = 'X'.
ENDFORM. " BUILD_LAYOUT
*FORM USER_COM USING PUCOM LIKE SY-UCOMM PSELFIELD TYPE SLIS_SELFIELD.
*CASE PUCOM.
*WHEN '&IC1'.
SET PARAMETER ID 'MAT' FIELD PSELFIELD-VALUE.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
*ENDCASE.
*ENDFORM.
*& Form BUILD_EVENT_TAB
text
--> p1 text
<-- p2 text
FORM BUILD_EVENT_TAB .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IEVENT
EXCEPTIONS
LIST_TYPE_WRONG = 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.
READ TABLE IEVENT INTO WEVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC = 0.
WEVENT-FORM = 'TOPOFPAGE'.
MODIFY IEVENT FROM WEVENT INDEX SY-TABIX.
ENDIF.
ENDFORM. " BUILD_EVENT_TAB
*& Form TOPOFPAGE
text
FORM TOPOFPAGE.
DATA : ILISTHEAD TYPE SLIS_T_LISTHEADER,
WLISTHEAD TYPE SLIS_LISTHEADER.
WLISTHEAD-INFO = 'Its a test hierarchical sequential alv dispaly'.
WLISTHEAD-TYP = 'H'.
APPEND WLISTHEAD TO ILISTHEAD.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = ILISTHEAD
I_LOGO = ''
I_END_OF_LIST_GRID =
ENDFORM.
*& Form GETHEADERMAT
text
--> p1 text
<-- p2 text
FORM GETHEADERMAT .
IF NOT ISTKO[] IS INITIAL.
SELECT MATNR STLNR INTO TABLE IMAST FROM MAST FOR ALL ENTRIES IN ISTKO
WHERE STLNR = ISTKO-STLNR.
ENDIF.
LOOP AT ISTKO.
READ TABLE IMAST WITH KEY STLNR = ISTKO-STLNR.
IF SY-SUBRC = 0.
ISTKO-MATNR = IMAST-MATNR.
ENDIF.
MODIFY ISTKO.
ENDLOOP.
ENDFORM. " GETHEADERMAT
What more you can do is go to that function module in se37 , and inside that function module you can use At New
command , like at new matnr or ebeln .
Reward points if helpful
Regards,
Amber S
Message was edited by:
Amber Soni -
I have a report, which has "Layout" and "Export file path" fields on selection screen. I need to export the report to CSV file in the format of dynamical layout while executing on background.
In this case:
1. How do I read the structure of layout before ALV dispaly.
2. How do I chang the internal table dynamically according to layout structure.
Kindly suggest.Hi ,
You can use Function Module 'REUSE_ALV_VARIANT_DEFAULT_GET' to get the variant name.
Please check the code --
CONSTANTS:
lc_a TYPE char1 VALUE 'A'.
MOVE sy-repid TO fs_variant-report.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = lc_a
CHANGING
cs_variant = fs_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc IS INITIAL.
p_varian = fs_variant-variant.
ELSE.
p_varian = space.
ENDIF. " IF sy-subrc IS INITIAL.
Thanks and Regards
Pinaki -
Reus_alv_grid_display
hi, can any one help me in calculating total and subtotal for a field of type 'curr'.... using performs and reuse_alv_grid_display
hI,
you need to use the do_sum statement in the modify field catalogue perform .
checkout this program...
Type pools
TYPE-POOLS : SLIS.
Tables
TABLES: VBAK,VBAP,ICON.
DATA Declaration
*--Table to hold the Header Sales data
DATA: BEGIN OF TB_VBAK OCCURS 0,
INDICAT LIKE ICON-ID, " Icon
VBELN LIKE VBAK-VBELN, " Sales Document
AUDAT LIKE VBAK-AUDAT, " Document date
VBTYP LIKE VBAK-VBTYP, " SD document category
AUART LIKE VBAK-AUART, " Sales Document Type
AUGRU LIKE VBAK-AUGRU, " Order reason
NETWR LIKE VBAK-NETWR, " Net Value
WAERK LIKE VBAK-WAERK, " SD document currency
END OF TB_VBAK.
*--Table to hold the Icons
DATA: BEGIN OF TB_ICON OCCURS 0,
ID TYPE ICON-ID, " Icon
NAME TYPE ICON-NAME, " Name of an Icon
END OF TB_ICON.
*--Table to hold the Item Sales data
DATA: BEGIN OF TB_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, " Sales Document
POSNR LIKE VBAP-POSNR, " Sales Document Item
MATNR LIKE VBAP-MATNR, " Material Number
END OF TB_VBAP.
*--Declaration of ALV Tables
DATA : TB_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, " Field Catalog
TB_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV, " Field Catalog
TB_EVENTS TYPE SLIS_T_EVENT, " ALV Events
TB_SORT_ALV TYPE SLIS_T_SORTINFO_ALV, " ALV Sort
TB_COMMENTS TYPE SLIS_T_LISTHEADER. " Comment
*--Declaration of Local Variables
DATA : G_REPID LIKE SY-REPID. " For Program name
DATA : L_TABIX TYPE SY-TABIX.
STRUCTURES
*-- Declaration of ALV structures
DATA : X_FIELDCAT TYPE SLIS_FIELDCAT_ALV, " For Field Catalog
X_LAYOUT TYPE SLIS_LAYOUT_ALV, " For Layout
X_EVENTS TYPE SLIS_ALV_EVENT, " For Events
X_SORT TYPE SLIS_SORTINFO_ALV, " For Sort
X_COMMENTS TYPE SLIS_LISTHEADER. " For Comments
C O N S T A N T S
*--Declaration of Constants
CONSTANTS : C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
C_PF_STATUS TYPE SLIS_FORMNAME VALUE 'FRM_PF_STATUS',
C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'FRM_USER_COMMAND',
C_GREEN(40) TYPE C VALUE 'ICON_GREEN_LIGHT',
C_RED(40) TYPE C VALUE 'ICON_RED_LIGHT',
C_YELLOW(40) TYPE C VALUE 'ICON_YELLOW_LIGHT',
C_X TYPE C VALUE 'X', " Flag
C_H TYPE C VALUE 'H', " For Commenet-Type
C_S TYPE C VALUE 'S'. " For Commenet-Type
INITIALIZATION
*--Intialization.
INITIALIZATION.
G_REPID = SY-REPID.
SELECTION SCREEN
*--Block 1.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER: P_AUDAT LIKE VBAK-AUDAT
DEFAULT '20050101'(003). " doc date.
SELECTION-SCREEN: END OF BLOCK B1.
*--bLOCK 2.
SELECTION-SCREEN : BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETER :P_ALVDIS AS CHECKBOX. " For List/Grid
SELECTION-SCREEN : END OF BLOCK B2.
START OF SELECTION
START-OF-SELECTION.
*--Populating the header data from VBAK
PERFORM POPULATE_VBAK.
*--Populating all icons from ICON table
PERFORM POPULATE_ICONS.
*--Populating the final dispaly table
PERFORM FINAL_POPULATION.
END OF SELECTION
END-OF-SELECTION.
IF NOT TB_VBAK[] IS INITIAL.
*--Populating the field catalog for final display table
PERFORM BUILD-FIELDCATALOG.
*--Modifying the field catalog table
PERFORM MODIFY_FIELDCATALOG.
*--Generating all the events into the table
PERFORM GET_EVENTS.
*--sorting the Final table
PERFORM SORT_TABLE.
*--Dispalying the Fianl ALV Table
PERFORM DISPLAY_TABLE.
ELSE.
MESSAGE I999 WITH 'No Records found for the selection criteria'(006)
ENDIF.
*& Form build-fieldcatalog
Populating the fieldcatalog table for the Final display
FORM BUILD-FIELDCATALOG .
DATA :L_TABNAME TYPE SLIS_TABNAME. " Table Name
L_TABNAME = 'TB_VBAK'.
REFRESH : TB_FIELDCAT.
CLEAR : TB_FIELDCAT.
*--calling a function to build fieldcatalog for header data
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = G_REPID
I_INTERNAL_TABNAME = L_TABNAME
I_INCLNAME = G_REPID
CHANGING
CT_FIELDCAT = TB_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " build-fieldcatalog
*& Form display_table
Module to display the ALV Grid/List
FORM DISPLAY_TABLE .
*--Layout settings
CLEAR X_LAYOUT.
X_LAYOUT-ZEBRA = C_X.
X_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
X_LAYOUT-NO_COLHEAD = SPACE.
*--for list format settings
IF P_ALVDIS = C_X.
X_LAYOUT-NO_VLINE = C_X.
X_LAYOUT-NO_HLINE = C_X.
ENDIF.
*--Displaying the ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = C_PF_STATUS
IS_LAYOUT = X_LAYOUT
IT_EVENTS = TB_EVENTS
IT_FIELDCAT = TB_FIELDCAT
IT_SORT = TB_SORT_ALV
TABLES
T_OUTTAB = TB_VBAK
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_table
*& Form get_events
Module to GET EVENTS for ALV Dispaly
FORM GET_EVENTS .
REFRESH : TB_EVENTS.
CLEAR : TB_EVENTS.
*--functin to get events
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = TB_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 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.
Modifing Top of Page event
READ TABLE TB_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO X_EVENTS.
CLEAR L_TABIX.
L_TABIX = SY-TABIX.
IF SY-SUBRC = 0.
X_EVENTS-FORM = C_TOP_OF_PAGE.
MODIFY TB_EVENTS FROM X_EVENTS INDEX L_TABIX.
CLEAR X_EVENTS.
ENDIF.
Modifing User comand event
READ TABLE TB_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND
INTO X_EVENTS.
CLEAR L_TABIX.
L_TABIX = SY-TABIX.
IF SY-SUBRC = 0.
X_EVENTS-FORM = C_USER_COMMAND.
MODIFY TB_EVENTS FROM X_EVENTS INDEX L_TABIX.
CLEAR X_EVENTS.
ENDIF.
ENDFORM. " get_events
*& Form TOP_OF_PAGE
Top Of Page for the ALV format
FORM TOP_OF_PAGE.
DATA : L_DATE(02) TYPE C, "Date
L_MONTH(02) TYPE C, "Month
L_YEAR(04) TYPE C, "Year
L_DATE_INFO(10) TYPE C, "DATE
L_TEMP1(100) TYPE C, "temp
L_TEMP(100) TYPE C, "temp
L_TITLE(50) TYPE C. "title
CLEAR : TB_COMMENTS,
TB_COMMENTS[].
Filling Comments for Top of Page
X_COMMENTS-TYP = C_H.
L_TITLE = SY-TITLE.
X_COMMENTS-INFO = L_TITLE.
APPEND X_COMMENTS TO TB_COMMENTS.
CLEAR X_COMMENTS.
CLEAR :L_TEMP,L_TEMP1.
X_COMMENTS-TYP = C_S.
date
L_DATE = SY-DATUM+6(2).
L_MONTH = SY-DATUM+4(2).
L_YEAR = SY-DATUM+0(4).
L_TEMP = 'Date :'(005).
CONCATENATE L_YEAR '-' L_MONTH '-' L_DATE INTO L_DATE_INFO.
CONCATENATE L_TEMP L_DATE_INFO
INTO L_TEMP1 SEPARATED BY SPACE.
X_COMMENTS-INFO = L_TEMP1.
APPEND X_COMMENTS TO TB_COMMENTS.
*--Function to write Comments
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = TB_COMMENTS.
ENDFORM. " TOP_OF_PAGE
*& Form FINAL_POPULATION
Populating the FINAL table
FORM FINAL_POPULATION .
CLEAR SY-TABIX.
LOOP AT TB_VBAK.
L_TABIX = SY-TABIX.
IF TB_VBAK-NETWR <= 10.
READ TABLE TB_ICON WITH KEY NAME = C_GREEN BINARY SEARCH.
IF SY-SUBRC = 0.
TB_VBAK-INDICAT = TB_ICON-ID.
MODIFY TB_VBAK INDEX L_TABIX.
CLEAR TB_ICON.
ENDIF.
ELSEIF TB_VBAK-NETWR > 10 AND TB_VBAK-NETWR < 100.
READ TABLE TB_ICON WITH KEY NAME = C_YELLOW BINARY SEARCH.
IF SY-SUBRC = 0.
TB_VBAK-INDICAT = TB_ICON-ID.
MODIFY TB_VBAK INDEX L_TABIX.
CLEAR TB_ICON.
ENDIF.
ELSEIF TB_VBAK-NETWR => 100.
READ TABLE TB_ICON WITH KEY NAME = C_RED BINARY SEARCH.
IF SY-SUBRC = 0.
TB_VBAK-INDICAT = TB_ICON-ID.
MODIFY TB_VBAK INDEX L_TABIX.
CLEAR TB_ICON.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " FINAL_POPULATION
*& Form MODIFY_FIELDCATALOG
Modifying the FIELD CATALOG
FORM MODIFY_FIELDCATALOG .
DATA: L_DDICTXT TYPE C VALUE 'L'. "FLAG
LOOP AT TB_FIELDCAT INTO X_FIELDCAT.
CLEAR L_TABIX.
L_TABIX = SY-TABIX.
CASE X_FIELDCAT-FIELDNAME.
WHEN 'INDICAT'. " icon
X_FIELDCAT-SELTEXT_L = 'Status indicator'(008).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'VBELN'. " sales doc
X_FIELDCAT-SELTEXT_L = 'Sales Doc #'(009).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AUDAT'. " doc date
X_FIELDCAT-SELTEXT_L = 'Document Date'(010).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'VBTYP'. " doc category
X_FIELDCAT-SELTEXT_L = 'Category'(011).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AUART'. " doc type
X_FIELDCAT-SELTEXT_L = 'Doc Type'(012).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AUGRU'. " reason
X_FIELDCAT-SELTEXT_L = 'Reason'(013).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'WAERK'. " Currency unit
X_FIELDCAT-SELTEXT_L = 'Unit'(014).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'NETWR' . " Amount
X_FIELDCAT-SELTEXT_L = 'Net Value'(015).
X_FIELDCAT-DDICTXT = L_DDICTXT.
*-- TO display the total sum at the end.
X_FIELDCAT-DO_SUM = C_X.
ENDCASE.
MODIFY TB_FIELDCAT FROM X_FIELDCAT INDEX L_TABIX.
ENDLOOP.
ENDFORM. " MODIFY_FIELDCATALOG
*& Form SORT_TABLE
SORTING the ALV
FORM SORT_TABLE .
*--sorting the fields
CLEAR X_SORT.
X_SORT-SPOS = '1'.
X_SORT-FIELDNAME = 'AUART'.
X_SORT-TABNAME = 'TB_VBAK'.
X_SORT-UP = C_X.
APPEND X_SORT TO TB_SORT_ALV.
CLEAR X_SORT.
X_SORT-SPOS = '2'.
X_SORT-FIELDNAME = 'VBTYP'.
X_SORT-TABNAME = 'TB_VBAK'.
X_SORT-UP = C_X.
APPEND X_SORT TO TB_SORT_ALV.
CLEAR X_SORT.
X_SORT-SPOS = '3'.
X_SORT-FIELDNAME = 'WAERK'.
X_SORT-TABNAME = 'TB_VBAK'.
X_SORT-UP = C_X.
X_SORT-SUBTOT = C_X.
APPEND X_SORT TO TB_SORT_ALV.
ENDFORM. " SORT_TABLE
*& Form FRM_PF_STATUS
Customizing the PF-STATUS
FORM FRM_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB .
DATA: L_EXTAB TYPE SLIS_EXTAB.
CLEAR EXTAB[].
L_EXTAB-FCODE = '&EB9'.
APPEND L_EXTAB TO EXTAB.
L_EXTAB-FCODE = '&SUM'.
APPEND L_EXTAB TO EXTAB.
L_EXTAB-FCODE = '&OAD'.
APPEND L_EXTAB TO EXTAB.
L_EXTAB-FCODE = '&UMC'.
APPEND L_EXTAB TO EXTAB.
L_EXTAB-FCODE = '&AVE'.
APPEND L_EXTAB TO EXTAB.
L_EXTAB-FCODE = '&RNT'.
APPEND L_EXTAB TO EXTAB.
*--excluding some the tool buttons from the PF status
SET PF-STATUS 'PRACTICE_ALV' EXCLUDING EXTAB.
ENDFORM. " FRM_PF_STATUS
*& Form FRM_USER_COMMAND
USER COMMAND for the ALV event
FORM FRM_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD .
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE TB_VBAK INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC = 0.
*--selecting the line items for the selected VBELN
SELECT VBELN POSNR MATNR
FROM VBAP
INTO TABLE TB_VBAP
WHERE VBELN = TB_VBAK-VBELN.
IF SY-SUBRC = 0.
*--Perforrming the field catalog for line item table
PERFORM FIELDCAT_ITEM.
PERFORM DISPLAY_POPUP.
ELSE.
MESSAGE I999 WITH 'NO item data existing for the record'(007).
ENDIF.
ENDIF.
ENDCASE.
ENDFORM. " FRM_USER_COMMAND
*& Form FIELDCAT_ITEM
Build field catalog for the line items
FORM FIELDCAT_ITEM .
DATA : L_TABNAME TYPE SLIS_TABNAME.
L_TABNAME = 'TB_VBAP'.
CLEAR : TB_FIELDCAT1,TB_FIELDCAT1[].
*-- building catalog for line items
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = G_REPID
I_INTERNAL_TABNAME = L_TABNAME
I_INCLNAME = G_REPID
CHANGING
CT_FIELDCAT = TB_FIELDCAT1
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " FIELDCAT_ITEM
*& Form POPULATE_VBAK
Populating the Sales header data
FORM POPULATE_VBAK .
*-- selecting from VBAK
SELECT VBELN
AUDAT
VBTYP
AUART
AUGRU
NETWR
WAERK
INTO CORRESPONDING FIELDS OF TABLE TB_VBAK
FROM VBAK
WHERE AUDAT > P_AUDAT AND
NETWR > 0.
IF SY-SUBRC <> 0.
SORT TB_VBAK BY AUART VBTYP WAERK .
ENDIF.
ENDFORM. " POPULATE_VBAK
*& Form POPULATE_ICONS
Populating the ICON table
FORM POPULATE_ICONS .
*--selecting from ICON table
SELECT ID
NAME
INTO TABLE TB_ICON
FROM ICON.
IF SY-SUBRC = 0.
SORT TB_ICON BY NAME .
ENDIF.
ENDFORM. " POPULATE_ICONS
*& Form DISPLAY_POPUP
Displaying the POP UP with line item details
FORM DISPLAY_POPUP .
DATA: L_TITLE(40) TYPE C . " For pop up title
L_TITLE = 'Sales document Item Data'(004).
*--Function to display the pop up with line item details
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = L_TITLE
I_TABNAME = 'TB_VBAP'
IT_FIELDCAT = TB_FIELDCAT1
I_CALLBACK_PROGRAM = G_REPID
TABLES
T_OUTTAB = TB_VBAP
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_POPUP
regards,
sateesh -
How to dispaly items of Particular Sorder of IT into single row in alv dis?
Hi,
Experts,
I have an Sales order internal table along with its corresponding items
i want to display those items in side by side in alv display.
Ex:
Vbeln posnr netwr waerk
56800 10 21.00 Col
56800 20
56800 30
56800 40
I want to display:
Vbeln posnr posnr2 posnr3 posnr4 netwr waerk
56800 10 20 30 40 21.00 Col
I have added columns how can pull data into particular columns .How can i achieve this if any idea or input or suggestions please far word to me.
Thank You,
Shabeer ahmed.Hi,
Using basic report you can do like this:
DATA: BEGIN OF itab occurs 0,
sku(10) TYPE c,
month(2) TYPE n,
qty(2) TYPE n,
END OF itab.
itab-sku = 'AA'.
itab-month = '01'.
itab-qty = 10.
APPEND ITAB.
itab-sku = 'AA'. itab-month = 02. itab-qty = 20. APPEND ITAB.
itab-sku = 'AA'. itab-month = 03. itab-qty = 20. APPEND ITAB.
itab-sku = 'BB'. itab-month = 01. itab-qty = 20. APPEND ITAB.
itab-sku = 'BB'. itab-month = 02. itab-qty = 40. APPEND ITAB.
itab-sku = 'CC'. itab-month = 02. itab-qty = 50. APPEND ITAB.
itab-sku = 'CC'. itab-month = 03. itab-qty = 10. APPEND ITAB.
itab-sku = 'CC'. itab-month = 04. itab-qty = 20. APPEND ITAB.
PERFORM LIST.
FORM LIST.
data: cl like itab-sku.
SKIP TO LINE 3.
LOOP AT ITAB.
if cl <> itab-sku.
write : / itab-sku.
else.
write : ''.
endif.
write : itab-qty.
cl = itab-sku.
ENDLOOP.
ENDFORM.
Regards,
Bhaskar -
Regarding PF Status In ALV Grid Dispaly
Hi..
Can you please tell me how to set PF status in ALV Grid Display.
Regards
Sandeep.hi,
if u use REUSE_ALV_LIST_DISPLAY copy the standard GUI-Status named STANDARD from function group SALV in your program
if u use REUSE_ALV_GRID_DISPLAY_LVC or REUSE_ALV_GRID_DISPLAY copy the standard GUI-Status named STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN in your program
after that you cas set the pf-status in this way:
>CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
> EXPORTING
> i_callback_program = sy-cprog
> i_callback_pf_status_set = 'STATUS'
> i_callback_user_command = 'USERCOMMAND'
> is_layout = st_layout
> it_fieldcat = st_fieldcat
> TABLES
> t_outtab = outtab
or
>CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
> EXPORTING
> i_callback_program = sy-cprog
> i_callback_pf_status_set = 'STATUS'
> i_callback_user_command = 'USERCOMMAND'
> is_layout_lvc = wa_slis_layout
> it_fieldcat_lvc = tb_slis_fieldcat
> TABLES
> t_outtab = tb_app
where USERCOMMAND and STATUS are 2 forms in your program.
>FORM status USING pfstat TYPE slis_t_extab.
> SET PF-STATUS 'STANDARD' EXCLUDING pfstat.
>ENDFORM.
>
> ...
>
>FORM usercommand USING okcode LIKE sy-ucomm
> wa_selfield TYPE slis_selfield.
> CASE okcode.
> ....
> ENDCASE
>ENDFORM.
Bye.
Marco -
Alv grid dispaly in custom container....?
Hay friends i have shown ALV grid display in custom container .....in that some fields are input fields...
how can i modify my internal table (which is shown in ALV )...by knowing that this field is changed...i need to update in my internal table...
need help...
reply soon...Hello
All you need to know can be found in thread About events of class cl_gui_alv_grid and the links mentioned therein.
Regards
Uwe -
Hi,
I have a requirement to select a row in ALV output and perform some action after a button is pressed.
(i.e) i have a release button and after i select a line item in alv output and press on the button ,that item should be released.
so both the events (Selection of line item and pressing of button) should happen together
how can this be achieved.
moreover i should be able to select multiple line items in the alv grid display.how can this be achieved.is it in fieldcatalog level or layout level.
Any pointers to this would be of great help.
Regards,
S.Subasree.Hi,
Check the sample code which captures multipe selcted rows
on clicking a button.
FORM sub_user_command USING ucomm TYPE sy-ucomm
sel TYPE slis_selfield.
DATA: ref_grid TYPE REF TO cl_gui_alv_grid.
DATA: count TYPE i ,
i_rows TYPE lvc_t_row .
DATA: lf_row_index TYPE lvc_index ,
i_selected_line_s TYPE lvc_s_row ,
l_vbeln TYPE vbeln .
*then insert the following code in your USER_COMMAND routine...
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
CASE ucomm.
WHEN 'PDF'.
CALL METHOD ref_grid->get_selected_rows
IMPORTING
et_index_rows = i_rows.
LOOP AT i_rows
INTO i_selected_line_s.
lf_row_index = i_selected_line_s-index.
CLEAR i_selected_line_s.
READ TABLE it_itab
INTO wa_itab
INDEX lf_row_index.
IF sy-subrc EQ 0.
refresh:bdcmsgcoll,
bdcdata.
clear:l_vbeln.
MOVE wa_itab-vbeln TO l_vbeln.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'Z_PF_TEST'
i_callback_user_command = 'SUB_USER_COMMAND'
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = it_itab.
Regards,
Raj.
Maybe you are looking for
-
Reports with subreports take longer to preview in Crystal 2008 Viewer
Previewing reports containing one or more subreports within a .NET application using the 2008 Windows Forms Crystal Report Viewer control takes much longer than running those same reports from the XI R2 viewer. This occurs because the report will ru
-
My the number pad of my keyboard stopped working...well I can still use clear = / * - + and Enter but no numbers...This is really annoying when I am doing data entry. Can anyone help. Has anyone found a solution. I read some where you can hit the
-
Should I clean install when MBP arrives?
Hello everyone. I know that there have been several posts that touch on this subject, but I havent found one dedicated to it. My MBP should arrive this week or the next and I have been reading a lot about people formatting the hard drive and then doi
-
Can't find answer to problem, have reloaded software, have re-set preferences to default state. Need help with this one. Problem not showing in my Elements 12 version .
-
Classic Report Tooltip in column header
How can I create a tooltip on the header of the columns in a Classic Report?