Adding a Pushbutton on ALV toolbar
Hi ,
I wanna add a pushbutton to my ALV report toolbar, I have tried by screen painter(se51) but its not working. That is when you open the screen painter its showing the push button, but when you run the screen as transaction its not showing that button.
Any help is greatly appreciated.
Regards
Moderator Message: Please search before posting your question. Thread locked.
Edited by: Suhas Saha on Oct 18, 2011 3:40 PM
Hi Harsh,
To add button in the ALV toolbar, follow the below steps :
1. Open Functional group SALV in se80 and copy the GUI status 'STANDARD' in customer namespace ( for e.g. ZSTANDARD' to your ALV report program.
2. Once you copy the GUI status, open your ALV report program in se80 and modify it's GUI status 'ZSTANDARD' according to your requirement.
3. Code accordingly in your ALV report program.
Here is the below code for your reference.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_pf_status_set = alv_status_set
i_callback_user_command = *alv_user_comm*
i_grid_title = grid_title
i_save = g_save
is_variant = gs_variant
is_layout = alv_layout
it_fieldcat = alv_fieldcat[]
it_events = gt_events[]
it_sort = alv_sort[]
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = it_final[].
PERFORM *alv_user_comm* USING r_ucomm
rs_selfield.
FORM *alv_user_comm* USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
r_ucomm = sy-ucomm.
CASE r_ucomm.
ENDCASE.
ENDFORM.
Let us know if you still having some issues.
Cheers
VJ
Similar Messages
-
How can I add a pushbutton inside ALV toolbar?
Hi,
This can be included into ALV by defining a GUI and setting that GUI using Set PF Status.
Check the below code for the same,
REPORT ZSPRENH069 NO STANDARD PAGE HEADING.
TYPE-POOLS : SLIS. "Global Type for ALV
T Y P E S *
TYPES:
BEGIN OF TY_VB_AKAP,
VBELN TYPE VBELN_VA, "Sales Document
KUNNR TYPE KUNAG, "Sold-to party
POSNR TYPE POSNR_VA, "Item Number
MATNR TYPE MATNR, "Material Number
PMATN TYPE PMATN, "Pricing Reference Material/Newly Created Material
KWMENG TYPE KWMENG, "Cumulative Order Qty. in Sales Units
VRKME TYPE VRKME, "Sales Unit
NETPR TYPE NETPR, "Net Price
KZWI1 TYPE KZWI1, "Sub Total 1 from pricing procedure for condition
VKAUS TYPE ABRVW, "Usage Indicator
END OF TY_VB_AKAP,
BEGIN OF TY_MARA,
MATNR TYPE MATNR, "Material Number
ZZTECHSPEC TYPE ZTECHSPEC, "Technical Specification
END OF TY_MARA,
BEGIN OF TY_MVKE,
MATNR TYPE MATNR, "Material Number
VKORG TYPE VKORG, "Sales Organization
VTWEG TYPE VTWEG, "Distribution Channel
KONDM TYPE KONDM, "Material Pricing Group
END OF TY_MVKE,
BEGIN OF TY_VBKD,
VBELN TYPE VBELN_VA, "Sales Document
POSNR TYPE POSNR_VA, "Item Number
BSTKD_E TYPE BSTKD_E, "Used to capture New Material Number
END OF TY_VBKD,
BEGIN OF TY_IHEADER,
SELECT(1) TYPE C, "Check Box
VBELN TYPE VBELN, "Sales Document
KUNNR TYPE KUNAG, "Sold-to Party
END OF TY_IHEADER,
BEGIN OF TY_MESSAGE1,
VKORG TYPE VKORG, "Sales Organization
VTWEG TYPE VTWEG, "Distribution Channel
KUNNR TYPE KUNAG, "Customer number
KONDM TYPE KONDM, "Material pricing group
ZCOUNT(2) TYPE N, "Zcount
MSGTYP(1) TYPE C, "Message type
TEXT(150) TYPE C, "Message text
END OF TY_MESSAGE1,
BEGIN OF TY_MESSAGE2,
VKORG TYPE VKORG, "Sales Organization
VTWEG TYPE VTWEG, "Distribution Channel
KUNNR TYPE KUNAG, "Customer number
MATNR TYPE MATNR, "Material Number
MSGTYP(1) TYPE C, "Message type
TEXT(150) TYPE C, "Message text
END OF TY_MESSAGE2,
BEGIN OF TY_IFINAL,
VBELN TYPE VBELN_VA, "Sales Document
KWMENG TYPE KWMENG, "Cumulative Order Qty. in Sales Units
POSNR TYPE POSNR_VA, "Item Number
KUNNR TYPE KUNAG, "Sold-to party
MATNR TYPE MATNR, "Material Number
VRKME TYPE VRKME, "Sales Unit
KZWI1 TYPE KZWI1, "Sub Total 1 from pricing procedure for condition
VKAUS TYPE ABRVW, "Usage Indicator
ZZTECHSPEC TYPE ZTECHSPEC, "Technical Specification
PMATN TYPE PMATN, "Pricing Reference Material/Newly Created Material
KONDM TYPE KONDM, "Material Pricing Group
END OF TY_IFINAL,
BEGIN OF TY_ACC1,
VBELN TYPE VBELN_VA, "Sales Document
KUNNR TYPE KUNAG, "Sold-to party
KONDM TYPE KONDM, "Material Pricing Group
ZCOUNT(2) TYPE N, "ZCount indicator
KSTBM TYPE KSTBM, "Quantity
VRKME TYPE VRKME, "Sales Unit
ZZTECHSPEC TYPE ZTECHSPEC, "Technical Specification
KZWI1 TYPE KZWI1, "Sub Total 1 from pricing procedure for condition
ERROR(1) TYPE N, "Error Field
END OF TY_ACC1,
BEGIN OF TY_ACC2,
VBELN TYPE VBELN_VA, "Sales Document
KUNNR TYPE KUNAG, "Sold-to party
MATNR TYPE MATNR, "Material Number
KSTBM TYPE KSTBM, "Cumulative Order Qty. in Sales Units
ZZTECHSPEC TYPE ZTECHSPEC, "Technical Specification
VRKME TYPE VRKME, "Sales Unit
KZWI1 TYPE KZWI1, "Sub Total 1 from pricing procedure for condition
ERROR(1) TYPE N, "Error field
END OF TY_ACC2.
D A T A *
Internal Table Declarations
DATA: T_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV, "Fieldcatalog IT
T_EVENTS TYPE SLIS_T_EVENT, "Event IT
T_HEADER TYPE SLIS_T_LISTHEADER, "Header IT
T_VB_AKAP TYPE STANDARD TABLE OF TY_VB_AKAP, "To hold records from VBAK & VBAP Table
T_MARA TYPE STANDARD TABLE OF TY_MARA, "To hold records from MARA Table
T_MVKE TYPE STANDARD TABLE OF TY_MVKE, "To hold records from MVKE Table
T_VBKD TYPE STANDARD TABLE OF TY_VBKD, "To hold records from VBKD Table
T_IHEADER TYPE STANDARD TABLE OF TY_IHEADER, "To hold records from VBAK Table
T_IFINAL TYPE STANDARD TABLE OF TY_IFINAL, "To hold cumulative data for ALV
T_BDCDATA TYPE STANDARD TABLE OF BDCDATA, "IT for bdcdata
T_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL, "IT for error messages
T_MESSAGE1 TYPE STANDARD TABLE OF TY_MESSAGE1, "IT for conditions1 messages
T_MESSAGE2 TYPE STANDARD TABLE OF TY_MESSAGE2, "IT for conditions2 messages
T_ACC2 TYPE STANDARD TABLE OF TY_ACC2, "IT for holding data for Second Access Sequence Processing
T_ACC1 TYPE STANDARD TABLE OF TY_ACC1, "IT for holding data for First Access Sequence Processing
T_SELECT TYPE STANDARD TABLE OF RSPARAMS, "IT for holding data related to the selection screen
Work area Declarations
W_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV, "Fieldcatalog WA
W_EVENT TYPE SLIS_ALV_EVENT, "Event WA
W_HEADER TYPE SLIS_LISTHEADER, "Header WA
W_LAYOUT TYPE SLIS_LAYOUT_ALV, "Layout WA
W_KEYINFO TYPE SLIS_KEYINFO_ALV, "Key Information WA
W_VB_AKAP TYPE TY_VB_AKAP, "To hold records from T_VB_AKAP
W_MARA TYPE TY_MARA, "To hold records from T_MARA
W_MVKE TYPE TY_MVKE, "To hold records from T_MVKE
W_VBKD TYPE TY_VBKD, "To hold records from T_VBKD
W_IHEADER TYPE TY_IHEADER, "To hold records from T_IHEADER
W_IFINAL TYPE TY_IFINAL, "To hold records from T_IFINAL
W_PARAMS TYPE CTU_PARAMS, "CTU Params
W_BDCDATA TYPE BDCDATA, "Work Area for BDCDATA
W_BDCMSGCOLL TYPE BDCMSGCOLL, "Work Area to collect BDC Messages
W_MESSAGE1 TYPE TY_MESSAGE1, "WA for price conditions1 messages
W_MESSAGE2 TYPE TY_MESSAGE2, "WA for price conditions2 messages
W_ACC2 TYPE TY_ACC2, "WA for holding records from T_ACC2
W_ACC1 TYPE TY_ACC1, "WA for holding records from T_ACC1
Variable declarations
G_AUDAT TYPE AUDAT, "Document Date (Date Received/Sent)
G_VBELN TYPE VBELN_VA, "Sales Document
G_KUNNR TYPE KUNAG, "Sold-to party
G_MATNR TYPE MATNR, "Material Number
G_REPID TYPE SY-REPID, "Program Name
G_MESSAGE(73) TYPE C, "To Capture Message
G_FLAG1(1) TYPE C, "Flag
G_ANSWER(1) TYPE C. "Optional Button
Constant declarations
CONSTANTS:
C_A(1) TYPE C VALUE 'A', "Constant Value A
C_S(1) TYPE C VALUE 'S', "Constant Value S
C_U(1) TYPE C VALUE 'U', "Constant Value U
C_X(1) TYPE C VALUE 'X', "Constant Value X
C_E(1) TYPE C VALUE 'E', "Constant Value E
C_I(1) TYPE C VALUE 'I', "Constant Value I
C_R(1) TYPE C VALUE 'R', "Constant Value R
C_B(1) TYPE C VALUE 'B', "Document Category is Quotation
C_HTNAME(10) TYPE C VALUE 'T_IHEADER', "Internal table for Header Data
C_ITNAME(10) TYPE C VALUE 'T_IFINAL', "Internal Table with processed data
C_Q2(2) TYPE C VALUE 'Q2', "Constant Order Reason Q2
C_100(3) TYPE C VALUE '100', "Popup screen
C_046(3) TYPE C VALUE '046', "Value 046
C_047(3) TYPE C VALUE '047', "Value 047
C_25(2) TYPE C VALUE '25', "Popup screen
C_5(1) TYPE C VALUE '5', "Popup screen
C_1 TYPE I VALUE 1, "Value 1 for Error Denotion
C_2 TYPE I VALUE 2, "Value 2 for Error Denotion
C_3 TYPE I VALUE 3, "Value 3 for BDC Error Denotion
C_1000(4) TYPE N VALUE 1000, "Value 1000
C_01(2) TYPE N VALUE '01', "Value 01 for Zcount
C_VK11(4) TYPE C VALUE 'VK11', "Transaction VK11
C_DYNBEGIN(1) TYPE C VALUE 'X', "Indicator
C_UPDATE(1) TYPE C VALUE 'S', "Update
C_DISMODE(1) TYPE C VALUE 'N', "Display
C_ZBPR(4) TYPE C VALUE 'ZBPR', "Condition Type ZBPR
C_ERROR(5) TYPE C VALUE 'ERROR'. "Error screen title
S E L E C T O P T I O N S & P A R A M E T E R S *
Selection-screen Block 1
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_VKORG TYPE VKORG OBLIGATORY, "Sales Organization
P_VTWEG TYPE VTWEG OBLIGATORY, "Distribution Channel
P_SPART TYPE SPART DEFAULT '00'. "Division
SELECTION-SCREEN END OF BLOCK BLK1.
SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: S_AUDAT FOR G_AUDAT, "Document Date (Date Received/Sent)
S_VBELN FOR G_VBELN, "Sales Document
S_KUNNR FOR G_KUNNR, "Sold-to party
S_MATNR FOR G_MATNR. "Material Number
PARAMETERS: P_VKAUS(2) TYPE N. "Usage Indicator
SELECTION-SCREEN END OF BLOCK BLK2.
I N I T I A L I Z A T I O N *
INITIALIZATION.
CLEAR : G_REPID. "Program Name
G_REPID = SY-REPID. "Program Name
A T S E L E C T I O N S C R E E N *
AT SELECTION-SCREEN.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
Data Selection
PERFORM DATA_RETRIEVAL.
Build Field Catalog
PERFORM BUILD_FIELDCATALOG.
Bulid layout
PERFORM BUILD_LAYOUT.
Build Events
PERFORM BUILD_EVENTS.
Captures the Values of Selection Screen
PERFORM CAPTURE_SCREEN.
E N D O F S E L E C T I O N *
END-OF-SELECTION.
Display List
PERFORM DISPLAY_ALV_REPORT.
F O R M S *
*& Form DATA_RETRIEVAL
Retrieves Data for ALV Display
FORM DATA_RETRIEVAL .
DATA : L_VKAUS TYPE VKAUS. "Variable to hold Usage Indicator
CLEAR L_VKAUS.
SELECT VBELN
KUNNR
INTO CORRESPONDING FIELDS OF TABLE T_IHEADER
FROM VBAK
WHERE VBELN IN S_VBELN
AND KUNNR IN S_KUNNR
AND VKORG EQ P_VKORG
AND AUDAT IN S_AUDAT
AND VTWEG EQ P_VTWEG
AND SPART EQ P_SPART
AND AUGRU EQ C_Q2
AND VBTYP EQ C_B.
IF NOT T_IHEADER IS INITIAL.
IF NOT P_VKAUS IS INITIAL OR P_VKAUS NE C_1.
CONCATENATE 'C' P_VKAUS INTO L_VKAUS.
SELECT A~VBELN
A~KUNNR
B~POSNR
B~MATNR
B~PMATN
B~KWMENG
B~VRKME
B~NETPR
B~KZWI1
B~VKAUS
INTO TABLE T_VB_AKAP
FROM VBAK AS A
JOIN VBAP AS B
ON A~VBELN EQ B~VBELN
FOR ALL ENTRIES IN T_IHEADER
WHERE A~VBELN EQ T_IHEADER-VBELN
AND B~MATNR IN S_MATNR
AND B~VKAUS EQ L_VKAUS.
ELSE.
SELECT A~VBELN
A~KUNNR
B~POSNR
B~MATNR
B~PMATN
B~KWMENG
B~VRKME
B~NETPR
B~KZWI1
B~VKAUS
INTO TABLE T_VB_AKAP
FROM VBAK AS A
JOIN VBAP AS B
ON A~VBELN EQ B~VBELN
FOR ALL ENTRIES IN T_IHEADER
WHERE A~VBELN EQ T_IHEADER-VBELN
AND B~MATNR IN S_MATNR.
ENDIF.
IF NOT T_VB_AKAP IS INITIAL.
SELECT VBELN
POSNR
BSTKD_E
INTO TABLE T_VBKD
FROM VBKD
FOR ALL ENTRIES IN T_VB_AKAP
WHERE VBELN EQ T_VB_AKAP-VBELN
AND POSNR EQ T_VB_AKAP-POSNR.
ENDIF.
SORT T_VBKD BY VBELN POSNR.
CLEAR W_VB_AKAP.
After much of coding was completed, Usage of PMATN was dropped and
the first eighteen characters of the field BSTKD was proposed for usage
Hence PMATN is overwritten by BSTKD value in the below loop
LOOP AT T_VB_AKAP INTO W_VB_AKAP.
CLEAR: W_VBKD,
W_VB_AKAP-PMATN.
READ TABLE T_VBKD INTO W_VBKD
WITH KEY VBELN = W_VB_AKAP-VBELN
POSNR = W_VB_AKAP-POSNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
W_VB_AKAP-PMATN = W_VBKD-BSTKD_E+0(18).
ENDIF.
MODIFY T_VB_AKAP FROM W_VB_AKAP TRANSPORTING PMATN.
CLEAR W_VB_AKAP.
ENDLOOP.
IF NOT T_VB_AKAP IS INITIAL.
SELECT MATNR
ZZTECHSPEC
INTO TABLE T_MARA
FROM MARA
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MATNR EQ T_VB_AKAP-MATNR.
IF SY-SUBRC EQ 0.
SORT T_MARA BY MATNR.
ENDIF. "Checking SY-SUBRC for T_MARA
SELECT MATNR
ZZTECHSPEC
APPENDING TABLE T_MARA
FROM MARA
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MATNR EQ T_VB_AKAP-PMATN.
IF SY-SUBRC EQ 0.
SORT T_MARA BY MATNR.
ENDIF. "Checking SY-SUBRC for T_MARA
SELECT MATNR
VKORG
VTWEG
KONDM
INTO TABLE T_MVKE
FROM MVKE
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MATNR EQ T_VB_AKAP-PMATN.
IF SY-SUBRC EQ 0.
SORT T_MVKE BY MATNR VKORG VTWEG.
ENDIF. "Checking SY-SUBRC for T_MVKE
SELECT MATNR
VKORG
VTWEG
KONDM
APPENDING TABLE T_MVKE
FROM MVKE
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MATNR EQ T_VB_AKAP-MATNR.
IF SY-SUBRC EQ 0.
SORT T_MVKE BY MATNR VKORG VTWEG.
ENDIF. "Checking SY-SUBRC for T_MVKE
ENDIF. " FOR T_VB_AKAP NOT INITIAL.
ENDIF. " FOR T_IHEADER NOT INITIAL.
CLEAR: W_VB_AKAP,
W_IFINAL.
LOOP AT T_VB_AKAP INTO W_VB_AKAP.
W_IFINAL-VBELN = W_VB_AKAP-VBELN.
W_IFINAL-KUNNR = W_VB_AKAP-KUNNR.
W_IFINAL-POSNR = W_VB_AKAP-POSNR.
W_IFINAL-MATNR = W_VB_AKAP-MATNR.
W_IFINAL-PMATN = W_VB_AKAP-PMATN.
W_IFINAL-KWMENG = W_VB_AKAP-KWMENG.
W_IFINAL-VRKME = W_VB_AKAP-VRKME.
W_IFINAL-NETPR = W_VB_AKAP-NETPR.
W_IFINAL-KZWI1 = ( W_VB_AKAP-KZWI1 / W_VB_AKAP-KWMENG ) * 1000.
W_IFINAL-VKAUS = W_VB_AKAP-VKAUS.
Populating Material Pricing Group from New Material Group, if such Group doesn't exist
Population of Material Pricing Group from Material Number is tried.
Similar condition does suit for Tech Spec too.
SORT: T_MVKE BY MATNR VKORG VTWEG,
T_MARA BY MATNR.
IF NOT W_VB_AKAP-PMATN IS INITIAL.
CLEAR W_MVKE.
READ TABLE T_MVKE
INTO W_MVKE
WITH KEY MATNR = W_VB_AKAP-PMATN
VKORG = P_VKORG
VTWEG = P_VTWEG
BINARY SEARCH.
IF SY-SUBRC EQ 0.
W_IFINAL-KONDM = W_MVKE-KONDM.
ENDIF.
READ TABLE T_MARA
INTO W_MARA
WITH KEY MATNR = W_VB_AKAP-PMATN
BINARY SEARCH.
IF SY-SUBRC EQ 0.
W_IFINAL-ZZTECHSPEC = W_MARA-ZZTECHSPEC.
ENDIF. " SY-SUBRC FOR READ TABLE T_MARA
IF W_MVKE-KONDM IS INITIAL.
ELSE.
SORT T_MVKE BY MATNR VKORG VTWEG.
CLEAR W_MVKE.
READ TABLE T_MVKE
INTO W_MVKE
WITH KEY MATNR = W_VB_AKAP-MATNR
VKORG = P_VKORG
VTWEG = P_VTWEG
BINARY SEARCH.
IF SY-SUBRC EQ 0.
W_IFINAL-KONDM = W_MVKE-KONDM.
ENDIF.
READ TABLE T_MARA
INTO W_MARA
WITH KEY MATNR = W_VB_AKAP-MATNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
W_IFINAL-ZZTECHSPEC = W_MARA-ZZTECHSPEC.
ENDIF. " SY-SUBRC FOR READ TABLE T_MARA
ELSE.
W_IFINAL-KONDM = W_MVKE-KONDM.
ENDIF. " IS INITIAL CHECK FOR W_MVKE-KONDM
APPEND W_IFINAL TO T_IFINAL.
CLEAR: W_VB_AKAP,
W_IFINAL.
ENDLOOP.
SORT T_IFINAL BY VBELN.
Checking whether if there are any header quotations which does not have items against them in item internal table
if such records exist then, ensuring that such records gets deleted from header too, so that inconsitency is removed.
CLEAR W_IHEADER.
LOOP AT T_IHEADER INTO W_IHEADER.
CLEAR W_IFINAL.
READ TABLE T_IFINAL INTO W_IFINAL WITH KEY VBELN = W_IHEADER-VBELN.
IF SY-SUBRC NE 0.
W_IHEADER-SELECT = C_X.
MODIFY T_IHEADER FROM W_IHEADER TRANSPORTING SELECT.
ENDIF.
ENDLOOP.
DELETE T_IHEADER WHERE SELECT = C_X.
SORT T_IFINAL BY VBELN.
ENDFORM. " DATA_RETRIEVAL
*& Form build_layout
To build ALV Layout
FORM BUILD_LAYOUT.
CLEAR : W_LAYOUT.
W_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
W_LAYOUT-BOX_TABNAME = C_HTNAME. "tabname for checkbox
W_LAYOUT-BOX_FIELDNAME = 'SELECT'. "fieldname for checkbox
CLEAR : W_KEYINFO.
W_KEYINFO-HEADER01 = 'VBELN'. "Header1 key information
W_KEYINFO-ITEM01 = 'VBELN'. "Item1 key information
ENDFORM. "build_layout
*& Form build_events
To build ALV Events
FORM BUILD_EVENTS.
CONSTANTS: C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 1
IMPORTING
ET_EVENTS = T_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
IF SY-SUBRC = 0.
READ TABLE T_EVENTS INTO W_EVENT
WITH KEY NAME = C_TOP_OF_PAGE.
IF SY-SUBRC = 0.
MOVE C_TOP_OF_PAGE TO W_EVENT-FORM.
MODIFY T_EVENTS INDEX SY-TABIX
FROM W_EVENT
TRANSPORTING FORM.
ENDIF.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "build_events
*& Form top_of_page
To display top of page in ALV Report
FORM TOP_OF_PAGE. "#EC CALLED
DATA :
L_VKORG(35) TYPE C, "Sales Organization
L_VTWEG(35) TYPE C, "Distribution Channel
L_SPART(35) TYPE C. "Division
Title
CLEAR W_HEADER.
W_HEADER-TYP = C_H.
W_HEADER-INFO = TEXT-003.
APPEND W_HEADER TO T_HEADER.
Sales Organization
CLEAR W_HEADER.
W_HEADER-TYP = C_S.
CONCATENATE TEXT-004 P_VKORG INTO L_VKORG.
W_HEADER-INFO = L_VKORG.
APPEND W_HEADER TO T_HEADER.
Distribution Channel
CLEAR W_HEADER.
W_HEADER-TYP = C_S.
CONCATENATE TEXT-005 P_VTWEG INTO L_VTWEG.
W_HEADER-INFO = L_VTWEG.
APPEND W_HEADER TO T_HEADER.
Division
CLEAR W_HEADER.
W_HEADER-TYP = C_S.
CONCATENATE TEXT-006 P_SPART INTO L_SPART.
W_HEADER-INFO = L_SPART.
APPEND W_HEADER TO T_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. "top_of_page
*& Form pf_status
To set PF-Status (user interface)
-->EXTAB The excluding table (function codes)
FORM PF_STATUS "#EC CALLED
USING T_EXTAB TYPE SLIS_T_EXTAB. "#EC NEEDED
SET PF-STATUS 'ZSTANDARD_FULLSCREEN'.
ENDFORM. "pf_status
*& Form display_alv_report
To display ALV report
FORM DISPLAY_ALV_REPORT.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = W_LAYOUT
IT_FIELDCAT = T_FIELDCATALOG
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = C_X
I_SAVE = C_A
IS_VARIANT =
IT_EVENTS = T_EVENTS[]
IT_EVENT_EXIT =
I_TABNAME_HEADER = 'T_IHEADER'
I_TABNAME_ITEM = 'T_IFINAL'
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
IS_KEYINFO = W_KEYINFO
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IR_SALV_HIERSEQ_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB_HEADER = T_IHEADER
T_OUTTAB_ITEM = T_IFINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display_alv_report
*& Form BUILD_FIELDCATALOG
To build ALV Field Catalog
FORM BUILD_FIELDCATALOG .
DATA: L_COUNT TYPE I VALUE 0.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_HTNAME.
W_FIELDCATALOG-FIELDNAME = 'SELECT'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C01.
W_FIELDCATALOG-CHECKBOX = C_X.
W_FIELDCATALOG-EDIT = C_X.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_HTNAME.
W_FIELDCATALOG-FIELDNAME = 'VBELN'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C02.
W_FIELDCATALOG-KEY = C_X. "Fixes the column for no-scroll
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_HTNAME.
W_FIELDCATALOG-FIELDNAME = 'KUNNR'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C04.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR L_COUNT.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_ITNAME.
W_FIELDCATALOG-FIELDNAME = 'POSNR'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C03.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_ITNAME.
W_FIELDCATALOG-FIELDNAME = 'KWMENG'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C06.
W_FIELDCATALOG-EMPHASIZE = 'C400'.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_ITNAME.
W_FIELDCATALOG-FIELDNAME = 'VRKME'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C07.
W_FIELDCATALOG-JUST = C_R.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_ITNAME.
W_FIELDCATALOG-FIELDNAME = 'NETPR'.
W_FIELDCATALOG-FIELDNAME = 'KZWI1'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C08.
W_FIELDCATALOG-EMPHASIZE = 'C400'.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_ITNAME.
W_FIELDCATALOG-FIELDNAME = 'VKAUS'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C12.
W_FIELDCATALOG-JUST = C_R.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_ITNAME.
W_FIELDCATALOG-FIELDNAME = 'ZZTECHSPEC'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C09.
W_FIELDCATALOG-EMPHASIZE = 'C400'.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_ITNAME.
W_FIELDCATALOG-FIELDNAME = 'MATNR'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C05.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_ITNAME.
W_FIELDCATALOG-FIELDNAME = 'PMATN'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C10.
W_FIELDCATALOG-EMPHASIZE = 'C400'.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
CLEAR W_FIELDCATALOG.
L_COUNT = L_COUNT + 1.
W_FIELDCATALOG-COL_POS = L_COUNT.
W_FIELDCATALOG-TABNAME = C_ITNAME.
W_FIELDCATALOG-FIELDNAME = 'KONDM'.
W_FIELDCATALOG-SELTEXT_M = TEXT-C11.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
ENDFORM. " BUILD_FIELDCATALOG
*& Form user_command
EXIT routine for command handling
-->L_UCOMM Function code that PAI triggered
-->W_SELFIELD Information cursor position ALV
FORM USER_COMMAND USING L_UCOMM LIKE SY-UCOMM "#EC CALLED
W_SELFIELD TYPE SLIS_SELFIELD. "#EC NEEDED
Check function code
CASE L_UCOMM.
WHEN 'CREATE'.
SORT T_IHEADER BY SELECT.
READ TABLE T_IHEADER INTO W_IHEADER
WITH KEY SELECT = C_X
BINARY SEARCH.
IF SY-SUBRC <> 0.
MESSAGE I000(ZS) WITH TEXT-M01.
ELSE.
CLEAR : G_ANSWER.
Dialog box for save prompts
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TEXT_QUESTION = TEXT-OP1
DISPLAY_CANCEL_BUTTON = ''
IMPORTING
ANSWER = G_ANSWER
EXCEPTIONS
TEXT_NOT_FOUND = 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.
ELSE.
IF G_ANSWER = 1.
SET PF-STATUS 'ZSTANDARD_SCREEN'.
PERFORM DATA_IDENTITY_4_ACCESS_SEQ.
PERFORM CREATE_CONDITIONS.
PERFORM DISPLAY_RESULT.
ENDIF.
ENDIF.
ENDIF.
WHEN '&REFRESH'.
SUBMIT ZSPRENH069 USING SELECTION-SCREEN 1000
WITH SELECTION-TABLE T_SELECT.
WHEN 'BACKTO'.
SUBMIT ZSPRENH069 USING SELECTION-SCREEN 1000
WITH SELECTION-TABLE T_SELECT.
ENDCASE.
ENDFORM. "user_command
*& Form DATA_IDENTITY_4_ACCESS_SEQ
Seperates the Available Data for processing for both Access Sequences
FORM DATA_IDENTITY_4_ACCESS_SEQ .
CLEAR : W_IFINAL,
W_ACC1,
W_ACC2.
SORT T_MVKE BY MATNR VKORG VTWEG.
LOOP AT T_IHEADER INTO W_IHEADER WHERE SELECT = C_X.
LOOP AT T_IFINAL INTO W -
Adding an EXIT button in ALV toolbar
Hi,
i want to add an exit button in my ALV toolbar wherein it should exit the browser or the URL which displays the output. Plzz help me on this.
Thanks.Hi,
the following code may help you:
DATA:
l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
l_interface TYPE REF TO iwci_salv_wd_table,
lr_table TYPE REF TO cl_salv_wd_config_table.
create alv component
l_ref_cmp_usage = wd_this->wd_cpuse_<name_of_alv_comp>( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
get config models
l_interface = wd_this->wd_cpifc_alv_activities_prdstd( ).
lr_table = l_interface->get_model( ).
create the toolbar button
DATA:
lr_functions TYPE REF TO if_salv_wd_function_settings,
lr_function TYPE REF TO cl_salv_wd_function,
lr_fe_button TYPE REF TO cl_salv_wd_fe_button.
lr_functions ?= lr_table.
lr_function = lr_functions->create_function( 'MYBUTTON' ).
CREATE OBJECT lr_fe_button.
lr_fe_button->set_text( 'MyButton' ).
lr_function->set_editor( lr_fe_button ).
After that add an event handler for the ON_FUNCTION event of the alv. In this method you can do whatever you want.
Kind Regards,
Anika -
How to add a pushbutton in ALV
Hi,
Can anybody tell me the step-by-step procedure to add a pushbutton in a ALV Report?Hi Sudheer,
Add Button to ALV Toolbar with REUSE_ALV_LIST_DISPLAY
How to add button to ALV toolbar using REUSE_ALV_LIST_DISPLAY?
In the program which calls ALV using REUSE_ALV_LIST_DISPLAY,
I have to add a new button.
I saw the demo program BCALV_GRID_08, which is written using ABAP-Controls.
In that example, the button is added using TOOLBAR event of cl_gui_alv_grid.
Could you help me to implement the same logic using REUSE_ALV_LIST_DISPLAY parameters.
you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.
Execute this transaction to get to next screen. select status using checkbox. click on GUI Status --> Copy.
Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.
Then you can edit the new status to add or delete buttons. This will also bring in the standard SAP ALV functionality such as sorting/subtotaling etc...
When you call 'REUSE_ALV_GRID_DISPLAY' make sure you pass it the new status name.
an example of one of mine:
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZSDBOLST_REPORT'
i_callback_pf_status_set = 'STANDARD' <----
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'I_BOLACT'
i_grid_title = 'BOL Action Report'(031)
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_save = 'A'
is_variant = v_variant
TABLES
t_outtab = i_bolact
EXCEPTIONS
program_error = 1
others = 2.
I just tried the same procedure ,but my entire application toolbar disappeared and a lock icon appears next to the application toolbar in my copied pf-status.
Could you advice what might have gone wrong ?
As identified with the FM's help you can do the following.
1). Using SE80 (I think) you can copy a GUI status from one program to another. It mentions which one in the FM's help.
2). Create a form named like so:
Code:
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
ENDFORM. "Set_pf_status
In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called '%DELETE'.
3). Create the following report:
Code:
Form User_command
Notes: Called by FM REUSE_ALV_GRID_DISPLAY
Detects whether the icon/button for
'Return Tag Deletion' has been pressed. If it has then
detect whether any rows have been highlighted and then
set the delete flag.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: li_count TYPE I.
IF r_ucomm EQ '%DELETE'.
LOOP AT %g00 WHERE mark EQ 'X'.
ADD 1 TO li_count.
ENDLOOP.
IF li_count GT 0.
gc_delete_flag = 'X'.
r_ucomm = '&F03'. "Back arraow
ELSE.
MESSAGE W000 WITH 'Please highlight the rows to be deleted!'.
ENDIF.
ENDIF.
ENDFORM. "User_command
As I've added an extra button to indicate which records should be deleted I need to identify a form to be called to process when this button is chosen.
Then when you call the ALV function you to specify the following extra details:
Code:
call function 'REUSE_ALV_GRID_DISPLAY'
exporting i_callback_program = gc_repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
i_grid_title = lc_grid_title
is_layout = lc_layout
it_fieldcat = gt_fieldcat
it_sort = sort
i_save = l_save
is_reprep_id = l_bbs_id
is_variant = l_variant
tables t_outtab = %g00
exceptions program_error = 1
others = 2.
The parameters in capitals are the extra ones that need to be added.
That should be it!
Make you sure that you also read the help against the ALV function.
Please chk the below link which is in PDF format
http://www.erpgenie.com/abaptips/index2.php?option=com_content&do_pdf=1&id=141
And also please chk the link
http://abapprogramming.blogspot.com/2007/07/alv-documentation-complete.html
https://www.sdn.sap.com/irj/sdn/advancedsearch?query=alv%20grid&cat=sdn_all&start=111
Reward if useful.
Regards,
Chandru -
Hi Friends,
I need to put a pushbutton in ALV List's every row. And then when user click this button, I will get the selected line of list. My application server is 4.6 and I want to implement this using the function call of CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY', not using object oriented programming. How can I put button in alv list and get the selected line when button is clicked?
Thanks.U can not do it by 'Reuse_alv*'. You have to use class for that. Here is the example: I have created a pushbutton 'Download file'.
report z_82235_alv_oops_pustbutton .
tables: mara.
types: begin of t_mara,
matnr type matnr,
mtart type mtart,
matkl type matkl,
meins type meins,
end of t_mara.
data: gt_mara type standard table of t_mara,
gs_mara like line of gt_mara.
class lcl_event_receiver definition deferred.
*-- Global Data defenation for ALV
*---Alv Grid instance referance
data : gr_alvgrid type ref to cl_gui_alv_grid,
event_receiver type ref to lcl_event_receiver.
*---Name of the custom control added on the screen
data gc_custom_control_name type scrfname value 'CC_ALV'
*---Custom container instance referance
data: gr_ccontainer type ref to cl_gui_custom_container.
*---Field catalog table
data: gt_fieldcat type lvc_t_fcat,
gs_fieldcat type lvc_s_fcat.
*---Layout structure
data: gs_layout type lvc_s_layo.
data: g_repid like sy-repid.
select matnr
mtart
matkl
meins
from mara into table gt_mara
up to 25 rows.
g_repid = sy-repid.
include <icon>.
* Predefine a local class for event handling to allow the
* declaration of a reference variable before the class is defined.
* Set initial dynpro
set screen 100.
* LOCAL CLASSES: Definition
*===============================================================
* class lcl_event_receiver: local class to
* define and handle own functions.
* Definition:
* ~~~~~~~~~~~
class lcl_event_receiver definition.
public section.
methods:
handle_toolbar
for event toolbar of cl_gui_alv_grid
importing e_object e_interactive,
handle_user_command
for event user_command of cl_gui_alv_grid
importing e_ucomm.
private section.
endclass.
* lcl_event_receiver (Definition)
*===============================================================
* LOCAL CLASSES: Implementation
*===============================================================
* class lcl_event_receiver (Implementation)
class lcl_event_receiver implementation.
method handle_toolbar.
* § 2.In event handler method for event TOOLBAR: Append own functions
* by using event parameter E_OBJECT.
data: ls_toolbar type stb_button.
* E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
* This class has got one attribute, namly MT_TOOLBAR, which
* is a table of type TTB_BUTTON. One line of this table is
* defined by the Structure STB_BUTTON (see data deklaration above).
* A remark to the flag E_INTERACTIVE:
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* 'e_interactive' is set, if this event is raised due to
* the call of 'set_toolbar_interactive' by the user.
* You can distinguish this way if the event was raised
* by yourself or by ALV
* (e.g. in method 'refresh_table_display').
* An application of this feature is still unknown... :-)
* append a separator to normal toolbar
clear ls_toolbar.
move 3 to ls_toolbar-butn_type.
append ls_toolbar to e_object->mt_toolbar.
* append an icon to download
clear ls_toolbar.
ls_toolbar-function = 'DOWN'.
ls_toolbar-icon = 'icon_generate'.
ls_toolbar-quickinfo = 'DOWNLOAD FILE'.
ls_toolbar-text = 'DOWNLOAD FILE'.
* MOVE ' ' TO ls_toolbar-disabled.
append ls_toolbar to e_object->mt_toolbar.
endmethod.
method handle_user_command.
* § 3.In event handler method for event USER_COMMAND: Query your
* function codes defined in step 2 and react accordingly.
data: lt_rows type lvc_t_row.
case e_ucomm.
when 'DOWN'.
call function 'GUI_DOWNLOAD'
exporting
* BIN_FILESIZE =
filename = 'D:a.txt'
* FILETYPE = 'ASC'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
tables
data_tab = gt_mara
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
others = 22
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endcase.
endmethod. "handle_user_command
endclass.
* lcl_event_receiver (Implementation)
*===================================================================
* S T A R T - O F - S E L E C T I O N.
start-of-selection.
set screen '100'.
*& Module display_alv OUTPUT
* text
module display_alv output.
if gr_alvgrid is initial.
*---Creating custom container instance
create object gr_ccontainer
exporting
container_name = gc_custom_control_name
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*---Creating ALV gris instance
create object gr_alvgrid
exporting
i_parent = gr_ccontainer
i_appl_events = 'X'
exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 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.
*---Prepare field catalog
perform prepare_field_catalog tables gt_fieldcat.
*---Prepare layout
perform prepare_layout changing gs_layout.
*---Call ALV grid
call method gr_alvgrid->set_table_for_first_display
exporting
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
is_layout = gs_layout
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
changing
it_outtab = gt_mara[]
it_fieldcatalog = gt_fieldcat
* IT_SORT =
* IT_FILTER =
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
* ->Create Object to receive events and link them to handler methods.
* When the ALV Control raises the event for the specified instance
* the corresponding method is automatically called.
create object event_receiver.
set handler event_receiver->handle_user_command for gr_alvgrid.
set handler event_receiver->handle_toolbar for gr_alvgrid.
* § 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
call method gr_alvgrid->set_toolbar_interactive.
* endif. "IF grid1 IS INITIAL
* call method cl_gui_control=>set_focus exporting control = gr_alvgrid.
*--- the instance is present
else .
call method gr_alvgrid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
exceptions
finished = 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.
endmodule. " display_alv OUTPUT
*& Form prepare_field_catalog
* text
* <--P_GT_FIELDCAT text
form prepare_field_catalog tables gt_fieldcat.
clear : gs_fieldcat.
gs_fieldcat-fieldname = 'MATNR'.
gs_fieldcat-col_pos = 1.
gs_fieldcat-emphasize = 'X'.
gs_fieldcat-outputlen = 10.
gs_fieldcat-coltext = 'Material No'.
gs_fieldcat-edit = 'X'.
append gs_fieldcat to gt_fieldcat.
clear : gs_fieldcat.
gs_fieldcat-fieldname = 'MTART'.
gs_fieldcat-col_pos = 2.
gs_fieldcat-outputlen = 6.
gs_fieldcat-coltext = 'Material Type'.
append gs_fieldcat to gt_fieldcat.
clear : gs_fieldcat.
gs_fieldcat-fieldname = 'MATKL'.
gs_fieldcat-col_pos = 3.
gs_fieldcat-outputlen = 5.
gs_fieldcat-coltext = 'Material Grp'.
append gs_fieldcat to gt_fieldcat.
clear : gs_fieldcat.
gs_fieldcat-fieldname = 'MEINS'.
gs_fieldcat-col_pos = 4.
gs_fieldcat-outputlen = 4.
gs_fieldcat-coltext = 'Unit'.
append gs_fieldcat to gt_fieldcat.
endform. " prepare_field_catalog
*& Form prepare_layout
* text
* <--P_GS_LAYOUT text
form prepare_layout changing p_gs_layout type lvc_s_layo.
p_gs_layout-zebra = 'X'.
p_gs_layout-grid_title = 'Material'.
p_gs_layout-smalltitle = 'X'.
endform. " prepare_layout
*& Module STATUS_0100 OUTPUT
* text
module status_0100 output.
set pf-status 'STATUS1'.
* SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
module user_command_0100 input.
case sy-ucomm.
when 'BACK' or 'UP' or 'CANCEL'.
leave program.
when '&DETAIL'.
leave program.
endcase.
endmodule. " USER_COMMAND_0100 INPUT -
How to add a dropdown box in an ALV toolbar??
hi,
i have a requirement where i need to add a dropdown box in my ALV Toolbar. To be precise next to the export button in my ALV.
Plz help me on this, thanks.Hi Frank,
I am providing the some peice of code which will be helpful to you.
Adding the DropDown list to the ALV toolbar:
lr_functions ?= wd_this->r_table.
lr_function = lr_functions->create_function( 'MYDROPDOWNBYINDEX' ).
create object lr_dropdown_by_idx
exporting
texts_elementname = 'DROPDOWNBYINDEX.VALUE'.
lr_dropdown_by_idx->set_label_text( 'MYDROPDOWNBYINDEX' ).
lr_function->set_editor( lr_dropdown_by_idx ).
Providing the values to that DropDown:
Here in my example DROPDOWNBYINDEX.VALUE is the context attrubute. And i write the Supply function for that node as follows:
data:
lt_dropdownbyindex type if_componentcontroller=>elements_dropdownbyindex,
ls_dropdownbyindex type if_componentcontroller=>element_dropdownbyindex.
ls_dropdownbyindex-value = 'Nothing'. "#EC NOTEXT
append ls_dropdownbyindex to lt_dropdownbyindex.
ls_dropdownbyindex-value = 'ActionDropdownByIndex'. "#EC NOTEXT
append ls_dropdownbyindex to lt_dropdownbyindex.
node->bind_table( lt_dropdownbyindex ).
For reference you can refer the WD component SALV_WD_TEST_TABLE_TOOLBR which holds the same code
Hope this will help you. Reward points if it helps.
Cheers,
Darshna. -
How to display standard ALV toolbar function in Webdynpro ABAP
Hi All,
Could any one please let me know that how to display the standard ALV functions. What I tried is as follows:
data :lr_config_table type ref to cl_salv_wd_config_table.
data lr_function type ref to cl_salv_wd_function_std
Got the reference by calling the get_model().
Now tried to display a standard button say :
CALL METHOD lr_config_table ->if_salv_wd_function_settings~get_function_std
EXPORTING
id = 'SALV_WD_INPUT_INSERT_ROW'
RECEIVING
value = lr_function.
CALL METHOD lr_function->set_visible
EXPORTING
value = cl_wd_uielement=>e_visible-visible.
But I can't see the button added to my ALV toolbar! Could any one please help me out on this if I am missing something.
Many Thanks!
SomnathHi..
ALV report which when displayed normally allows users to insert and delete rows using the methods below from class Cl_Salv_Wd_Config_Table:
I think add these lines to your code and check..
IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY (false)
IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_INSERT_ROW_ALLOWED (true).
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv_basic( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
l_salv_wd_table = wd_this->wd_cpifc_alv_basic( ).
DATA l_table TYPE REF TO cl_salv_wd_config_table.
l_table = l_salv_wd_table->get_model( ).
l_table->if_salv_wd_table_settings~set_read_only( abap_false ).
l_table->if_salv_wd_std_functions~set_edit_append_row_allowed( abap_false ).
l_table->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_false ).
l_table->if_salv_wd_std_functions~set_edit_delete_row_allowed( abap_false ).
Cheers,
Kris. -
Handling ALV Toolbar in Customized Global Class
Hi Experts!!
We have a global class ZCL_TEST_DISP in which there is a private attribute go_grid TYPE REF TO cl_gui_alv_grid. Now in this custom class, we have methods like SET_DISPLAY, EXCLUDE_TOOLBAR etc in which instance of go_grid is created and methods of cl_gui_alv_grid are called.
Now my requirement is to create a new pushbutton in ALV output. I know how to do it normally. I checked BCALV_GRID_05 for this. But as instance of grid is in ZCL_TEST_DISP, I must create methods to hanle toolbar using this class only. I am wondering how to proceed.
Can somebody please help me out?
Thanks a lot.Checked an existing global class as reference and solved.
-
Hi
i am enhancing one report.i just added some fields like standard price,special procurement,safety stock.i'm displaying the
report in ALV.my problem is report displaying is fine.but when i click any ALV toolbar buttons like export to local file,print preview.before enhancement,ALV tool bar is working fine.it is showing the runtime error like "The statement strlen(obj) the argument 'obj' can only take a character type data obj.in this case,the operand 'ob' has the non character type".i am unabale to find where exactly error is occuring.. when i start debugger in runtime error 'the cursor going to 'gs_out-hlplen = strlen( <field> ).when i click this one is is showing my standard price value of the first material in ALV like '3367.44'.can anyone suggest on this issue.
Thanks
ArjunHi PranavJeeth,
this is my field catalog.i'm just showing one field.
PERFORM set_field USING:
FIELD SHORT TEXT LONG TEXT OUTLEN TYP FMT SUM HID
'STPRS' 'STD.PRICE ' 'STANDARD PRICE ' '00011' 'P' ' ' ' ' ' ',
FORM set_field USING pv_fieldname TYPE c
pv_descr_s TYPE c
pv_descr_m TYPE c
pv_length TYPE c
pv_inttype TYPE c
pv_format TYPE c
pv_sum TYPE c
pv_hide TYPE c.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = pv_fieldname.
gw_fieldcat-seltext_s = pv_descr_s.
gw_fieldcat-seltext_m = pv_descr_m.
gw_fieldcat-outputlen = pv_length.
gw_fieldcat-inttype = pv_inttype.
gw_fieldcat-no_out = pv_hide.
CASE pv_format.
*-- Prices must have corresponding currency for format purposes
If no currency field is needed (fixed currency), use
GW_FIELDCAT-CURRENCY instead of GW_FIELDCAT-CFIELDNAME
WHEN 'P'. " prices
gw_fieldcat-currency = 'MYR'.
gw_fieldcat-do_sum = pv_sum.
when i excute report is ok.but when we clcik on alv toolbar runtime error occuring.when i run debugger,the code like this
if gs_fc-tech_form ne 99.
gs_out-hlplen = strlen( <field> ).
endif.
when i click on field the values like this
<field> = 100
gs_fc-tech_form = 90.
please suggest on this issue. -
Checkbox problem in ALV toolbar
Hello all,
I hv added a checkbox in my alv toolbar using classes.
i.e. MOVE 'NO_DEFECTS' TO ls_toolbar-function.
MOVE 'No Defects' TO ls_toolbar-quickinfo.
MOVE 'No Defects' TO ls_toolbar-text.
MOVE 5 TO ls_toolbar-butn_type.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
Alv is displaying in one subscreen.
My problem is my checkbox is displaying as a button instead of a check box and also i want to know how can i check whether my checkbox is active or not.
I want to disable some buttons in the alv toolbar based on this checkbox.
Thanks in advance.
regards,
LokeshHi,
To disable the buttons in the toolbar, In the ALV events exclude the fcodes of the buttons you want to disable and pass it to the
to the program like the below statement
set pf-status 'STDPOPBX_FULLSCREEN' excluding lt_extab
of program 'SAPLKKBL'.
To use the check box pass the ls_toolbar-ICON as ICON_WD_CHECK_BOX.
Regards,
Kranthi -
Add on custom button to ALV toolbar in std tcode ME51N, ME52N and ME53N.
Hi All,
I have the requirement to add on the custom button to ALV toolbar in ITEM OVERVIEW for standard transaction ME51N, ME52N and ME53N. Does anyone know what enhancement point or user exit i should apply and how i can add on the custom button?
Thanks.There are no user exits or badi's for COOIS. You may have to make copy of the PPIO_ENTRY to ZPPIO_ENTRY including all the varians without changing their names like copy SAP&COOIS to SAP&COOIS. Create a T-Code ZCOOIS and replace COOIS in variant SAP&COOIS to ZCOOIS not in the name of the variant but in the field "Check Authorization for".
The PF-Status is found in the include LCOISOUTPUTF16 which is located in the function group COISOUTPUT you may have to copy that too. Finally you need to copy SAPLCOISOUTPUT with its GUI status GENERAL and add your custom button there. -
Hi,
When using FM 'REUSE_ALV_GRID_DISPLAY'
Exporting Parameters : I_CALLBACK_PF_STATUS_SET
in SET PF Status Creating additional Buttons.
In ALV Report output addition additional buttons are coming
but Standard ALV Toolbar are missing like Sort Assending ,Descending,Total,Subtotal,
Layouts.
Please give any Suggestions for Standard toolbar as well as additional buttons to display
by using FM 'REUSE_ALV_GRID_DISPLAY'.
Thanks,
ManishHi,
Check this subroutine in example program :
BCALV_TEST_FULLSCREEN_CALLS
form f01_event_pf_status_set using rt_extab type slis_t_extab.
set pf-status 'STANDARD_FULLSCREEN' excluding rt_extab.
endform. " f01_event_pf_status_set
regards,
Advait -
Menu Button in ALV toolbar (multiple choices for a button)
Hi abapers,
I would like to have a button with multiple choices in the toolbar;
at the moment I have created a menu button with just one function.
Here is my code:
CLASS lcl_event_receiver (Definition)
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive.
ENDCLASS. "lcl_event_receiver DEFINITION
CLASS lcl_event_receiver (Implementation)
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
*Separator
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
*Button
CLEAR ls_toolbar.
MOVE 1 TO ls_toolbar-butn_type.
MOVE 'EDIT' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE ' Modifica'(l02) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
MOVE 'Modifica' TO ls_toolbar-quickinfo.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
ENDCLASS. "lcl_event_receiver IMPLEMENTATIONhi,
check this code and reward me if it helps you..
TYPE-POOLS : slis,icon.
*Structure declaration for tcodes
TYPES : BEGIN OF ty_table,
tcode TYPE tcode,
pgmna TYPE progname,
END OF ty_table.
*Structure for tocde text
TYPES : BEGIN OF ty_itext,
tcode TYPE tcode,
ttext TYPE ttext_stct,
sprsl TYPE sprsl,
END OF ty_itext.
*Structure for output display
TYPES : BEGIN OF ty_output,
tcode TYPE tcode,
pgmna TYPE progname,
ttext TYPE ttext_stct,
END OF ty_output.
*internal table and work area declarations
DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
wa_table TYPE ty_table,
wa_output TYPE ty_output,
wa_ittext TYPE ty_itext.
*Class definition for ALV toolbar
CLASS: lcl_alv_toolbar DEFINITION DEFERRED.
*Declaration for toolbar buttons
DATA : ty_toolbar TYPE stb_button.
Data declarations for ALV
DATA: c_ccont TYPE REF TO cl_gui_custom_container, "Custom container object
c_alvgd TYPE REF TO cl_gui_alv_grid, "ALV grid object
it_fcat TYPE lvc_t_fcat, "Field catalogue
it_layout TYPE lvc_s_layo, "Layout
c_alv_toolbar TYPE REF TO lcl_alv_toolbar, "Alv toolbar
c_alv_toolbarmanager TYPE REF TO cl_alv_grid_toolbar_manager. "Toolbar manager
*Initialization event
INITIALIZATION.
*Start of selection event
START-OF-SELECTION.
*Subroutine to get values from tstc table
PERFORM fetch_data.
*subroutine for alv display
PERFORM alv_output.
CLASS lcl_alv_toolbar DEFINITION
ALV event handler
CLASS lcl_alv_toolbar DEFINITION.
PUBLIC SECTION.
*Constructor
METHODS: constructor
IMPORTING
io_alv_grid TYPE REF TO cl_gui_alv_grid,
*Event for toolbar
on_toolbar
FOR EVENT toolbar
OF cl_gui_alv_grid
IMPORTING
e_object.
ENDCLASS. "lcl_alv_toolbar DEFINITION
CLASS lcl_alv_toolbar IMPLEMENTATION
ALV event handler
CLASS lcl_alv_toolbar IMPLEMENTATION.
METHOD constructor.
Create ALV toolbar manager instance
CREATE OBJECT c_alv_toolbarmanager
EXPORTING
io_alv_grid = io_alv_grid.
ENDMETHOD. "constructor
METHOD on_toolbar.
Add customized toolbar buttons.
variable for Toolbar Button
ty_toolbar-icon = icon_generate.
ty_toolbar-butn_type = 0.
ty_toolbar-text = 'Button1'.
APPEND ty_toolbar TO e_object->mt_toolbar.
ty_toolbar-icon = icon_voice_output.
ty_toolbar-butn_type = 0.
ty_toolbar-text = 'Button2'.
APPEND ty_toolbar TO e_object->mt_toolbar.
ty_toolbar-icon = icon_phone.
ty_toolbar-butn_type = 0.
ty_toolbar-text = 'Button3'.
APPEND ty_toolbar TO e_object->mt_toolbar.
ty_toolbar-icon = icon_mail.
ty_toolbar-butn_type = 0.
ty_toolbar-text = 'Button4'.
APPEND ty_toolbar TO e_object->mt_toolbar.
ty_toolbar-icon = icon_voice_input.
ty_toolbar-butn_type = 0.
ty_toolbar-text = 'Button5'.
APPEND ty_toolbar TO e_object->mt_toolbar.
Call reorganize method of toolbar manager to
display the toolbar
CALL METHOD c_alv_toolbarmanager->reorganize
EXPORTING
io_alv_toolbar = e_object.
ENDMETHOD. "on_toolbar
ENDCLASS. "lcl_alv_toolbar IMPLEMENTATION
*& Form fetch_data
text
--> p1 text
<-- p2 text
FORM fetch_data .
Select the tcodes upto 200 rows from TSTC
SELECT tcode
pgmna
FROM tstc
INTO CORRESPONDING FIELDS OF TABLE it_table
UP TO 200 ROWS
WHERE dypno NE '0000'.
*Select the tcode textx
IF it_table[] IS NOT INITIAL.
SELECT ttext
tcode
sprsl
FROM tstct
INTO CORRESPONDING FIELDS OF TABLE it_ittext
FOR ALL ENTRIES IN it_table
WHERE tcode = it_table-tcode
AND sprsl = 'E'.
ENDIF.
Apppending the data to the internal table of ALV output
LOOP AT it_table INTO wa_table.
wa_output-tcode = wa_table-tcode.
wa_output-pgmna = wa_table-pgmna.
For texts
READ TABLE it_ittext INTO wa_ittext WITH KEY tcode = wa_table-tcode.
wa_output-ttext = wa_ittext-ttext.
APPEND wa_output TO it_output.
CLEAR wa_output.
ENDLOOP.
ENDFORM. " fetch_data
*& Form alv_output
text
--> p1 text
<-- p2 text
FORM alv_output .
*Calling the ALV
CALL SCREEN 0600.
ENDFORM. " alv_output
Calling the ALV screen with custom container
On this statement double click it takes you to the screen painter SE51.Enter the attributes
*Create a Custom container and name it CC_CONT and OK code as OK_CODE.
*Save check and Activate the screen painter.
Now a normal screen with number 600 is created which holds the ALV grid. PBO of the actual screen , Here we can give a title and *customized menus
*& Module STATUS_0600 OUTPUT
text
MODULE status_0600 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0600 OUTPUT
calling the PBO module ALV_GRID.
*& Module ALV_GRID OUTPUT
text
MODULE alv_grid OUTPUT.
*create object for custom container
CREATE OBJECT c_ccont
EXPORTING
container_name = 'CC_CONT'.
*create object of alv grid
CREATE OBJECT c_alvgd
EXPORTING
i_parent = c_ccont.
create ALV event handler
CREATE OBJECT c_alv_toolbar
EXPORTING
io_alv_grid = c_alvgd.
Register event handler
SET HANDLER c_alv_toolbar->on_toolbar FOR c_alvgd.
Fieldcatalogue for ALV
PERFORM alv_build_fieldcat.
ALV attributes FOR LAYOUT
PERFORM alv_report_layout.
CHECK NOT c_alvgd IS INITIAL.
Call ALV GRID
CALL METHOD c_alvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE. " ALV_GRID OUTPUT
*& Form alv_build_fieldcat
text
<--P_IT_FCAT text
FORM alv_build_fieldcat.
DATA lv_fldcat TYPE lvc_s_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '1'.
lv_fldcat-fieldname = 'TCODE'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 8.
lv_fldcat-scrtext_m = 'TCODE'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '2'.
lv_fldcat-fieldname = 'PGMNA'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'PROGNAME'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '3'.
lv_fldcat-fieldname = 'TTEXT'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 60.
lv_fldcat-scrtext_m = 'Description'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
ENDFORM. " alv_build_fieldcat
*& Form alv_report_layout
text
<--P_IT_LAYOUT text
FORM alv_report_layout.
it_layout-cwidth_opt = 'X'.
it_layout-zebra = 'X'.
ENDFORM. " alv_report_layout
PAI module of the screen created. In case we use an interactive ALV or
*for additional functionalities we can create OK codes
*and based on the user command we can do the coding.
*& Module USER_COMMAND_0600 INPUT
text
MODULE user_command_0600 INPUT.
ENDMODULE. " USER_COMMAND_0600 INPUT
thanks,
gupta -
Add a button choice on alv toolbar in wd4a
Hy everyone i've to add a button choice on alv toolbar. I create a node 'MY_TOOLBAR_FUNCTIONS' where add node and attributes to bind in external mapping in function_elements of alv interface controller.For button_choice I made a node 'CHOICE' and attribute 'WA_VALUE' type string. But the application dumps when create object lr_choice ; the error is WebDynpro Exception: IDs Can Only Contain Characters of Syntactical Character Set .
May you help me? Thanks in advance.
data: ls_choice TYPE ig_componentcontroller=>element_choice,
nd_choice TYPE REF TO if_wd_context_node,
nd_choice = nd_my_functions->get_child_node( name = wd_this->wdctx_choice ).
el_choice = nd_choice->get_element( ).
ls_choice-wa_value = '01'.
APPEND ls_choice TO lt_choice.
nd_choice->bind_table( lt_choice ).
DATA:lr_button_choice TYPE REF TO cl_salv_wd_fe_button_choice.
DATA:lr_choice TYPE REF TO cl_salv_wd_menu_action_item.
lr_function = l_value->if_salv_wd_function_settings~create_function_right( id = 'MYBUTTONCHOICE' ).
CREATE OBJECT lr_button_choice.
EXPORTING
sel_action_item_elementname = 'CHOICE.WA_VALUE'.
lr_button_choice->set_text( value = 'Filter' ).
lr_button_choice->set_tooltip( value = 'Filter').
lr_button_choice->set_sel_action_itm_elementname( 'CHOICE.WA_VALUE' ).
CREATE OBJECT lr_choice
EXPORTING
id = ls_CHOICE-WA_VALUE.
lr_choice->set_text( 'Esito Positivo' ).
lr_choice->set_image_source( value = 'ICON_GREEN_LIGHT').
lr_button_choice->add_choice( lr_choice ).
lr_function->set_editor( lr_button_choice ).in CREATE OBJECT lr_choice the object id have to refer to name of node.
CREATE OBJECT lr_choice
EXPORTING
id = 'CHOICE'. -
How to create multiple buttons in ALV Toolbar in Webdynpro ABAP
Hi all,
I am trying to create multiple buttons in Webdynpro ALV toolbar, please go through the code.
What happening is, second button is replacing the first one.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv_table( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv_table( ).
DATA lv_value TYPE REF TO cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model(
DATA lr_buttonui1 TYPE REF TO cl_salv_wd_fe_button.
DATA lr_buttonui2 TYPE REF TO cl_salv_wd_fe_button.
DATA button1 TYPE REF TO cl_salv_wd_function.
DATA button2 TYPE REF TO cl_salv_wd_function.
**First button
CREATE OBJECT lr_buttonui1.
lr_buttonui1->set_text('Button')."setting the text of the button on alv toolbar
button1 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON')."creating the function for alv button
button1->set_editor( lr_buttonui1 ).
**Second button
CREATE OBJECT lr_buttonui2.
lr_buttonui2->set_text('Button1')."setting the text of the button on alv toolbar
button2 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON' )."creating the function for alv button
button2->set_editor( lr_buttonui2 ).
How can I overcome this??
Thanks
EshwarHi Eshwar,
The button Ids are same for both the buttons in your code. You need to change it as BUTTON1, BUTTON2.
**First button
CREATE OBJECT lr_buttonui1.
lr_buttonui1->set_text('Button')."setting the text of the button on alv toolbar
button1 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON1')."creating the function for alv button
button1->set_editor( lr_buttonui1 ).
**Second button
CREATE OBJECT lr_buttonui2.
lr_buttonui2->set_text('Button1')."setting the text of the button on alv toolbar
button2 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON2' )."creating the function for alv button
button2->set_editor( lr_buttonui2 ).
Maybe you are looking for
-
There is double quantity in the sales item report?
Hi all, I have created an infoset with sales order item and delivery The issue is there is one sales order item with qty 10 but because it was delivered on different dates with different quantity like 5,5 the report show likes sales order item
-
Mon MAC ne reconnais pas un disque dure externe LACIE
Bonjour, je ne comprend et j'aimerais savoir comment je peux faire que mon MAC 10.4.9 reconnaisse mon disqaue externe. Je le branche mes deux cable dans mes port USB et il ne detecte pas mon disque dur. La premiere fois il l'a detecté, puis il 'a mis
-
*** Authorization Forums, are they still part of SAP
Hi coffee lovers,. I am one of the old school guys when it comes to authorizations and SAP security. I have found that with the Audit COBIT principals and GRC enabling toolsets the "TODAY" authorization administrator gets sucked into enhancing applic
-
I have uninstalled and reinstalled the app numerous times. The application does not open a log in window when attempting to connect to the online account. Any help would be greatly appreciated. A window opens that states The Program Cannot Access
-
Fed up with VPN connection failures
Cant get a brand new laptop with built in wireless to get a VPN connection with a BEFW11s4 router. Internet is fine. An older laptop works fine. This new labtop even works beautifully with a wireless adapter,not the built in. Called Linksys tech supp