Convert Normal Report of Write statements to alv list display by usg at new
Hi Experts,
I have one Report in which Data is fetched and displayed using WRITE Stmts now
i want to modify this Report to alv_list_display but prob is with at new command..Suppose when ever new customer is triggered it have to display the data of that particular customer in new page.....
And also format of output in old resport is little bit tricky i want to knw can we format the same output using alv_list_display.
At Header Level data is dispalyed in 4 parts column wise and under those 4colums
Items have been displayed. but i have 20 fields which are to b displayed same as old one. under those 4 colums when i use alv_list_display.
Naveen Kumar
hi,
try this code
this program is first of all header level data will be printed
when you click on any header level it show all the items under that head
Data Extract from Tables ZFII_COST, BSIS.
Program Name :ZFII_COSTING_REPORT_DISPLAY
Object ID :E7
Functional Analyst :VENKAT
Programmer :venkatesh
Start date :07/05/2007
Initial CTS :HFDK901345
Description :
Includes :n/a
Function Modules :REUSE_ALV_GRID_DISPLAY , *
CONVERSION_EXIT_ALPHA_INPUT
FTI_FISCAL_YEAR_MONTH_GET
Logical database :n/a
Transaction Code :n/a
External references :n/a
Modification Log
Date | Modified by | CTS number | Comments
07/05/2007 | venkaetsh | HFDK901345 | Initial version
REPORT ZFII_COSTING_REPORT_DISPLAY NO STANDARD PAGE HEADING
MESSAGE-ID ZFI.
TYPE-POOLS: FTIS.
FOR THE ALV DISPLAY.
TYPE-POOLS: SLIS.
DATA:
G_REPID LIKE SY-REPID,
GWA_SORT TYPE SLIS_SORTINFO_ALV,
GIT_SORT TYPE SLIS_T_SORTINFO_ALV,
GIT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GIT_EVENTS TYPE SLIS_T_EVENT,
GFL_LAYOUT TYPE SLIS_LAYOUT_ALV,
GIT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV ,
GWA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
GIT_XS_EVENT TYPE SLIS_ALV_EVENT,
G_POS TYPE I VALUE 1.
DATA:
G_REPID LIKE SY-REPID,
GWA_SORT TYPE SLIS_SORTINFO_ALV,
GIT_SORT TYPE SLIS_T_SORTINFO_ALV,
GIT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GIT_EVENTS TYPE SLIS_T_EVENT,
GFL_ITEMSLAYOUT TYPE SLIS_LAYOUT_ALV,
GIT_ITEMSFIELDCAT TYPE SLIS_T_FIELDCAT_ALV ,
GWA_ITEMSFIELDCAT TYPE SLIS_FIELDCAT_ALV,
GIT_XS_EVENT TYPE SLIS_ALV_EVENT,
G_ITEMSPOS TYPE I VALUE 1.
DECLARING THE VARIABLES.
DATA:
G_BUKRS TYPE T001-BUKRS.
TABLE FOR THE INITIAL FETCHING
TYPES: BEGIN OF T_COST.
INCLUDE STRUCTURE ZFII_COST.
TYPES: CNSTDGLACC TYPE ZFII_COSTING-CNSTDGLACC.
TYPES: END OF T_COST.
TYPES: T_IT_COST TYPE STANDARD TABLE OF T_COST.
DATA: GIT_COST TYPE T_IT_COST.
DATA: GWA_COST TYPE T_COST.
TYPES: BEGIN OF T_CONSOL.
INCLUDE STRUCTURE ZFII_COSTING.
TYPES: END OF T_CONSOL.
TYPES: T_IT_CONSOL TYPE STANDARD TABLE OF T_CONSOL.
DATA: GWA_CONSOL TYPE T_CONSOL.
DATA: GIT_CONSOL TYPE T_IT_CONSOL.
*TYPES: BEGIN OF T_SENDDATA.
INCLUDE STRUCTURE ZFII_COSTINGDETAILS.
*TYPES: END OF T_SENDDATA.
*TYPES: T_IT_SENDDATA TYPE STANDARD TABLE OF T_SENDDATA.
*DATA: GIT_SENDDATA TYPE T_IT_SENDDATA.
*DATA: GWA_SENDDATA TYPE T_SENDDATA.
TYPES: BEGIN OF T_BSIS,
HKONT TYPE BSIS-HKONT,
SHKZG TYPE BSIS-SHKZG,
DMBTR TYPE BSIS-DMBTR,
KOSTL TYPE BSIS-KOSTL,
END OF T_BSIS.
TYPES: T_IT_BSIS TYPE STANDARD TABLE OF T_BSIS.
DATA: GIT_BSIS TYPE T_IT_BSIS.
DATA: GWA_BSIS TYPE T_BSIS.
DATA: GIT_TOTALBSIS TYPE T_IT_BSIS.
DATA: GWA_TOTALBSIS TYPE T_BSIS.
DATA: G_FTIS_DATUM TYPE FTIS_DATUM.
DATA: G_FTIS_GJAHR TYPE FTIS_GJAHR.
DATA: G_FTIS_MONAT TYPE FTIS_MONAT.
ranges
RANGES: R_HKONT FOR BSIS-HKONT.
data: g_KOSTL type BSIS-KOSTL.
DESIGNING OF THE SELECTION SCREEN STARTS.
DATA: G_YEARMONTH TYPE ZFII_COST-YEARMONTH.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME. " TITLE TEXT-001.
PARAMETERS: P_COCODE TYPE T001-BUKRS DEFAULT 'H901'.
SELECT-OPTIONS: S_MONYR FOR G_YEARMONTH OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
DESIGN OF THE SELECTION SCREEN ENDS.
INITIALIZATION.
clearing and refreshing all the variables
and the tables used in the programme.
INITIALIZATION.
PERFORM CLEAR_REFRESH.
AT SELECTION-SCREEN.
event to validate the values entered
and fetching the data
if no data found error message will be shown
AT SELECTION-SCREEN.
PERFORM VALIDATE_VALUES.
*start of selection.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM CHANGE_DATA.
PERFORM DISPLAY_ALV.
*& Form CLEAR_REFRESH
text
--> p1 text
<-- p2 text
FORM CLEAR_REFRESH .
CLEAR: G_REPID.
G_REPID = SY-REPID.
CLEAR:
GWA_COST, G_POS,
G_BUKRS, GWA_TOTALBSIS,
R_HKONT, G_FTIS_DATUM.
REFRESH:
GIT_BSIS, GIT_COST.
ENDFORM. " CLEAR_REFRESH
*& Form VALIDATE_VALUES
text
--> p1 text
<-- p2 text
FORM VALIDATE_VALUES .
SELECT SINGLE
BUKRS FROM
T001 INTO G_BUKRS
WHERE BUKRS = P_COCODE.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-000.
ENDIF.
ENDFORM. " VALIDATE_VALUES
*& Form GET_DATA
text
--> p1 text
<-- p2 text
FORM GET_DATA .
SELECT
MANDT
COMPCODE
YEARMONTH
DEPARTMENT
CNSTDGLACC
GLCODEFROM
GLCODETO
AMOUNT
FLAG
TYPE
FROM ZFII_COST
INTO TABLE GIT_COST
WHERE COMPCODE = P_COCODE
and YEARMONTH in S_MONYR.
IF SY-SUBRC NE 0.
MESSAGE I000 WITH TEXT-001.
STOP.
ELSE.
SELECT
MANDT
CNSTDGLACC
GLCODEFROM
GLCODETO
FLAG
FROM ZFII_COSTING
INTO TABLE GIT_CONSOL.
IF SY-SUBRC NE 0.
MESSAGE I000 WITH TEXT-003.
STOP.
ENDIF.
ENDIF.
ENDFORM. " GET_DATA
*& Form Change_data
text
--> p1 text
<-- p2 text
FORM CHANGE_DATA .
IF GIT_CONSOL IS NOT INITIAL.
IF GIT_COST IS NOT INITIAL.
sort GIT_CONSOL.
LOOP AT GIT_COST INTO GWA_COST.
READ TABLE GIT_CONSOL INTO GWA_CONSOL
WITH KEY GLCODEFROM = GWA_COST-GLCODEFROM
GLCODETO = GWA_COST-GLCODETO
BINARY SEARCH.
IF SY-SUBRC EQ 0.
GWA_COST-CNSTDGLACC = GWA_CONSOL-CNSTDGLACC.
MODIFY GIT_COST FROM GWA_COST.
ENDIF.
CLEAR: GWA_CONSOL, GWA_COST.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " Change_data
*& Form DISPLAY_ALV
text
--> p1 text
<-- p2 text
FORM DISPLAY_ALV .
GFL_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GFL_LAYOUT-ZEBRA = 'X'.
PERFORM FILL_FIELDCAT.
PERFORM SORT_FIELDS.
PERFORM CALL_GRID.
ENDFORM. " DISPLAY_ALV
*& Form FILL_FIELDCAT
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT .
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'COMPCODE' " InTab Field Name
'GIT_COST' " InTab Name
'5' " Output Length
'Company code' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'YEARMONTH' " InTab Field Name
'GIT_COST' " InTab Name
'8' " Output Length
'Year & Month' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'CNSTDGLACC' " InTab Field Name
'GIT_COST' " InTab Name
'8' " Output Length
'G/L Account code' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'CNSTDGLACC' " InTab Field Name
'GIT_COST' " InTab Name
'8' " Output Length
'Cnsl GL' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'DEPARTMENT' " InTab Field Name
'GIT_COST' " InTab Name
'4' " Output Length
'Department' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'GLCODEFROM' " InTab Field Name
'GIT_COST' " InTab Name
'8' " Output Length
'From GL' " Column Name Text
'' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'GLCODETO' " InTab Field Name
'GIT_COST' " InTab Name
'8' " Output Length
'To GL' " Column Name Text
'' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'FLAG' " InTab Field Name
'GIT_COST' " InTab Name
'2' " Output Length
'Flag' " Column Name Text
'' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'TYPE' " InTab Field Name
'GIT_COST' " InTab Name
'2' " Output Length
'Type' " Column Name Text
'' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_POS = G_POS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
G_POS " Column Position
'AMOUNT' " InTab Field Name
'GIT_COST' " InTab Name
'18' " Output Length
'Amount' " Column Name Text
'CURR' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
'X' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
ENDFORM. " FILL_FIELDCAT
*& Form init_field_catalog
text
-->P_GIT_FIELDCAT text
-->PV_POS text
-->PV_FIELDNAME text
-->PV_TABNAME text
-->PV_OUTPUT text
-->PV_SELTEXT text
-->PV_DATATYPE text
-->PV_KEY text
-->PV_ROW text
-->PV_HOTSPOT text
-->PV_EMPHASIZE text
-->PV_SUM text
-->PV_CHECKBOX text
-->PV_INPUT text
FORM INIT_FIELD_CATALOG USING P_GIT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV
PV_POS LIKE GWA_FIELDCAT-COL_POS
PV_FIELDNAME LIKE GWA_FIELDCAT-FIELDNAME
PV_TABNAME LIKE GWA_FIELDCAT-TABNAME
PV_OUTPUT LIKE GWA_FIELDCAT-OUTPUTLEN
PV_SELTEXT LIKE GWA_FIELDCAT-SELTEXT_M
PV_DATATYPE LIKE GWA_FIELDCAT-DATATYPE
PV_KEY LIKE GWA_FIELDCAT-KEY
PV_ROW LIKE GWA_FIELDCAT-ROW_POS
PV_HOTSPOT LIKE GWA_FIELDCAT-HOTSPOT
PV_EMPHASIZE LIKE GWA_FIELDCAT-EMPHASIZE
PV_SUM LIKE GWA_FIELDCAT-DO_SUM
PV_CHECKBOX LIKE GWA_FIELDCAT-CHECKBOX
PV_EDIT LIKE GWA_FIELDCAT-EDIT
PV_INPUT LIKE GWA_FIELDCAT-INPUT.
DATA: LT_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
LT_FIELDCAT-OUTPUTLEN = PV_OUTPUT.
LT_FIELDCAT-COL_POS = PV_POS.
LT_FIELDCAT-FIELDNAME = PV_FIELDNAME.
LT_FIELDCAT-TABNAME = PV_TABNAME.
LT_FIELDCAT-SELTEXT_L = PV_SELTEXT.
LT_FIELDCAT-KEY = PV_KEY.
LT_FIELDCAT-ROW_POS = PV_ROW.
LT_FIELDCAT-HOTSPOT = PV_HOTSPOT.
LT_FIELDCAT-EMPHASIZE = PV_EMPHASIZE.
LT_FIELDCAT-DO_SUM = PV_SUM.
LT_FIELDCAT-CHECKBOX = PV_CHECKBOX.
LT_FIELDCAT-INPUT = PV_INPUT.
LT_FIELDCAT-EDIT = PV_EDIT.
LT_FIELDCAT-DATATYPE = PV_DATATYPE.
APPEND LT_FIELDCAT TO P_GIT_FIELDCAT.
CLEAR LT_FIELDCAT.
ENDFORM. " init_field_catalog
*& Form SORT_FIELDS
text
--> p1 text
<-- p2 text
FORM SORT_FIELDS .
GWA_SORT-SPOS = 1. " Sort order
GWA_SORT-FIELDNAME = 'COMPCODE'.
GWA_SORT-TABNAME = 'GIT_COST'.
GWA_SORT-UP = 'X'.
x_sort-subtot = 'X'. " Sub total allowed
APPEND GWA_SORT TO GIT_SORT.
CLEAR GWA_SORT.
GWA_SORT-SPOS = 2. " Sort order
GWA_SORT-FIELDNAME = 'YEARMONTH'.
GWA_SORT-TABNAME = 'GIT_COST'.
GWA_SORT-UP = 'X'.
x_sort-subtot = 'X'. " Sub total allowed
APPEND GWA_SORT TO GIT_SORT.
CLEAR GWA_SORT.
GWA_SORT-SPOS = 3. " Sort order
GWA_SORT-FIELDNAME = 'CNSTDGLACC'.
GWA_SORT-TABNAME = 'GIT_COST'.
GWA_SORT-UP = 'X'.
x_sort-subtot = 'X'. " Sub total allowed
APPEND GWA_SORT TO GIT_SORT.
CLEAR GWA_SORT.
GWA_SORT-SPOS = 4. " Sort order
GWA_SORT-FIELDNAME = 'DEPARTMENT'.
GWA_SORT-TABNAME = 'GIT_COST'.
GWA_SORT-UP = 'X'.
x_sort-subtot = 'X'. " Sub total allowed
APPEND GWA_SORT TO GIT_SORT.
CLEAR GWA_SORT.
ENDFORM. " SORT_FIELDS
*& Form CALL_GRID
text
--> p1 text
<-- p2 text
FORM CALL_GRID .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = '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 = GFL_LAYOUT
IT_FIELDCAT = GIT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GIT_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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = GIT_COST
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. " CALL_GRID
*& Form SET_PF_STATUS
text
-->EXTAB text
FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB. "#EC CALLED
SET PF-STATUS 'ZFII_PF_STATUS'. " OF PROGRAM 'SAPLKKBL'.
ENDFORM. "set_pf_status
*& Form USER_COMMAND
Called from within the ALV processes.
PV_UCOMM contains the sy-ucomm from ALV
SELFIELD is a structure that contains all the data required to
process a user selection. The following is an example
of the SELFIELD structure and sample values:
TRIGGERS WHEN THE USER CLICK THE
FORM USER_COMMAND USING PV_UCOMM LIKE SY-UCOMM "#EC NEEDED
SELFIELD TYPE SLIS_SELFIELD. "#EC NEEDED
CASE PV_UCOMM.
WHEN '&IC1'.
when the user double clicks on any record this will show the
READ TABLE GIT_COST INTO GWA_COST INDEX SELFIELD-TABINDEX.
entire list of g/l accounts for which we calculated the sum.
IF SY-SUBRC EQ 0.
CLEAR: g_KOSTL.
g_KOSTL = GWA_COST-DEPARTMENT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GWA_COST-DEPARTMENT
IMPORTING
OUTPUT = g_KOSTL.
CLEAR: R_HKONT.
REFRESH: R_HKONT.
R_HKONT-SIGN = 'I'.
R_HKONT-OPTION = 'BT'.
R_HKONT-LOW = GWA_COST-GLCODEFROM.
R_HKONT-HIGH = GWA_COST-GLCODETO.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = R_HKONT-LOW
IMPORTING
OUTPUT = R_HKONT-LOW.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = R_HKONT-HIGH
IMPORTING
OUTPUT = R_HKONT-HIGH.
append r_hkont.
PERFORM DISPLAY_DETAILS.
ENDIF.
when OTHERS.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form display_details
text
--> p1 text
<-- p2 text
FORM DISPLAY_DETAILS .
PERFORM GET_VALUES_BSIS.
PERFORM FILL_FIELDCAT_ITEMS.
PERFORM DISPALY_ITEMS.
ENDFORM. " display_details
*& Form FILL_FIELDCAT_items
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_ITEMS .
CLEAR: GIT_ITEMSFIELDCAT. ", GWA_ITEMSFIELDCAT.
REFRESH: GIT_ITEMSFIELDCAT.
GFL_ITEMSLAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GFL_ITEMSLAYOUT-ZEBRA = 'X'.
CLEAR: G_ITEMSPOS.
G_ITEMSPOS = G_ITEMSPOS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_ITEMSFIELDCAT[] " Field Catalog
G_ITEMSPOS " Column Position
'HKONT' " InTab Field Name
'GIT_TOTALBSIS' " InTab Name
'10' " Output Length
'G/L Account' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_ITEMSPOS = G_ITEMSPOS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_ITEMSFIELDCAT[] " Field Catalog
G_ITEMSPOS " Column Position
'KOSTL' " InTab Field Name
'GIT_TOTALBSIS' " InTab Name
'10' " Output Length
'Cost Center' " Column Name Text
' ' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
G_ITEMSPOS = G_ITEMSPOS + 1.
PERFORM INIT_FIELD_CATALOG USING GIT_ITEMSFIELDCAT[] " Field Catalog
G_ITEMSPOS " Column Position
'DMBTR' " InTab Field Name
'GIT_TOTALBSIS' " InTab Name
'18' " Output Length
'Amount' " Column Name Text
'CURR' " Datatype
' ' " Key?
' ' " Row Position
' ' " Hotspot
' ' " Emphasize
'X' " Do_sum field?
' ' " checkbox
' ' " EDIT
' '. " input
ENDFORM. " FILL_FIELDCAT_items
*& Form get_values_bsis
text
--> p1 text
<-- p2 text
FORM GET_VALUES_BSIS .
clear: " G_FTIS_DATUM,
G_FTIS_GJAHR, G_FTIS_MONAT.
G_FTIS_DATUM+0(6) = gwa_cost-YEARMONTH.
G_FTIS_DATUM+6(2) = '01'.
CALL FUNCTION 'FTI_FISCAL_YEAR_MONTH_GET'
EXPORTING
I_BUKRS = 'H901'
I_BUDAT = G_FTIS_DATUM
I_DZTERM = FTIS_DATUM-INITIAL
I_GJAHR = FTIS_GJAHR-INITIAL
IMPORTING
E_GJAHR = G_FTIS_GJAHR
E_MONAT = G_FTIS_MONAT.
IF NOT GIT_COST IS INITIAL.
CLEAR: GWA_BSIS, GWA_TOTALBSIS.
REFRESH: GIT_BSIS, GIT_TOTALBSIS.
SELECT
HKONT
SHKZG
DMBTR
KOSTL
FROM BSIS
INTO TABLE GIT_BSIS
WHERE BUKRS = P_COCODE
AND HKONT in R_HKONT
AND GJAHR = G_FTIS_GJAHR
AND MONAT = G_FTIS_MONAT
AND KOSTL eq g_KOSTL.
IF SY-SUBRC EQ 0.
LOOP AT GIT_BSIS INTO GWA_BSIS.
SHIFT GWA_BSIS-HKONT LEFT DELETING LEADING '0'.
GWA_TOTALBSIS-HKONT = GWA_BSIS-HKONT.
GWA_TOTALBSIS-KOSTL = GWA_BSIS-KOSTL.
IF GWA_BSIS-SHKZG = 'H'.
GWA_TOTALBSIS-DMBTR = GWA_BSIS-DMBTR * -1.
ELSE.
GWA_TOTALBSIS-DMBTR = GWA_BSIS-DMBTR.
ENDIF.
APPEND GWA_TOTALBSIS TO GIT_TOTALBSIS.
CLEAR: GWA_TOTALBSIS, GWA_BSIS.
ENDLOOP.
SORT GIT_TOTALBSIS ASCENDING BY HKONT KOSTL.
ENDIF.
ENDIF.
ENDFORM. " get_values_bsis
&----
Similar Messages
-
Write statement after alv display
Hi Experts,
My requirement is that i am displaying an output of ALV List display, in the List display i have a button which undergoes updation of records in Ztable.After pressing the button now i have to display Total no of records in write statement in which i should not have ALV display(i need 2 screens ).
Regards,
Vikram Sukumar<li>I don't know how you are doing but I am able to display. try this sample program for double click event.
REPORT ztest_notepad.
DATA: BEGIN OF it_t001 OCCURS 0,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
adrnr TYPE t001-adrnr,
END OF it_t001.
TYPE-POOLS:slis.
DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat.
DEFINE fieldcat.
wa_fieldcat-fieldname = &1.
wa_fieldcat-tabname = &2.
wa_fieldcat-seltext_m = &3.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
END-OF-DEFINITION.
START-OF-SELECTION.
SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_t001 UP TO 10 ROWS.
fieldcat: 'BUKRS' 'IT_T001' 'BUKRS',
'BUTXT' 'IT_T001' 'BUTXT',
'ADRNR' 'IT_T001' 'ADRNR'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_t001.
*& Form USER_COMMAND
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
IF r_ucomm = '&IC1'.
WRITE 'Venkat'.
ENDIF.
ENDFORM. "USER_COMMAND
Thanks
Venkat.O -
Shifting ALV list display of report into center
Hi All,
I have got a requirement in which the ALV list needs to be shifted in to right. By default the alv list displays from 0 Postion of the column.
IN a classical list its easy to shift the output to any column postion using write statement but in alv list how can we achieve this?
Kindly provide your inputs.
Thanks and regards
Mudit BatraHi.,
I dont think it is possible., By default it will start from position 1 even in field catalog if u give col_pos 4, 5 or., .. . If u want to display alv in center u have to create a screen and create a custom container at the center and display ALV in it..
hope this helps u.,
Thanks & Regards
Kiran -
Issue in ALV List display
Posted: Apr 5, 2008 10:25 AM Edit E-mail this message Reply
Hi Friends,
Can any one help me out in the logic to display the output in the ALV list.
i want to get the out put as
based on the field4 i have to display fieds5, field6 and field 7 values as mentioned below.
field1 field2 field3 field4 field5 field6 field7
0L 123 456 2008 001 123.00 456.00
- - - - 002 213.00 789.00
- - - 003 0.00 0.00
- - - 004 0.00 0.00
- - - 005 0.00 0.00
- - - 006 0.00 0.00
336.00 1245.00
Thanks,
Vijayfor display you have to define fieldcatlaog and use Fm RESUE_ALV_GRID_DISPLAY,
Go through this program
*& Report Z_OPEN_CLOSE *
REPORT Z_OPEN_CLOSE MESSAGE-ID YW2 LINE-SIZE 231 LINE-COUNT 45
NO STANDARD PAGE HEADING.
Type Declaration *
TYPE-POOLS SLIS.
Tables *
TABLES: MKPF, " Material Document: Header Data
MSEG, " Material Document: Item Data
MARA,
MARD,
S031,
EKKO,
EKPO,
LIKP,
MAKT,
J_1IWRKCUS,
T001W,
WB2_V_MKPF_MSEG2,
MMIM_REP_PRINT,
YW2_STKMOVEMENTS,
YPLNT,
MARDH.
Internal Tables *
DATA: I_WERKS LIKE J_1IWRKCUS OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF I_YPLNT OCCURS 0,
PPLNT LIKE YPLNT-PPLNT,
WPLNT LIKE YPLNT-WPLNT,
END OF I_YPLNT.
DATA: BEGIN OF I_MKPF OCCURS 0,
MBLNR LIKE MKPF-MBLNR,
MJAHR LIKE MKPF-MJAHR,
BUDAT LIKE MKPF-BUDAT,
VGART LIKE MKPF-VGART,
BWART LIKE MSEG-BWART,
MATNR LIKE MSEG-MATNR,
WERKS LIKE MSEG-WERKS,
LGORT LIKE MSEG-LGORT,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
KUNNR LIKE MSEG-KUNNR,
ZEILE LIKE MSEG-ZEILE,
XAUTO LIKE MSEG-XAUTO,
SHKZG LIKE MSEG-SHKZG,
MATNR1 LIKE MSEG-MATNR,
END OF I_MKPF.
DATA: BEGIN OF I_MARDH OCCURS 0,
WERKS LIKE MARDH-WERKS,
MEINS LIKE MARA-MEINS,
MATNR LIKE MARDH-MATNR,
LGORT LIKE MARDH-LGORT,
LABST LIKE MARDH-LABST,
LFGJA LIKE MARDH-LFGJA, "Added -MB
LFMON LIKE MARDH-LFMON, "Added -MB
PERIO(6),
INSME LIKE MARDH-LABST,
EINME LIKE MARDH-LABST,
SPEME LIKE MARDH-LABST,
RETME LIKE MARDH-LABST,
O_STK LIKE MARDH-LABST, " Opening Stock
C_STK LIKE MARDH-LABST, " Closing Stock
END OF I_MARDH.
DATA: BEGIN OF I_MARD OCCURS 0,
WERKS LIKE MARD-WERKS,
MATNR LIKE MARD-MATNR,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
INSME LIKE MARD-LABST,
MEINS LIKE MARA-MEINS,
EINME LIKE MARD-LABST,
SPEME LIKE MARD-LABST,
RETME LIKE MARD-LABST,
END OF I_MARD.
DATA: I_MARD1 LIKE I_MARD OCCURS 0 WITH HEADER LINE.
DATA: I_MARDH1 LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF I_MKPF1 OCCURS 0,
MBLNR LIKE MKPF-MBLNR,
WERKS LIKE MSEG-WERKS,
MATNR LIKE MSEG-MATNR,
BUDAT LIKE MKPF-BUDAT,
BWART LIKE MSEG-BWART,
MJAHR LIKE MKPF-MJAHR,
VGART LIKE MKPF-VGART,
LGORT LIKE MSEG-LGORT,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
XAUTO LIKE MSEG-XAUTO,
SHKZG LIKE MSEG-SHKZG,
END OF I_MKPF1.
DATA: BEGIN OF I_MKPF2 OCCURS 0,
WERKS LIKE MSEG-WERKS,
MATNR LIKE MSEG-MATNR,
BUDAT LIKE MKPF-BUDAT,
BWART LIKE MSEG-BWART,
MJAHR LIKE MKPF-MJAHR,
VGART LIKE MKPF-VGART,
LGORT LIKE MSEG-LGORT,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
XAUTO LIKE MSEG-XAUTO,
END OF I_MKPF2.
DATA: BEGIN OF I_FINAL5 OCCURS 0,
WERKS LIKE MSEG-WERKS, " Plant
MATNR LIKE MSEG-MATNR, " Material
LGORT LIKE MSEG-LGORT, " Storage Location
BUDAT LIKE MKPF-BUDAT, " Posting Date
MTART LIKE MARA-MTART, " Material Type
SPMON LIKE S031-SPMON, " Month
MAKTX LIKE MAKT-MAKTX, " Description
meins(3), " UOM
MEINS LIKE MSEG-MEINS,
O_STK LIKE MARDH-LABST, " opening stock
TRECEP LIKE MARDH-LABST, " total receipts
PRODU LIKE MARDH-LABST, " Net Receipts - Production
RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
TDISP LIKE MARDH-LABST, " total dispatches
CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
TLOSS LIKE MARDH-LABST, " Total Loss
TRLOSS LIKE MARDH-LABST, " Transit Loss
WHLOSS LIKE MARDH-LABST, " Warehouse Loss
C_STK LIKE MARDH-LABST, " Closing Stock
TRFSTK LIKE MARDH-LABST, "Transfer stock
MENGE LIKE MSEG-MENGE,
OTHADJ LIKE MARDH-LABST,
END OF I_FINAL5.
DATA: BEGIN OF I_FINAL OCCURS 0,
WERKS LIKE MSEG-WERKS, " Plant
MATNR LIKE MSEG-MATNR, " Material
BUDAT LIKE MKPF-BUDAT, " Posting Date
MTART LIKE MARA-MTART, " Material Type
SPMON LIKE S031-SPMON, " Month
MAKTX LIKE MAKT-MAKTX, " Description
meins(3), " UOM
MEINS LIKE MSEG-MEINS,
O_STK LIKE MARDH-LABST, " opening stock
TRECEP LIKE MARDH-LABST, " total receipts
PRODU LIKE MARDH-LABST, " Net Receipts - Production
RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
TDISP LIKE MARDH-LABST, " total dispatches
CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
TRFSTK LIKE MARDH-LABST, "Material Transfer stock
TRLOSS LIKE MARDH-LABST, " Transit Loss
WHLOSS LIKE MARDH-LABST, " Warehouse Loss
TLOSS LIKE MARDH-LABST, " Total Loss
C_STK LIKE MARDH-LABST, " Closing Stock
OTHADJ LIKE MARDH-LABST,
END OF I_FINAL.
DATA: I_FINAL1 LIKE I_FINAL OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF I_FINAL_TEMP OCCURS 0,
WERKS LIKE MSEG-WERKS, " Plant
MATNR LIKE MSEG-MATNR, " Material
MTART LIKE MARA-MTART, " Material Type
MAKTX LIKE MAKT-MAKTX, " Description
MEINS LIKE MSEG-MEINS,
O_STK LIKE MARDH-LABST, " opening stock
TRECEP LIKE MARDH-LABST, " total receipts
PRODU LIKE MARDH-LABST, " Net Receipts - Production
RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
TDISP LIKE MARDH-LABST, " total dispatches
CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
TRFSTK LIKE MARDH-LABST, "Material Transfer stock
TRLOSS LIKE MARDH-LABST, " Transit Loss
WHLOSS LIKE MARDH-LABST, " Warehouse Loss
TLOSS LIKE MARDH-LABST, " Total Loss
C_STK LIKE MARDH-LABST, " Closing Stock
OTHADJ LIKE MARDH-LABST,
END OF I_FINAL_TEMP.
For Materials
DATA: BEGIN OF I_MARA OCCURS 0,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MEINS LIKE MARA-MEINS,
LABST TYPE MARD-LABST,
MAKTX LIKE MAKT-MAKTX,
END OF I_MARA.
DATA: BEGIN OF I_STKMVMNTS OCCURS 0,
BWART LIKE MSEG-BWART,
SHKZG LIKE MSEG-SHKZG,
VZBEW LIKE YW2_STKMOVEMENTS-VZBEW,
END OF I_STKMVMNTS.
DATA: BEGIN OF I_FINALT OCCURS 0,
WERKS LIKE MSEG-WERKS, " Plant
MATNR LIKE MSEG-MATNR, " Material
BUDAT LIKE MKPF-BUDAT, " Posting Date
MTART LIKE MARA-MTART, " Material Type
SPMON LIKE S031-SPMON, " Month
MAKTX LIKE MAKT-MAKTX, " Description
meins(3), " UOM
MEINS LIKE MSEG-MEINS,
O_STK LIKE MARDH-LABST, " opening stock
TRECEP LIKE MARDH-LABST, " total receipts
PRODU LIKE MARDH-LABST, " Net Receipts - Production
RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
TDISP LIKE MARDH-LABST, " total dispatches
CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
TRFSTK LIKE MARDH-LABST, "Material Transfer stock
TRLOSS LIKE MARDH-LABST, " Transit Loss
WHLOSS LIKE MARDH-LABST, " Warehouse Loss
TLOSS LIKE MARDH-LABST, " Total Loss
C_STK LIKE MARDH-LABST, " Closing Stock
OTHADJ LIKE MARDH-LABST,
MONTH(8) ,
END OF I_FINALT.
DATA: IMKPFT LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
DATA: IMKPFT1 LIKE I_MKPF1 OCCURS 0 WITH HEADER LINE.
DATA: IMARDT LIKE I_MARD OCCURS 0 WITH HEADER LINE.
DATA: IMARDHT LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
DATA: T_FINAL LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
DATA: IMKPFT2 LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
FCAT is used for the field catalog
DATA: FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
for excluding the ICONs from the application toolbar
FEXC TYPE TABLE OF SLIS_EXTAB WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
FS_LAYO is used for Grid Layout
FS_LAYO TYPE SLIS_LAYOUT_ALV,
FEVENTS to handle the events TOP OF PAGE & USER_COMMAND
FEVENTS TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
FHEADER is used for List header
FHEADER TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
sort is used for sorting
FSORT TYPE TABLE OF SLIS_SORTINFO_ALV WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
FCAT1 TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
FS_LAYO1 TYPE SLIS_LAYOUT_ALV,
GT_LIST_TOP_OF_PAGE1 TYPE SLIS_T_LISTHEADER,
FEVENTS1 TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
FHEADER1 TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT
KEY WITH HEADER LINE INITIAL SIZE 0,
G_STATU_071 TYPE SLIS_FORMNAME VALUE 'Z_PFSTATUS',
ALV_VARIANT1 LIKE DISVARIANT.
Variable Declaration *
TYPES: TRFF_TYPE_DEC_6_5(6) TYPE P DECIMALS 5.
DATA: FYEAR(4),
MON(2),
FYEAR1(4),
MON1(2),
OBAL LIKE MARD-LABST,
CBAL LIKE MARD-LABST,
INDEX TYPE I,
COUNT,
COUNT1 TYPE I,
O_STK TYPE P DECIMALS 3,
C_STK TYPE P DECIMALS 3,
V_MJAHR LIKE MKPF-MJAHR,
MONTHS TYPE TRFF_TYPE_DEC_6_5,
MONTH TYPE I.
Global variables for handling ALV functionality
DATA: ALV_KEYINFO TYPE SLIS_KEYINFO_ALV,
ALV_VARIANT LIKE DISVARIANT,
ALV_LAYOUT TYPE SLIS_LAYOUT_ALV,
ALV_REPID LIKE SY-REPID,
ALV_PRINT TYPE SLIS_PRINT_ALV,
ALV_DETAIL_FUNC(30),
ALV_DEFAULT_VARIANT LIKE DISVARIANT-VARIANT,
ALV_COLOURIZE_FIELDS LIKE MMIM_REP_PRINT-COLOR.
RANGES: R_BUDAT FOR MKPF-BUDAT.
*Added by Prabhu for year on 26.4.05.
DATA: IDATE LIKE R_BUDAT OCCURS 0 WITH HEADER LINE.
Selection Screen Elements *
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_WERKS FOR MARD-WERKS OBLIGATORY NO INTERVALS.
PARAMETER: P_SPMON LIKE S031-SPMON NO-DISPLAY .
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR OBLIGATORY,
S_LGORT FOR MSEG-LGORT NO-EXTENSION NO INTERVALS,
S_MBLNR FOR MKPF-MBLNR,
S_BUDAT FOR MKPF-BUDAT OBLIGATORY .
SELECTION-SCREEN END OF BLOCK BLK.
SELECTION-SCREEN BEGIN OF BLOCK BLK3 WITH FRAME TITLE TEXT-004.
PARAMETER : MTART LIKE MARA-MTART DEFAULT 'FERT' NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK BLK3.
SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-003.
SELECTION-SCREEN END OF BLOCK BLK2.
ADDED BY PRABHU FOR DAY-WISE REPORT.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-007.
PARAMETERS: D1 RADIOBUTTON GROUP P1 DEFAULT 'X',
M1 RADIOBUTTON GROUP P1,
Y1 RADIOBUTTON GROUP P1.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-006.
PARAMETERS: ALV_DEF LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK B2.
DATA: S_BUDAT1 LIKE S_BUDAT OCCURS 0 WITH HEADER LINE."prabhu
Initialization *
INITIALIZATION.
PERFORM ALV_INIT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR ALV_DEF.
PERFORM ALV_F4.
At Selection Screen
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_spmon.
PERFORM monat_f4.
At Selection Screen *
AT SELECTION-SCREEN.
checking for the layout
PERFORM ALV_CHECK.
authorisation check for the Plant
PERFORM auth_check.
Validation for the Plant
PERFORM VALIDITY_CHECK.
IF MTART NE 'FERT'.
MESSAGE E041 WITH 'Material Type must be FERT Only...'.
ENDIF.
IF D1 = 'X'." On 26.4.05.
P_SPMON0(4) = S_BUDAT-LOW0(4).
P_SPMON4(2) = S_BUDAT-LOW4(2).
ELSE.
P_SPMON0(4) = S_BUDAT-LOW0(4).
P_SPMON4(2) = S_BUDAT-LOW4(2).
ENDIF.
LOOP AT S_BUDAT.
IF S_BUDAT-HIGH IS INITIAL.
S_BUDAT-HIGH = S_BUDAT-LOW.
MODIFY S_BUDAT.
ENDIF.
ENDLOOP.
IDATE-LOW = S_BUDAT-LOW.
IDATE-HIGH = S_BUDAT-HIGH.
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
I_DATE_FROM = IDATE-LOW
I_DATE_TO = IDATE-HIGH
IMPORTING
E_DAYS =
E_MONTHS = MONTH
E_YEARS =
DATA: I(3) TYPE C.
I = S_BUDAT-LOW+4(2).
CLEAR: R_BUDAT.
REFRESH: R_BUDAT.
*added by Prabhu for Only for Oneday.on 18.5.5
IF MONTH EQ '0'.
MONTH = MONTH + 1.
ENDIF.
*added by Prabhu for Only for Oneday.on 18.5.5
DO MONTH TIMES.
R_BUDAT-LOW = S_BUDAT-LOW.
APPEND R_BUDAT.
ENDDO.
I = 0.
LOOP AT R_BUDAT.
R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2) + I.
I = I + 1.
R_BUDAT-LOW+6(2) = '01'.
MODIFY R_BUDAT.
ENDLOOP.
LOOP AT R_BUDAT.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = R_BUDAT-LOW
IMPORTING
LAST_DAY_OF_MONTH = R_BUDAT-HIGH
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
MODIFY R_BUDAT.
ENDLOOP.
LOOP AT R_BUDAT.
IF R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2).
R_BUDAT-LOW = S_BUDAT-LOW.
MODIFY R_BUDAT.
ENDIF.
IF R_BUDAT-HIGH4(2) = S_BUDAT-HIGH4(2).
R_BUDAT-HIGH = S_BUDAT-HIGH.
MODIFY R_BUDAT.
ENDIF.
For Summary on 26.4.05.
IF Y1 = 'X'.
CLEAR R_BUDAT.
REFRESH R_BUDAT.
R_BUDAT-LOW = S_BUDAT-LOW.
R_BUDAT-HIGH = S_BUDAT-HIGH.
APPEND R_BUDAT.
CLEAR R_BUDAT.
ENDIF.
ENDLOOP.
At Selection Screen *
AT SELECTION-SCREEN OUTPUT.
Start of Selection *
START-OF-SELECTION.
V_MJAHR = P_SPMON+0(4).
Get plant distinction warehouse/production
PERFORM GET_PLANT_DISTINCTION.
Collect the data from various tables
PERFORM GETDATA_FG_STOCK.
here the number of rows in the output table is found
PERFORM OUTPUT_TABLE_CHECK.
here the top of the page code is written, that is to be displayed
in the output
PERFORM Z_TOP_OF_PAGE.
here ALV layout properties are set
PERFORM Z_LAYOUT_SETTINGS.
ALV EVENTS for TOP OF PAGE and for USER COMMAND
PERFORM Z_ALV_EVENTS.
The field catalog is defined for the Primary List is defined in
the subroutine CREATE_FIELD_CATALOG include program ZPRRDOCR_FCAT
PERFORM Z_CREATE_FIELD_CATALOG.
This is for displaying the output
PERFORM Z_REUSE_ALV_GRID_DISPLAY.
*& Form getdata_fg_stock
Getting data from standard tables
FORM GETDATA_FG_STOCK.
For getting the Start date & end date of the month
PERFORM get_month_dates.
Getting the Opening Stock from MARDH table
IF MON EQ '01'.
MON1 = MON.
FYEAR1 = FYEAR.
MON = '12'.
FYEAR = FYEAR - 1.
ELSE.
MON1 = MON.
FYEAR1 = FYEAR.
MON = MON - 1.
FYEAR = FYEAR.
ENDIF.
PERFORM GET_RECORDS_FROM_DB.
*added for Month Summary on 26.4.05.
LOOP AT R_BUDAT.
S_BUDAT-LOW = R_BUDAT-LOW.
S_BUDAT-HIGH = R_BUDAT-HIGH.
*for Month
P_SPMON0(4) = S_BUDAT-LOW0(4).
P_SPMON4(2) = S_BUDAT-LOW4(2).
*for summary.
IF Y1 = 'X'.
LOOP AT S_BUDAT.
S_BUDAT1-SIGN = 'I'.
S_BUDAT1-OPTION = 'NB'.
S_BUDAT1-LOW = S_BUDAT-LOW.
S_BUDAT1-HIGH = S_BUDAT-HIGH.
APPEND S_BUDAT1.
CLEAR S_BUDAT1.
ENDLOOP.
ENDIF.
IMKPFT[] = I_MKPF[].
IMKPFT2[] = I_MKPF[].
IMARDT[] = I_MARD[].
IMARDHT[] = I_MARDH[].
PERFORM MONTH_WISE.
PERFORM PROCESS_MOVEMENTS.
PERFORM CALCULATE_OPENING_STOCK.
PERFORM UPDATE_NON_TRANSACTION_ITMS.
PERFORM DELETE_EMPTY_RECORDS.
CLEAR: IMARDHT,IMARDT,IMKPFT1,IMKPFT,I_FINAL,I_FINAL5.
REFRESH: IMARDHT,IMARDT,IMKPFT1,I_FINAL,I_FINAL5,IMKPFT.
ENDLOOP.
CLEAR: R_BUDAT.
REFRESH: R_BUDAT.
*end of changes for month.
ENDFORM. " getdata_fg_stock
FORM MONAT_F4 *
F4-Hilfe für Monat *
FORM MONAT_F4.
DATA: BEGIN OF MF_DYNPFIELDS OCCURS 1.
INCLUDE STRUCTURE DYNPREAD.
DATA: END OF MF_DYNPFIELDS.
DATA: MF_RETURNCODE LIKE SY-SUBRC,
MF_MONAT LIKE ISELLIST-MONTH,
MF_HLP_REPID LIKE SY-REPID.
FIELD-SYMBOLS: .
Wert von Dynpro lesen
GET CURSOR FIELD MF_DYNPFIELDS-FIELDNAME.
APPEND MF_DYNPFIELDS.
MF_HLP_REPID = SY-REPID.
DO 2 TIMES.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = MF_HLP_REPID
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = MF_DYNPFIELDS
EXCEPTIONS
INVALID_ABAPWORKAREA = 01
INVALID_DYNPROFIELD = 02
INVALID_DYNPRONAME = 03
INVALID_DYNPRONUMMER = 04
INVALID_REQUEST = 05
NO_FIELDDESCRIPTION = 06
UNDEFIND_ERROR = 07.
IF SY-SUBRC = 3.
Aktuelles Dynpro ist Wertemengenbild
MF_HLP_REPID = 'SAPLALDB'.
ELSE.
READ TABLE MF_DYNPFIELDS INDEX 1.
Unterstriche durch Blanks ersetzen
TRANSLATE MF_DYNPFIELDS-FIELDVALUE USING '_ '.
EXIT.
ENDIF.
ENDDO.
IF SY-SUBRC = 0.
Konvertierung ins interne Format
CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'
EXPORTING
INPUT = MF_DYNPFIELDS-FIELDVALUE
IMPORTING
OUTPUT = MF_MONAT
EXCEPTIONS
ERROR_MESSAGE = 1.
IF MF_MONAT IS INITIAL.
Monat ist initial => Vorschlagswert aus akt. Datum ableiten
MF_MONAT = SY-DATLO(6).
ENDIF.
CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
EXPORTING
ACTUAL_MONTH = MF_MONAT
IMPORTING
SELECTED_MONTH = MF_MONAT
RETURN_CODE = MF_RETURNCODE
EXCEPTIONS
FACTORY_CALENDAR_NOT_FOUND = 01
HOLIDAY_CALENDAR_NOT_FOUND = 02
MONTH_NOT_FOUND = 03.
IF SY-SUBRC = 0 AND MF_RETURNCODE = 0.
ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804
<MF_FELD> = MF_MONAT.
CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT'
EXPORTING
INPUT = MF_MONAT
IMPORTING
OUTPUT = MF_DYNPFIELDS-FIELDVALUE.
COLLECT MF_DYNPFIELDS.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = MF_HLP_REPID
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = MF_DYNPFIELDS
EXCEPTIONS
INVALID_ABAPWORKAREA = 01
INVALID_DYNPROFIELD = 02
INVALID_DYNPRONAME = 03
INVALID_DYNPRONUMMER = 04
INVALID_REQUEST = 05
NO_FIELDDESCRIPTION = 06
UNDEFIND_ERROR = 07. "<<== note 148804
ENDIF.
ENDIF.
ENDFORM. "MONAT_F4
*& Form get_month_dates
Calculating the Month Start & End Date
FORM GET_MONTH_DATES.
IF M1 = 'X'.
FYEAR = P_SPMON+0(4).
MON = P_SPMON+4(2).
CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
R_BUDAT-SIGN = 'I'.
R_BUDAT-OPTION = 'BT'.
CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
EXPORTING
I_DATE = R_BUDAT-LOW
IMPORTING
E_DATE = R_BUDAT-HIGH.
APPEND R_BUDAT.
CLEAR S_BUDAT.
REFRESH S_BUDAT.
S_BUDAT-SIGN = 'I'.
S_BUDAT-OPTION = 'BT'.
S_BUDAT-LOW = R_BUDAT-LOW.
S_BUDAT-HIGH = R_BUDAT-HIGH.
APPEND S_BUDAT.
ELSE.
FYEAR = P_SPMON+0(4).
MON = P_SPMON+4(2).
CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
R_BUDAT-SIGN = 'I'.
R_BUDAT-OPTION = 'BT'.
CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
EXPORTING
I_DATE = R_BUDAT-LOW
IMPORTING
E_DATE = R_BUDAT-HIGH.
APPEND R_BUDAT.
ENDIF.
ENDFORM. " get_month_dates
*& Form output_table_Check
checking for records for output
FORM OUTPUT_TABLE_CHECK .
DESCRIBE TABLE I_FINALT LINES INDEX.
IF INDEX EQ 0.
MESSAGE I041 WITH TEXT-005.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. "OUTPUT_TABLE_CHECK
*& Form Z_TOP_OF_PAGE
for setting the details in the top of page *
has no formal paramters *
FORM Z_TOP_OF_PAGE.
DATA: V_MON(2),
V_YR(40),
V_FIN(18),
V_FIN1(48),
LOW(10),
HIGH(10).
V_MON = P_SPMON+4(2).
V_YR = P_SPMON+0(4).
FHEADER-TYP = 'H'.
FHEADER-INFO = 'Stock Register Report (FG Stock)'.
APPEND FHEADER.
CLEAR FHEADER.
*if m1 = 'X'.
CONCATENATE 'Month = ' v_mon '.' v_yr INTO v_fin.
fheader-typ = 'H'.
fheader-info = v_fin.
APPEND fheader.
CLEAR fheader.
*endif."prabhu on 18.5.5
IF D1 = 'X'.
CLEAR S_BUDAT.
LOOP AT S_BUDAT.
CONCATENATE S_BUDAT-LOW6(2) '/' S_BUDAT-LOW4(2) '/'
S_BUDAT-LOW+0(4) INTO LOW.
CONCATENATE S_BUDAT-HIGH6(2) '/' S_BUDAT-HIGH4(2) '/'
S_BUDAT-HIGH+0(4) INTO HIGH.
CONCATENATE 'Date = ' LOW ' - ' HIGH INTO V_FIN1.
FHEADER-TYP = 'H'.
FHEADER-INFO = V_FIN1.
APPEND FHEADER.
CLEAR FHEADER.
ENDLOOP.
ENDIF.
ENDFORM. " Z_TOP_OF_PAGE
*& Form Z_LAYOUT_SETTINGS
this is done for setting the properties for the layout of the *
grid *
has no formal paramters *
FORM Z_LAYOUT_SETTINGS.
FS_LAYO-ZEBRA = 'X'. " Output in Zebra pattern
FS_LAYO-DETAIL_POPUP = 'X'. " A popup window appears to give
FS_LAYO-DETAIL_TITLEBAR = TEXT-022.
FS_LAYO-COLWIDTH_OPTIMIZE = 'X'.
ENDFORM. " Z_LAYOUT_SETTINGS
*& Form Z_ALV_EVENTS
This is used for handling the events TOP OF PAGE and the USER *
COMMAND event *
has no formal paramters *
FORM Z_ALV_EVENTS.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = FEVENTS[].
READ TABLE FEVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC = 0.
FEVENTS-FORM = 'Z_TOPOFPAGE'.
MODIFY FEVENTS INDEX SY-TABIX.
CLEAR FEVENTS.
ENDIF.
READ TABLE FEVENTS WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC = 0.
FEVENTS-FORM = 'Z_USER_COMMAND'.
MODIFY FEVENTS INDEX SY-TABIX.
CLEAR FEVENTS.
ENDIF.
ENDFORM. "Z_ALV_EVENTS
*& Form Z_CREATE_FIELD_CATALOG
here the field catalog is created for the primary list *
no formal parameters *
FORM Z_CREATE_FIELD_CATALOG.
for the Plant
FCAT-FIELDNAME = 'WERKS'.
FCAT-KEY = 'X'.
FCAT-OUTPUTLEN = '000005'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Plant'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'CHAR'.
APPEND FCAT.
CLEAR FCAT.
for the Material Type
FCAT-FIELDNAME = 'MTART'.
FCAT-KEY = 'X'.
FCAT-OUTPUTLEN = '000006'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'MatTyp'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'CHAR'.
APPEND FCAT.
CLEAR FCAT.
for the Material No.
FCAT-FIELDNAME = 'MATNR'.
FCAT-KEY = 'X'.
fcat-hotspot = 'X'.
FCAT-OUTPUTLEN = '000018'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Material'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'CHAR'.
APPEND FCAT.
CLEAR FCAT.
for the Material Description
FCAT-FIELDNAME = 'MAKTX'.
FCAT-KEY = ''.
FCAT-OUTPUTLEN = '000040'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Description'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'CHAR'.
APPEND FCAT.
CLEAR FCAT.
for the Unit of Measure
FCAT-FIELDNAME = 'MEINS'.
FCAT-KEY = ''.
FCAT-OUTPUTLEN = '03'.
FCAT-JUST = 'C'.
FCAT-SELTEXT_M = 'UOM'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'UNIT'.
APPEND FCAT.
CLEAR FCAT.
for the Plant
FCAT-FIELDNAME = 'MONTH'.
FCAT-KEY = 'X'.
FCAT-OUTPUTLEN = '08'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'MONTH'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'CHAR'.
APPEND FCAT.
CLEAR FCAT.
for the Opening Stock
FCAT-FIELDNAME = 'C_STK'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Opening Stock'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
fcat-do_sum = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT.
CLEAR FCAT.
for the Total Receipts
FCAT-FIELDNAME = 'TRECEP'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Total Receipts'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
FCAT-DO_SUM = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT.
CLEAR FCAT.
for the Production
FCAT-FIELDNAME = 'PRODU'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Production'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
FCAT-DO_SUM = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT.
CLEAR FCAT.
for the Other Plant Receipts
FCAT-FIELDNAME = 'RECEP'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Othr Plnt Recpts'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
FCAT-DO_SUM = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT.
CLEAR FCAT.
Sales Return
FCAT-FIELDNAME = 'SAL_RET'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Sales Return'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
FCAT-DO_SUM = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT.
CLEAR FCAT.
Total Dispatches
FCAT-FIELDNAME = 'TDISP'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Total Dispatches'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
FCAT-DO_SUM = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT. -
How to send the alv list display to spool
Hi all,
I am executing a program in foreground. My requirement is sending alv list output to spool. When i execute the smae program in background mode the SAP is handling the spool output in hierarchial list display. How to get the same output in foreground also.
Thanks and Regards,
Vijay.Hi max,
I think my question is not clear.
when I execute my report in background mode, I can able to see the output in the spool.
But when I execute the same report in foreground no spool output is getting generated.
To handle this I am calling some function modules like RSPO_OPEN_SPOOLREQUEST , RSPO_WRITE_SPOOLREQUEST, RSPO_WRITE_SPOOLREQUEST. But by using this i cannot able to get the desired output in alv list display format. what to do to get my desired output.
Thanks and Regards,
Vijay. -
Hi Experts,
My requirement is i need a button along with the tool bar of ALV list display . when i check the button it should display the Selection criteria values which user entered as a pop up .
Is there any default tool which displays user selection values for ALV list display ?
Regards,
Vikram.S> Is there any default tool which displays user selection values for ALV list display ?
No such program.
But you have to write a code for it. Activate Button using the pf-status. then Handle that button in User command , and show a popup with the selection values.
Function used to get the selection details is
RS_REFRESH_FROM_SELECTOPTIONS
get the data and show it using a Popup. May be a ALV popup select function will help you. -
HOW TO DISPLAY MY OWN PF STATUS IN ALV LIST DISPLAY
Hi All,
i am developing one program in this program i am displaying output by using alv list display. after displaying the out SAP predefined pf status is coming. here i need my own pf status. any body can send me the sample code ir modify my code if possible.
i am sending my code below.
report zmahi6.
type-pools : slis.
tables : zuser_secobjects.
data : it_secobjects like zuser_secobjects occurs 0 with header line.
data : i_field type slis_t_fieldcat_alv with header line.
data : w_field like line of i_field.
data : i_sort type slis_t_sortinfo_alv.
data : w_sort like line of i_sort.
data : it_filt1 type slis_t_filter_alv with header line.
data:
i_tabname type tabname,
i_repid like sy-repid,
is_lout type slis_layout_alv.
data : chk_box type slis_fieldname.
selection-screen: begin of block b1 with frame title text-t01.
parameters : p_appln type zuser_secobjects-appln.
parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
p_partnr type zuser_secobjects-appln_partner,
p_ptype type zuser_secobjects-partner_type default '02',
p_upostn type zuser_secobjects-user_position,
p_sdate like likp-erdat default sy-datum,
"type zuser_secobjects-start_date
p_edate(10) default '12/31/9999',
type zuser_secobjects-end_date,
p_revnum type zuser_secobjects-revnum,
p_cted type zuser_secobjects-created_by,
p_cdate type zuser_secobjects-creation_date,
p_ctime type zuser_secobjects-creation_time,
p_chnby type zuser_secobjects-changed_by,
p_cdate1 type zuser_secobjects-changed_date,
p_ctime1 type zuser_secobjects-changed_time.
selection-screen: end of block b1.
start-of-selection.
perform get_data.
check sy-subrc eq 0.
set pf-status 'ZMAHEE'.
perform prepare_fieldcatalog.
perform alv_list_display.
*& Form PREPARE_FIELDCATALOG
text
--> p1 text
<-- p2 text
form prepare_fieldcatalog.
clear: w_field,i_field.
refresh:i_field.
i_field-key = 'X'.
i_field-col_pos = 1.
i_field-ddictxt = 'S'.
i_field-seltext_s = '@11@'.
i_field-checkbox = 'X'.
i_field-input = 'X'.
i_field-fieldname = 'HEADER'.
i_field-outputlen = 0.
append i_field.
clear i_field.
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-outputlen = '10'.
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'APPLN_USER'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m02.
w_field-outputlen = '7'.
w_field-col_pos = 2.
append w_field to i_field.
clear w_field.
endform. " PREPARE_FIELDCATALOG
*form pf_status_set using rt_extab type slis_t_extab.
set pf-status '0001'.
*endform.
*& Form ALV_LIST_DISPLAY
text
--> p1 text
<-- p2 text
form alv_list_display.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_comomand = 'USER_COMMAND'
is_layout = is_lout
it_fieldcat = i_field[]
it_sort = i_sort
it_events = it_evts[]
tables
t_outtab = it_secobjects.
endform. " ALV_LIST_DISPLAY
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form get_data.
select * from zuser_secobjects
into table it_secobjects.
endform. " GET_DATA
thanks,
maheedhar.tFollow this steps.
I ahve done it once and hope wuld work for you as well.
Go to SE80. Open a a standard ABAP program - SAPLKKBL. diasplay object.
This program has many standard GUI status. Copy the one which suits you the best. May be any one standars status. Right click it and copy to your custom report. Now open your Z-Program in SE80. You will see the GUI status and when you open it you see the name of the status that you have copied from.
Now you can go and do any modifications in the screen.
Remember you have to use the same status in the program as well.
Please check this piece of code.
call the ABAP list viewer *
FORM list_display TABLES a_output.
pgm = disvariant-report = sy-repid.
disvariant-variant = variant.
call list viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = pgm
i_callback_pf_status_set = 'SET_PF_STATUS'
it_fieldcat = fieldcat
is_variant = disvariant
is_layout = layout
is_print = print
i_save = 'A'
it_events = eventcat
it_sort = sortcat
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = a_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. "LIST_DISPLAY
FORM SET_PF_STATUS *
FORM set_pf_status USING extab TYPE slis_t_extab.
SET PF-STATUS 'STATUS1'.
ENDFORM. "set_pf_status
FORM USER_COMMAND *
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
DATA t_difference TYPE i.
CASE ucomm.
WHEN 'ENT1'.<----Function code
D0 your processing.
ENDCASE.
selfield-refresh = 'X'.
ENDFORM. "user_command
HOpe this helps.
Shreekant -
Filtering the ALV List Display
Hi all.
We had a requirement like filtering ALV List display.
Suppose my ALV list dispaly contains 100 records and by using the standard filtering option ,I restricted it to 50 records and by clicking a check box for 20 records and delete button(Customized) ,I should ideally get 30 records.
But according to standard SAP functionality buttons ,all 80 Records will be displayed .But i need 30 records.
Any function module or code will be available to achieve this one?
In this case which will be the preferable method to go further?
What will be the best method(Normal ALV/OOALV) ?
Any pointers in this regard are very much helpful.
Regards,
SSR.While selecting the records on each condition , perform the select based on ur condition so dat dat select only those records directly.
-
Help Me Plz In ALV List Display
hi,
I am using ALV List display for output pupose and where i am using push buttons and using PF-STATUS its fetching other details and its workin fine..my problem is when i press back button and again press the push button .... the same content is repeating or the list is not cleared ......what to do how to clear the content in the list ........
regrds,
karthik.Clear and Refresh your main internal table in OK_CODE = 'BACK' button.
Ok den do this..
if ok_code = 'BACK'.
p_code = ok_code.
clear itab[].
refresh itab.
endif.
now for coding of pushbutton,write this.
if ok_code = 'pusbutton' ( your name of pushbutton)
if p_code = 'BACK'.
clear p_code .
clear itab[]. "ITAB is your displayed main internal table
refresh itab.
endif.
reward if useful.
Amit Singla
Message was edited by:
Amit Singla -
Hide delete option is not working in ALV List Display- urgent
Hi All,
In my program i am displaying the output by using alv list display. after displaying the data i am displaying my own pf status here. in this i have few pushbuttons like
selest all, deselect all, hide . first two options are working fine. when i click hide button selected records are going to be hide.but this is not happening in my program. any body cam send me the code plz.
i am sending my code below. if possible please modify and resend the code asap.
my code:
type-pools : slis.
tables : zuser_secobjects.
data : t_header1 like zuser_secobjects.
data : begin of it_secobjects occurs 0.
include structure t_header1.
*data : box,
input(1) type c,
data : checkbox type c,
flag type c,
end of it_secobjects.
data : wa_ita like line of it_secobjects.
*data : it_secobjects like zuser_secobjects occurs 0 with header line.
data : i_field type slis_t_fieldcat_alv with header line.
data : w_field like line of i_field.
data : i_sort type slis_t_sortinfo_alv.
data : w_sort like line of i_sort.
data : it_filt1 type slis_t_filter_alv with header line.
data:
i_tabname type tabname,
i_repid like sy-repid,
is_lout type slis_layout_alv.
data : it_filt type slis_t_filter_alv with header line,
it_evts type slis_t_event with header line.
DATA : is_vari type disvariant.
constants : c_default_vari value 'X',
c_save_vari value 'U',
c_checkfield type slis_fieldname value 'ACTION',
c_f2code type sy-ucomm value '&ETA'.
data : chk_box type slis_fieldname.
selection-screen: begin of block b1 with frame title text-t01.
parameters : p_appln type zuser_secobjects-appln.
parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
p_partnr type zuser_secobjects-appln_partner,
p_ptype type zuser_secobjects-partner_type default '02',
p_upostn type zuser_secobjects-user_position,
p_sdate like likp-erdat default sy-datum,
p_edate(10) default '12/31/9999',
p_revnum type zuser_secobjects-revnum,
p_cted type zuser_secobjects-created_by,
p_cdate type zuser_secobjects-creation_date,
p_ctime type zuser_secobjects-creation_time,
p_chnby type zuser_secobjects-changed_by,
p_cdate1 type zuser_secobjects-changed_date,
p_ctime1 type zuser_secobjects-changed_time.
selection-screen: end of block b1.
form user_command using p_ucomm like sy-ucomm
rs_selfield type slis_selfield.
*DATA : it_filt type slis_t_filter_alv with header line.
case p_ucomm.
when 'SELECT_ALL'. " SELALL is the FCODE of ur push button
loop at it_secobjects into wa_ita.
wa_ita-checkbox = 'X'.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
when 'DESLCT_ALL'.
loop at it_secobjects into wa_ita.
wa_ita-checkbox = ' '.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
is_lout-f2code = c_f2code.
is_lout-box_fieldname = c_checkfield.
is_lout-get_selinfos = 'X'.
is_lout-detail_popup = 'X'.
is_lout-detail_initial_lines = 'X'.
when 'HIDE_DEL'.
rs_selfield-exit = 'X'.
it_filt-fieldname = 'CHECKBOX'.
it_filt-tabname = '1'.
it_filt-valuf = 'X'.
it_filt-intlen = '1'.
it_filt-inttype = 'C'.
it_filt-datatype = 'CHAR'.
it_filt-valuf_int = 'X'.
it_filt-sign0 = 'E'.
it_filt-optio = 'EQ'.
if it_filt[] is initial.
append it_filt.
else.
modify it_filt index 1.
endif.
perform display using i_object.
PERForm ALV_LIST_DISPLAY.
WHEN 'SHOW_DEL'.
rs_selfield-exit = 'X'.
free it_filt.
PERForm ALV_LIST_DISPLAY.
when 'SAVE1'.
select * from zuser_secobjects where
appln = zuser_secobjects-appln
and appln_partner = zuser_secobjects-appln_partner
and partner_type = zuser_secobjects-partner_type
and start_date = zuser_secobjects-start_date
and end_date = zuser_secobjects-end_date.
endselect.
if sy-subrc eq 0.
message e000(ZV) with 'Duplicate Entry'.
endif.
endcase.
endform.
*& Form delete
form delete.
data : begin of is_secobjects occurs 0.
include structure zuser_secobjects.
data : checkbox type c.
data : end of is_secobjects.
is_secobjects-checkbox = 'X'.
modify is_secobjects
from it_secobjects
transporting checkbox
where checkbox = 'X'.
endform.
*& Form get_data
form get_data.
select * from zuser_secobjects
into table it_secobjects.
endform. " get_data
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
form prepare_fieldcatalog.
clear: w_field,i_field.
refresh:i_field.
i_field-key = 'X'.
i_field-col_pos = 1.
i_field-ddictxt = 'S'.
i_field-seltext_s = '@11@'.
i_field-checkbox = 'X'.
i_field-input = 'X'.
i_field-fieldname = 'HEADER'.
i_field-outputlen = 0.
append i_field.
clear i_field.
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-outputlen = '10'.
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'APPLN_USER'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m02.
w_field-outputlen = '7'.
w_field-col_pos = 2.
append w_field to i_field.
clear w_field.
endform. " prepare_fieldcatalog
*& Form ALV_LIST_DISPLAY
text
--> p1 text
<-- p2 text
form alv_list_display.
i_repid = sy-repid.
is_lout-box_fieldname = 'CHECKBOX'.
it_filt-fieldname = 'CHECKBOX'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
is_layout = is_lout
it_fieldcat = i_field[]
it_filter = it_filt[]
it_events = it_evts[]
i_default = c_default_vari
i_save = c_save_vari
is_variant = is_vari
tables
t_outtab = it_secobjects.
endform. " ALV_LIST_DISPLAY
*& Form display
text
-->P_I_OBJECT text
form display using object.
case object.
ENDCASE.
endform. " display
thanks,
maheedhar.tHi,
What do you mean by Hiding the records.
Deleting completely from the screen.
You can just delete the records from the internal table and pass to field catalog before displaying again.
or serach in the slis structrue for hiding the contents of the output.
reward if useful
regards,
Anji -
How to edit particular field in alv list display-urgent
HI ALL,
my requirement is i am displaying output using alv list display. now my rewuirement :
i am displaying out in edit mode only. when user clicks one particular field
for example record is like
runrate a01 maheed -> if user clicks on a01 this field should be editable. i have a following code
w_field-edit = w_edit.
w_field-input = 'X'. -> using this code i can able to display entire colomn in edit mode. this not suits my requirement.anybody can send me the sample code please.
thanks,
maheedhar.tCan you please send me the sample code plz.
i am sending my code below.
type-pools : slis.
tables : zuser_secobjects.
data : t_header1 like zuser_secobjects.
data : begin of it_secobjects occurs 0.
include structure t_header1.
data : checkbox type c value 'X',
action type c,
end of it_secobjects.
data : begin of it_secobjects1 occurs 0.
include structure ZUSER_SECOBJECTS.
data : checkbox type c VALUE 'X',
end of it_secobjects1.
data : wa_ita like line of it_secobjects.
data : i_field type slis_t_fieldcat_alv with header line.
data : w_field like line of i_field.
data : i_sort type slis_t_sortinfo_alv.
data : w_sort like line of i_sort.
data : it_filt1 type slis_t_filter_alv with header line.
data:
i_tabname type tabname,
i_repid like sy-repid,
is_lout type slis_layout_alv.
data : it_filt type slis_t_filter_alv with header line,
it_evts type slis_t_event with header line.
DATA : is_vari type disvariant.
constants : c_default_vari value 'X',
c_save_vari value 'U',
c_checkfield type slis_fieldname value 'ACTION',
c_f2code type sy-ucomm value '&ETA'.
data : chk_box type slis_fieldname.
selection-screen: begin of block b1 with frame title text-t01.
parameters : p_appln type zuser_secobjects-appln.
parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
p_partnr type zuser_secobjects-appln_partner,
p_ptype type zuser_secobjects-partner_type default '02',
p_upostn type zuser_secobjects-user_position,
p_sdate like likp-erdat default sy-datum,
p_edate(10) default '12/31/9999',
p_revnum type zuser_secobjects-revnum,
p_cted type zuser_secobjects-created_by,
p_cdate type zuser_secobjects-creation_date,
p_ctime type zuser_secobjects-creation_time,
p_chnby type zuser_secobjects-changed_by,
p_cdate1 type zuser_secobjects-changed_date,
p_ctime1 type zuser_secobjects-changed_time.
selection-screen: end of block b1.
form user_command using p_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case p_ucomm.
when 'SELECT_ALL'. " SELALL is the FCODE of ur push button
loop at it_secobjects into wa_ita.
wa_ita-checkbox = 'X'.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
when 'DESLCT_ALL'.
loop at it_secobjects into wa_ita.
wa_ita-checkbox = ' '.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
is_lout-f2code = c_f2code.
is_lout-box_fieldname = c_checkfield.
is_lout-get_selinfos = 'X'.
is_lout-detail_popup = 'X'.
is_lout-detail_initial_lines = 'X'.
maheed-start.
*when 'SAVE'.
*LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.
MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
APPEND IT_SECOBJECTS1.
CLEAR IT_SECOBJECTS1.
DELETE IT_SECOBJECTS.
*ENDLOOP.
*DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
WHEN 'DELETE'.
loop at it_SECOBJECTS where checkbox eq 'X'.
delete it_SECOBJECTS.
endloop.
*RS_SELFIELD-REFRESH = 'X'.
maheed-end.
maheed-start. apr 13
WHEN 'DELETE'.
loop at it_SECOBJECTS where checkbox eq 'X'.
MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
APPEND IT_SECOBJECTS1.
delete it_SECOBJECTS.
endloop.
RS_SELFIELD-REFRESH = 'X'.
when 'SAVE'.
DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
commit work.
refresh :IT_SECOBJECTS1.
maheed-end. apr 13
*when 'SAVE'.
*LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.
MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
APPEND IT_SECOBJECTS1.
CLEAR IT_SECOBJECTS1.
DELETE IT_SECOBJECTS.
*ENDLOOP.
*DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
ENDCASE.
endform.
*& Form delete
form delete.
data : begin of is_secobjects occurs 0.
include structure zuser_secobjects.
data : checkbox type c.
data : end of is_secobjects.
is_secobjects-checkbox = 'X'.
modify is_secobjects
from it_secobjects
transporting checkbox
where checkbox = 'X'.
endform.
*& Form get_data
form get_data.
select * from zuser_secobjects
into table it_secobjects.
endform. " get_data
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
form prepare_fieldcatalog." USING w_edit TYPE any.
data : w_edit type c.
clear w_edit.
clear: w_field,i_field.
refresh:i_field.
i_field-key = 'X'.
i_field-col_pos = 1.
i_field-ddictxt = 'S'.
i_field-seltext_s = '@11@'.
i_field-checkbox = 'X'.
i_field-input = 'X'.
i_field-fieldname = 'HEADER'.
i_field-outputlen = 0.
append i_field.
clear i_field.
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-outputlen = '10'.
w_field-EDIT = 'X'. "maheed
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'APPLN_USER'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m02.
w_field-outputlen = '7'.
w_field-col_pos = 2.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'APPLN_PARTNER'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m03.
w_field-edit = w_edit.
w_field-input = 'X'.
w_field-outputlen = '7'.
w_field-col_pos = 2.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'INACTIVE'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m02.
w_field-outputlen = '7'.
w_field-col_pos = 3.
append w_field to i_field.
clear w_field.
endform. " prepare_fieldcatalog
*& Form ALV_LIST_DISPLAY
text
--> p1 text
<-- p2 text
form alv_list_display.
DATA : LC_GLAY TYPE LVC_S_GLAY.
LC_GLAY-EDT_CLL_CB = 'X'.
i_repid = sy-repid.
is_lout-box_fieldname = 'CHECKBOX'.
it_filt-fieldname = 'ACTION'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
is_layout = is_lout
it_fieldcat = i_field[]
it_filter = it_filt[]
it_events = it_evts[]
i_default = c_default_vari
i_save = c_save_vari
is_variant = is_vari
tables
t_outtab = it_secobjects.
endform. " ALV_LIST_DISPLAY
*& Form display
text
-->P_I_OBJECT text
form display using object.
case object.
ENDCASE.
endform. " display
thanks,
maheedhar.t -
Editable field in alv list display
i WANT TO GIVE COLOR FOR EDITABLE FIELD IN ALV LIST DISPLAY.i TRIED WITH EMPHASIZE IN FIELD CATALOGUE ASSIGNING.bUT,IT IS NOT WORKING.HOW TO DO.tHANX IN ADVANCE.........
HI,
Please refer the link below:
http://www.****************/Tutorials/ALV/Edit/demo.htm
http://www.****************/Tutorials/ALV/ColorSALV/Demo.htm
Thanks,
Sriram Ponna. -
How to get subtotal value in ALV list display
Hi all,
How to give condition on the value of subtotal line in ALV list display,
i.e.if value of subtotal of plan quantity = actual quantity (in red oval) it should show the message
'ON TIME DELIVERY' else it should not show messagee.In my case(shown in red oval) its
showing for each subtotal value. I know how to change the subtotal text but i want to change
with respect to value of the subtotal.(plz refer attachment)
Any input regard to this will be achieved great.
Many thanks in advance.
samadhan shinde.Hi Samadhan,
I am awaiting for solution for this problem.....but as i think dynamically displaying sub total based on
matching actual quantity and planned quantity is bit complicated.
My idea is to display matched quantities in one block and unmatched quantities in another. I mean using blocked list.
awaiting suggestions.
regards, -
Dynamically assign value to a column in ALV LIST Display
Hi all,
How can I dynamically assign value to a column in ALV LIST Display without using classes and methods?
Thanks,
RidhimaHi Vikranth,
I am displaying one ALV list say with columns A and B.
I have value in A but not in B. Now at runtime user selects one row, clicks on push button in application toolbar, then i have to display value in column B in the already displayed list.
I searched and came to know it can be done with oops concept. but i am not using classes and methods.
so how can i do this?
Thanks,
Ridhima. -
How to give color of particular cell in alv list display for dynamic table
Dear Experts,
i want to give color of a particular cell in alv list display (reuse_alv_list_display). Here i am passing data through dynamic table?Hi,
Se this:
DATA: lt_color TYPE lvc_t_scol WITH HEADER LINE.
DATA: BEGIN OF data_tab OCCURS 0.
tabcolor TYPE lvc_t_scol,
END OF data_tab.
* Befone ALV call
alv_layout-coltab_fieldname = 'TABCOLOR'.
* For each row in data_tab
REFRESH: lt_color.
CLEAR: lt_color.
lt_color-color-col = 6.
lt_color-color-int = 1.
lt_color-fname = FIELD1'.
APPEND lt_color.
lt_color-color-col = 2.
lt_color-color-int = 0.
lt_color-fname = 'FIELD2'.
APPEND lt_color.
data_tab-tabcolor[] = lt_color[].
append data_tab.
Best regards,
Leandro Mengue
Maybe you are looking for
-
I am trying to update the itunes software on my Mac but I keep getting an instalation alert saying please close itunes. It is already closed, the only option then left is to quit instalation. I want the update though. Can anyone help?
-
How to get the details of entry date in SQ00.
Hello, Can anybody let me know the steps how to get the entry date in the report SQ00.Here when i am selecting entry date its coming as 00.00.00.(as zero).please let me know how to correct the steps with proper steps.
-
SPRY accordion widget IE8 ONLY issue
hello everybody, i noticed a strange "jumpy" behavior while using the spry accordion widget -- this affects IE8 only (currently using 8.0.6001.18882 on vista), other browsers (including IE7 and IE8 forced into IE7 mode) work as expected. this issue s
-
Keeps crashing and doesnt have same ease as before dont like it
keeps crashing and doesnt have same ease as before dont like it want earlier version how can i fix asap?
-
Hey , I am trying to understand the java event handling with swing . I have got good responses from urhand ( thanks for all your responses :) ) but I have a different approach to it. I am primarily a actionscript developer so I`ll try and explain to