ALV list problem
Hi all,
I am facing a strange problem in ALV. i have two internal tables one is for alv header and another is alv line items. i have a proper data in in both internal tables.
when i pass the data of these two internal tables to the function REUSE_ALV_HIERSEQ_LIST_DISPLAY i found in the output that line items date changes.
actually date is in format 04112005 but when i see the output its showing like this 05.20.0411 .
please help me to solve the problem.
Regards,
Lisa
Hii
use this func module
<b>CONVERT_DATE_TO_INTERN_FORMAT</b>
<b>CONVERSION_EXIT_PDATE_INPUT</b>
Thsi will give the dtae in YYYY.MM.DD format
check this program for reference
REPORT Z_50657_ALV_EX1
MESSAGE-ID ZZ .
Type Pools *
TYPE-POOLS: SLIS.
Tables *
TABLES: LFA1, "Vendor Master
LFB1, "Vendor Master (Company Code)
LFM1. "purchasing organization data
Internal Tables *
TABLE TO HOLD DATA FROM VENDOR MASTER
DATA: BEGIN OF IT_LFA1 OCCURS 0,
LIFNR LIKE LFA1-LIFNR, "Account Number of Vendor
KTOKK LIKE LFA1-KTOKK, "Vendor account group
NAME1 LIKE LFA1-NAME1, "Name
STRAS LIKE LFA1-STRAS, "House Number and Street
ORT01 LIKE LFA1-ORT01, "City
REGIO LIKE LFA1-REGIO, "Region
PFORT LIKE LFA1-PFORT, "PO Box City
PSTLZ LIKE LFA1-PSTLZ, "Postal Code
PSTL2 LIKE LFA1-PSTL2, "P.O. Box
TELF1 LIKE LFA1-TELF1, "First telephone number
END OF IT_LFA1.
TABLE TO HOLD DATA ABOUT COMPANY
DATA: BEGIN OF IT_LFB1 OCCURS 0,
LIFNR LIKE LFB1-LIFNR, "Account Number of Vendor
BUKRS LIKE LFB1-BUKRS, "COMP CODE
END OF IT_LFB1.
TABLE TO HOLD DATA ABOUT PURCHASING ORG
DATA: BEGIN OF IT_LFM1 OCCURS 0,
LIFNR LIKE LFM1-LIFNR, "Account Number of Vendor
EKORG LIKE LFM1-EKORG, "Purchasing Organization
END OF IT_LFM1.
TABLE TO HOLD DATA FOR FINAL DISPLAY
DATA: BEGIN OF IT_FINAL OCCURS 0,
LIFNR LIKE LFB1-LIFNR, "Account Number of Vendor
BUKRS LIKE LFB1-BUKRS, "COMP CODE
EKORG LIKE LFM1-EKORG, "Purchasing Organization
KTOKK LIKE LFA1-KTOKK, "Vendor account group
NAME1 LIKE LFA1-NAME1, "Name
STRAS LIKE LFA1-STRAS, "House Number and Street
ORT01 LIKE LFA1-ORT01, "City
REGIO LIKE LFA1-REGIO, "Region
PFORT LIKE LFA1-PFORT, "PO Box City
PSTLZ LIKE LFA1-PSTLZ, "Postal Code
PSTL2 LIKE LFA1-PSTL2, "P.O. Box
TELF1 LIKE LFA1-TELF1, "First telephone number
END OF IT_FINAL.
DATA: V_INDEX TYPE SY-TABIX.
Work Areas *
*WORK AREAS DEFINED FOR ALV'S
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT TYPE SLIS_LAYOUT_ALV.
Selection-Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_LIFNR FOR LFA1-LIFNR, "ACCOUNT NUMBER
S_BUKRS FOR LFB1-BUKRS, "COMPANY CODE
S_EKORG FOR LFM1-EKORG, "PURCHASING ORG
S_KTOKK FOR LFA1-KTOKK. "ACCOUNT GROUP
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS: LIST RADIOBUTTON GROUP G1, "ALV LIST DISPLAY
GRID RADIOBUTTON GROUP G1. "ALV GRID DISPLAY
SELECTION-SCREEN END OF BLOCK B2.
At Selection-Screen *
AT SELECTION-SCREEN.
PERFORM VALIDATION.
Start of Selection *
START-OF-SELECTION.
*POPULATE DATA INTO ITAB_FINAL USING INNER JOINS OF IT_LFA1 IT_LFB1
*IT_LFM1
PERFORM GET_DATA.
*CHECK FOR RADIO BUTTON SELECTION AND ACCORDINGLY DISPLAY ALV GRID/LIST
PERFORM CHECK_SEL.
*& Form VALIDATION
text
FORM VALIDATION.
IF S_LIFNR IS NOT INITIAL.
SELECT SINGLE LIFNR FROM LFA1 INTO IT_LFA1 WHERE LIFNR IN S_LIFNR.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'THIS IS NOT A VALID VENDOR NUMBER'.
STOP.
ELSE.
IF S_BUKRS IS NOT INITIAL.
SELECT SINGLE BUKRS FROM LFB1 INTO IT_LFB1-BUKRS WHERE BUKRS IN
S_BUKRS.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'THIS IS NOT A VALID COMPANY CODE'.
STOP.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CLEAR IT_LFA1.
CLEAR IT_LFB1.
ENDFORM. "VALIDATION
*& Form GET_DATA
text
FORM GET_DATA.
SELECT LIFNR
KTOKK
NAME1
STRAS
ORT01
REGIO
PFORT
PSTLZ
PSTL2
TELF1
FROM LFA1
INTO TABLE IT_LFA1
WHERE LIFNR IN S_LIFNR AND KTOKK IN S_KTOKK.
SORT IT_LFA1 BY LIFNR.
IF NOT IT_LFA1[] IS INITIAL.
SELECT LIFNR
BUKRS
FROM LFB1
INTO TABLE IT_LFB1
FOR ALL ENTRIES IN IT_LFA1 WHERE LIFNR = IT_LFA1-LIFNR AND
BUKRS IN S_BUKRS.
SORT IT_LFB1 BY LIFNR BUKRS.
SELECT LIFNR
EKORG
FROM LFM1
INTO TABLE IT_LFM1
FOR ALL ENTRIES IN IT_LFA1 WHERE LIFNR = IT_LFA1-LIFNR.
SORT IT_LFM1 BY LIFNR.
ENDIF.
IT_FINAL[] = IT_LFB1[].
LOOP AT IT_FINAL.
V_INDEX = SY-TABIX.
READ TABLE IT_LFA1 WITH KEY LIFNR = IT_FINAL-LIFNR BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE: IT_LFA1-KTOKK TO IT_FINAL-KTOKK,
IT_LFA1-NAME1 TO IT_FINAL-NAME1,
IT_LFA1-STRAS TO IT_FINAL-STRAS,
IT_LFA1-ORT01 TO IT_FINAL-ORT01,
IT_LFA1-REGIO TO IT_FINAL-REGIO,
IT_LFA1-PFORT TO IT_FINAL-PFORT,
IT_LFA1-PSTLZ TO IT_FINAL-PSTLZ,
IT_LFA1-PSTL2 TO IT_FINAL-PSTL2,
IT_LFA1-TELF1 TO IT_FINAL-TELF1.
ENDIF.
READ TABLE IT_LFM1 WITH KEY LIFNR = IT_FINAL-LIFNR BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE IT_LFM1-EKORG TO IT_FINAL-EKORG.
ENDIF.
MODIFY IT_FINAL INDEX V_INDEX.
ENDLOOP.
LOOP AT IT_LFA1.
LOOP AT IT_FINAL WHERE LIFNR = IT_LFA1-LIFNR.
MOVE IT_LFA1-KTOKK TO IT_FINAL-KTOKK.
MODIFY IT_FINAL INDEX SY-TABIX.
MOVE IT_LFA1-NAME1 TO IT_FINAL-NAME1.
MODIFY IT_FINAL INDEX SY-TABIX.
MOVE IT_LFA1-STRAS TO IT_FINAL-STRAS.
MODIFY IT_FINAL INDEX SY-TABIX.
MOVE IT_LFA1-ORT01 TO IT_FINAL-ORT01.
MODIFY IT_FINAL INDEX SY-TABIX.
MOVE IT_LFA1-REGIO TO IT_FINAL-REGIO.
MODIFY IT_FINAL INDEX SY-TABIX.
MOVE IT_LFA1-PFORT TO IT_FINAL-PFORT.
MODIFY IT_FINAL INDEX SY-TABIX.
MOVE IT_LFA1-PSTLZ TO IT_FINAL-PSTLZ.
MODIFY IT_FINAL INDEX SY-TABIX.
MOVE IT_LFA1-PSTL2 TO IT_FINAL-PSTL2.
MODIFY IT_FINAL INDEX SY-TABIX.
MOVE IT_LFA1-TELF1 TO IT_FINAL-TELF1.
MODIFY IT_FINAL INDEX SY-TABIX.
ENDLOOP.
ENDLOOP.
LOOP AT IT_LFM1.
LOOP AT IT_FINAL WHERE LIFNR = IT_LFM1-LIFNR.
MOVE IT_LFM1-EKORG TO IT_FINAL-EKORG.
MODIFY IT_FINAL INDEX SY-TABIX.
ENDLOOP.
ENDLOOP.
SORT IT_FINAL BY LIFNR BUKRS EKORG.
ENDFORM. "GET_DATA
*& Form CHECK_SEL
text
FORM CHECK_SEL.
X_FIELDCAT-FIELDNAME = 'LIFNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-SELTEXT_L = 'VENDOR'.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = 10.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'BUKRS'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-SELTEXT_L = 'COMPANY'.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = 4.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'EKORG'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-SELTEXT_L = 'PURCHASING ORGANISATION'.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = 4.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'KTOKK'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-SELTEXT_L = 'ACCOUNT GROUP'.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = 4.
X_FIELDCAT-COL_POS = 4.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'NAME1'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-SELTEXT_L = 'VENDOR NAME'.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = 35.
X_FIELDCAT-COL_POS = 5.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'STRAS'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-SELTEXT_L = 'STREET'.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = 10.
X_FIELDCAT-COL_POS = 6.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'ORT01'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-SELTEXT_L = 'CITY NAME'.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = 20.
X_FIELDCAT-COL_POS = 7.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'REGIO'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-SELTEXT_L = 'REGION NAME'.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = 2.
X_FIELDCAT-COL_POS = 8.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
IF LIST = 'X'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_FINAL'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_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.
L_LAYOUT-ZEBRA = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_FINAL
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.
ELSE.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_FINAL'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_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.
L_LAYOUT-ZEBRA = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_FINAL
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.
ENDIF.
Regards
Naresh
Similar Messages
-
Hi All
I have developed ALV report which is working fine
while i double click on one record i need to call another transaction code i.e "COHV" which is also working fine
and the value is not population to that transaction code.
I have written code like this
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE ta_final INTO wa_final INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
IF rs_selfield-fieldname = 'AUFNR'.
SET PARAMETER ID 'ANR' FIELD wa_final-aufnr.
* GET PARAMETER ID 'ANR' FIELD rs_selfield-value.
CALL TRANSACTION 'COHV'." AND SKIP FIRST SCREEN .
ENDIF.
ENDIF.
ENDCASE.
this is not working
now i came to know that is t-code for a report selection screen how to pass the value to that
Please help me
SurendraHi
1. Use SUBMIT COHVOMPP AND RETURN instead of CALL TRANSACTION 'COHV'.
2. Here's some example code of SUBMITTING a program WITH SELECT-OPTIONS:
DATA: SELTAB TYPE TABLE OF RSPARAMS,
SELTAB_WA LIKE LINE OF SELTAB.
MOVE: 'LANGU' TO SELTAB_WA-SELNAME,
'S' TO SELTAB_WA-KIND, " SELECT-OPTION
'I' TO SELTAB_WA-SIGN,
'BT' TO SELTAB_WA-OPTION,
'D' TO SELTAB_WA-LOW,
'I' TO SELTAB_WA-HIGH.
APPEND SELTAB_WA TO SELTAB.
MOVE: 'E' TO SELTAB_WA-SIGN,
'EQ' TO SELTAB_WA-OPTION,
'F' TO SELTAB_WA-LOW,
SPACE TO SELTAB_WA-HIGH.
APPEND SELTAB_WA TO SELTAB.
CLEAR SELTAB_WA.
MOVE: 'ARBGB' TO SELTAB_WA-SELNAME,
'P' TO SELTAB_WA-KIND, " PARAMETER
'XX' TO SELTAB_WA-LOW.
APPEND SELTAB_WA TO SELTAB.
SUBMIT REPORT00
USING SELECTION-SET 'VARIANT1'
WITH ARBGB CP 'A*'
WITH SELECTION-TABLE SELTAB
AND RETURN. -
Scrolling-problem in an editable ALV-list
Hi,
I have built an <b>ALV-list</b> with one of the fields <b>open for input</b>. The user wants to use the arrow to scroll <u>down</u> through the table and update that particular field in every row. I have <b>2</b> questions about this:
- First of all, the cursor moves in a strange way. The first number of rows it stays in the right column, but then, out of the blue, it jumps back and forth to other columns after scrolling.
- Secondly, the field I want to edit is always in Insert-mode. Is there any way I can get it into Overwrite-mode? I cannot use the Tab-key, because of the lead-selection.
Thanks in advance for your help.
Kind regards,
Andre MoniharaponHi Vijay,
please don't get me wrong, I really appreciate your attempts to help me, but my problem is that when I press the Down-arrow it <u>doesn't</u> always go to the next cell in the <i>same</i> column. It sometimes goes to the next cell in <i>another</i> column. And if I can't force it to stay in the same column in some way, than my problem cannot be solved and I must think of another solution. So, I don't want the cursor to stay in the same field, I want it to go to the next cell in the same column. You got that right. Again, I really appreciate your help, but it looks more and more that there's no solution to my problem.
Kind regards,
Andre -
Problem with printing ALV lists
Hey Guys,
I have a problem with printing ALV lists ,
I created a report with several ALV lists (not grids) on the same screen but when i attempt to print the report
it prints each alv list on a different page..so if i have 3 alv lists in the same report it will print the report on 3 pages
How can i print them all in one page?
Thanks in advance
Noha Salah.Hey Max,
I tried setting the Layout-list_append before my block_list_append function call
And setting the is_print-NO_NEW_PAGE , it printed the 3 lists on one page the only problem i have
is that the lists are truncated and the list formats has totally been messed up..how can i restore them back
to their original format? -
Problem in Printing the ALV list
Hi,
I have one problem with printing the ALV list. While printing the ALV list(thro Print Icon on application Tool bar) ,Fist page of my print out contains some other inforamtion.
inforamtions included two tables
first table contains Sort Criteria, Ascdg, Descnd, Subtotal columns.
And second table contains Data statistics , number of
columns.
But from Second page onwards , my alv list printed correctly .
How can i avoid the First page inforamtion and
what is the Reason of coming like this?
Thanks,
Neptune.MI assume you are using function module Reuse_alv_grid_display or reuse_alv_list_display for ALV.
If this is the case, there is a parameter called IS_PRINT that you need to supply while calling the function module.
you can for exapmle declare
data:
printstruc type SLIS_PRINT_ALV.
printstruc-NO_PRINT_LISTINFOS = 'X'.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_PRINT = printstruc
There are many other flags in is_print structures that you can use to manipulate the printing.
Cheers! -
Problem in Expand when using Blocked ALV list
Hi All,
I am using the Blocked list ALV to display two lists in a program. One among them is a hierarchial ALV. When i click on the Expand button of this ALV it terminates with the runtime error "GETWA_NOT_ASSIGNED".
I was able to use this functionality using similar code in a stand alone hierarchial ALV list in another program without any problem.
I have assigned the Expand Field name as follows in both programs:
wa_layout-expand_fieldname = 'EXPAND'
Any suggestions or help in this would be highly appreciated.
Thanks & Reagrds,
PraveenHai Praveen
Check the following Code
*& Report ZALV_BLOCKLIST *
REPORT ZALV_BLOCKLIST NO STANDARD PAGE HEADING
LINE-SIZE 150
LINE-COUNT 60(4)
MESSAGE-ID Z00.
*..Type Definitions for ALV Report
TYPE-POOLS SLIS.
*..Includes
*for ICONs
*INCLUDE <ICON>.
Table/Structure declarations. *
TABLES: MARA,
MARC,
T134.
Internal Tables declaration *
*..To store Basic Report fields
DATA:BEGIN OF IT_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
MEINS LIKE MARA-MEINS,
NTGEW LIKE MARA-NTGEW,
END OF IT_MARA.
*DATA:BEGIN OF IT_MATKL OCCURS 0,
MATKL LIKE T023-MATKL,
WGBEZ LIKE T023-WGBEZ,
END OF IT_MATKL.
DATA:BEGIN OF IT_MARC OCCURS 0,
WERKS LIKE MARC-WERKS,
LADGR LIKE MARC-LADGR,
MTVFP LIKE MARC-MTVFP,
DISPR LIKE MARC-DISPR,
DISMM LIKE MARC-DISMM,
DISPO LIKE MARC-DISPO,
END OF IT_MARC.
ALV Type declaration *
DATA:V_NO_DATA TYPE C.
ALV Type declaration *
DATA:V_REPID TYPE SYREPID.
DATA: IT_FIELDCATALOG_MARA TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCATALOG_MARA TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCATALOG_MARC TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCATALOG_MARC TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCATALOG_MATKL TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCATALOG_MATKL TYPE SLIS_FIELDCAT_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT,
WA_KEYINFO TYPE SLIS_KEYINFO_ALV.
Selection Screen. *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR ,
S_MTART FOR MARA-MTART .
SELECTION-SCREEN END OF BLOCK B1.
Event:Initialization *
INITIALIZATION.
*Report Name
V_REPID = SY-REPID.
AT Selection Screen. *
AT SELECTION-SCREEN.
Event: Start-of-Selection *
START-OF-SELECTION.
PERFORM FETCH_DATA.
Event: End-of-Selection *
END-OF-SELECTION.
IF V_NO_DATA = ''.
MESSAGE I010 WITH 'NO DATA TO DISPLAY ! '.
EXIT.
ELSE.
PERFORM FILL_FIELDCAT_MARA.
PERFORM FILL_FIELDCAT_MAKT.
PERFORM FILL_FIELDCAT_MARC.
PERFORM FILL_LAYOUT.
PERFORM CALL_ALV_INIT.
PERFORM ADD_LISTS.
PERFORM DISPLAY_BLOCK_LIST.
ENDIF.
FORM DEFINITIONS *
*& Form FETCH_DATA
text
--> p1 text
<-- p2 text
FORM FETCH_DATA.
SELECT MATNR
MTART
MATKL
MEINS
NTGEW
INTO CORRESPONDING FIELDS OF TABLE IT_MARA
FROM MARA
WHERE MATNR IN S_MATNR
AND MTART IN S_MTART.
IF SY-SUBRC <> 0.
V_NO_DATA = ''.
ELSE.
V_NO_DATA = 'X'.
SELECT WERKS
LADGR
MTVFP
DISPR
DISMM
DISPO
INTO CORRESPONDING FIELDS OF TABLE IT_MARC
FROM MARC
WHERE MATNR IN S_MATNR.
ENDIF.
ENDFORM. " FETCH_DATA
*& Form FILL_FIELDCAT_MARA
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_MARA.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME =
I_STRUCTURE_NAME = 'IT_MARA'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = V_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCATALOG_MARA
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.
LOOP AT IT_FIELDCATALOG_MARA INTO WA_FIELDCATALOG_MARA.
CASE WA_FIELDCATALOG_MARA-FIELDNAME.
WHEN 'MATNR'.
WA_FIELDCATALOG_MARA-COL_POS = '1'.
WA_FIELDCATALOG_MARA-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARA-SELTEXT_L = 'Material NO'.
WHEN 'MTART'.
WA_FIELDCATALOG_MARA-COL_POS = '2'.
WA_FIELDCATALOG_MARA-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARA-SELTEXT_L = 'Mat Type'.
WHEN 'MATKL'.
WA_FIELDCATALOG_MARA-COL_POS = '3'.
WA_FIELDCATALOG_MARA-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARA-SELTEXT_L = 'Mat Group'.
WHEN 'MEINS'.
WA_FIELDCATALOG_MARA-COL_POS = '4'.
WA_FIELDCATALOG_MARA-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARA-SELTEXT_L = 'Measure Unit'.
WHEN 'NTGEW'.
WA_FIELDCATALOG_MARA-COL_POS = '5'.
WA_FIELDCATALOG_MARA-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARA-SELTEXT_L = 'Net Wt'.
WA_FIELDCATALOG_MARA-DO_SUM = 'X'.
ENDCASE.
MODIFY IT_FIELDCATALOG_MARA FROM WA_FIELDCATALOG_MARA INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " FILL_FIELDCAT_MARA
*& Form FILL_FIELDCAT_MARC
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_MARC.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_MARC'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = V_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCATALOG_MARC
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.
LOOP AT IT_FIELDCATALOG_MARC INTO WA_FIELDCATALOG_MARC.
CASE WA_FIELDCATALOG_MARC-FIELDNAME.
WHEN 'WERKS'.
WA_FIELDCATALOG_MARC-COL_POS = '1'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'PLANT NAME'.
WHEN 'LADGR'.
WA_FIELDCATALOG_MARC-COL_POS = '2'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'Loading Group'.
WHEN 'MTVFP'.
WA_FIELDCATALOG_MARC-COL_POS = '3'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '20'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'Checking group'.
WHEN 'DISPR'.
WA_FIELDCATALOG_MARC-COL_POS = '4'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'MRP PROFILE'.
WHEN 'DISMM'.
WA_FIELDCATALOG_MARC-COL_POS = '5'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'MRP TYPE'.
WHEN 'DISPO'.
WA_FIELDCATALOG_MARC-COL_POS = '6'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'MRP CONTROLLER'.
ENDCASE.
MODIFY IT_FIELDCATALOG_MARC FROM WA_FIELDCATALOG_MARC INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " FILL_FIELDCAT_MARC
*& Form FILL_FIELDCAT_MAKT
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_MAKT.
ENDFORM. " FILL_FIELDCAT_MAKT
*& Form CALL_ALV_INIT
text
--> p1 text
<-- p2 text
FORM CALL_ALV_INIT.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IT_EXCLUDING =
ENDFORM. " CALL_ALV_INIT
*& Form ADD_LISTS
text
--> p1 text
<-- p2 text
FORM ADD_LISTS.
*ADD IT_MARA TABLE TO THE OUTPUT
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCATALOG_MARA
I_TABNAME = 'IT_MARA'
IT_EVENTS = IT_EVENTS
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARA
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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.
**ADD IT_MARC TABLE TO THE OUTPUT
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCATALOG_MARC
I_TABNAME = 'IT_MARC'
IT_EVENTS = IT_EVENTS
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARC
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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. " ADD_LISTS
*& Form FILL_LAYOUT
text
--> p1 text
<-- p2 text
FORM FILL_LAYOUT.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
ENDFORM. " FILL_LAYOUT
*& Form DISPLAY_BLOCK_LIST
text
--> p1 text
<-- p2 text
FORM DISPLAY_BLOCK_LIST.
WA_KEYINFO-HEADER01 = 'MATNR'.
WA_KEYINFO-ITEM01 = 'MATNR'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
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 =
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_BLOCK_LIST .
Thanks & regards
Sreenivasulu P -
Hi friends,
I have created one program with alv list, but i am unable to add one header and footer, also i have to add one logo to the program. Plese some one tell me a easy procedure to add a header, footer and also a logo. If you can show me one with example that would be very helpful.
This is my program, plz add the necessary parts.
*& Report Y_BOM2_ALV
REPORT y_bom2_alv LINE-SIZE 350 LINE-COUNT 350.
*& Include YINCLUDE1
TABLES : mast, stko, stpo.
TYPE-POOLS : slis.
DATA : BEGIN OF iall OCCURS 10,
matnr LIKE mast-matnr,
werks LIKE mast-werks,
stlan LIKE mast-stlan,
stlal LIKE mast-stlal,
stlst LIKE stko-stlst,
posnr LIKE stpo-posnr,
idnrk LIKE stpo-idnrk,
menge LIKE stpo-menge,
meins LIKE stpo-meins,
ausch LIKE stpo-ausch,
lgort LIKE stpo-lgort,
END OF iall.
DATA : i_repid LIKE sy-repid,
i_lines LIKE sy-tabix.
DATA : int_fcat TYPE slis_t_fieldcat_alv.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE title1.
PARAMETER : p_werks LIKE mast-werks.
SELECT-OPTIONS : s_matnr FOR mast-matnr.
SELECTION-SCREEN END OF BLOCK a1.
INITIALIZATION.
title1(50) = ' Bill Of Material Input Screen '.
*& Include YINCLUDE2
START-OF-SELECTION.
SELECT mastmatnr mastwerks maststlan maststlal stko~stlst
stpoposnr stpoidnrk stpomenge stpomeins stpo~ausch
stpo~lgort INTO TABLE iall FROM stpo INNER JOIN stko ON
stpostlnr = stkostlnr INNER JOIN mast ON
stpostlnr = maststlnr WHERE mast~werks EQ
p_werks AND mast~matnr IN s_matnr.
IF sy-subrc <> 0 OR p_werks EQ ' ' OR s_matnr EQ ' '.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
titel = 'ERROR MESSAGE ( INPUT ERROR / WRONG INPUT ) '
textline1 = ' PLANT / MATERIAL Invalid or Empty '
textline2 = ' Plese enter plant no / material no again '
start_column = 20
start_row = 5.
EXIT.
ENDIF.
CLEAR i_lines.
DESCRIBE TABLE iall LINES i_lines.
IF i_lines LT 1.
WRITE: /
'No materials found.'.
EXIT.
ENDIF.
END-OF-SELECTION.
i_repid = sy-repid.
*& Include YINCLUDE3
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_repid
i_internal_tabname = 'IALL'
i_inclname = i_repid
CHANGING
ct_fieldcat = int_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = i_repid
it_fieldcat = int_fcat
i_save = 'A'
TABLES
t_outtab = iall
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.Hi Tapodipta,
See below example and modify ur code according to ur requirement..
REPORT ZTEST_ALV_CHECK .
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT type slis_layout_alv,
x_events type slis_alv_event,
it_events type SLIS_T_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
x_events-NAME = SLIS_EV_END_OF_PAGE.
x_events-FORM = 'END_OF_PAGE'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
x_events-NAME = SLIS_EV_TOP_OF_PAGE.
x_events-FORM = 'TOP_OF_PAGE'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
x_events-NAME = slis_ev_end_of_list.
x_events-FORM = 'END_OF_LIST'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
it_events = it_events
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.
FORM TOP_OF_PAGE.
* BREAK-POINT.
WRITE: / 'TOP_OF_PAGE'.
ENDFORM.
FORM END_OF_LIST.
* BREAK-POINT.
"here you can use this for footer
WRITE: / 'FOR FOOTER'.
ENDFORM.
FORM END_OF_PAGE.
* BREAK-POINT.
WRITE: / 'END_OF_PAGE'.
ENDFORM.
Go through the link as well..
Re: ALV Footer
Hope it will solve ur problem..
<b>Reward points if useful..</b>
Thanks & Regards
ilesh 24x7 -
Alv list report-problems while printing
hai,
i get following dump error when tryign to print a alv list report.
'Illegal interruption of the event LOAD-OF-PROGRAM.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLSZA12" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
During the flow of the event LOAD-OF-PROGRAM (event for the
initialization of an ABAP program), a condition occurred under which
the event was to be left early. This is not permitted as it would
result in an inconsistent status in the ABAP program.'
the problem resolves for a particular output(when i restrict the list to lesser rows) by changing FORMAT from
X_65_255 to X_90_120 in the print dialog properties option..
however this restricts the coloumn width..
anycase i will have to print the output for all conditions.
the problem seems to be centred around number of rows in the list output..is somethign wrong with the values in this internal table gt_comtypes_tab...
this is where the dump is pointing..at LAOD OF PROGRAM EVENT
1 FUNCTION addr_get_conversion_table.
2 *"----
3 ""Lokale Schnittstelle:
4 *" EXPORTING
5 *" VALUE(COMTYPES_TAB) TYPE ADCOMTYPES_TAB
6 *" EXCEPTIONS
7 *" INTERNAL_ERROR
8 *"----
9
10 comtypes_tab = gt_comtypes_tab.
11
12 ENDFUNCTION.
values of gt_comtypes_tab.
2 TEL ADTEL
3 FAX ADFAX
4 TTX ADTTX
5 TLX ADTLX
6 INT ADSMTP
7 RML ADRML
8 X40 ADX400
9 RFC ADRFC
10 PRT ADPRT
11 SSF ADSSF
12 URI ADURI
13 PAG ADPAG -
Problems submitting ALV list to spool
Hi!
When sending the ALV list (function module REUSE_ALV_GRID_DISPLAY) to sap-spool, there seems to be a problem with the <b>"Total"</b> lines. When the <b>"Total"</b> line appears on a page break, it's not displayed at all - not at the end of the current page nor at the top of the next page. All the other <b>"Total"</b> lines are displayed correctly, as long as they don't appear on a page break.
Does anyone know how to solve this problem?
- Mari VirikI have not heard of this. I would suggest that you search OSS notes for this issue. Or report the problem directly to SAP through OSS.
-
Hai Friends,
In my ALV List header..i am writing date , time and my program name.
but all are coming on left side.
can i get date on left side, program name on centered and time on write side.
my code is like this.
FORM list_headers.
lists-typ = 'H'.
lists-info = text-010.
APPEND lists.
CLEAR lists.
lists-typ = 'S'.
lists-key = text-011.
CONCATENATE sy-datum+6(2) '/'
sy-datum+4(2) '/'
sy-datum+0(4) INTO lists-info.
APPEND lists.
CLEAR lists.
lists-typ = 'S'.
lists-key = text-012.
CONCATENATE sy-uzeit+0(2) ':'
sy-uzeit+2(2) ':'
sy-uzeit+4(2) INTO lists-info.
APPEND lists.
CLEAR lists.
ENDFORM.Hi again,
1. first of all how are u writing / displaying
the alv header ?
2. using documentary write ?
then also, u can use one variable of
length 100 and use this concept.
3. If u are using top_of_page
event,
in this event, WE CAN use WRITE.
(i have used it, and it
works fantastic)
(not in case of alv grid)
4. My point is, what ever u are using,
use on variable of length 100.
WRITE value INTO variable.
using offset
and then proceed further.
regards,
amit m. -
Reg:ALV list Background Problem
Dear All,
I created a ALV LIST report. While i am running in that program in foreground i am getting timeout error. While running in background i am getting the output in improper way. While i am seeing that report in spool request and pressing the spool output display in maximum width i am getting the output list fields in improper position. What should i have to do for this issue?
Thanks,
Sankar MWhen you execute the report in background, u require to provide the width of the output it will be some thing like X_65_255.Try increasing the width.
One more alternative is go to SPAD -> In settings Menu option -> Select Spool System -> go to others tab -> select the check box number of columns for list display format.
Hope this inputs will help you.
Regards,
Shafivullah Mohammad -
Problem with check Box in ALV list
Hi All,
In my alv list I am using Check box and if I enabled the check box after pressing that pushbutton its not reflecting in the internal table how can I resolve it.
Please find below the piece of codes
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
sy-ucomm = ucomm.
CASE ucomm.
When 'SAVE'.
I am checking my internal table value here.
my logic....
When others.
Endcase.
FORM FIELD_CATLOGUE USING VALUE(P_tname) "Int.table name
VALUE(P_fname) "Field name
VALUE(P_title) "Column name
VALUE(P_sum) "Sum
VALUE(P_edit) "Edit
VALUE(P_Check). " Check box
CLEAR wa_fcat.
wa_fcat-tabname = p_tname.
wa_fcat-fieldname = p_fname.
wa_fcat-seltext_l = p_title.
wa_fcat-do_sum = P_Sum.
Wa_Fcat-edit = P_Edit.
Wa_Fcat-checkbox = P_Check.
Append wa_fcat to i_fcat.
gs_user_command type slis_formname value 'USER_COMMAND'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = i_fcat
is_layout = ilay
I_DEFAULT = 'X'
I_SAVE = 'A'
I_CALLBACK_PF_STATUS_SET = gs_user_status
i_callback_user_command = gs_user_command
TABLES
t_outtab = it_data
EXCEPTIONS
program_error = 1
others = 2.Hi,
Refer this program:-
* internal table and alv declarations
* with one field in internal table as
* flag(1) type c (for checkbox in alv)
* START-OF-SELECTION
START-OF-SELECTION.
"your select query to populate data in internal table
* END-OF-SELECTION
END-OF-SELECTION.
* FIELD CATALOG FOR FIRST GRID DISPLAY
PERFORM field_catalog.
* SORT W.R.T. WORK ORDER NUMBER FOR FIRST GRID DISPLAY
PERFORM sort_field.
* FOR LAYOUT FOR FIRST GRID DISPLAY
PERFORM set_layout.
* DISPLAY RECORDS IN ALV GRID FOR FIRST GRID DISPLAY
PERFORM alv_display.
*& SUBROUTINE DEFINITIONS
*& Form FIELD_CATALOG
* SUB-ROUTINE FIELD_CATALOG USED TO SET THE COLUMNS FOR
* THE ALV GRID (OUTPUT FORMAT)
* SETS THE COLUMN NAME AND THE OUTPUT LENGTH FOR THE FIELDS
FORM field_catalog .
wa_field-fieldname = 'FLAG'. " name of field from internal table
wa_field-tabname = 'IT_FINAL'. " internal table name
wa_field-outputlen = 2. " output length on screen
wa_field-checkbox = c_check. " print as checkbox
wa_field-edit = c_check. " make field open for input
wa_field-seltext_l = ' '. " header information
APPEND wa_field TO it_field. " append field catalog internal table
CLEAR wa_field. " clear field catalog work area
wa_field-fieldname = 'AUFNR'. " name of field from internal table
wa_field-tabname = 'IT_FINAL'. " internal table name
wa_field-outputlen = 20. " output length on screen
wa_field-seltext_l = text-003. " header information
APPEND wa_field TO it_field. " append field catalog internal table
CLEAR wa_field. " clear field catalog work area
ENDFORM. " FIELD_CATALOG
*& Form SORT_FIELD
* SUB-ROUTINE SORT_FIELD IS USED TO SORT THE RECORDS IN THE
* INTERNAL TABLE BASED ON THE GIVEN FIELD AND NATURE OF
* SORTING TO BE DONE (ASCENDING OR DESCENDING)
FORM sort_field .
wa_sort-spos = 1. " sort priority
wa_sort-fieldname = 'AUFNR'. " field on which records sorted
wa_sort-tabname = 'IT_FINAL'. " internal table name
wa_sort-up = c_check. " sort ascending
APPEND wa_sort TO it_sort. " append sort info internal table
CLEAR wa_sort. " clear sort info work area
ENDFORM. " SORT_FIELD
*& Form SET_LAYOUT
* SUB-ROUTINE SET_LAYOUT IS USED TO SET THE DISPLAY OF THE
* ALV GRID LINES IN ALTERNATIVE COLOURS
FORM set_layout .
wa_layout-zebra = c_check. " so set colors of line alternatively
ENDFORM. " SET_LAYOUT
*& Form ALV_DISPLAY
* SUB-ROUTINE ALV_DISPLAY IS USED TO SET THE PARAMETERS
* FOR THE FUNCTION MODULE REUSE_ALV_GRID_DISPLAY
* AND PASS THE INTERNAL TABLE EXISTING THE RECORDS TO BE
* DISPLAYED IN THE GRID FORMAT
FORM alv_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_rep_id " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'USER_COMMAND' " for User-Command
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
it_sort = it_sort " sort info
TABLES
t_outtab = it_final " internal 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.
ENDFORM. " ALV_DISPLAY
*& Form pf
* SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
* ON WHICH THE ALV GRID IS DISPLAYED
* -->RT_EXTAB
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZTG_STAT'.
ENDFORM. "pf
*& Form USER_COMMAND
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->L_SELFIELD text
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
* when the function code is EXECUTE then process the selected records
WHEN 'EXECUTE'.
* refresh it_process when user processes selected records
REFRESH it_process.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
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.
* refresh the ALV Grid output from internal table
l_selfield-refresh = c_check.
WHEN 'SEL_ALL'.
* to select all the records displayed in ALV Grid
LOOP AT it_final INTO wa_final.
wa_final-flag = 'X'.
MODIFY it_final FROM wa_final.
ENDLOOP.
* refresh the ALV Grid output from internal table
l_selfield-refresh = c_check.
WHEN 'DESEL_ALL'.
* to deselect all the records displayed in ALV Grid
LOOP AT it_final INTO wa_final.
wa_final-flag = ' '.
MODIFY it_final FROM wa_final.
ENDLOOP.
* refresh the ALV Grid output from internal table
l_selfield-refresh = c_check.
ENDCASE.
ENDFORM. "USER_COMMAND
Hope this helps you.
Regards,
Tarun. -
Problems converting ALV LIST to ALV GRID
Hey guys
when i changed the name of the function REUSE_ALV_LIST_DISPLAY to REUSE_ALV_GRID_DISPLAY..in a report..I get the GRID in next page..
whys is it so??
like the rpeort has the the ALV to be displayed in END_OF_LIST event...(the report has oen HIERARCHIAL ALV as the main ALV LIST and in the END OF LIST it has another ALV)
when i change LIST to GRID ...
the GRID gets itno 2nd page while the rest of the report gets into page 1...
i want both these in 1st page onlyyou can do it with blocks, but the whole thing will be in list mode
REUSE_ALV_BLOCK_LIST_INIT
REUSE_ALV_BLOCK_LIST_HS_APPEND (for hierarchical list)
REUSE_ALV_BLOCK_LIST_APPEND (for simple grid list)
REUSE_ALV_BLOCK_LIST_DISPLAY -
Display error protocol in an alv list
Hi!
I have in my program an alv list.Two of its fields are editable. For one of this field I want to control the value key by the user. So , i used ADD_PROTOCOL_ENTRY from class CL_ALV_CHANGED_DATA_PROTOCOL like in report BCALV_EDIT_04. The control works very well when the user key a wrong value.
But, here is my problem. I add a button to allow user to change value for several line with one click (mass change) and i would like to control entry too.
Since when i call method CHECK_CHANGED_DATA after my mass changes nothing appends, in PAI module i add this code.
DATA WT_CHANGED TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL. CREATE OBJECT WT_CHANGED EXPORTING I_CALLING_ALV = GRID1.
PERFORM MASS_CHANGE.
CALL METHOD G_VERIFIER->HANDLE_DATA_CHANGED( WT_CHANGED ).
In perform mass_change i had this code :
WT_CELLS-ROW_ID = WT_INDEX2-ROW_ID.
WT_CELLS-FIELDNAME = '/BIC/ZC_SIPROD'.
WT_CELLS-VALUE = P_SIPROD.
WT_CELLS-TABIX = W_TABIX.
APPEND WT_CELLS.
APPEND WT_CELLS TO WT_CHANGED->MT_GOOD_CELLS.
The protocol windows appears. When i click on an error message the cell witch contains the error is selected but the fiels <i>name of the columns</i> is empty in the protocol windows and the incorrect value is not deleted.
NB : when i do manual change (i.e line by line) this columns isn't empty and the incorrect value is deleted.
can you help me in order to solve my problem?
Thanks by advance,
LB.
Message was edited by:
Laurent BOUDARTHi,
you can have a look in BCALV_GRID_EDIT.
Look in the perform data_changed.
Edited by: Mario Schmidt on Jun 21, 2010 5:05 AM -
From ALV list to Selection-screen
Hi,
I have problem in coming back to selection screen after displaying ALV List.
In ALV list i'm using check box option to delete selected records. After deletion I'm displaying the remaining records with one more call to ALV function module.
As this is not a secondary list i'm not able to use SY-LSIND and even call selection-screen or leave to screen 0 are not working.
could you please help me out.
Thanks,
Vinay.Hi
You don't have to show the remaining records in another ALV.
In the user command sub-routine we will be passing the parameter RS_SELFIELD TYPE SLIS_SELFIELD.
When you delete the rows from the internal table in the user command set the refresh field to on.
RS_SELFIELD-REFRESH = 'X'.
Please let me know if it works.
Thanks,
Naren
Maybe you are looking for
-
How can I set up a Dell AIO 922 printer on my Macbook Pro?
I'm running OS X 10.9.2, and I've downloaded a lexmark 5200 series driver like others have said to do, but when I try to add a printer, nothing shows up.
-
I recently bought a new computer and downloaded itunes onto it. When i sync my ipod it prompts me to authorize my computer with the purchases that i've made, but when i try to do so, my apple i.d. is not what shows up and so my ipod won't sync any o
-
Is there a Mac Application that exactly copies PDF documents into Word?
Hello, I work at a University and acquire electronic texts for students with disabilities from publishers. They come in a PDF format where the images on the screen can be highlighted with the mouse. Sometimes I have students who require documents in
-
How do I begin with a template and then import a Word document?
I know I can open a word document in pages (I do this all the time). But I have a specific template and I want the word document I open to take up the designed elements of the template. How do I do that?
-
Regarding data type related to roman no
hi , i have created a z table named as zstudent. In that i hve one field name as zstandard which should contain only roman numbers from I TO X (1ST TO 10 TH ) class .hw can i do this .wen i creating entries on that table it should restrict to only