Regarding alv output
Hi all,
My user command is not working in my program.
When i am clicking in any value on any filed its not working out. I have debuuged also i m not getting.
<code>
*& Report ZVEN_PRA
REPORT zven_pra
NO STANDARD PAGE HEADING
MESSAGE-ID zven.
*&Internal table declarations
DATA:BEGIN OF it_ekko OCCURS 0,
ebeln TYPE ekko-ebeln, "po number
bukrs TYPE ekko-bukrs, "company code
bstyp TYPE ekko-bstyp, "po category
lifnr TYPE ekko-lifnr, "vendor no
ekorg TYPE ekko-ekorg, "pur org
ekgrp TYPE ekko-ekgrp, "pur group
END OF it_ekko.
DATA:BEGIN OF it_ekpo OCCURS 0,
ebelp TYPE ekpo-ebelp,"item of po number
matnr TYPE ekpo-matnr,"material no
werks TYPE ekpo-werks,"plant
menge TYPE ekpo-menge,"po qty
meins TYPE ekpo-meins,"order unit
netwr TYPE ekpo-netwr,"net order value
END OF it_ekpo.
DATA:v_field(50) TYPE c,
v_value TYPE ekko-ebeln.
DATA:v_bukrs TYPE ekko-bukrs.
TYPE-POOLS:slis.
DATA:it_fcat TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv,
layout TYPE slis_layout_alv,
it_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
DATA : it_event TYPE slis_t_event.
DATA:it_fcat2 TYPE slis_t_fieldcat_alv,
wa_fcat2 TYPE slis_fieldcat_alv,
gs_selfield TYPE slis_selfield,
g_exit(1) TYPE c,
gs_private TYPE slis_data_caller_exit.
*to store the variants.
data:ws_x_variant like disvariant,
ws_variant like disvariant,
ws_save type c,
ws_exit type c.
CONSTANTS :
c_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
c_usercommand TYPE slis_formname VALUE 'USER_COMMAND',
c_pf_status TYPE slis_formname VALUE 'PF_STATUS_SET'.
DATA:IT_HEADER TYPE SLIS_T_LISTHEADER.
*&Selection-Screen declarations
TABLES:ekko.
SELECTION-SCREEN BEGIN OF BLOCK e WITH FRAME TITLE text-002.
SELECT-OPTIONS:s_bukrs FOR ekko-bukrs,
s_lifnr FOR ekko-lifnr.
SELECTION-SCREEN END OF BLOCK e.
*validate the company code
AT SELECTION-SCREEN.
PERFORM validate_code.
START-OF-SELECTION.
PERFORM get_data_ekko.
PERFORM build_field_catalog.
END-OF-SELECTION.
PERFORM get_layout.
PERFORM fill_event.
perform fill_variant.
PERFORM print_data_ekko.
*& Form get_data_ekko
text
FORM get_data_ekko .
SELECT ebeln
bukrs
bstyp
lifnr
ekorg
ekgrp
FROM ekko
INTO TABLE it_ekko
WHERE bukrs IN s_bukrs
AND lifnr IN s_lifnr.
IF sy-subrc = 0.
SORT it_ekko BY ebeln.
ENDIF.
ENDFORM. " get_data_ekko
*& Form print_data_ekko
text
FORM print_data_ekko .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = TOP_1
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_BACKGROUND_ID = ' '
i_grid_title = 'ALVREPORT'
I_GRID_SETTINGS = I_GRID_SETTINGS
is_layout = layout
it_fieldcat = it_fcat[]
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
it_events = it_event[]
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
IT_HYPERLINK = IT_HYPERLINK
IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
t_outtab = it_ekko
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
*loop at it_ekko.
*write:/ it_ekko-ebeln hotspot on,15 it_ekko-bukrs,25 it_ekko-bstyp,
35 it_ekko-lifnr,45 it_ekko-ekorg,55 it_ekko-ekgrp.
hide it_ekko-ebeln.
*endloop.
ENDFORM. " print_data_ekko
*& Form get_data_ekpo
text
FORM get_data_ekpo .
IF NOT it_ekko[] IS INITIAL.
SELECT ebelp
matnr
werks
menge
meins
netwr
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln = it_ekko-ebeln.
ENDIF.
ENDFORM. " get_data_ekpo
*& Form validate_code
text
FORM validate_code .
IF NOT s_bukrs[] IS INITIAL.
SELECT SINGLE bukrs
INTO v_bukrs
FROM ekko
WHERE bukrs IN s_bukrs.
IF sy-subrc <> 0.
MESSAGE e001. "invalid company code
ENDIF.
ENDIF.
ENDFORM. " validate_code
*& Form build_field_catalog
text
FORM build_field_catalog .
CLEAR wa_fcat.
*CLEAR IT_FCAT.
wa_fcat-emphasize = 'C112'.
wa_fcat-tabname = 'IT_EKKO'.
wa_fcat-fieldname = 'EBELN'.
wa_fcat-col_pos = '1'.
wa_fcat-seltext_l = 'PO NUMBER'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
*CLEAR IT_FCAT.
wa_fcat-emphasize = 'C212'.
wa_fcat-tabname = 'IT_EKKO'.
wa_fcat-fieldname = 'BUKRS'.
wa_fcat-col_pos = '2'.
wa_fcat-seltext_l = 'COM CODE'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
*CLEAR IT_FCAT.
wa_fcat-emphasize = 'C312'.
wa_fcat-tabname = 'IT_EKKO'.
wa_fcat-fieldname = 'BSTYP'.
wa_fcat-col_pos = '3'.
wa_fcat-seltext_l = 'PO CATEGORY'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
*CLEAR IT_FCAT.
wa_fcat-emphasize = 'C412'.
wa_fcat-tabname = 'IT_EKKO'.
wa_fcat-fieldname = 'LIFNR'.
wa_fcat-col_pos = '4'.
wa_fcat-seltext_l = 'VENDOR NUMBER'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
*CLEAR IT_FCAT.
wa_fcat-emphasize = 'C512'.
wa_fcat-tabname = 'IT_EKKO'.
wa_fcat-fieldname = 'EKORG'.
wa_fcat-col_pos = '5'.
wa_fcat-seltext_l = 'PO ORGAN'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
*CLEAR IT_FCAT.
wa_fcat-emphasize = 'C612'.
wa_fcat-tabname = 'IT_EKKO'.
wa_fcat-fieldname = 'EBGRP'.
wa_fcat-col_pos = '6'.
wa_fcat-seltext_l = 'PO GROUP'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " build_field_catalog
*& Form get_layout
text
FORM get_layout .
layout-zebra = 'X'.
ENDFORM. " get_layout
*& Form get_headerin_alv
text
-->P_IT_HEADER text
FORM top_of_page .
DATA:it_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
CLEAR wa_header.
wa_header-typ = 'H'.
wa_header-info = 'venkatakrishna'.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-info = 'SOFTWARE ENGINEER'.
APPEND wa_header TO it_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_header
I_LOGO = I_LOGO
I_END_OF_LIST_GRID = I_END_OF_LIST_GRID
I_ALV_FORM = I_ALV_FORM
ENDFORM. "TOP_OF_PAGE
*& Form user_command
text
-->RF_UCOMM text
-->RS_SELFIELD text
FORM user_command USING rf_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE rf_ucomm.
WHEN '&IC1'.
READ TABLE it_ekko INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
PERFORM get_data_ekpo.
PERFORM PRINT_DATA_EKPO.
PERFORM build_field_catalog2.
PERFORM print_field_data.
ENDIF.
ENDCASE.
ENDFORM. "user_command
*& Form BUILD_FIELD_CATALOG2
text
FORM build_field_catalog2 .
CLEAR: it_fcat,wa_fcat.
CLEAR: wa_fcat2,it_fcat2.
wa_fcat2-tabname = 'IT_EKPO'.
wa_fcat2-fieldname = 'EBELP'.
wa_fcat2-col_pos = '1'.
wa_fcat2-seltext_l = 'item of po number'.
APPEND wa_fcat2 TO it_fcat2.
CLEAR wa_fcat2.
wa_fcat2-tabname = 'IT_EKPO'.
wa_fcat2-fieldname = 'MATNR'.
wa_fcat2-col_pos = '2'.
wa_fcat2-seltext_l = 'material no'.
APPEND wa_fcat2 TO it_fcat2.
CLEAR wa_fcat2.
wa_fcat2-tabname = 'IT_EKPO'.
wa_fcat2-fieldname = 'WERKS'.
wa_fcat2-col_pos = '3'.
wa_fcat2-seltext_l = 'PLANT'.
APPEND wa_fcat2 TO it_fcat2.
CLEAR wa_fcat2.
wa_fcat2-tabname = 'IT_EKPO'.
wa_fcat2-fieldname = 'MENGE'.
wa_fcat2-col_pos = '4'.
wa_fcat2-seltext_l = 'PO QTY'.
APPEND wa_fcat2 TO it_fcat2.
CLEAR wa_fcat2.
wa_fcat2-tabname = 'IT_EKPO'.
wa_fcat2-fieldname = 'MEINS'.
wa_fcat2-col_pos = '5'.
wa_fcat2-seltext_l = 'ORDER UNIT'.
APPEND wa_fcat2 TO it_fcat2.
CLEAR wa_fcat2.
wa_fcat2-tabname = 'IT_EKPO'.
wa_fcat2-fieldname = 'NETWR'.
wa_fcat2-col_pos = '6'.
wa_fcat2-seltext_l = 'net order value'.
APPEND wa_fcat2 TO it_fcat2.
ENDFORM. " BUILD_FIELD_CATALOG2
*& Form PRINT_FIELD_DATA
text
--> p1 text
<-- p2 text
FORM print_field_data .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = 'EKPO'
I_BACKGROUND_ID = ' '
i_grid_title = 'INTERACTIVE REPORT'
I_GRID_SETTINGS = I_GRID_SETTINGS
IS_LAYOUT = IS_LAYOUT
it_fieldcat = it_fcat2
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = ws_x_variant
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
IT_HYPERLINK = IT_HYPERLINK
IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
t_outtab = it_ekpo
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
*USE THE POPUP_TO_CONFIRM FUNCTION MODULE FOR SELECT
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = 'venkat'
I_SELECTION = 'X'
I_ALLOW_NO_SELECTION = I_ALLOW_NO_SELECTION
I_ZEBRA = 'X'
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_CHECKBOX_FIELDNAME = I_CHECKBOX_FIELDNAME
I_LINEMARK_FIELDNAME = I_LINEMARK_FIELDNAME
I_SCROLL_TO_SEL_LINE = 'X'
i_tabname = 'EKPO'
i_structure_name = 'EKPO'
it_fieldcat = it_fcat2
IT_EXCLUDING = IT_EXCLUDING
I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
I_CALLBACK_USER_COMMAND = I_CALLBACK_USER_COMMAND
is_private = gs_private
IMPORTING
es_selfield = gs_selfield
e_exit = g_exit
TABLES
t_outtab = IT_EKPO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ENDFORM. " PRINT_FIELD_DATA
*& Form fill_event
text
--> p1 text
<-- p2 text
FORM fill_event .
DATA : st_event TYPE slis_alv_event.
*- Clear.
CLEAR : st_event, it_event[].
*- Local variable
DATA : l_tabix TYPE sy-tabix.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_event
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*- Read event table
READ TABLE it_event WITH KEY name = slis_ev_top_of_page
INTO st_event.
*- Top of page event
*- Clear
CLEAR l_tabix.
l_tabix = sy-tabix.
*- Check subrc
IF sy-subrc = 0.
st_event-form = c_top_of_page.
*- Modify
MODIFY it_event FROM st_event INDEX l_tabix.
*- Clear
CLEAR st_event.
ENDIF.
*- User command event
*- Read event table
READ TABLE it_event WITH KEY name = slis_ev_user_command
INTO st_event.
*- Clear
CLEAR l_tabix.
l_tabix = sy-tabix.
*- Check subrc
IF sy-subrc = 0.
st_event-form = c_usercommand.
*- Modify
MODIFY it_event FROM st_event INDEX l_tabix.
*- Clear
CLEAR st_event.
ENDIF.
ENDFORM. " fill_event
*& Form GET_HEADER
text
*& Form fill_variant
text
form fill_variant .
ws_x_variant-report = 'ZVEN_PRA'.
endform. " fill_variant
</code>
Thanks,
suraj
Thank u frnds i m getting it now.
I M GETTING PROBLEM IN THIS PROGRAM AGAIN.
<CODE>Report Z_50840_ALV
Line-size 80
Line-count 64
Message-id ZZ
No Standard Page Heading.
Copyright statement *
@ copyright 2007 by Intelligroup Inc. *
Program Details *
Program Name: Z_50840_ALV
Date : 19.07.2007
Author : Vasudevaraman V
Description : Test Program
Transport No:
Change Log *
Date :
Author :
Description :
Transport No:
Tables *
Tables: vbrk.
Type Pools *
Type-Pools: SLIS.
Variables *
Data: GV_REPID TYPE SY-REPID.
Structures *
Data: BEGIN OF GIT_VBRK OCCURS 0,
VBELN LIKE VBRK-VBELN, "Billing Document
FKART LIKE VBRK-FKART, "Billing Type
KNUMV LIKE VBRK-KNUMV, "Number of the document condition
BUKRS LIKE VBRK-BUKRS, "Company code
NETWR LIKE VBRK-NETWR, "Net value in document currency
WAERK LIKE VBRK-WAERK, "SD document currency in basic list
END OF GIT_VBRK,
GIT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT TYPE slis_fieldcat_alv,
GIT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT.
Field Symbols *
Field-symbols: <fs_xxxx>.
Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR VBRK-VBELN.
PARAMETERS: LISTDISP RADIOBUTTON GROUP G1,
GRIDDISP RADIOBUTTON GROUP G1 DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK B1.
Initialization *
Initialization.
GV_REPID = SY-REPID.
At Selection Screen *
At selection-screen.
Start Of Selection *
Start-of-selection.
SET PF-STATUS 'ABC'(001).
PERFORM GET_BILLING_DETAILS.
PERFORM FIELD_CATALOGUE.
PERFORM GET_EVENTS.
End Of Selection *
End-of-selection.
PERFORM DISPLAY_BILLING_DETAILS.
Top Of Page *
Top-of-page.
End Of Page *
End-of-page.
*& Form GET_BILLING_DETAILS
text
--> p1 text
<-- p2 text
FORM GET_BILLING_DETAILS .
SELECT VBELN
FKART
KNUMV
BUKRS
NETWR
WAERK
FROM VBRK
INTO TABLE GIT_VBRK
WHERE VBELN IN S_VBELN.
IF SY-SUBRC = 0.
SORT GIT_VBRK BY VBELN.
ENDIF.
ENDFORM. " GET_BILLING_DETAILS
*& Form FIELD_CATALOGUE
text
--> p1 text
<-- p2 text
FORM FIELD_CATALOGUE .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = GV_REPID
I_INTERNAL_TABNAME = 'GIT_VBRK'
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = GV_REPID
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
CHANGING
CT_FIELDCAT = GIT_FCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " FIELD_CATALOGUE
*& Form DISPLAY_BILLING_DETAILS
text
--> p1 text
<-- p2 text
FORM DISPLAY_BILLING_DETAILS .
IF LISTDISP = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GV_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = I_STRUCTURE_NAME
IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = GIT_FCAT
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
IT_EVENTS = GIT_EVENTS
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IR_SALV_LIST_ADAPTER = IR_SALV_LIST_ADAPTER
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = GIT_VBRK
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_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GV_REPID
I_CALLBACK_PF_STATUS_SET = ' '
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_STRUCTURE_NAME
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_GRID_TITLE
I_GRID_SETTINGS = I_GRID_SETTINGS
IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = GIT_FCAT
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
IT_EVENTS = GIT_EVENTS
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
IT_HYPERLINK = IT_HYPERLINK
IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = GIT_VBRK
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.
ENDFORM. " DISPLAY_BILLING_DETAILS
*& Form GET_EVENTS
text
--> p1 text
<-- p2 text
FORM GET_EVENTS .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = GIT_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT GIT_EVENTS INTO WA_EVENTS.
CASE WA_EVENTS-NAME.
WHEN 'USER_COMMAND'.
WA_EVENTS-FORM = 'USER_COMMAND'.
ENDCASE.
MODIFY GIT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " GET_EVENTS
FORM USER_COMMAND.
WRITE :/ 'USER_COMMAND'.
ENDFORM.</CODE>.
REGARDS,
SURAJ
Similar Messages
-
Regarding ALV output to Excel file download
Hi all,
i had a requirement when downloading the ALV output to the Excel file it should ask for the password.if the user enters the password then this pass word shuld be assigned to the Excel file that was downloaded.
Can i know how this can be implementedHi,
Using EXCEL_OLE_STANDARD_DAT you can specify the PASSWORD & PASSWORD OPTION.
Regards,
Sharat -
Regarding ALV outputs ( with layout variants)
Hi,
I have a problem where in an ALV report when it is executed with a variant (there is one layout parameter in the screen which is also filled. This layout is set with a filter),
displays the output. But the displayed output doesn't filter the output as per the required criteria set in the layout filter.
When I execute the report with the same variant but now if I select the layout by pressing F4 on the layout field and select the same layout as earlier (which is having the filter criteria), now it displays the output as per the required criteria set in the filter.
I don't understand why if I execute the report with a variant with the layout value also filled, it is not able to give the required output as per the filter criteria set for the layout.
When the report is executed with the same variant but the layout value selected from F4, it dispalys the correct output with the filter criteria set for the layout.
In general, I mean why the program is not able to load the layout with filter when it is called from a variant?
Regards,
RajeshIt depends on your Layout, How you saved it .
And one more question are you passing the layout parameter and Filter parameter to the Function module -
I am not getting the headings of the fields in ALV output.
I am not getting ALV out put but the headings of the fields in ALV output.
Please see my below code .
TYPES : BEGIN OF ty_zgxmit.
INCLUDE STRUCTURE zgxmit.
TYPES : END OF ty_zgxmit.
DATA : gt_zgxmit TYPE TABLE OF ty_zgxmit.
*& Form alv_display *
This subroutine is to display the out put in ALV. *
FORM alv_display .
Local data
DATA: y_x LIKE boole VALUE 'X'.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: lf_fieldcat TYPE slis_fieldcat_alv.
DATA: lh_index LIKE lf_fieldcat-col_pos.
For variant
DATA: ws_repid LIKE sy-repid,
g_save TYPE c VALUE 'A',
g_exit TYPE c,
g_variant LIKE disvariant,
gx_variant LIKE disvariant.
For 1st field.( RPT_LOC )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'RPT_LOC'.
lf_fieldcat-tabname = 'GT_ZGXMIT'.
lf_fieldcat-ref_tabname = 'RPT_LOC'.
lf_fieldcat-ref_fieldname = 'ZGXMIT'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
For 2nd field.( BAL_XMIT )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'BAL_XMIT'.
lf_fieldcat-tabname = 'GT_ZGXMIT'.
lf_fieldcat-ref_tabname = 'BAL_XMIT'.
lf_fieldcat-ref_fieldname = 'ZGXMIT'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
For 3rd field.( INC_XMIT )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'INC_XMIT'.
lf_fieldcat-tabname = 'GT_ZGXMIT'.
lf_fieldcat-ref_tabname = 'INC_XMIT'.
lf_fieldcat-ref_fieldname = 'ZGXMIT'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
For 4th field.( Z500_XMIT )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'Z500_XMIT'.
lf_fieldcat-tabname = 'GT_ZGXMIT'.
lf_fieldcat-ref_tabname = 'Z500_XMIT'.
lf_fieldcat-ref_fieldname = 'ZGXMIT'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZJV_2245'
it_fieldcat = lt_fieldcat
TABLES
t_outtab = gt_zgxmit
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_displayYou can force the headings like so.
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'RPT_LOC'.
lf_fieldcat-tabname = 'GT_ZGXMIT'.
lf_fieldcat-ref_tabname = 'RPT_LOC'.
lf_fieldcat-ref_fieldname = 'ZGXMIT'.
lf_fieldcat-reptext_ddic = 'Whatever Heading'. "<- Right here
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
Regards,
Rich Heilman -
Newly added field not getting displayed in ALV output
Hi All,
I'm adding one more field/column to be displayed in an old existing program that uses REUSE_ALV_FIELDCATALOG_MERGE to generate the ALV fieldcat.
DATA: BEGIN OF it_salary OCCURS 0,
pernr LIKE pa0000-pernr,
ename LIKE pa0001-ename,
rtext like lv_rtext, -
added field
waers LIKE pa0008-waers
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = driver
i_internal_tabname = 'IT_SALARY'
i_client_never_display = 'X'
i_inclname = driver
CHANGING
ct_fieldcat = lv_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = driver
it_fieldcat = lv_fieldcat[]
i_default = 'X'
i_save = 'A'
is_variant = lv_tmplt
is_layout = lv_ls_layout
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = it_salary
EXCEPTIONS
program_error = 1
OTHERS = 2.
The newly added field is not getting populated in the lv_fieldcat table. Tried running programs BALVBUFDEL,
BCALV_BUFFER_DEL_SHARED then logging off and logging in but of no help.
Please provide suggestion for this issue.
Regards,
Sridevi SHi,
Fieldcat is buffered - so use
I_BYPASSING_BUFFER = 'X'
Since a while CL_GUI_ALV_GRID is available which does NOT need any fieldcat (is determined internally using RTTI). It is worth playing around whith this class if you have some time. This class is recommended for ALV Output by SAP (but no edit is possible - was never supported officially).
A simple use would be:
data: gt_output type standard table of (adjust!).
*simple ALV output
data go_alv type ref to cl_salv_table.
data go_functions type ref to cl_salv_functions_list.
data go_columns type ref to cl_salv_columns_table.
data go_column type ref to cl_salv_column_table.
*Exceprion handlig
data: go_exception type ref to cx_root,
gv_errortext type string.
** fill table gt_output ...
** ALV output
if not gt_output is initial.
try.
call method cl_salv_table=>factory
importing
r_salv_table = go_alv
changing
t_table = gt_output.
catch cx_salv_msg into go_exception.
gv_errortext = go_exception->get_text( ).
message gv_errortext type 'A'.
endtry.
* enable all standard ALV functions
go_functions = go_alv->get_functions( ).
go_functions->set_all( ).
* hide MANDT
go_columns = go_alv->get_columns( ).
go_column ?= go_columns->get_column( columnname = 'MANDT' ).
go_column->set_technical( ).
go_alv->display( ).
Kind regards,
Holger -
Negative sign for DMBTR field in ALV output
Hi Experts,
Before posting I have searched for more than 3 hours in the forums to get a solution for this.
I did not get any solution so I am posting this problem which I need to resolve.
I have to display the DMBTR field in ALV output for which a grand total will have to be displayed.
Here for all the values in DMBTR which are negative are getting displayed as '- 6673.56','- 289956.23' as I am using the edit mask 'V_____________.__'.
I have to get the value shown as '-6673.56', '-289956.23'.
I tried to use convert this DMBTR to String and have successfully displayed the negative sign correctly in front of the value but I am not getting the totals which I need to have
PLease check and suggest for a solution.
Regards
KishoreHi,
If this is the case, then you can use character field to display the sign on the left. Sum up the total and use the event end of list to display the same. Remember to set the TECH and NO_OUT in the field catalog.
Hope this helps.
Regards,
Siva -
Co41 enhancement for add field in ALV output
I must add a custom filed to ALV output of transaction CO41 and i trying to use all the 25 enhancements provided (that i find in other post CO41- Enhancement ), but i haven't found any way to get the desired results.
Can any body help me?
Thanks in advance.Hi,
I had the same requirement to add a custom field to ALV output of transaction CO41.
1. I first added the custom field to an new append-structure to the structure SFC_POCO.
2. Then i added this field to the Dynpro-Screen 200 in the function-group COUP (by choosing the table control, pressing F6 and then adding the custom field of SFC_POCO).
3. At last i added an Enhancement to the function CO_UP_PLANNED_ORDERS_SELECT and filled my custom field with data there.
Please reward if useful.
Regards,
Henry -
ALV output converted into PDF format and send that PDF to user through mail
Hi Experts,
I have report earlier its output was in alv grid.
Now i want that ALV output converted into PDF format.And that PDF output send to user through mail.
Can u please tell how to do?
My code is here(output is displaying in ALV grid).
INCLUDE <icon>.
TYPE-POOLS: slis, kkblo.
TABLES : zmsd_freight_hdr, zmsd_freight_det, zmsd_blinfo, zmsd_diheader.
TABLES : lfa1.
DATA : t_hdr LIKE zmsd_freight_hdr OCCURS 0 WITH HEADER LINE,
T_DET LIKE ZMSD_FREIGHT_DET OCCURS 0 WITH HEADER LINE,
t_bl LIKE zmsd_blinfo OCCURS 0 WITH HEADER LINE,
t_di LIKE zmsd_diheader OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_det OCCURS 0.
INCLUDE STRUCTURE zmsd_freight_det.
DATA type(30).
DATA: END OF t_det.
DATA: v_target2(30),
v_zsammg LIKE t_det-zsammg,
v_gsttotal LIKE t_det-zamount.
DATA : BEGIN OF t_data OCCURS 0,
zsammg LIKE zmsd_freight_hdr-zsammg,
zdidbl LIKE zmsd_freight_hdr-zdidbl,
zvkorg LIKE zmsd_freight_hdr-zvkorg,
zinvno LIKE zmsd_freight_hdr-zinvno,
zttlamt LIKE zmsd_freight_hdr-zttlamt,
zstatus LIKE zmsd_freight_hdr-zstatus,
ztype LIKE zmsd_freight_hdr-ztype,
zconfirm LIKE zmsd_freight_hdr-zconfirm,
zconfirmdate LIKE zmsd_freight_hdr-zconfirmdate,
erdat LIKE zmsd_freight_hdr-erdat,
ernam LIKE zmsd_freight_hdr-ernam,
erzet LIKE zmsd_freight_hdr-erzet,
aedat(10),
aenam LIKE zmsd_freight_hdr-aenam,
aezet LIKE zmsd_freight_hdr-aezet,
zline LIKE zmsd_freight_det-zline,
zfptype LIKE zmsd_freight_det-zfptype,
zchrcode LIKE zmsd_freight_det-zchrcode,
zcurcode LIKE zmsd_freight_det-zcurcode,
zqty LIKE zmsd_freight_det-zqty,
zuom LIKE zmsd_freight_det-zuom,
zrate LIKE zmsd_freight_det-zrate,
zamount LIKE zmsd_freight_det-zamount,
zexrate LIKE zmsd_freight_det-zexrate,
zccode LIKE zmsd_blinfo-zccode, "MADK991565
zccode like ZMSD_FREIGHT_HDR-zfcode, "MADK991565
zbldate(10),
zbl LIKE zmsd_blinfo-zbl,
type(3),
waerk LIKE zmsd_freight_det-zcurcode,
zamountl LIKE zmsd_freight_det-zamount,
END OF t_data.
DATA : w_layout TYPE slis_layout_alv,
w_catalog TYPE slis_fieldcat_alv,
t_catalog TYPE slis_t_fieldcat_alv,
w_sort TYPE slis_sortinfo_alv,
t_sort TYPE slis_t_sortinfo_alv.
DATA V_ZINVNO like T_HDR-ZINVNO. "MADK991565
DATA : v_count TYPE i.
SELECTION-SCREEN BEGIN OF BLOCK a0 WITH FRAME TITLE text-001.
PARAMETERS : p_zvkorg LIKE zmsd_freight_hdr-zvkorg OBLIGATORY .
SELECT-OPTIONS : s_zdidbl FOR zmsd_freight_hdr-zdidbl ,
s_zccode FOR lfa1-lifnr ,
s_status FOR zmsd_freight_hdr-zstatus ,
s_ztype FOR zmsd_freight_hdr-ztype ,
s_erdat FOR zmsd_freight_hdr-erdat ,
s_ernam FOR zmsd_freight_hdr-ernam ,
s_zconfd FOR zmsd_freight_hdr-zconfirmdate .
PARAMETERS : p_zconf AS CHECKBOX .
SELECTION-SCREEN END OF BLOCK a0.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-002.
PARAMETERS : p_hdr RADIOBUTTON GROUP rad DEFAULT 'X' ,
p_det RADIOBUTTON GROUP rad .
SELECTION-SCREEN END OF BLOCK a1.
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
PERFORM get_data.
PERFORM process.
PERFORM display.
END-OF-SELECTION.
PERFORM fm_get_num_pages.
AT USER-COMMAND.
AT LINE-SELECTION.
TOP-OF-PAGE.
PERFORM fm_top_of_page USING '7010' sy-title space.
FORM get_data.
SELECT *
FROM zmsd_freight_hdr
INTO TABLE t_hdr
WHERE zvkorg EQ p_zvkorg
AND zdidbl IN s_zdidbl
AND zstatus IN s_status
AND ztype IN s_ztype
AND erdat IN s_erdat
AND ernam IN s_ernam
AND zconfirmdate IN s_zconfd
AND ZFCODE IN S_ZCCODE. "MADK991565
IF p_zconf = 'X'.
DELETE t_hdr WHERE zconfirm NE 'C'.
ENDIF.
CHECK NOT t_hdr[] IS INITIAL.
SELECT *
FROM zmsd_blinfo
INTO TABLE t_bl
FOR ALL ENTRIES IN t_hdr
WHERE zsammg = t_hdr-zsammg.
SORT t_bl BY zsammg.
SELECT *
FROM zmsd_diheader
INTO TABLE t_di
FOR ALL ENTRIES IN t_hdr
WHERE zsammg = t_hdr-zsammg.
SORT t_di BY zsammg.
IF P_DET = 'X'. "MADK933361
SELECT *
FROM zmsd_freight_det
INTO TABLE t_det
FOR ALL ENTRIES IN t_hdr
WHERE zsammg = t_hdr-zsammg
AND ZINVNO = T_HDR-ZINVNO . "MADK991565
SORT t_det BY zsammg zline. "MADK991565
SORT T_DET BY ZSAMMG ZINVNO ZLINE. "MADK991565
ENDIF. "MADK933361
ENDFORM.
FORM process.
REFRESH t_data.
CLEAR v_gsttotal. "MADK933361
LOOP AT t_hdr.
Start of MADK933361
CLEAR: v_target2.
v_zsammg = t_hdr-zsammg.
V_ZINVNO = T_HDR-ZINVNO. "MADK991565
AT NEW zsammg. "MADK991565
AT NEW ZINVNO. "MADK991565
PERFORM get_gst_value.
ENDAT.
End of MADK933361
PERFORM move_header.
CHECK t_data-zccode IN s_zccode.
IF p_det = 'X'.
CSF Project Changes Starts DEV34 MADK985782
LOOP AT T_DET WHERE ZSAMMG = T_HDR-ZSAMMG..
LOOP AT t_det WHERE zsammg = t_hdr-zsammg AND
zinvno = t_hdr-zinvno.
CSF Project Changes Ends DEV34 MADK985782
PERFORM move_header.
CHECK t_data-zccode IN s_zccode.
MOVE-CORRESPONDING t_det TO t_data.
t_data-zamountl = t_data-zamount * t_data-zexrate.
APPEND t_data.
CLEAR t_data.
ENDLOOP.
ELSE.
APPEND t_data.
CLEAR t_data.
ENDIF.
AT END OF zsammg.
CLEAR v_gsttotal.
ENDAT.
*Start of changes for IS090901289-PIA MADK991565
AT END OF ZINVNO.
CLEAR V_GSTTOTAL.
ENDAT.
*End of changes for IS090901289-PIA MADK991565
ENDLOOP.
ENDFORM.
FORM move_header.
MOVE-CORRESPONDING t_hdr TO t_data.
t_data-zttlamt = t_data-zttlamt + v_gsttotal. "MADK933361
t_data-waerk = 'SGD'.
IF NOT t_hdr-aedat IS INITIAL.
WRITE: t_hdr-aedat TO t_data-aedat.
ELSE.
CLEAR : t_data-aedat.
ENDIF.
READ TABLE t_bl WITH KEY zsammg = t_hdr-zsammg BINARY SEARCH.
IF sy-subrc EQ 0.
t_data-zccode = t_bl-zccode. "MADK991565
T_DATA-ZCCODE = T_HDR-ZFCODE. "MADK991565
IF NOT t_bl-zbldate IS INITIAL.
WRITE: t_bl-zbldate TO t_data-zbldate.
ENDIF.
t_data-zbl = t_bl-zbl.
t_data-type = 'DBL'.
ELSE.
READ TABLE t_di WITH KEY zsammg = t_hdr-zsammg BINARY SEARCH.
IF sy-subrc EQ 0.
t_data-zccode = t_di-zdiforcode. "MADK991565
T_DATA-ZCCODE = T_HDR-ZFCODE. "MADK991565
t_data-type = 'DI'.
ENDIF.
ENDIF.
ENDFORM.
FORM display.
IF t_data[] IS INITIAL.
MESSAGE s398(00) WITH 'No Data Selected'.
EXIT.
ENDIF.
DATA : l_repid LIKE sy-repid.
l_repid = sy-repid.
REFRESH t_catalog.
CLEAR t_catalog.
w_layout-cell_merge = 'X'.
PERFORM map_fields.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_user_command = 'ALV_USER_COMMAND'
is_layout = w_layout
it_fieldcat = t_catalog[]
i_grid_title = sy-title
i_save = 'A'
it_sort = t_sort[]
TABLES
t_outtab = t_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
FORM map_fields.
Sort Order
CLEAR v_count.
PERFORM sf USING 'ZDIDBL' 'X' 'X'.
Fields to be displayed
CLEAR v_count.
IF p_hdr = 'X'.
PERFORM af USING :
DESCRIPTION FIELD LEN RTABLE RFIELD
'DI/DBL ' 'ZDIDBL' '14' ' ' ' ',
'Type ' 'TYPE' '04' ' ' ' ',
'Forwarder Code ' 'ZCCODE' '14' ' ' ' ',
'BL Number ' 'ZBL' '14' ' ' ' ',
'BL Date ' 'ZBLDATE' '10' ' ' ' ',
'Invoice Number ' 'ZINVNO' '15' ' ' ' ',
'Extraction ' 'ZSTATUS' '05' 'ZMSD_FREIGHT_HDR' 'ZSTATUS ',
'Freight Type ' 'ZTYPE' '05' 'ZMSD_FREIGHT_HDR' 'ZTYPE ',
'Confirmation ' 'ZCONFIRM' '05' 'ZMSD_FREIGHT_HDR' 'ZCONFIRM',
'Confirm Date ' 'ZCONFIRMDATE' '10' 'ZMSD_FREIGHT_HDR'
'ZCONFIRMDATE',
'Total Amount ' 'ZTTLAMT' '18' ' ' ' ',
'Created On ' 'ERDAT' '10' ' ' ' ',
'Created By ' 'ERNAM' '10' ' ' ' ',
'Changed On ' 'AEDAT' '10' ' ' ' ',
'Changed By ' 'AENAM' '10' ' ' ' '.
ELSE.
PERFORM af USING :
DESCRIPTION FIELD LEN RTABLE RFIELD
'DI/DBL ' 'ZDIDBL' '14' ' ' ' ',
'Type ' 'TYPE' '04' ' ' ' ',
'Forwarder Code ' 'ZCCODE' '14' ' ' ' ',
'BL Number ' 'ZBL' '14' ' ' ' ',
'BL Date ' 'ZBLDATE' '10' ' ' ' ',
'Invoice Number ' 'ZINVNO' '15' ' ' ' ',
'Extraction ' 'ZSTATUS' '05' 'ZMSD_FREIGHT_HDR' 'ZSTATUS ',
'Freight Type ' 'ZTYPE' '05' 'ZMSD_FREIGHT_HDR' 'ZTYPE ',
'Confirmation ' 'ZCONFIRM' '05' 'ZMSD_FREIGHT_HDR' 'ZCONFIRM',
'Confirm Date ' 'ZCONFIRMDATE' '10' 'ZMSD_FREIGHT_HDR'
'ZCONFIRMDATE',
'Total Amount ' 'ZTTLAMT' '18' ' ' ' ',
'Freight Payment ' 'ZFPTYPE' '14' ' ' ' ',
'Charge Code ' 'ZCHRCODE' '10' ' ' ' ',
'Currency ' 'ZCURCODE' '08' ' ' ' ',
'Quantity ' 'ZQTY' '13' ' ' ' ',
'UoM ' 'ZUOM' '04' ' ' ' ',
'Rate ' 'ZRATE' '15' ' ' ' ',
'Amt(Foreign Curr)' 'ZAMOUNT' '16' ' ' ' ',
'Exchange Rate ' 'ZEXRATE' '13' ' ' ' ',
'Amt(Local Curr) ' 'ZAMOUNTL' '16' ' ' ' ',
'Created On ' 'ERDAT' '10' ' ' ' ',
'Created By ' 'ERNAM' '10' ' ' ' ',
'Changed On ' 'AEDAT' '10' ' ' ' ',
'Changed By ' 'AENAM' '10' ' ' ' '.
ENDIF.
ENDFORM.
FORM af USING text
field
len
table
reffield.
v_count = v_count + 1.
w_catalog-col_pos = v_count.
w_catalog-fieldname = field.
w_catalog-ref_tabname = table.
w_catalog-ref_fieldname = reffield.
w_catalog-seltext_s = text.
w_catalog-seltext_m = text.
w_catalog-seltext_l = text.
w_catalog-outputlen = len.
IF field = 'ZTTLAMT' OR field = 'ZAMOUNTL'.
w_catalog-no_zero = 'X'.
w_catalog-cfieldname = 'WAERK'.
w_catalog-datatype = 'CURR'.
ENDIF.
IF FIELD = 'ZRATE' OR FIELD = 'ZAMOUNT'.
IF field = 'ZAMOUNT'.
w_catalog-no_zero = 'X'.
w_catalog-cfieldname = 'ZCURCODE'.
w_catalog-datatype = 'CURR'.
ENDIF.
IF field = 'ZQTY' OR field = 'ZRATE'.
w_catalog-no_zero = 'X'.
w_catalog-datatype = 'DEC'.
ENDIF.
APPEND w_catalog TO t_catalog.
CLEAR w_catalog.
ENDFORM.
FORM sf USING fieldname sortup group.
v_count = v_count + 1.
CLEAR w_sort.
w_sort-fieldname = fieldname.
w_sort-spos = v_count.
w_sort-up = sortup.
w_sort-group = group.
APPEND w_sort TO t_sort.
ENDFORM.
FORM alv_user_command USING in_ucomm LIKE sy-ucomm
in_selfield TYPE slis_selfield.
DATA: lfs_data LIKE t_data.
IF in_ucomm = '&IC1'.
READ TABLE t_data INDEX in_selfield-tabindex INTO lfs_data.
CHECK NOT lfs_data-zdidbl IS INITIAL.
IF lfs_data-type = 'DBL'.
DATA: l_zdbl LIKE zmsd_diheader-zdinum.
l_zdbl = in_selfield-value.
EXPORT l_zdbl TO MEMORY ID 'VBL'.
CALL TRANSACTION 'ZMSD_BL01'.
ENDIF.
IF lfs_data-type = 'DI'.
DATA: v_dinum LIKE zmsd_diheader-zdinum.
v_dinum = in_selfield-value.
EXPORT v_dinum TO MEMORY ID 'VDI'.
CALL TRANSACTION 'ZMSD_DI01'.
ENDIF.
ENDIF.
ENDFORM.
FORM get_gst_value.
LOOP AT t_det WHERE zsammg = v_zsammg
AND ZINVNO = V_ZINVNO. "MADK991565
CHECK t_data-zccode IN s_zccode.
t_det-zamount = t_det-zamount * t_det-zexrate.
SELECT SINGLE y0mmtarget2
INTO v_target2
FROM y0mmipstranslate
WHERE y0mmdatatype = '70' AND
y0mmsource = t_det-zchrcode.
SELECT SINGLE y0mmtarget1
INTO t_det-type
FROM y0mmipstranslate
WHERE y0mmdatatype = '76' AND
y0mmsource = v_target2.
IF t_det-type NE '3Z'.
v_gsttotal = v_gsttotal +
( t_det-zamount * 5 / 100 ).
ENDIF.
ENDLOOP.
Regards,
Raj.Hello,
Following is the procedure to convert alv output to spool and then it to PDF Format.
After we display the ALV, we can check whether it is running in the background using system field u2018sy-batchu2018. Then,we call an function module named u2018GET_JOB_RUNTIME_INFOu2019 to get the current job information. Then go to spool request table tbtcp to get the spool id.
Get current job details
CALL FUNCTION u2018GET_JOB_RUNTIME_INFOu2019
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> u20180000000000u2032
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
Finally, we can call function module u2018CONVERT_ABAPSPOOLJOB_2_PDFu2018 to convert spool reqeust(which is stored in OTF format) to PDF format. Then we can call either function module u2018SO_DOCUMENT_SEND_API1u2032 or SAP BCS (Business Communication Service) to send the pdf as an email attachment.
CALL FUNCTION u2018CONVERT_ABAPSPOOLJOB_2_PDFu2019
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
Regards,
Sayali
Edited by: Sayali Paradkar on Apr 20, 2010 12:51 PM -
Page-break in alv background job for alv output variant not coming correctl
Hi,
I have created an ALV grid report. When i run the report in background i get the output with correct page-break on FIELD1. Now when i run the report in background with an "ALV output variant" (its the ALV variant that controls the fields display in the output; this is not the program variant), i do not get the page-break on FIELD1. I have already build the sort criteria and using:
gs_sort-group = '* '. "New-Page
Please let me know what could be reason for not getting the page-break in background when i am using the alv output variant and how do i correct this problem.
Regards,
RakeshHello Everyone,
I have solved the problem. While running the program in background, we get the page-breaks when we use the below part of code in the sort catalogue with the condition that the program variant should not use any ALV layout variant.
gs_sort-group = '* '. "New-Page
If you are using the ALV layout variant in the program variant then we can check the ROWPOS, COLPOS, and NO_OUT for that ALV layout variant and pass them along in the fieldcatalog table. You should be careful with not to pass the layout variant in the DISVARIANT. You can notice that i have cleared it and simply passing the program name into that.
*C-- Process separately for jobs running in Background. Actually
*C-- sortcat-group solves the problem only in Foreground. In background
*C-- when ALV layout variant is not selected then it works otherwise it
*C-- fails. So for background jobs we are reading the fieldcat and then
*C-- passing the same in the display FM.
IF sy-batch = 'X'.
CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
EXPORTING
i_dialog = ' '
i_user_specific = ' '
i_default = ' '
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
it_default_fieldcat = gt_fieldcat
i_layout = gs_layout
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
IMPORTING
* E_EXIT =
et_fieldcat = lt_fieldcat
* et_sort = gt_sort[]
* ET_FILTER =
* es_layout = gs_layout
CHANGING
cs_variant = gs_disvariant
EXCEPTIONS
wrong_input = 1
fc_not_complete = 2
not_found = 3
program_error = 4
OTHERS = 5
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR gs_fieldcat.
LOOP AT gt_fieldcat INTO gs_fieldcat.
*C-- Transfer all position changes to gt_fieldcat from lt_fieldcat
CLEAR ls_fieldcat.
READ TABLE lt_fieldcat
INTO ls_fieldcat
WITH KEY fieldname = gs_fieldcat-fieldname.
IF sy-subrc = 0.
gs_fieldcat-row_pos = ls_fieldcat-row_pos.
gs_fieldcat-col_pos = ls_fieldcat-col_pos.
gs_fieldcat-no_out = ls_fieldcat-no_out.
MODIFY gt_fieldcat FROM gs_fieldcat INDEX sy-tabix.
CLEAR gs_fieldcat.
ENDIF.
ENDLOOP.
*C-- Clear the disvariant for the background job as it contains the ALV
*C-- layout varinat
CLEAR gs_disvariant.
gs_disvariant-report = 'ZGPPMP0001'.
Then pass gt_fieldcat to 'REUSE_ALV_GRID_DISPLAY'.
The reason i'm doing it this way is that when we pass the layout variant name, the contents in gt_fieldcat were getting modified.
One more thing i'd like to point out is that that, i tried to delete the fields with no_out = 'x'. Now when i ran the program in background with all the fields in sort catalog (suppose there are 2 fields field1 and field2) also in fieldcatalog it ran fine. In the next run in background i removed one of the fields in sort catalog from the fieldcatalog (delete the fields with no_out = 'x') and i got dump. Basically i had hidden field1 and so the code which was deleting fields with no_out = 'x' deleted this field from gt_fieldcat. So basically we should not delete fields with no_out = 'x'.
I was getting ABAP runtime errors MESSAGE_TYPE_X in the following part of the standard code.
000310 LOOP AT CT_SORT INTO LS_SORT.
000320
000330 READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
000340 WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
000350 IF SY-SUBRC NE 0.
> MESSAGE X000(0K).
000370 ENDIF.
000380
000390 LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
i have just mentioned this part because when i checked the forum many people were getting such errors "MESSAGE_TYPE_X". This could also be one of the reasons. -
How to get check box in alv output
hi gurus
can anyone explian me how to get check box in alv output
it should not be a pop up window
i want to get in output itself
tahnk you
regards
kals.Hi
by using rs_selfield
ty to call dynamic subroutine..
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
read table rs-selfield with key cond = 'X'
endform.
see the below example
REPORT Z_GET_REFRESH no standard page heading.
type-pools : slis.
tables : makt,
mara.
data : i_fieldcat type slis_t_fieldcat_alv.
CONSTANTS :
gc_refresh TYPE syucomm VALUE '&REFRESH'.
data : begin of i_makt occurs 0,
matnr like makt-matnr,
maktx like makt-maktx,
end of i_makt.
data : v_repid like sy-repid,
g_user_command type slis_formname value 'USER_COMMAND',
g_status_set type slis_formname value 'SET_PF_STATUS',
lt_event_exit TYPE slis_t_event_exit,
ls_event_exit TYPE slis_event_exit.
DATA:LC_GLAY TYPE LVC_S_GLAY.
select-options s_matnr for mara-matnr .
start-of-selection.
select matnr maktx from makt into table i_makt
where matnr in s_matnr.
end-of-selection.
Fill the fieldcatlog
perform fill_field.
Call the FM
perform call_fm.
*& Form fill_field
text
--> p1 text
<-- p2 text
FORM fill_field.
data wa_fieldcat type slis_fieldcat_alv.
clear : wa_fieldcat.
wa_fieldcat-tabname = 'I_MAKT'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-outputlen = '18'.
wa_fieldcat-seltext_l = 'Material #'.
wa_fieldcat-col_pos = '1'.
append wa_fieldcat to i_fieldcat.
clear : wa_fieldcat.
wa_fieldcat-tabname = 'I_MAKT'.
wa_fieldcat-fieldname = 'MAKTX'.
wa_fieldcat-outputlen = '40'.
wa_fieldcat-seltext_l = 'Material Desc'.
wa_fieldcat-col_pos = '2'.
append wa_fieldcat to i_fieldcat.
ENDFORM. " fill_field
*& Form call_fm
text
--> p1 text
<-- p2 text
FORM call_fm.
v_repid = sy-repid.
LC_GLAY-EDT_CLL_CB = 'X'.
CLEAR ls_event_exit.
ls_event_exit-ucomm = gc_refresh. " Refresh
ls_event_exit-after = 'X'.
APPEND ls_event_exit TO lt_event_exit.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = g_status_set
I_CALLBACK_USER_COMMAND = g_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 = LC_GLAY
IS_LAYOUT =
IT_FIELDCAT = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT = lt_event_exit
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_makt
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_fm
FORM USER_COMMAND *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
data i_RSPARAMS like RSPARAMS occurs 0.
CASE R_UCOMM.
WHEN '&IC1'.
read table i_makt index rs_selfield-tabindex.
SET PARAMETER ID 'MAT' FIELD i_makt-matnr.
if not i_makt-matnr is initial.
call transaction 'MM02' and skip first screen.
endif.
when '&REFRESH'.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
CURR_REPORT = v_repid
IMPORTING
SP =
TABLES
SELECTION_TABLE = i_RSPARAMS
EXCEPTIONS
NOT_FOUND = 1
NO_REPORT = 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.
submit z_get_refresh with selection-table i_RSPARAMS.
rs_selfield-refresh = 'X'.
ENDCASE.
MOVE '&REFRESH' TO r_ucomm.
ENDFORM.
FORM set_pf_status *
FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
DELETE Rt_extab WHERE fcode = gc_refresh.
SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'
EXCLUDING Rt_extab.
*SET PF-STATUS 'STANDARD' EXCLUDING rt_extab.
SET TITLEBAR sy-tcode.
ENDFORM. -
How to display Long text in alv output
Hi,
I have developed an ALV report.It is displaying the output.
There is another requirment for alv output text field as below
From the long text fields show only the first 20 characters and afterwards the long text icon. If the icon is clicked open the long text display screen.
Please give your suggestion how to work on this requirement.
Thanks in advanceHi,
Create a hotspot for the long text column of ALV.
When user clicks on the hotspot, handle the event to display long text screen.
You may refer sample program of hotspot ALV :
Goto SE38
Type BCALV*
Click F4
search for HOTSPOT or EVENTS & you will get a sample program.
Best regards,
Prashant -
Add button to QA33 ALV output list
Hi, SAP experts:
I need to add a custom button to the ALV output list display in QA33 transaction.
I´ve only found the BAdi ALV_SWITCH_GRID_LIST, but it doesn´t fit my requirements at all.
Any idea?
Thank you very much!Hi,
Please check if this explanation helps you,
Custom Butoon in REUSE_ALV_GRID_DISPLAY_LVC
Regards
Ram -
Runtime Error while summing a column in ALV output
Dear All,
I have developed an ALV Report and the report is giving output without any flaws.
I have defined proper field catalog and displaying the results using REUSE_ALV_GRID function module.
Now the report is generating Runtime Error while the user selects a column and click the SUM icon.
The fields like Qty, or amounts are also theowing runtime error while summing up their column in the ALV output.
What might be the reason and how to resolve this issu?
Regards
PavanHi ,
I don't know how you have write down the code but follow the below coding example:
FOR TOTAL:
there is a property of fieldcatalog, that is do_sum.
USE COED LIKE:
PERFORM fieldcat USING:
'1' 'MATNR' 'I_MARD' 'MATERIAL NO' 'MARD' 'MATNR ' ' ',
'2' 'NETWR' 'I_MARD' 'PLANT' 'MARD' 'WERKS' ' ',
FORM fieldcat USING value(p_0029)
value(p_0030)
value(p_0031)
value(p_0032)
wa_fieldcat-col_pos = p_0029.
wa_fieldcat-fieldname = p_0030.
wa_fieldcat-tabname = p_0031.
wa_fieldcat-reptext = p_0032.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " FIELDCAT
in final output you will get the total of currency field.
FOR SUB TOTAL:
decleare: i_sort type standard table of slis_sortinfo_alv,
wa_sort type slis_t_sortinfo_alv.
wa_sort-spos = '1'.
wa_sort-fieldname = 'field1'.
wa_sort-subtot = 'X'.
append wa_tab to i_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
it_sort = i_sort
Hope this can solve your pbs.
If you need more inputs let me know.
Regards,
Tutun -
Regarding the output of background job in spool
Hi Friends:
I have a report.When I run it in foreground, it displays an alv output.
I want to see the output when I run it in background. When I select the job & press on spool, it shows a message that no list available. Please help with the settings to see the output in spool.
Suitable points will be rewarded.
Regards:
GauravHi,
have a look at this thread:
Re: OO ALV in background job
Best regards. -
Clearing of ALV output is not happening in one side of the output.
Hi All,
I have created a simple upload program and using a Post button I am posting the Material Document. I have uploaded the file, I am using a ALV splitter to display the output ( Line Item in left panel and Message log in the right panel).
If I upload another Excel file on the same screen, and click on 'Upload' button, left panel is getting refreshed with new set of line items whereas in the Right Panel Message Log details of First uploaded file is present, it is not getting refreshed.
I used Free(), Refresh and Refresh_Table_dsiplay keywords to clear it, but its not working.
In debug mode, If I see the internal table which is used to store the Message Log Details is empty, but the message is still present in the ALV output for newly uploaded file.
Kindly give your valuable inputs.
Thanks & Regards,
Karthikeyan G.Hello Karthikeyan G,
have you tried to cl_gui_cfw=>flush after your Refresh_Table_Display?
Also,when you write ALV splitter, did you use easy-splitter or the regular splitter container?
You ran the methods against the correct instance, right
Hope that helps,
Frank.
Maybe you are looking for
-
Exchange OWA 2010 is not showing events on calendar correctly.
I have Exchange 2010 setup on 2 servers running Windows 2008 R2 Standard. Some users' OWA accounts, (mine included) are working just fine. Other users, are showing just a blank gray box on the calendar. Even if there are multiple events that day,
-
The validate() and doLayout() methods
In the first mini-program I made, what is the purpose of the validate() method? I read that it is to force the container into using the new layout manager for the components added. My first question is just: why don't I have to call the validate() me
-
Two ways of integrating portlets from PDK
Hello, I have just installed the sample JPDK portlets in Portal and they are working correctly. I followed the instructions on the file: /pdk/jpdk/installing.jpdk.html (Installing the PDK-Java Framework and Samples) from the August PDK edition. Surpr
-
Block the vendor from quality side as process from the evoluation
Dear All, How to Block the vendor from the quality side. i check the MK05 . but if i block thru this txn. the purchase people will change unblock the vendor from XK05 . I need to know , if the vendor is blocked . it will not be unblock by anyother th
-
IPhoto 8.1 breaks Entourage 2008 with Snow Leopard
The new iPhoto 8.1 update breaks the email functionality to Entourage 2008, if you're using Mac OS X 10.6 Snow Leopard. iPhoto 8.1 can no longer successfully email photos to Entourage 2008. It worked just fine with iPhoto 8.0.4, but no longer works w