ALV USING FM(FIELDCATALOG_MERGE)
What is the purpose of fm
"REUSE_ALV_FIELDCATALOG_MERGE"
explain briefly with sample code.
Hi,
Using REUSE_ALV_FIELDCATALOG_MERGE can automatically determine the fieldstructure from this source program, no need to maunally build fieldcatalog for the fields defined in the internal table.
REPORT Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB .
*data definition
tables:
marav. "Table MARA and table MAKT
* Data to be displayed in ALV
* Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
* matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
" intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
"make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
* Other data needed
* field to store report name
data i_repid like sy-repid.
* field to check table length
data i_lines like sy-tabix.
* Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
select-options:
s_matnr for marav-matnr matchcode object MAT1.
start-of-selection.
* read data into table imat
select * from marav
into corresponding fields of table imat
where
matnr in s_matnr.
* Check if material was found
clear i_lines.
describe table imat lines i_lines.
if i_lines lt 1.
* Using hardcoded write here for easy upload
write: /
'No materials found.'.
exit.
endif.
end-of-selection.
* Now, we start with ALV
* To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
* The fieldcatalouge can be generated by FUNCTION
* 'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
* report source, including this report.
* The only problem one might have is that the report and table names
* need to be in capital letters. (I had it :-( )
* Store report name
i_repid = sy-repid.
* Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = i_repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
*explanations:
* I_PROGRAM_NAME is the program which calls this function
* I_INTERNAL_TABNAME is the name of the internal table which you want
* to display in ALV
* I_INCLNAME is the ABAP-source where the internal table is defined
* (DATA....)
* CT_FIELDCAT contains the Fieldcatalouge that we need later for
* ALV display
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
*This was the fieldcatlogue
* And now, we are ready to display our list
* Call for ALV list display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
I_CALLBACK_PROGRAM = i_repid
IT_FIELDCAT = int_fcat
I_SAVE = 'A'
TABLES
T_OUTTAB = imat
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*explanations:
* I_CALLBACK_PROGRAM is the program which calls this function
* IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
* now the data definition needed for display
* I_SAVE allows the user to save his own layouts
* T_OUTTAB contains the data to be displayed in ALV
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.
Thanks,
Sriram Ponna.
Similar Messages
-
UNLOCKING single row in ALV using Funtions
hai,
Actually i am displaying a table in ALV USING FUNCTIONS and i am locking key values.
Now my reqment is , if i press (NEW, COPY )button then i have to add one new row and that row should be Unlocked to insert values.
Is it possible USING FUNCTIONS(I have a solution using CLASSES)Hi ramesh,
it is possible with the LVC FM.i gave the sample yesterday did you check that..
if not check it to day..
REPORT ZTESTALV.
TYPE-POOLS: SLIS.
*- Fieldcatalog
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV..
*- For Events
DATA:IT_EVENTS TYPE SLIS_T_EVENT.
DATA: X_FIELDCAT TYPE LVC_S_FCAT,
X_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA:X_LAYOUT TYPE LVC_S_LAYO.
"{ FOR DISABLE
DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
"} FOR DISABLE
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE
END OF IT_VBAP.
DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
SELECT VBELN
POSNR
UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP.
DATA:L_POS TYPE I VALUE 1.
CLEAR: L_POS.
L_POS = L_POS + 1.
X_FIELDCAT-SELTEXT = 'VBELN'.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
x_fieldcat-ref_field = 'VBELN'.
x_fieldcat-ref_table = 'VBAK'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SELTEXT = 'POSNR'.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
"{FOR DISABLE HERE 6ROW IS DISABLED
SY-TABIX = 6.
LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 10.
INSERT LS_EDIT INTO TABLE LT_EDIT.
LS_EDIT-FIELDNAME = 'POSNR'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 6.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB TRANSPORTING
HANDLE_STYLE .
X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
"} UP TO HERE
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT_LVC = X_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCAT
TABLES
T_OUTTAB = IT_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.
Regards
vijay -
How to get Subtotal text in ALV using OOPS
hi,
Can any one pls help me out getting <b>subtotals text</b> in ALV using OOPS concepts....Pls provide me if any of u have sample code for that......
my code:
data:gr_grid_d0100 type ref to cl_gui_alv_grid.
data : gr_events_d0100 type ref to lcl_events_d0100.
classes**********
class lcl_events_d0100 definition.
public section.
methods:
subtotal_text for event subtotal_text
of cl_gui_alv_grid
importing es_subtottxt_info
ep_subtot_line
e_event_data.
endclass.
class lcl_events_d0100 implementation.
method subtotal_text.
perform d0100_event_subtotal_text using es_subtottxt_info
ep_subtot_line
e_event_data.
endmethod. "subtotal_text
endclass.
data : gr_event_handler type ref to lcl_events_d0100.
SET HANDLER gr_event_handler->subtotal_text FOR wcl_alv_grid_request
FORM d0100_event_subtotal_text USING
es_subtottxt_info TYPE LVC_S_STXT
ep_subtot_line TYPE REF TO data
e_event_data TYPE REF TO cl_alv_event_data.
DATA: l_text TYPE string.
l_text = es_subtottxt_info.
FIELD-SYMBOLS: <fs> TYPE ANY.
ASSIGN e_event_data->m_data->* TO <fs>.
<fs> = text-007.hi vijay
check this code
if you want to use field symbols.
data: total type ref to data,
subtotal1 type ref to data.
field-symbols <total> like gt_sflight.
field-symbols <subtotal1> like gt_sflight.
call method grid1->get_subtotals
importing
ep_collect00 = total
ep_collect01 = subtotal1.
assign total->* to <total>.
assign subtotal1->* to <subtotal1>.
or u can use
U have to do the subtotal column wise.In the field catalog specify the following in addition to the corresponding field name(i.e. Column)
DATA ls_fcat TYPE lvc_s_fcat.
ls_fcat-do_sum = 'X'.
Hope this helps u out.
Thanks & Regards,
naveen -
How to add a new button in an ALV using factory method
im using factory method to creat an ALV
The reason why I'm doing this is because I want the ALV and the selection screen in the same screen like exemplified here http://help-abap.blogspot.com/2008/10/dispaly-alv-report-output-in-same.html
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
r_container = lo_cont
container_name = 'DOCK_CONT'
IMPORTING
r_salv_table = lo_alv
CHANGING
t_table = me->t_data.
The above code already uses every parameter that method as to offer.
Is it possible to add extra buttons to an ALV using that method?Hi Ann,
The reason you are not able to see any of the new columns as a option to select in your web service block is because when you have published that block, they were not present. Add these two new objects in your block and publish it again. You will be prompted for duplication content. Select the highlighted block for duplicate and now you can see the new added objects in the filter option. Update and this will overwrite your published block. Please note, web services do appear to behave weirdly when used with dashboards so I request you to please try it in a separate test report first.
Hope that helps.
Regards,
Tanisha -
Hello ,
Can anyone let me know how to trigger the END-of-page event in ALV using OOPs.
Thanks in advance.
Regards
JaiHello Pratuysh,
Thanks for the answer
I know that report,but that doesn't help me.
Any other way
Thanks
Jai -
How to populate field catalogue fields in ALV using dynamic internal table
Hi All,
Please let me know how to populate field catalogue fields in ALV using dynamic internal table.
I have created <dyn_table> using code below.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = g_t_ifc
it_fieldcatalog = g_t_fieldcat
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <dyn_table>.
Create dynamic work area and assign to FS
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
Now this <dyn_table> has fields like idoc no.,creation date ,
segment field 1, segment field 2 etc..Now idoc no.,creation date are static fields from table EDIDC. And segment field 1, segment field 2 etc are dynamic fields from table EDSAPPL.
In my ALV report I am getting the final layout properly but I am unable to move values to corresponding fields in the final layout shown.Please let me know how to populate these fields from different tables.
I tried this way but its not working.
SORT g_t_edid4 BY docnum.
LOOP AT g_t_edidc INTO g_r_edidc.
READ TABLE g_t_edid4 into g_r_edid4
WITH KEY docnum = g_r_edidc-docnum
BINARY SEARCH.
IF sy-subrc = 0.
<dyn_wa> = g_r_edid4-sdata.
MOVE-CORRESPONDING g_r_edid4 to <dyn_wa>.
CLEAR g_r_edid4.
ENDIF.
MOVE-CORRESPONDING g_r_edidc to <dyn_wa>.
APPEND <dyn_wa> TO <dyn_table>.You have to assign each field to field symbol and then assign the value to that field symbol and asssign that field symbol to workarea field symbol.
LOOP AT g_t_edidc INTO g_r_edidc.
READ TABLE g_t_edid4 into g_r_edid4
WITH KEY docnum = g_r_edidc-docnum
BINARY SEARCH.
IF sy-subrc = 0.
ASSIGN COMPONENT 'SDATA' OF STRUCTURE <DYN_WA> TO <DYN_FLD>.
<DYN_FLD> = g_r_edid4-sdata.
" <dyn_wa> = g_r_edid4-sdata.
" Assign each fields like this.
" MOVE-CORRESPONDING g_r_edid4 to <dyn_wa>.
CLEAR g_r_edid4.
ENDIF.
" MOVE-CORRESPONDING g_r_edidc to <dyn_wa>.
APPEND <dyn_wa> TO <dyn_table>.
Regards,
Naimesh Patel -
How to select records in ALV using FM
Hi guys,
How to select records in ALV using FM. Not the OO method. Thx in advance!
KunhI
by using REUSE_ALV_FIELDCATALOUG_MERGE. Iys fill field catalouge table as per internal table description. Then use REUSE_ALV_GRID_DISPLAY for display ALV REPORT.
**Please reward suitable points***
With Regards
Navin Khedikar -
I need to display Table header in ALV using Oops.
I need to data from 8 fields which I get in the run time of the program.
I am new to Oops ALV, I have done a similar thing in normal ALV but not in oops.
Detailed info required, Custom container settings as well.
Thanks in Advancesee this weblog TOP_OF_PAGE in ALV Using CL_GUI_ALV_GRID
-
Events in ALV Using OO ...
I wrote an ALV using OO . My problem is that i can't control the events for Hotspot , Double Click etc .
Look my code please to find the problem.
*& Report YDP_ALV_USING_OO
REPORT YDP_ALV_USING_OO.
INCLUDE <CL_ALV_CONTROL>.
CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
*DOUBLE-CLICK CONTROL
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO,
*Hotspot click control
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID
E_COLUMN_ID
ES_ROW_NO ,
*To implement user commands
HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM .
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK .
PERFORM HANDLE_DOUBLE_CLICK USING E_ROW
E_COLUMN
ES_ROW_NO.
ENDMETHOD . "handle_double_click
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
PERFORM HANDLE_HOTSPOT_CLICK USING E_ROW_ID
E_COLUMN_ID
ES_ROW_NO .
ENDMETHOD . "handle_hotspot_click
*--Handle User Command
METHOD HANDLE_USER_COMMAND .
PERFORM HANDLE_USER_COMMAND USING E_UCOMM .
ENDMETHOD. "handle_user_command
ENDCLASS . "lcl_event_handler IMPLEMENTATION
*& Form handle_hotspot_click
text
-->I_ROW_ID text
-->I_COLUMN_ID text
-->IS_ROW_NO text
FORM HANDLE_HOTSPOT_CLICK USING I_ROW_ID TYPE LVC_S_ROW
I_COLUMN_ID TYPE LVC_S_COL
IS_ROW_NO TYPE LVC_S_ROID.
READ TABLE ITAB INDEX IS_ROW_NO-ROW_ID .
IF SY-SUBRC = 0 AND I_COLUMN_ID-FIELDNAME = 'REWARD' .
BREAK DFREARAS.
ENDIF .
ENDFORM . "handle_hotspot_click
*& Form handle_double_click
text
-->I_ROW text
-->I_COLUMN text
-->IS_ROW_NO text
FORM HANDLE_DOUBLE_CLICK USING I_ROW TYPE LVC_S_ROW
I_COLUMN TYPE LVC_S_COL
IS_ROW_NO TYPE LVC_S_ROID.
BREAK DFREARAS.
READ TABLE ITAB INDEX IS_ROW_NO-ROW_ID .
IF SY-SUBRC = 0 AND I_COLUMN-FIELDNAME = 'COMPL_NO' .
BREAK DFREARAS.
ENDIF .
ENDFORM . "handle_double_click
Please help ...THANKS EVERYONE ....
I FOUND IT ... -
TWO ALV USING SPLITTER CONTAINER
HI ALL.
I WANT TO DISPLAY TWO DIFFERENT ALV USING SPLITTER.
ON DOUBLE CLICKING THE FIRST ALV THE SECOND ALV GET CALLED RESPECTIVE OF THE FIELDS I CHOOSE ON CLICKING
THE FIRST LIST IS IN LEFT SPLITTER . AND THE SECOND LIST IS IN RIGHT SPLITTER .
Moderator message: many examples are available, please search before asking, do not post in all upper case in these forums.
Edited by: Thomas Zloch on Dec 2, 2010 1:08 PMHi,
CREATE OBJECT g_custom_container
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT g_custom_container1
EXPORTING
container_name = 'CONTAINER1'.
CREATE OBJECT g_splitter
EXPORTING parent = G_CUSTOM_container
rows = 1
columns = 2.
CALL METHOD g_splitter->get_container
EXPORTING row = 1
column = 1
RECEIVING container = g_container_1.
CALL METHOD g_splitter->get_container
EXPORTING row = 1
column = 2
RECEIVING container = g_container_2.
CREATE OBJECT g_splitter1
EXPORTING parent = G_CUSTOM_container
rows = 1
columns = 2.
CALL METHOD g_splitter->get_container
EXPORTING row = 1
column = 1
RECEIVING container = g_container_1.
CALL METHOD g_splitter->get_container
EXPORTING row = 1
column = 2
RECEIVING container = g_container_2.
CALL METHOD g_splitter->get_container
EXPORTING row = 1
column = 2
RECEIVING container = g_container_2.
call method g_splitter1----
>set_table_for_first_display.
call method g_splitter2----
>set_table_for_first_display.
regards,
muralii -
Please send me some sample codes of ALVS using function modules only
Hi,
i am new to alvs
Please send me some sample codes of alvs using function modules only.
My mail id is [email protected]
Thanks & regards,
hari priyahI
http://www.sapdev.co.uk/reporting/reportinghome.htm SPECIAL FOR ALL ALV PROGRAMS WITH EXAMPLE CODES
Check the below links :
http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
http://www.sap-img.com/abap-function.htm
http://www.sap-basis-abap.com/sapab034.htm
http://www.erpgenie.com/abap/example_code.htm
These all are very simple ALV programs ,good luck
<b>Reward if usefull</b> -
Hi all,
I need to create an ALV using OO approach in which the user should change,insert,delete and save the values which should be reflected in the internal table also.
Can u guys supply me with a sample program so i can refer it.Hello Sharan,
Please refer to program BCALV_GRID_EDIT for your requirement.
Hope this helps and please don't forget to reward points.
Cheers,
Sougata.
p.s. if your Dev client has no flight model data already, first run program SAPBC_DATA_GENERATOR to create flight model data in your client.
Edited by: Sougata Chatterjee on Jun 4, 2008 4:13 PM -
Need some sample alvs using merge
I need some sample alvs using merge
Hi!
data w_fieldcat type slis_fieldcat_alv.
type-pools : slis.
tables : sflight.
data : i_fieldcat type slis_T_fieldcat_alv.
data v_repid like sy-repid.
data : begin of i_sflight occurs 0,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
end of i_sflight.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = v_repid
i_internal_tabname = 'I_SFLIGHT'
i_inclname = v_repid
changing
ct_fieldcat = I_fieldcatalog_TYPE.
Check this link
http://help.sap.com/saphelp_nw04/helpdata/en/22/a3f5fed2fe11d2b467006094192fe3/frameset.htm
Regards
Tamá -
Reg..ALV using classes
i have displayed a ALV report with a push button 'HST'.
When i select a particular line(vbeln) and click on pushbutton 'HST' it has to display me a interactive report based on the condition vbeln and posnr.
can anyone help me with the detail code using classes..
answers will be rewarded....
regards,
kumarHi,
Class ALV Specification
Classes used:
CL_GUI_ALV_GRID
Example of ALV using Classes
DATA: lcl_alv TYPE REF TO cl_gui_alv_grid,
t_flights TYPE STANDARD TABLE OF FLIGHTS.
SELECT * FROM flights INTO TABLE t_flights.
CREATE OBJECT lcl_alv
EXPORTING I_PARENT = cl_gui_container=>screen0.
CALL METHOD lcl_alv->set_table_for_first_display
EXPORTING
I_STRUCTURE_NAME = 'FLIGHTS'
CHANGING
IT_OUTTAB = t_flights.
CALL SCREEN 100.
Example Details
This is a simple example of the class ALV, we do not need to create, in this case, a field catalog because we are using the whole table of FLIGHTS and we will show all the fields that this table contains, we do this at the I_STRUCTURE_NAME = 'FLIGHTS' statement.
The CL_GUI_ALV_GRID constructor needs the I_PARENT parameter to define where it will be show, in the example we set the entire screen to place the ALV.
reward if helpful -
Top of Page Sequential/Hierarchical ALV using Class
Hi Experts.
I'd like to ask some codes on how to have the top-of-page function of the Sequential ALV using the CLASS cl_salv_hierseq_table.
Points would be rewarded.
Thanks!
Message was edited by:
Jay Cruz
Message was edited by:
Jay CruzHi Jay,
Plz check out this code.
REPORT BALVHT01 NO STANDARD PAGE HEADING.
ALV
TYPE-POOLS: SLIS.
DB-Table
TABLES: SCARR, SPFLI.
Includes
INCLUDE .
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
GT_EVENTS TYPE SLIS_T_EVENT.
Data to be displayed
DATA: BEGIN OF GT_SPFLI OCCURS 0.
INCLUDE STRUCTURE SPFLI.
DATA: ADD1,
BOX,
WERT TYPE P,
LIGHTS.
DATA: END OF GT_SPFLI.
DATA: BEGIN OF GT_SCARR OCCURS 0.
INCLUDE STRUCTURE SCARR.
DATA: BOX,
LIGHTS,
EXPAND.
DATA: END OF GT_SCARR.
DATA: G_REPID LIKE SY-REPID.
DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
Report Selections
SELECT-OPTIONS CARRID FOR SCARR-CARRID.
SELECTION-SCREEN SKIP 1.
Parameters
PARAMETERS: P_MAXROW TYPE I DEFAULT 50.
SELECTION-SCREEN SKIP 1.
Variante
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE TEXT-064.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK 0.
Layout
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-060.
PARAMETERS:
P_ZEBRA AS CHECKBOX DEFAULT ' ',
P_NOCOLH AS CHECKBOX DEFAULT ' ',
P_COLOPT AS CHECKBOX DEFAULT ' ',
P_KEYHOT AS CHECKBOX DEFAULT ' ',
P_NOINPT AS CHECKBOX DEFAULT ' '.
SELECTION-SCREEN END OF BLOCK A.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME TITLE TEXT-061.
PARAMETERS:
P_LIGHTS AS CHECKBOX DEFAULT ' ',
P_LIGHTC AS CHECKBOX DEFAULT ' '.
SELECTION-SCREEN END OF BLOCK B.
SELECTION-SCREEN BEGIN OF BLOCK C WITH FRAME TITLE TEXT-062.
PARAMETERS:
P_TOTONL AS CHECKBOX DEFAULT ' ',
P_TOTEXT(60),
P_STTEXT(60).
SELECTION-SCREEN END OF BLOCK C.
SELECTION-SCREEN BEGIN OF BLOCK D WITH FRAME TITLE TEXT-063.
PARAMETERS:
P_GPCE AS CHECKBOX DEFAULT ' ',
P_CHKBOX AS CHECKBOX DEFAULT ' ',
P_EXPAND AS CHECKBOX DEFAULT ' ',
P_DETPOP AS CHECKBOX DEFAULT ' '.
SELECTION-SCREEN END OF BLOCK D.
DATA: G_BOXNAM TYPE SLIS_FIELDNAME VALUE 'BOX',
G_EXPANDNAME TYPE SLIS_FIELDNAME VALUE 'EXPAND',
P_F2CODE LIKE SY-UCOMM VALUE '&ETA',
P_LIGNAM TYPE SLIS_FIELDNAME VALUE 'LIGHTS',
G_SAVE(1) TYPE C,
G_TABNAME_HEADER TYPE SLIS_TABNAME,
G_TABNAME_ITEM TYPE SLIS_TABNAME,
g_default(1) type c,
G_EXIT(1) TYPE C,
GX_VARIANT LIKE DISVARIANT,
G_VARIANT LIKE DISVARIANT.
INITIALIZATION.
G_REPID = SY-REPID.
G_TABNAME_HEADER = 'GT_SCARR'.
G_TABNAME_ITEM = 'GT_SPFLI'.
define keyinfo
CLEAR GS_KEYINFO.
GS_KEYINFO-HEADER01 = 'CARRID'.
GS_KEYINFO-ITEM01 = 'CARRID'.
PERFORM E01_FIELDCAT_INIT USING GT_FIELDCAT[].
PERFORM E03_EVENTTAB_BUILD USING GT_EVENTS[].
PERFORM E04_COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
PERFORM E06_T_SORT_BUILD USING GT_SORT[].
PERFORM E07_SP_GROUP_BUILD USING GT_SP_GROUP[].
Schalter Varianten benutzerspezifisch/allgemein speicherbar setzen
Set Options: save variants userspecific or general
G_SAVE = 'A'.
PERFORM VARIANT_INIT.
Get default variant
GX_VARIANT = G_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 0.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
Process on value request
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
PERFORM F4_FOR_VARIANT.
PAI
AT SELECTION-SCREEN.
PERFORM PAI_OF_SELECTION_SCREEN.
START-OF-SELECTION.
PERFORM SELECTION.
END-OF-SELECTION.
PERFORM E05_LAYOUT_BUILD USING GS_LAYOUT. "wg. Parameters
Call ABAP/4 List Viewer
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS = GT_SP_GROUP[]
IT_SORT = GT_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 = g_default
I_SAVE = G_SAVE
IS_VARIANT = G_VARIANT
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
I_TABNAME_HEADER = G_TABNAME_HEADER
I_TABNAME_ITEM = G_TABNAME_ITEM
IS_KEYINFO = GS_KEYINFO
IS_PRINT =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
TABLES
T_OUTTAB_HEADER = GT_SCARR
T_OUTTAB_ITEM = GT_SPFLI.
FORM E01_FIELDCAT_INIT *
--> E01_LT_FIELDCAT *
FORM E01_FIELDCAT_INIT USING E01_LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'ADD1'.
LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.
LS_FIELDCAT-REPTEXT_DDIC = '?'.
LS_FIELDCAT-OUTPUTLEN = 1.
LS_FIELDCAT-NO_OUT = 'X'.
LS_FIELDCAT-INPUT = 'X'.
LS_FIELDCAT-SP_GROUP = 'A'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME =
I_INTERNAL_TABNAME = G_TABNAME_HEADER
I_STRUCTURE_NAME = 'SCARR'
I_CLIENT_NEVER_DISPLAY = 'X'
CHANGING
CT_FIELDCAT = E01_LT_FIELDCAT[].
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME =
I_INTERNAL_TABNAME = G_TABNAME_ITEM
I_STRUCTURE_NAME = 'SPFLI'
I_CLIENT_NEVER_DISPLAY = 'X'
CHANGING
CT_FIELDCAT = E01_LT_FIELDCAT[].
geht am Anfang nicht !!!!
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'WERT'.
LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.
LS_FIELDCAT-REPTEXT_DDIC = 'Wert'(070).
LS_FIELDCAT-OUTPUTLEN = 4.
LS_FIELDCAT-INTTYPE ='P'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
ENDFORM.
FORM E02_DATA_ADD *
--> E02_LT_SFLIGHT *
FORM E02_DATA_ADD TABLES E02_LT_SPFLI STRUCTURE GT_SPFLI.
LOOP AT E02_LT_SPFLI.
IF SY-TABIX > 10.
E02_LT_SPFLI-ADD1 = 'A'.
E02_LT_SPFLI-BOX = 'X'.
E02_LT_SPFLI-LIGHTS = '3'.
ELSE.
IF SY-TABIX = 1.
E02_LT_SPFLI-LIGHTS = '2'.
ELSE.
E02_LT_SPFLI-LIGHTS = '1'.
ENDIF.
ENDIF.
E02_LT_SPFLI-WERT = SY-TABIX MOD 5.
MODIFY E02_LT_SPFLI.
ENDLOOP.
ENDFORM.
FORM E03_EVENTTAB_BUILD *
--> E03_LT_EVENTS *
FORM E03_EVENTTAB_BUILD USING E03_LT_EVENTS TYPE SLIS_T_EVENT.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 1
IMPORTING
ET_EVENTS = E03_LT_EVENTS.
READ TABLE E03_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 E03_LT_EVENTS.
ENDIF.
ENDFORM.
FORM E04_COMMENT_BUILD *
--> E04_LT_TOP_OF_PAGE *
FORM E04_COMMENT_BUILD USING E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: LS_LINE TYPE SLIS_LISTHEADER.
Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-KEY: not used for this type
LS_LINE-INFO = TEXT-001.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = TEXT-050.
LS_LINE-INFO = TEXT-010.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
LS_LINE-KEY = TEXT-051.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
LS_LINE-KEY: not used for this type
LS_LINE-INFO = TEXT-002.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
ENDFORM.
FORM E05_LAYOUT_BUILD *
<-> E05_LS_LAYOUT *
FORM E05_LAYOUT_BUILD USING E05_LS_LAYOUT TYPE SLIS_LAYOUT_ALV.
E05_LS_LAYOUT-F2CODE = P_F2CODE.
E05_LS_LAYOUT-ZEBRA = P_ZEBRA.
E05_LS_LAYOUT-COLWIDTH_OPTIMIZE = P_COLOPT.
IF P_CHKBOX = 'X'.
E05_LS_LAYOUT-BOX_FIELDNAME = G_BOXNAM.
E05_LS_LAYOUT-BOX_TABNAME = G_TABNAME_ITEM.
ELSE.
CLEAR E05_LS_LAYOUT-BOX_FIELDNAME.
CLEAR E05_LS_LAYOUT-BOX_TABNAME.
ENDIF.
IF P_EXPAND = 'X'.
E05_LS_LAYOUT-EXPAND_FIELDNAME = G_EXPANDNAME.
ELSE.
CLEAR E05_LS_LAYOUT-EXPAND_FIELDNAME.
ENDIF.
E05_LS_LAYOUT-NO_INPUT = P_NOINPT.
E05_LS_LAYOUT-NO_COLHEAD = P_NOCOLH.
IF P_LIGHTS = 'X' OR P_LIGHTC = 'X'.
E05_LS_LAYOUT-LIGHTS_FIELDNAME = P_LIGNAM.
E05_LS_LAYOUT-LIGHTS_TABNAME = G_TABNAME_ITEM.
ELSE.
CLEAR E05_LS_LAYOUT-LIGHTS_FIELDNAME.
CLEAR E05_LS_LAYOUT-LIGHTS_TABNAME.
ENDIF.
IF P_GPCE = 'X'.
E05_LS_LAYOUT-GROUP_CHANGE_EDIT = 'X'.
ENDIF.
E05_LS_LAYOUT-LIGHTS_CONDENSE = P_LIGHTC.
E05_LS_LAYOUT-TOTALS_TEXT = P_TOTEXT.
E05_LS_LAYOUT-SUBTOTALS_TEXT = P_STTEXT.
E05_LS_LAYOUT-TOTALS_ONLY = P_TOTONL.
E05_LS_LAYOUT-KEY_HOTSPOT = P_KEYHOT.
E05_LS_LAYOUT-DETAIL_POPUP = P_DETPOP.
ENDFORM.
FORM E06_T_SORT_BUILD *
--> E06_LT_SORT *
FORM E06_T_SORT_BUILD USING E06_LT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'CARRID'.
LS_SORT-TABNAME = G_TABNAME_HEADER.
LS_SORT-SPOS = 1.
LS_SORT-UP = 'X'.
APPEND LS_SORT TO E06_LT_SORT.
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'CONNID'.
LS_SORT-TABNAME = G_TABNAME_ITEM.
LS_SORT-SPOS = 2.
LS_SORT-DOWN = 'X'.
APPEND LS_SORT TO E06_LT_SORT.
ENDFORM.
FORM E07_SP_GROUP_BUILD *
--> E07_LT_SP_GROUP *
FORM E07_SP_GROUP_BUILD USING E07_LT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV.
DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
CLEAR LS_SP_GROUP.
LS_SP_GROUP-SP_GROUP = 'A'.
LS_SP_GROUP-TEXT = TEXT-005.
APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
ENDFORM.
FORM SELECTION *
FORM SELECTION.
SELECT * FROM SCARR INTO CORRESPONDING FIELDS OF TABLE GT_SCARR
WHERE CARRID IN CARRID.
SELECT * FROM SPFLI INTO CORRESPONDING FIELDS OF TABLE GT_SPFLI
UP TO P_MAXROW ROWS
WHERE CARRID IN CARRID.
LOOP AT GT_SCARR.
READ TABLE GT_SPFLI WITH KEY CARRID = GT_SCARR-CARRID.
IF SY-SUBRC NE 0.
DELETE GT_SCARR.
ENDIF.
ENDLOOP.
PERFORM E02_DATA_ADD TABLES GT_SPFLI.
ENDFORM.
FORM TOP_OF_PAGE *
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM.
FORM F4_FOR_VARIANT *
FORM F4_FOR_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = G_VARIANT
I_SAVE = G_SAVE
I_TABNAME_HEADER = G_TABNAME_HEADER
I_TABNAME_ITEM = G_TABNAME_ITEM
it_default_fieldcat =
IMPORTING
E_EXIT = G_EXIT
ES_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 2.
MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF G_EXIT = SPACE.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
ENDIF.
ENDFORM.
*& Form PAI_OF_SELECTION_SCREEN
text
FORM PAI_OF_SELECTION_SCREEN.
IF NOT P_VARI IS INITIAL.
MOVE G_VARIANT TO GX_VARIANT.
MOVE P_VARI TO GX_VARIANT-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT.
G_VARIANT = GX_VARIANT.
ELSE.
PERFORM VARIANT_INIT.
ENDIF.
ENDFORM. " PAI_OF_SELECTION_SCREEN
*& Form VARIANT_INIT
text
--> p1 text
<-- p2 text
FORM VARIANT_INIT.
CLEAR G_VARIANT.
G_VARIANT-REPORT = G_REPID.
ENDFORM. " VARIANT_INIT
Regards,
Kiran
Maybe you are looking for
-
Getting Duplicate data Records error while loading the Master data.
Hi All, We are getting Duplicate data Records error while loading the Profit centre Master data. Master data contains time dependent attributes. the load is direct update. So i made it red and tried to reloaded from PSA even though it is throwing sam
-
PPC & Intel backing up on the same hard drive?
Hi alll. I´ve been using time Machine with my iMac G5 for several months without a glitch on an external USB HD. Now my wife bought a new iMac 20" and we want to use the same USB HD for her backups as well. Here´s what I did so far: I partitioned the
-
Pre+ help pages don't work
Does anybody know why the Palm Pre+ help page don't work? Everytime I ask for help on ANY subject all I get is a message that reads "Failed to load requested page" I guess the palm is trying to load a page from the internet, but the server can't prov
-
Sales process from inquiry to Payment Invoice.
Hi, Can any body explain the SALES PROCESS in SAP -SD I know about- Inquiry, Quotation, Purchase order, Sales order, Ref to quotation P.O and with ref to Quotation. Shipping,Delivery, Billing, Payment. Where Debit memo reqest and credit memo request
-
ITunes 9.2: Lots of errors
I've recently downloaded and installed iTunes 9.2, but there are lots of errors. The executables MobileBackup, MDCrashReportTool, MobileDeviceHelper and Upgradedb crash on the way to iTunes. I have an iPhone 3GS and Windows XP Professional. Well, i'm