Regarding Check boxes in ALV
Hi
Can anyone tell how to insert checkboxes in to ALV and based on the checkboxes selected i want to display the data.
I have tried like this, but it is giving a dump as Field Symbol is not yet been assigned.
Data: c1(1).
wa_layout-box_fieldname = 'C1'.
wa_layout-box_tabname = 'INTTAB'.
Regards
Haritha.
report zpl_om_assignment3.
type-pools : slis.
Table Declarations
tables : kona,
ebox,
kote008,
kote007,
kote006,
ekbo,
ekbe.
DATA DECLARATIONS ---- INTERNAL TABLES
data : begin of it_ebox occurs 0,
knumh like ebox-knumh,
vbeln like ebox-vbeln,
end of it_ebox.
data : begin of it_kona occurs 0,
knuma like kona-knuma,
boart like kona-boart,
bonem like kona-bonem,
bolif like kona-bolif,
datab like kona-datab,
datbi like kona-datbi,
kobog like kona-kobog,
botext like kona-botext,
bukrs like kona-bukrs,
ekorg like kona-ekorg,
ekgrp like kona-ekgrp,
end of it_kona.
data : begin of it_kote occurs 0,
kappl like kote008-kappl,
kschl like kote008-kschl,
ekorg like kote008-ekorg,
lifnr like kote008-lifnr,
datbi like kote008-datbi,
knuma like kote008-knuma,
datab like kote008-datab,
knumh like kote008-knumh,
end of it_kote.
data : begin of it_final occurs 0,
box type c,
knuma like kona-knuma, "Arrangement
boart like kona-boart, "Arrangement type
datab like kona-datab, "Validity data from
datbi like kona-datbi, "date to
knumh like kote008-knumh, "Condition Record
kobog like kona-kobog, "Condition type
botext like kona-botext, "Agreement desc
bonem like kona-bonem, "Rebate recipient
lifnr like kote008-lifnr, "Vendor number
name1 like lfa1-lifnr, "Vendor Name
ekorg like kote008-ekorg, "purchase organization
ebeln like ekbe-ebeln, "PO number
aedat like ekko-aedat, "PO Date
ebelp like ekbe-ebelp, "PO line item
matnr like ekbe-matnr, "MaterialNumber
werks like ekbe-werks, "Site Number
maktx like makt-maktx, "Material desc
matkl like mara-matkl, "Merchandise Category
menge like ekpo-menge, "Quantity
meins like ekpo-meins, "Unit of measure
gjahr like ekbe-gjahr, "Invoice Doc. Year
bldat like rbkp-bldat, "Invoice date
cpudt like ekbe-cpudt, "Inv. Update Date
belnr like ekbe-belnr, "Invoice Number
xblnr like rbkp-xblnr, "Reference
buzei like ekbe-buzei, "Invoice Line Item
dmbtr like ekbe-dmbtr, "Dollar Amount
shkzg like ekbe-shkzg, "Debit/Credit ind
bukrs like kona-bukrs, "Company code
end of it_final.
data : begin of it_ekbo occurs 0,
ebeln like ekbo-ebeln,
ebelp like ekbe-ebelp,
knumh like ekbo-knumh,
kopos like ekbo-kopos,
budat like ekbo-budat,
belnr like ekbo-belnr,
buzei like ekbo-buzei,
lifnr like ekbo-lifnr,
matnr like ekbo-matnr,
bltypn like ekbo-bltypn,
bltypf like ekbo-bltypf,
etenr like ekbo-etenr,
zekkn like ekbo-zekkn,
vgabe like ekbo-vgabe,
gjahr like ekbo-gjahr,
end of it_ekbo.
data : begin of it_ekbe occurs 0,
ebeln like ekbe-ebeln,
ebelp like ekbe-ebelp,
EBELP LIKE IT_EKBO-EBELP,
gjahr like ekbe-gjahr,
belnr like ekbe-belnr,
buzei like ekbe-buzei,
dmbtr like ekbe-dmbtr,
shkzg like ekbe-shkzg,
cpudt like ekbe-cpudt,
matnr like ekbe-matnr,
werks like ekbe-werks,
end of it_ekbe.
data : begin of it_lfa1 occurs 0,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
end of it_lfa1.
data : begin of it_mara occurs 0,
matnr like mara-matnr,
matkl like mara-matkl,
end of it_mara.
data : begin of it_makt occurs 0,
matnr like makt-matnr,
maktx like makt-maktx,
end of it_makt.
data : begin of it_ekko occurs 0,
ebeln like ekko-ebeln,
aedat like ekko-aedat,
end of it_ekko.
data : begin of it_ekpo occurs 0,
ebeln like ekpo-ebeln,
menge like ekpo-menge,
meins like ekpo-meins,
end of it_ekpo.
data : begin of it_rbkp occurs 0,
belnr like rbkp-belnr,
bldat like rbkp-bldat,
xblnr like rbkp-xblnr,
end of it_rbkp.
data : begin of t_ekpo occurs 0,
mandt type mandt,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
aedat type ekpo-aedat,
menge type ekpo-menge,
meins type ekpo-meins,
end of t_ekpo.
data : it_fieldcat type slis_t_fieldcat_alv,
it_fieldcat_ekpo type slis_t_fieldcat_alv with header line,
it_events type slis_t_event,
wa_events like line of it_events,
v_ucomm like sy-ucomm,
v_selfield type slis_selfield,
v_value type slis_entry,
it_layout type slis_layout_alv,
it_layout_ekpo type slis_layout_alv,
it_sort type slis_t_sortinfo_alv ,
wa_sort type slis_sortinfo_alv,
it_extab type slis_t_extab.
data : begin of it_ebeln occurs 1,
ebeln type ekpo-ebeln,
end of it_ebeln.
SELECTION-SCREEN ELEMENTS
Block for rebate Arrangements
selection-screen begin of block b1 with frame title text-001.
select-options : s_knuma for kona-knuma default '42',
s_boart for kona-boart,
s_bolif for kona-bolif.
selection-screen begin of line.
selection-screen comment (5) v_1 for field p_datab .
selection-screen position 33.
parameters : p_datab like kona-datab.
selection-screen position 52.
selection-screen comment (3) v_2 for field p_datbi .
selection-screen position 58.
parameters : p_datbi like kona-datbi.
selection-screen end of line.
selection-screen end of block b1.
Block for Condition Records
selection-screen begin of block b2 with frame title text-002.
selection-screen begin of line.
selection-screen comment (5) v_3 for field p_vfrom .
selection-screen position 33.
parameters : p_vfrom like kona-datab.
selection-screen position 52.
selection-screen comment (3) v_4 for field p_vto .
selection-screen position 58.
parameters : p_vto like kona-datbi.
selection-screen end of line.
selection-screen end of block b2.
Block for Organizational data
selection-screen begin of block b3 with frame title text-003.
select-options : s_ekorg for kona-ekorg,
s_ekgrp for kona-ekgrp.
selection-screen end of block b3.
parameters : p_dmemo as checkbox user-command chk,
p_vbeln like ebox-vbeln.
INITIALIZATION
initialization.
v_1 = v_3 = 'Validity Period' .
v_2 = v_4 = 'to' .
AT SELECTION-SCREEN OUTPUT
at selection-screen output.
loop at screen.
if p_dmemo = 'X'.
if screen-name = 'P_VBELN' and screen-group1 = 'CHK'.
screen-input = 'X'.
modify screen.
endif.
else.
if screen-name = 'P_VBELN'.
screen-input = ' '.
modify screen.
endif.
endif.
endloop.
START-OF-SELECTION
start-of-selection.
perform it_kona.
if p_dmemo = 'X'.
perform fetch_ebox.
endif.
perform it_kote.
perform it_ekbo.
perform it_ekbe.
perform it_lfa1.
perform it_mara.
perform it_makt.
perform it_ekko.
perform it_ekpo.
perform it_rbkp.
perform populate_final.
perform it_layout.
perform display.
perform get_events.
*& Form FETCH_EBOX
form fetch_ebox.
select knumh
lifnr
from ebox
INTO TABLE it_ebox
appending corresponding fields of
table it_kote
where vbeln eq p_vbeln.
endform. " FETCH_EBOX
*& Form it_kona
form it_kona .
if not p_datab is initial and not p_datbi is initial.
select knuma
boart
bonem
bolif
datab
datbi
kobog
botext
bukrs
ekorg
ekgrp
from kona into
table it_kona
where knuma in s_knuma and
boart in s_boart and
datab le p_datab and
datbi ge p_datbi and
bolif in s_bolif and
ekorg in s_ekorg and
ekgrp in s_ekgrp.
else.
select knuma
boart
bonem
bolif
datab
datbi
kobog
botext
bukrs
ekorg
ekgrp
from kona into
table it_kona
where knuma in s_knuma and
boart in s_boart and
bolif in s_bolif and
ekorg in s_ekorg and
ekgrp in s_ekgrp.
endif.
endform. " it_kona
*& Form IT_KOTE
form it_kote .
if not it_kona[] is initial.
if not p_vfrom is initial and p_vto is initial.
select kappl
kschl
ekorg
lifnr
datbi
knuma
datab
knumh
from kote008
into table it_kote
for all entries in it_kona
where knuma eq it_kona-knuma and
datab le p_vfrom and
datbi ge p_vto.
select kappl
kschl
ekorg
lifnr
datbi
knuma
datab
knumh
from kote007
appending table it_kote
for all entries in it_kona
where knuma eq it_kona-knuma and
datab le p_vfrom and
datbi ge p_vto.
select kappl
kschl
ekorg
lifnr
datbi
knuma
datab
knumh
from kote006
appending table it_kote
for all entries in it_kona
where knuma eq it_kona-knuma and
datab le p_vfrom and
datbi ge p_vto.
else.
select kappl
kschl
ekorg
lifnr
datbi
knuma
datab
knumh
from kote008
into table it_kote
for all entries in it_kona
where knuma eq it_kona-knuma.
select kappl
kschl
ekorg
lifnr
datbi
knuma
datab
knumh
from kote007
appending table it_kote
for all entries in it_kona
where knuma eq it_kona-knuma .
select kappl
kschl
ekorg
lifnr
datbi
knuma
datab
knumh
from kote006
appending table it_kote
for all entries in it_kona
where knuma eq it_kona-knuma.
endif.
endif.
endform. " IT_KOTE
*& Form IT_EKBO
form it_ekbo .
if not it_kote[] is initial.
select ebeln
ebelp
knumh
kopos
budat
belnr
buzei
lifnr
matnr
bltypn
bltypf
etenr
zekkn
vgabe
gjahr
from ekbo
into table it_ekbo
for all entries in it_kote
where knumh eq it_kote-knumh.
endif.
sort it_ekbo by ebeln ebelp.
delete adjacent duplicates from it_ekbo comparing ebeln ebelp.
endform. " IT_EKBO
*& Form IT_EKBE
form it_ekbe .
if not it_ekbo[] is initial.
select ebeln
ebelp
gjahr
belnr
buzei
dmbtr
shkzg
cpudt
matnr
werks
from ekbe into
table it_ekbe
for all entries in it_ekbo
where ebeln eq it_ekbo-ebeln
and ebelp eq it_ekbo-ebelp and
vgabe = '2'.
endif.
endform. " IT_EKBE
*& Form it_lfa1
form it_lfa1 .
if not it_kote[] is initial.
select lifnr
name1
from lfa1
into table it_lfa1
for all entries in it_kote
where lifnr eq it_kote-lifnr.
endif.
endform. " it_lfa1
*& Form it_mara
form it_mara .
if not it_ekbo[] is initial.
select matnr
matkl
from mara
into table it_mara
for all entries in it_ekbo
where matnr eq it_ekbo-matnr.
endif.
endform. " it_mara
*& Form it_makt
form it_makt .
if not it_mara[] is initial.
select matnr
maktx
from makt
into table it_makt
for all entries in it_mara
where matnr eq it_mara-matnr and
spras eq sy-langu.
endif.
endform. " it_makt
*& Form it_ekko
form it_ekko .
if not it_ekbo[] is initial.
select ebeln
aedat
from ekko
into table it_ekko
for all entries in it_ekbo
where ebeln eq it_ekbo-ebeln.
endif.
endform. " it_ekko
*& Form it_ekpo
form it_ekpo .
if not it_ekko[] is initial.
select ebeln
menge
meins
from ekpo
into table it_ekpo
for all entries in it_ekko
where ebeln eq it_ekko-ebeln.
endif.
endform. " it_ekpo
*& Form populate_final
form populate_final .
loop at it_kote.
it_final-knumh = it_kote-knumh.
it_final-lifnr = it_kote-lifnr.
it_final-ekorg = it_kote-ekorg.
read table it_kona with key knuma = it_kote-knuma.
it_final-knuma = it_kona-knuma.
it_final-boart = it_kona-boart.
it_final-datab = it_kona-datab.
it_final-datbi = it_kona-datbi.
it_final-kobog = it_kona-kobog.
it_final-botext = it_kona-botext.
it_final-bonem = it_kona-bonem.
it_final-bukrs = it_kona-bukrs.
read table it_ekbo with key knumh = it_kote-knumh.
it_final-ebeln = it_ekbo-ebeln.
it_final-ebelp = it_ekbo-ebelp.
read table it_ekbe with key ebeln = it_ekbo-ebeln
ebelp = it_ekbo-ebelp.
it_final-matnr = it_ekbe-matnr.
it_final-werks = it_ekbe-werks.
it_final-gjahr = it_ekbe-gjahr.
it_final-belnr = it_ekbe-belnr.
it_final-buzei = it_ekbe-buzei.
it_final-dmbtr = it_ekbe-dmbtr.
it_final-shkzg = it_ekbe-shkzg.
it_final-cpudt = it_ekbe-cpudt.
read table it_lfa1 with key lifnr = it_kote-lifnr.
it_final-lifnr = it_lfa1-lifnr.
read table it_mara with key matnr = it_ekbo-matnr.
it_final-matkl = it_mara-matkl.
read table it_makt with key matnr = it_mara-matnr.
it_final-maktx = it_makt-maktx.
read table it_ekko with key ebeln = it_ekbo-ebeln.
it_final-aedat = it_ekko-aedat.
read table it_ekpo with key ebeln = it_ekko-ebeln.
it_final-menge = it_ekpo-menge.
it_final-meins = it_ekpo-meins.
read table it_rbkp with key belnr = it_ekbo-belnr.
it_final-bldat = it_rbkp-bldat.
it_final-xblnr = it_rbkp-xblnr.
append it_final.
endloop.
endform. " populate_final
*& Form it_rbkp
form it_rbkp .
if not it_ekbo[] is initial.
select belnr
bldat
xblnr
from rbkp
into table it_rbkp
for all entries in it_ekbo
where belnr = it_ekbo-belnr.
endif.
endform. " it_rbkp
*& Form DISPLAY
form display .
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-cprog
i_internal_tabname = 'IT_FINAL'
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = sy-cprog
I_BYPASSING_BUFFER = I_BYPASSING_BUFFER
I_BUFFER_ACTIVE = I_BUFFER_ACTIVE
changing
ct_fieldcat = it_fieldcat
exceptions
inconsistent_interface = 1
program_error = 2
others = 3
if sy-subrc <> 0.
message i000(bctrain) with 'Not Merged'.
else.
*message i000(bctrain) with ' Merged'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = 'X'
I_BYPASSING_BUFFER = I_BYPASSING_BUFFER
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-cprog
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
I_STRUCTURE_NAME = I_STRUCTURE_NAME
is_layout = it_layout
it_fieldcat = it_fieldcat[]
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_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 = it_final
exceptions
program_error = 1
others = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY
*& Form get_events
form get_events .
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = it_events
exceptions
list_type_wrong = 1
others = 2.
if sy-subrc <> 0.
endif.
**USER_COMMAND EVENT
READ TABLE IT_EVENTS INTO WA_EVENTS WITH KEY
NAME = 'USER_COMMAND'.
IF SY-SUBRC = 0.
WA_EVENTS-FORM = 'USER_COMMAND'.
MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
ENDIF.
**PF_STATUS_SET EVENT
READ TABLE IT_EVENTS INTO WA_EVENTS WITH KEY
NAME = 'PF_STATUS_SET'.
IF SY-SUBRC = 0.
WA_EVENTS-FORM = 'PF_STATUS'.
MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
ENDIF.
TOP_OF_LIST EVENT.
read table it_events into wa_events with key
name = 'TOP_OF_LIST'.
NAME = 'TOP_OF_PAGE'.
if sy-subrc = 0.
wa_events-form = 'TOP-OF-LIST'.
modify it_events from wa_events index sy-tabix.
endif.
endform. " get_events
*& Form USER_COMMAND
form user_command using v_ucomm type sy-ucomm
v_selfield type slis_selfield .
refresh it_fieldcat_ekpo.
case v_ucomm.
when 'DISP_DET'.
refresh t_ekpo.
refresh it_ebeln.
loop at it_final.
if it_final-box = 'X'.
it_ebeln-ebeln = it_final-ebeln.
append it_ebeln.
endif.
endloop.
perform poitem_det.
endcase.
IF V_SELFIELD-FIELDNAME = 'EBELN'.
V_VALUE = V_SELFIELD-VALUE.
ELSE.
MESSAGE I000(BCTRAIN) WITH 'SELECT PURCHASE ORDER FOR ITEM DETAILS'
SY-LSIND.
EXIT.
ENDIF.
SELECT EBELN
EBELP
AEDAT
MENGE
MEINS
FROM EKPO
INTO TABLE T_EKPO
WHERE EBELN EQ V_VALUE.
IF SY-SUBRC <> 0.
MESSAGE I000(BCTRAIN) WITH 'NO ITEM DETAILS FOUND FOR PO :' V_VALUE.
EXIT.
ENDIF.
**perform fldcat_merge.
PERFORM IT_FIELDCAT_EKPO.
PERFORM IT_LAYOUT_EKPO.
PERFORM GET_EVENTS.
PERFORM DISP_ITEMDET.
REFRESH IT_FIELDCAT_EKPO.
**ENDIF.
endform. " USER_COMMAND
*& Form DISP_ITEMDET
form disp_itemdet.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = 'X'
I_BYPASSING_BUFFER = I_BYPASSING_BUFFER
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-cprog
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'TOP_OF_LIST'
I_STRUCTURE_NAME = I_STRUCTURE_NAME
is_layout = it_layout_ekpo
it_fieldcat = it_fieldcat_ekpo[]
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_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 = t_ekpo
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. " DISP_ITEMDET
*& Form IT_FIELDCAT_EKPO
form it_fieldcat_ekpo .
it_fieldcat_ekpo-fieldname = 'MANDT'.
it_fieldcat_ekpo-seltext_l = 'CLIENT'.
append it_fieldcat_ekpo.
it_fieldcat_ekpo-fieldname = 'EBELN'.
it_fieldcat_ekpo-seltext_l = 'PO NUMBER'.
append it_fieldcat_ekpo.
it_fieldcat_ekpo-fieldname = 'EBELP'.
it_fieldcat_ekpo-seltext_l = 'PO ITEM'.
append it_fieldcat_ekpo.
it_fieldcat_ekpo-fieldname = 'AEDAT'.
it_fieldcat_ekpo-seltext_l = 'PO DATE'.
append it_fieldcat_ekpo.
it_fieldcat_ekpo-fieldname = 'MENGE'.
it_fieldcat_ekpo-seltext_l = 'QUANTITY'.
it_fieldcat_ekpo-do_sum = 'X'.
append it_fieldcat_ekpo.
it_fieldcat_ekpo-fieldname = 'MEINS'.
it_fieldcat_ekpo-seltext_l = 'UNIT OF MEASURE'.
append it_fieldcat_ekpo.
endform. " IT_FIELDCAT_EKPO
*& Form TOP-OF-LIST
form top-of-list.
format color col_positive.
write : 'ITEM DETAILS OF PURCHASE ORDERS : ' .
endform. "TOP-OF-LIST
*& Form PF_STATUS_SET
form pf_status using it_extab type slis_t_extab.
set pf-status 'DISP_DET' excluding it_extab.
endform. "PF_STATUS_SET
*& Form IT_LAYOUT
form it_layout .
it_layout-box_fieldname = 'BOX'.
it_layout-box_tabname = 'IT_FINAL'.
IT_LAYOUT-TOTALS_TEXT = 'TOTALS'.
endform. " IT_LAYOUT
*& Form IT_LAYOUT_EKPO
form it_layout_ekpo .
it_layout_ekpo-subtotals_text = 'SUBTOTALS'.
it_layout_ekpo-totals_text = 'TOTALS'.
*CLEAR IT_LAYOUT_EKPO-SUBTOTALS_TEXT.
IT_LAYOUT_EKPO-NO_subtotals = ' '.
endform. " IT_LAYOUT_EKPO
*& Form fldcat_merge
form fldcat_merge .
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-cprog
i_internal_tabname = 'T_EKPO'
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = sy-cprog
I_BYPASSING_BUFFER = I_BYPASSING_BUFFER
I_BUFFER_ACTIVE = I_BUFFER_ACTIVE
changing
ct_fieldcat = it_fieldcat_ekpo
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. " fldcat_merge
*& Form it_fieldcat
form it_fieldcat .
*it_fieldcat-fieldname = 'KNUMA'.
*IT_FIELDCAT-SELTEXT_L = 'AGGREMENT'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'BOART'.
*IT_FIELDCAT-SELTEXT_L = 'AGGREMENTTYPE'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'DATAB'.
*IT_FIELDCAT-SELTEXT_L = 'AGGREMENT FROM DATE'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'DATBI'.
*IT_FIELDCAT-SELTEXT_L = 'AGGREMENT TO DATE'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'KNUMH'.
*IT_FIELDCAT-SELTEXT_L = 'CONDRECORD'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'KOBOG'.
*IT_FIELDCAT-SELTEXT_L = 'CT GRP'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'BOTEXT'.
*IT_FIELDCAT-SELTEXT_L = 'CTGrpText'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'BONEM'.
*IT_FIELDCAT-SELTEXT_L = 'REB_RECEIPT'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'LIFNR'.
*IT_FIELDCAT-SELTEXT_L = 'VENDORNUM'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'NAME1'.
*IT_FIELDCAT-SELTEXT_L = 'VEN NAME'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'EKORG'.
*IT_FIELDCAT-SELTEXT_L = 'PUR_ORG'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'EBELN'.
*IT_FIELDCAT-SELTEXT_L = 'PO NUM'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'AEDAT'.
*IT_FIELDCAT-SELTEXT_L = 'PO DATE'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'EBELP'.
*IT_FIELDCAT-SELTEXT_L = 'PO ITEM'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'MATNR'.
*IT_FIELDCAT-SELTEXT_L = 'MATERIALNUM'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'WERKS'.
*IT_FIELDCAT-SELTEXT_L = 'SITE NUM'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'MAKTX'.
*IT_FIELDCAT-SELTEXT_L = 'MAT_DESC'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'MATKL'.
*IT_FIELDCAT-SELTEXT_L = 'MAT GRP'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'MENGE'.
*IT_FIELDCAT-SELTEXT_L = 'QUANTITY'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'MEINS'.
*IT_FIELDCAT-SELTEXT_L = 'UNITOF MEAS'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'GJAHR'.
*IT_FIELDCAT-SELTEXT_L = 'DOC YR'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'BLDAT'.
*IT_FIELDCAT-SELTEXT_L = 'INV DATE'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'CPUDT'.
*IT_FIELDCAT-SELTEXT_L = 'INV_UPDATE_DATE'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'BELNR'.
*IT_FIELDCAT-SELTEXT_L = 'INV NUM'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'XBLNR'.
*IT_FIELDCAT-SELTEXT_L = 'REFERENCE'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'BUZEI'.
*IT_FIELDCAT-SELTEXT_L = 'INV_LNITEM'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'DMBTR'.
*IT_FIELDCAT-SELTEXT_L = 'DOLLAR AMT'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'SHKZG'.
*IT_FIELDCAT-SELTEXT_L = 'DEB/CRD IND'.
*APPEND IT_FIELDCAT.
*it_fieldcat-fieldname = 'BUKRS'.
*IT_FIELDCAT-SELTEXT_L = 'COMPANYCODE'.
*APPEND IT_FIELDCAT.
endform. " it_fieldcat
*& Form poitem_det
form poitem_det .
if not it_ebeln[] is initial.
select mandt
ebeln
ebelp
aedat
menge
meins
from ekpo
into table t_ekpo
for all entries in it_ebeln
where ebeln = it_ebeln-ebeln.
endif.
perform it_fieldcat_ekpo.
perform it_sort.
perform it_layout_ekpo.
perform get_events.
perform disp_itemdet.
refresh it_fieldcat_ekpo.
clear it_layout_ekpo.
refresh it_sort.
endform. " poitem_det
*& Form it_sort
form it_sort .
wa_sort-fieldname = 'EBELN'.
it_sort-spos = 1.
IT_SORT-TABNAME = 'T_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
wa_sort-group = 'UL'.
append wa_sort to it_sort.
endform. " it_sort
Similar Messages
-
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 get check box in alv grid list output
hi gurus,
can anyone inform me
how to get check box in alv output it should not be a pop up window
thank you
regards
kals.or
hi go through the fallowing code.
code*&----
*& Report YGS_ALV_BOM *
REPORT YGS_ALV_BOM .
TABLES : MAST,STKO,STPO.
TYPE-POOLS: SLIS.
TYPES : BEGIN OF TY_MAST,
CHECK_BOX,
MATNR TYPE MAST-MATNR,
WERKS TYPE MAST-WERKS,
STLAN TYPE MAST-STLAN,
STLNR TYPE MAST-STLNR,
STLAL TYPE MAST-STLAL,
END OF TY_MAST.
TYPES : BEGIN OF TY_STKO,
STLTY TYPE STKO-STLTY,
STLNR TYPE STKO-STLNR,
STLAL TYPE STKO-STLAL,
STKOZ TYPE STKO-STKOZ,
BMENG TYPE STKO-BMENG,
BMEIN TYPE STKO-BMEIN,
END OF TY_STKO.
TYPES : BEGIN OF TY_STPO,
LIGHTS,
STLTY TYPE STPO-STLTY,
STLNR TYPE STPO-STLNR,
STLKN TYPE STPO-STLKN,
STPOZ TYPE STPO-STPOZ,
IDNRK TYPE STPO-IDNRK,
MENGE TYPE STPO-MENGE,
MEINS TYPE STPO-MEINS,
END OF TY_STPO.
DATA : IT_MAST TYPE TABLE OF TY_MAST,
WA_MAST TYPE TY_MAST,
IT_STKO TYPE TABLE OF TY_STKO,
WA_STKO TYPE TY_STKO,
IT_STPO TYPE TABLE OF TY_STPO,
WA_STPO TYPE TY_STPO.
DATA : lt_fieldcat TYPE slis_t_fieldcat_alv,
ls_layout TYPE slis_layout_alv,
ls_event TYPE slis_alv_event,
lt_event TYPE slis_t_event,
it_sortinfo type slis_t_sortinfo_alv,
ls_header TYPE slis_listheader,
lt_header TYPE slis_t_listHEADER.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS : S_MATNR FOR MAST-MATNR.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM BUILD_FIELDCAT USING LT_FIELDCAT.
PERFORM BUILD_LAYOUT.
END-OF-SELECTION.
PERFORM DISPLAY_DATA.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form GET_DATA .
REFRESH : IT_MAST.
SELECT MATNR
WERKS
STLAN
STLNR
FROM MAST
INTO CORRESPONDING FIELDS OF TABLE IT_MAST
WHERE MATNR IN S_MATNR.
endform. " GET_DATA
*& Form BUILD_FIELDCAT
text
--> p1 text
<-- p2 text
form BUILD_FIELDCAT USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
REFRESH : LT_FIELDCAT.
L_FIELDCAT-COL_POS = 1.
L_FIELDCAT-FIELDNAME = 'MATNR'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'MATNR'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 2.
L_FIELDCAT-FIELDNAME = 'WERKS'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'WERKS'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 3.
L_FIELDCAT-FIELDNAME = 'STLNR'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
endform. " BUILD_FIELDCAT
*& Form BUILD_LAYOUT
text
--> p1 text
<-- p2 text
form BUILD_LAYOUT .
CLEAR LS_LAYOUT.
LS_LAYOUT-BOX_FIELDNAME = 'CHECK_BOX'.
LS_LAYOUT-BOX_TABNAME = 'IT_MAST'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
form DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_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 =
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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_MAST
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_DATA
FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'YSTATUS' OF PROGRAM SY-REPID
EXCLUDING RT_EXTAB.
ENDFORM.
FORM USER_COMMAND USING RF_UCOMM TYPE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE RF_UCOMM.
WHEN '&NEXT'.
PERFORM GET_DATA_BOM .
PERFORM BUILD_FIELDCAT_BOM USING LT_FIELDCAT.
PERFORM BUILD_LAYOUT_BOM.
PERFORM DISPLAY_DATA_BOM.
ENDCASE.
ENDFORM.
*& Form GET_DATA_BOM
text
--> p1 text
<-- p2 text
form GET_DATA_BOM .
CLEAR : WA_STPO,
WA_MAST.
REFRESH : IT_STPO.
DATA : IT_CHECK TYPE TABLE OF TY_MAST.
LOOP AT IT_MAST INTO WA_MAST.
IF WA_MAST-CHECK_BOX EQ 'X'.
APPEND WA_MAST TO IT_CHECK.
ENDIF.
ENDLOOP.
SELECT STLTY
STLNR
STLKN
VGKNT
IDNRK
MENGE
MEINS
FROM STPO
INTO CORRESPONDING FIELDS OF TABLE IT_STPO
FOR ALL ENTRIES IN IT_CHECK
WHERE IDNRK EQ IT_CHECK-MATNR.
CLEAR WA_STPO.
LOOP AT IT_STPO INTO WA_STPO.
SELECT SINGLE * FROM MAST WHERE MATNR EQ WA_STPO-IDNRK.
IF SY-SUBRC = 0.
WA_STPO-LIGHTS = '2'.
ELSE.
WA_STPO-LIGHTS = '1'.
ENDIF.
MODIFY IT_STPO FROM WA_STPO.
ENDLOOP.
endform. " GET_DATA_BOM
*& Form BUILD_FIELDCAT_BOM
text
--> p1 text
<-- p2 text
form BUILD_FIELDCAT_BOM USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
REFRESH : LT_FIELDCAT.
L_FIELDCAT-COL_POS = 1.
L_FIELDCAT-FIELDNAME = 'STLTY'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLTY'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 2.
L_FIELDCAT-FIELDNAME = 'STLNR'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 3.
L_FIELDCAT-FIELDNAME = 'STLKN'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLKN'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 4.
L_FIELDCAT-FIELDNAME = 'IDNRK'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'IDNRK'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 5.
L_FIELDCAT-FIELDNAME = 'MENGE'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'MENGE'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
endform. " BUILD_FIELDCAT_BOM
*& Form BUILD_LAYOUT_BOM
text
--> p1 text
*<-- p2 text
form BUILD_LAYOUT_BOM .
CLEAR : LS_LAYOUT.
LS_LAYOUT-LIGHTS_FIELDNAME = 'LIGHTS'.
LS_LAYOUT-LIGHTS_TABNAME = 'IT_STPO'.
endform. " BUILD_LAYOUT_BOM
*& Form DISPLAY_DATA_BOM
text
--> p1 text
<-- p2 text
form DISPLAY_DATA_BOM .
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 = 'USER_COMMAND_BOM'
I_CALLBACK_TOP_OF_PAGE = 'TOP9'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_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 =
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_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_STPO
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_DATA_BOM
FORM TOP9 .
CLEAR LS_HEADER.
REFRESH LT_HEADER.
LS_HEADER-TYP = 'H'.
LS_HEADER-INFO = 'BILL OF MATERIALS'.
APPEND LS_HEADER TO LT_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LT_HEADER
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
ENDFORM.
FORM USER_COMMAND_BOM USING RF_UCOMM_BOM LIKE SY-UCOMM
SEL_FIELD TYPE SLIS_SELFIELD.
CASE RF_UCOMM_BOM.
WHEN '&IC1'.
SET PARAMETER ID 'MAT' FIELD WA_STPO-IDNRK.
SET PARAMETER ID 'WRK' FIELD WA_MAST-WERKS.
SET PARAMETER ID 'CSA' FIELD WA_MAST-STLAN.
CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.
ENDCASE.[/code] -
How to create check box in ALV Reports?
how to create check box in ALV Reports?
Hi
check the report BCALV_TEST_GRID_EDITABLE
or
check this report
REPORT ZRFC346_TST.
TABLES:SFLIGHT,RL034.
TYPE-POOLS:SLIS.
INCLUDE:<ICON>,<SYMBOL>.
DATA: G_REPID LIKE SY-REPID,
G_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
G_IT_SORT TYPE SLIS_T_SORTINFO_ALV,
G_LAYOUT TYPE SLIS_LAYOUT_ALV,
G_TABNAME_HEADER TYPE SLIS_TABNAME,
G_TABNAME_ITEM TYPE SLIS_TABNAME,
G_KEYINFO TYPE SLIS_KEYINFO_ALV,
G_VARIANT LIKE DISVARIANT,
G_EXTAB TYPE SLIS_T_EXTAB,
I_SLIS_EXIT_BY_USER TYPE SLIS_EXIT_BY_USER.
DATA: XEVENT TYPE SLIS_T_EVENT,
AEVENT TYPE SLIS_ALV_EVENT,
VARIANT LIKE DISVARIANT,
LAYOUT TYPE SLIS_LAYOUT_ALV,
ASP_GROUP TYPE SLIS_SP_GROUP_ALV,
GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
EXTAB TYPE SLIS_T_EXTAB WITH HEADER LINE,
XFIELD TYPE SLIS_T_FIELDCAT_ALV,
AFIELD TYPE SLIS_FIELDCAT_ALV,
G_SUCOMM LIKE SY-UCOMM,
G_SELFLD TYPE SLIS_SELFIELD.
DATA: SAV_SY_REPID LIKE SY-REPID.
CONSTANTS: CON_SFLIGHT TYPE LVC_FNAME VALUE 'SFLIGHT',
CON_DISPLAY_FULL TYPE I VALUE 3.
Data to be displayed
DATA: BEGIN OF GT_SFLIGHT OCCURS 0.
INCLUDE STRUCTURE SFLIGHT.
DATA:ACTIVATE(1).
DATA: END OF GT_SFLIGHT.
INITIALIZATION.
*........Initialisierung...............................................
PERFORM INITIALIZATION_RL034.
*........Field cata....................................................
PERFORM FIELD_CAT.
*........SPECIAL GROUP.................................................
PERFORM E07_SP_GROUP_BUILD USING GT_SP_GROUP[].
START-OF-SELECTION.
Selection
SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
*........ALV CALL.......................................................
PERFORM ALV_CALL.
PERFORM USER_COMMAND_LOCAL USING G_SUCOMM G_SELFLD.
FORM USER_COMMAND_LOCAL *
--> G_UCOMM *
--> G_SELFIELD *
FORM USER_COMMAND_LOCAL USING G_UCOMM LIKE SY-UCOMM
G_SELFIELD TYPE SLIS_SELFIELD.
CASE G_UCOMM.
WHEN 'ACT'.
ENDCASE.
ENDFORM.
FORM ALV_CALL *
FORM ALV_CALL.
Call ABAP List Viewer (ALV)
G_LAYOUT-BOX_FIELDNAME = 'ACTIVATE'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_BYPASSING_BUFFER = SPACE
I_BUFFER_ACTIVE = SPACE
I_CALLBACK_PROGRAM = SAV_SY_REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND_LOCAL'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = 'SFLIGHT'
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = G_LAYOUT
IT_FIELDCAT = XFIELD[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS = GT_SP_GROUP[]
IT_SORT =
IT_FILTER =
IS_SEL_HIDE = 'X'
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = XEVENT
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
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 = GT_SFLIGHT
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.
FORM status *
--> EXTAB *
FORM STATUS USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STAT' EXCLUDING EXTAB.
ENDFORM. " STATUS
*& Form INITIALIZATION_RL034
text
--> p1 text
<-- p2 text
FORM INITIALIZATION_RL034.
SAV_SY_REPID = SY-REPID.
ENDFORM. " INITIALIZATION_RL034
*& Form DEFINE_EVENTS_RL034
text
--> p1 text
<-- p2 text
FORM DEFINE_EVENTS_RL034.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = XEVENT.
exceptions
list_type_wrong = 1
others = 2.
ENDFORM. " DEFINE_EVENTS_RL034
*& Form FIELD_CAT
text
--> p1 text
<-- p2 text
FORM FIELD_CAT.
DATA: LS_FCAT TYPE SLIS_FIELDCAT_ALV,
L_LIN TYPE I.
REFRESH XFIELD.
1. per Default eingeblendete Felder *
*........Ikone/Symbol..................................................
CLEAR AFIELD.
DATA: LS1_FCAT TYPE SLIS_FIELDCAT_ALV,
L_LIN1 TYPE I.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = CON_SFLIGHT
I_BYPASSING_BUFFER = SPACE
I_BUFFER_ACTIVE = SPACE
CHANGING
CT_FIELDCAT = XFIELD
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
DESCRIBE TABLE XFIELD LINES L_LIN1.
ADD 1 TO L_LIN1.
CLEAR LS_FCAT.
LS1_FCAT-FIELDNAME = 'ACTIVATE'.
LS1_FCAT-CHECKBOX = 'X'.
LS1_FCAT-KEY = 'X'.
LS1_FCAT-INPUT = 'X'.
LS1_FCAT-EDIT = 'X'.
LS1_FCAT-INTTYPE = 'C'.
LS1_FCAT-DATATYPE = 'CHAR'.
LS1_FCAT-INTLEN = 1.
LS1_FCAT-COL_POS = L_LIN1.
LS1_FCAT-SELTEXT_S = LS1_FCAT-FIELDNAME.
LS1_FCAT-SELTEXT_M = LS1_FCAT-FIELDNAME.
LS1_FCAT-SELTEXT_L = LS1_FCAT-FIELDNAME.
LS1_FCAT-SP_GROUP = 'A'.
APPEND LS1_FCAT TO XFIELD.
ADD 1 TO L_LIN.
ENDFORM. " FIELD_CAT
FORM E07_SP_GROUP_BUILD USING E07_LT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV.
DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
CLEAR LS_SP_GROUP.
LS_SP_GROUP-SP_GROUP = 'A'.
LS_SP_GROUP-TEXT = 'SPECIAL'.
APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
ENDFORM.
Regards
Shiva -
Add check box in ALV output List.
Hi
I want to add check box in alv out put list . i m trying but not getting succsses .
please tell me the process .
thanks
chandraHi Chandra,
Types: begin of ty_output,
u201C Included these two types in your output structure.
celltab TYPE lvc_t_styl,
checkbox TYPE c,
end of ty_output.
Data: it_output type standard table of ty_output,
wa_output type ty_output.
Loop at it_output into wa_output.
* Initially, set all checkbox cells editable.
ls_celltab-fieldname = 'CHECKBOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
INSERT ls_celltab INTO TABLE lt_celltab.
INSERT LINES OF lt_celltab INTO TABLE wa_coupon-celltab.
MODIFY it_coupon FROM wa_coupon TRANSPORTING celltab.
Endloop.
Form build_field_catalog.
wa_fieldcat-fieldname = 'CHECKBOX'.
ADD 1 TO wf_pos.
wa_fieldcat-col_pos = wf_pos.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-outputlen = '6'.
wa_fieldcat-reptext = 'Select'.
wa_fieldcat-coltext = 'Select'.
wa_fieldcat-seltext = 'Select'.
wa_fieldcat-tooltip = 'Select'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-key = ''.
wa_fieldcat-icon = ''.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
Endform.
Form display_alv.
ls_variant-report = sy-cprog..
gs_layout-stylefname = 'CELLTAB'. u201C Please do not forget to include this statement
gs_layout-zebra = 'X'.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fieldcat.
CLEAR gt_fieldcat.
Endform.
Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 4:31 PM -
Regard check box concept in alv grid display
HI Friends,
i am displaying the sales order details with check box. so my first field is checkbox. When user click on check box then he press the details icon.
my question i need a logic for calling the tcode based on the vbeln when it is cheked.
thanks in advance.
Regards,
Purna.hi,
go through this program
program bcalv_edit_05.
Purpose:
~~~~~~~~
This example shows how to use checkboxes within an ALV Grid Control.
You learn:
o how to define a column for editable checkboxes for an attribute
of your list (see also remark below)
o how to evaluate the checked checkboxes
o how to switch between editable and non-editable checkboxes
Important Remark
~~~~~~~~~~~~~~~~
The checkbox functionality has been replaced by selection buttons
in front of each row (field SEL_MODE of the layout structure
set to 'A' or 'D'; when using the editable ALV Grid Control,
these selection buttons are always visible).
Class methods like GET_SELECTED_ROWS work only for this new
functionality and not for checkboxes.
Thus checkboxes should not be used for line selection but for
a column as an additional or for an already existing attribute
(like field SMOKER in SBOOK).
To check program behavior
~~~~~~~~~~~~~~~~~~~~~~~~~
Try out the functions displayed in the application toolbar:
o The first sets all checked lines to initial values.
(see form reset_selected_entries)
o The seconds marks all checkboxes that are input enabled
o The third unmarks all checkboxes that are input enabled
o To try the forth, you have to select a line first using
the selection buttons on the left.
The function deactivates/activates a checkbox.
Checkboxes may be locked/unlocked using a double click on the
checkbox cell.
Essential steps (search for '§')
~~~~~~~~~~~~~~~
This example focusses on two aspects of checkboxes in an
editable ALV Grid Control:
A How to integrate, set, reset and evaluate checkboxes
B What you must do to lock particular checkboxes against input
A) Integrate, set, reset and evaluate checkboxes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A1.Extend your output table by a checkbox field.
A2.Add an entry for the checkbox in the fieldcatalog
A3.Optionally, check checkboxes initially after selecting data.
A4.Before you (a)set, (b)reset, (c)(de)activate or
(d)evaluate checkboxes, you must check the input cells.
B) Lock particular checkboxes against input
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
B1.Extend your output table by a field to dis- or enable
cells for input.
B2.After selecting data,
assign a style for each row of your checkbox column.
B3.Use the layout structure to aquaint additional field to ALV.
B4.Switch the style to dis- or enable a cell for input
class lcl_event_receiver definition deferred. "for event handling
data: ok_code like sy-ucomm,
save_ok like sy-ucomm,
g_container type scrfname value 'BCALV_GRID_DEMO_0100_CONT1',
g_grid type ref to cl_gui_alv_grid,
g_custom_container type ref to cl_gui_custom_container,
g_event_receiver type ref to lcl_event_receiver,
gt_fieldcat type lvc_t_fcat,
gs_layout type lvc_s_layo,
g_max type i value 100.
*§A1.Extend your output table by a checkbox field.
If you do not want to lock sole checkboxes against input
you do not need field 'celltab'.
types: begin of gs_outtab.
types: checkbox type c. "field for checkbox
§B1.Extend your output table by a field to dis- or enable
cells for input.
types: celltab type lvc_t_styl. "field to switch editability
include structure sflight.
types: end of gs_outtab.
data: gt_outtab type gs_outtab occurs 0 with header line.
LOCAL CLASSES
This local class only handles event DOUBLE_CLICK.
Wenn the user double clicks on a checkbox cell the status of
this cell is switched from editable to not editable and vice versa.
class lcl_event_receiver definition.
public section.
methods: catch_doubleclick
for event double_click of cl_gui_alv_grid
importing
e_column
es_row_no
sender.
endclass.
class lcl_event_receiver implementation.
method catch_doubleclick.
data: ls_outtab type gs_outtab,
ls_celltab type lvc_s_styl.
Function:
Switch between 'editable' and 'not editable' checkbox.
If the user clicked on another column there is
nothing to do.
if e_column-fieldname ne 'CHECKBOX'.
exit.
endif.
read table gt_outtab into ls_outtab index es_row_no-row_id.
The loop is only needed if there are other columns that
use checkboxes. At this point the loop could be
replaced by a READ of the first line of CELLTAB.
loop at ls_outtab-celltab into ls_celltab.
if ls_celltab-fieldname eq 'CHECKBOX'.
§B4.Switch the style to dis- or enable a cell for input
if ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
else.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
endif.
modify ls_outtab-celltab from ls_celltab.
endif.
endloop.
modify gt_outtab from ls_outtab index es_row_no-row_id.
call method sender->refresh_table_display.
endmethod.
endclass.
MAIN *
end-of-selection.
call screen 100.
MODULE PBO OUTPUT *
module pbo output.
set pf-status 'MAIN100'.
set titlebar 'MAIN100'.
if g_custom_container is initial.
perform create_and_init_alv.
endif.
endmodule.
MODULE PAI INPUT *
module pai input.
save_ok = ok_code.
clear ok_code.
case save_ok.
when 'EXIT'.
perform exit_program.
when 'SELECT'.
perform select_all_entries changing gt_outtab[].
when 'DESELECT'.
perform deselect_all_entries changing gt_outtab[].
when 'RESET'.
perform reset_selected_entries changing gt_outtab[].
when 'SWITCH'.
perform switch_activation changing gt_outtab[].
endcase.
endmodule.
FORM EXIT_PROGRAM *
form exit_program.
leave program.
endform.
*& Form BUILD_FIELDCAT
text
<--P_GT_FIELDCAT text
form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
data ls_fcat type lvc_s_fcat.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'SFLIGHT'
changing
ct_fieldcat = pt_fieldcat.
*§A2.Add an entry for the checkbox in the fieldcatalog
clear ls_fcat.
ls_fcat-fieldname = 'CHECKBOX'.
Essential: declare field as checkbox and
mark it as editable field:
ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.
do not forget to provide texts for this extra field
ls_fcat-coltext = text-f01.
ls_fcat-tooltip = text-f02.
ls_fcat-seltext = text-f03.
optional: set column width
ls_fcat-outputlen = 10.
append ls_fcat to pt_fieldcat.
endform.
*& Form CREATE_AND_INIT_ALV
text
<--P_GT_OUTTAB text
<--P_GT_FIELDCAT text
<--P_GS_LAYOUT text
form create_and_init_alv.
data: lt_exclude type ui_functions.
create object g_custom_container
exporting container_name = g_container.
create object g_grid
exporting i_parent = g_custom_container.
perform build_fieldcat changing gt_fieldcat.
Exclude all edit functions in this example since we do not need them:
perform exclude_tb_functions changing lt_exclude.
perform build_data.
*§ B3.Use the layout structure to aquaint additional field to ALV.
gs_layout-stylefname = 'CELLTAB'.
call method g_grid->set_table_for_first_display
exporting is_layout = gs_layout
it_toolbar_excluding = lt_exclude
changing it_fieldcatalog = gt_fieldcat
it_outtab = gt_outtab[].
create object g_event_receiver.
set handler g_event_receiver->catch_doubleclick for g_grid.
Set editable cells to ready for input initially
call method g_grid->set_ready_for_input
exporting
i_ready_for_input = 1.
endform. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
text
<--P_LT_EXCLUDE text
form exclude_tb_functions changing pt_exclude type ui_functions.
data ls_exclude type ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
append ls_exclude to pt_exclude.
endform. " EXCLUDE_TB_FUNCTIONS
*& Form build_data
text
--> p1 text
<-- p2 text
form build_data.
data: lt_sflight type table of sflight,
ls_sflight type sflight,
ls_celltab type lvc_s_styl,
lt_celltab type lvc_t_styl,
l_index type i.
select * from sflight into table lt_sflight up to g_max rows.
if sy-subrc ne 0.
generate own entries if db-table is empty so that this example
still works
perform generate_entries changing lt_sflight.
endif.
*§A3.Optionally, check checkboxes initially after selecting data.
(Omitted in this example)
loop at lt_sflight into ls_sflight.
move-corresponding ls_sflight to gt_outtab.
if gt_outtab-connid eq '400'.
gt_outtab-checkbox = 'X'.
endif.
append gt_outtab.
endloop.
§B2.After selecting data,
assign a style for each row of your checkbox column.
Initially, set all checkbox cells editable.
ls_celltab-fieldname = 'CHECKBOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
loop at gt_outtab.
l_index = sy-tabix.
refresh lt_celltab.
ls_celltab-fieldname = 'CHECKBOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
insert ls_celltab into table lt_celltab.
insert lines of lt_celltab into table gt_outtab-celltab.
modify gt_outtab index l_index.
endloop.
endform. " build_data
*& Form generate_entries
text
<--P_LT_SLFIGHT text
form generate_entries changing pt_slfight type standard table.
This form is only needed for the case that there is no
data in database table SFLIGHT.
data: ls_sflight type sflight,
l_month(2) type c,
l_day(2) type c,
l_date(8) type c.
ls_sflight-carrid = 'LH'.
ls_sflight-connid = '0400'.
ls_sflight-currency = 'DEM'.
ls_sflight-planetype = '747-400'.
ls_sflight-seatsmax = 660.
do 110 times.
ls_sflight-price = sy-index * 100.
ls_sflight-seatsocc = 660 - sy-index * 6.
ls_sflight-paymentsum = ls_sflight-seatsocc * ls_sflight-price.
l_month = sy-index / 10 + 1.
do 2 times.
l_day = l_month + sy-index * 2.
l_date+0(4) = '2000'.
l_date4(2) = l_month0(2).
l_date6(2) = l_day0(2).
ls_sflight-fldate = l_date.
append ls_sflight to pt_slfight.
enddo.
enddo.
endform. " generate_entries
*& Form select_all_entries
text
<--P_GT_OUTTAB text
form select_all_entries changing pt_outtab type standard table.
data: ls_outtab type gs_outtab.
data: l_valid type c,
l_locked type c.
*§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
you must check the input cells.
If all entries are ok, ALV transferes new values to the output
table which you then can modify.
call method g_grid->check_changed_data
importing
e_valid = l_valid.
if l_valid eq 'X'.
loop at pt_outtab into ls_outtab.
perform check_lock using ls_outtab
changing l_locked.
if l_locked is initial
and not ls_outtab-checkbox eq '-'.
ls_outtab-checkbox = 'X'.
endif.
modify pt_outtab from ls_outtab.
endloop.
call method g_grid->refresh_table_display.
endif.
endform. " select_all_entries
*& Form deselect_all_entries
text
<--P_GT_OUTTAB[] text
form deselect_all_entries changing pt_outtab type standard table.
data: ls_outtab type gs_outtab.
data: l_valid type c,
l_locked type c.
*§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
you must check the input cells.
If all entries are ok, ALV transferes new values to the output
table which you then can modify.
call method g_grid->check_changed_data
importing
e_valid = l_valid.
if l_valid eq 'X'.
loop at pt_outtab into ls_outtab.
perform check_lock using ls_outtab
changing l_locked.
if l_locked is initial
and not ls_outtab-checkbox eq '-'.
ls_outtab-checkbox = ' '.
endif.
modify pt_outtab from ls_outtab.
endloop.
call method g_grid->refresh_table_display.
endif.
endform. " deselect_all_entries
*& Form reset_selected_entries
text
<--P_GT_OUTTAB[] text
form reset_selected_entries changing pt_outtab type standard table.
data: ls_outtab type gs_outtab.
data: l_valid type c.
*§A4b. Before you set, (b)reset or evaluate checkboxes,
you must check the input cells.
If all entries are ok, ALV transferes new values to the output
table which you then can modify.
call method g_grid->check_changed_data
importing
e_valid = l_valid.
if l_valid eq 'X'.
loop at pt_outtab into ls_outtab.
if not ls_outtab-checkbox is initial
and not ls_outtab-checkbox eq '-'.
clear ls_outtab.
modify pt_outtab from ls_outtab.
endif.
endloop.
call method g_grid->refresh_table_display.
endif.
endform. " reset_selected_entries
form switch_activation changing pt_outtab type standard table.
data: ls_outtab type gs_outtab.
data: l_valid type c,
lt_row_no type lvc_t_roid with header line.
*§A4c. Before you set, reset, (c)(de)activate
or evaluate checkboxes, you must check the input cells.
If all entries are ok, ALV transferes new values to the output
table which you then can modify.
call method g_grid->check_changed_data
importing
e_valid = l_valid.
if l_valid eq 'X'.
call method g_grid->get_selected_rows
importing
et_row_no = lt_row_no[].
loop at lt_row_no.
read table pt_outtab into ls_outtab index lt_row_no-row_id.
if ls_outtab-checkbox ne '-'.
ls_outtab-checkbox = '-'.
else.
ls_outtab-checkbox = ' '.
endif.
modify pt_outtab from ls_outtab index lt_row_no-row_id.
endloop.
call method g_grid->refresh_table_display.
endif.
endform. " switch_activation
*& Form check_lock
text
-->P_LS_OUTTAB text
<--P_L_LOCKED text
form check_lock using ps_outtab type gs_outtab
changing p_locked.
data ls_celltab type lvc_s_styl.
loop at ps_outtab-celltab into ls_celltab.
if ls_celltab-fieldname = 'CHECKBOX'.
if ls_celltab-style eq cl_gui_alv_grid=>mc_style_disabled.
p_locked = 'X'.
else.
p_locked = space.
endif.
endif.
endloop.
endform. " check_lock
Regards,
Sindhu -
Hi All,
I have developed ALV hierarchical report with check boxes for header and item records.
If i select header checkbox, the corresponding item records checkboxes should be selected automatically, here after selecting header checkbox i have to press some push button(like Refresh) then only item check boxes getting selected,
but here my req. is without clicking any button item checkboxes should be checked automatically if corresponding header check box is selected.
If anybody have an idea pls get back to me.
Regards,
AshwinHi,
Construct a field catalogue as follows:
DATA: z_fieldcat TYPE slis_fieldcat_alv
Then set the checkbox related fields fields like:
z_fieldcat-seltext_l = 'Checkbox'.
z_fieldcat-checkbox = 'X'. " Display this field as a checkbox
z_fieldcat-edit = 'X'. " This option ensures that you can
" edit the checkbox. Else it will
" be protected.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Jan 30, 2008 5:35 PM -
Check boxes in ALV Report how to do ?
ALV report how to keep check box in the first field?
thanks in advance..
chalapathihi,
Check this small code.. U will get clear idea.
Report.
data : begin of it occurs 0,
MATNR TYPE MATNR,
c1 , " CHECK BOX FIELDS
c2,
end of it.
type-pools : slis.
data itlog type slis_t_fieldcat_alv.
data walog type slis_fieldcat_alv.
SELECT MATNR
FROM MARA
INTO TABLE IT .
****INSERTING CHECKBOX IN CHANGE MODE
WALOG-FIELDNAME = 'C1'.
WALOG-TABNAME = 'IT'.
WALOG-SELTEXT_M = 'CHECKBOX1'.
walog-CHECKBOX = 'X'.
WALOG-EDIT = 'X'.
APPEND WALOG TO ITLOG.
****INSERTING CHECKBOX IN DISPLAY MODE
WALOG-FIELDNAME = 'C2'.
WALOG-TABNAME = 'IT'.
WALOG-SELTEXT_M = 'CHECKBOX2'.
walog-CHECKBOX = 'X'.
WALOG-EDIT = ''.
APPEND WALOG TO ITLOG.
WALOG-FIELDNAME = 'MATNR'.
WALOG-TABNAME = 'IT'.
WALOG-SELTEXT_M = 'MATERIAL'.
walog-CHECKBOX = ''.
WALOG-EDIT = 'X'.
WALOG-NO_ZERO = 'X'. " LEFT ZEROS WILL CUT
APPEND WALOG TO ITLOG.
*WALOG-FIELDNAME = 'ICON'.
*WALOG-TABNAME = 'IT'.
*WALOG-SELTEXT_M = 'ICON'. "IN FIELDCATALOG ADDING THAT ICON
*walog-ICON = 'X'.
*walog-just = 'R'. " RIGHT JUSTIFICATION OR LEFT
**WALOG-EDIT = ''.
*APPEND WALOG TO ITLOG.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZALV_SIMPLE1'
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 =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = ITLOG
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT
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.
Thanks and Regards,
surya -
How to print check box in ALV list display and how to pick selected ones
Hi
i am displaying one ALV list dispaly. for that im adding one check box fields by filling the fieldcat as below:
wa_fldcat-checkbox = 'X'.
wa_fldcat-edit = 'X'.
but the check box is showing disable mode only. i want to display that check box and if i select that check box i want pick that records. for ALV grid i found one FM to pick records of selectedones as below.
DATA ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF ref_grid IS NOT INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
but how can i do for list display to pick those selected one records.
Can any one sugget regarding this.
Thanks in advance.
Rahul.Hi,
Thanks. now it's enabled. but how can we pick the records from that list whichever i selected through that check box.
i found this one for ALV grid:
DATA ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF ref_grid IS NOT INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
but how for ALV normal list display.
Thanks.
rahul -
Hi All,
I have a urgent requirement in my <b>ALV list</b>.
Where in the output list i need to create a check box, which is followed by Sales order, quantity columns etc......
Requirement: 1. tell me how to <b>create</b> a <b>check box</b>
2. i need to select the checkbox(Sales Order) and press a push button which is above the list(push button) in the tool bar.
I am able to see the output using <b>reuse_alv_grid_display</b>.
<b>But kindly let me know how to <b>link</b> the <b>check box</b> and the <b>push button</b> which is above the list for further processing.</b>
Possibly a sample code will help a lot.
Thanks in advance.
Rajesh Kumar.TO create a check box, take one field in your internal table as:
CHK TYPE C.
Now, pass the LAYOUT by filling up the LAYOUT strucutre.
LAYOUT-BOX_FIELDNAME = 'CHK' .
This will provide you the BOX field in the GRID and Checkbox in the LIST.
When you select the checkbox the field value will set to 'X' in the table.
Regards,
Naimesh Patel -
How to add a check box in ALV Grid using SAP R/3 release 4.6b?
Hello everyone,
I hope you all fine.
I'm writing because I have a requirement with ALV Grid, what I need to do, is to insert a checkbox into a cell, I already read the forum to know how to do that, but I'm using a SAP R/3 release 4.6b, and when I execute the program the checkbox is displayed greyout, because this release doesn't have the EDIT property into the slis_t_fieldcat_alv.
Does any body know how to enable the checkbox cell in the ALV Grid for this release?, so it will allow the user to mark the desired rows.
I'll really appreciate if you guys could help me to find a solution.
Thanks for your time.
Regards,
GuillermoHi,
if you need just a check box for each line, try to get rid of this line from your layout.
g_layout-box_fieldname = 'ZZCHECK'.
SAP uses this field to store info about selected lines. Hence you click on the second check box, you select different line and the first line is erased. You can select more line by holding SHIFT + CTRL
Cheers -
How to create command button called 'Remarks' and Check box in ALV GRID?
Hi, Experts,
Requirement is: in the ALVE GRID report output, user select a record by clicking the check box and pressing the button 'Remarks' it will take me into other transaction from the output list.
Please help me out.
Reward points.
SekharHi Chandra Shekar,
Check the following sample program. 2 things to remember.
1. Check the callback subroutine PF_STATUS_SET and create PF status for the program.and also ur REMARKS button in the application tool. Comments are made every where wherever those are needed. After creating Pf status execute the report.
2.Once you select records by selecting checkboxes, u have to press on Refresh button( that is there on application toolbar), then only for selected records, CHECK field in the internal is updated. After that press on REMARKS button .
REPORT zvenkat_alv_grid.
TABLES:t001.
"Types
TYPES:
BEGIN OF t_1001,
check TYPE c,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
ort01 TYPE t001-ort01,
land1 TYPE t001-land1,
END OF t_1001.
"Work area
DATA:
w_t001 TYPE t_1001.
"Internal table
DATA:
i_t001 TYPE STANDARD TABLE OF t_1001.
" ALV Declarations
* Types Pools
TYPE-POOLS:
slis.
* Types
TYPES:
t_fieldcat TYPE slis_fieldcat_alv,
t_events TYPE slis_alv_event,
t_layout TYPE slis_layout_alv.
* Workareas
DATA:
w_fieldcat TYPE t_fieldcat,
w_events TYPE t_events,
w_layout TYPE t_layout.
* Internal Tables
DATA:
i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,
i_events TYPE STANDARD TABLE OF t_events.
*& start of selection
START-OF-SELECTION.
PERFORM get_data.
*& end-of-selection.
END-OF-SELECTION.
PERFORM build_fieldcatlog.
PERFORM build_events.
PERFORM build_layout.
PERFORM list_display.
*& Form get_data
FORM get_data .
SELECT bukrs
butxt
ort01
land1
FROM t001
INTO CORRESPONDING FIELDS OF TABLE i_t001
UP TO 30 ROWS.
ENDFORM. " get_data
*& Form build_fieldcatlog
FORM build_fieldcatlog .
CLEAR:w_fieldcat,i_fieldcat[].
PERFORM build_fcatalog USING:
'CHECK' 'I_T001' ' ',
'BUKRS' 'I_T001' 'BUKRS',
'BUTXT' 'I_T001' 'BUTXT',
'ORT01' 'I_T001' 'ORT01',
'LAND1' 'I_T001' 'LAND1'.
ENDFORM. "BUILD_FIELDCATLOG
*& Form BUILD_FCATALOG
FORM build_fcatalog USING l_field l_tab l_text.
w_fieldcat-fieldname = l_field.
w_fieldcat-tabname = l_tab.
w_fieldcat-seltext_m = l_text.
IF l_field = 'CHECK'..
w_fieldcat-checkbox = 'X'.
w_fieldcat-edit = 'X'.
ENDIF.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fieldcatlog
*& Form build_events
* text
FORM build_events.
CLEAR :
w_events, i_events[].
w_events-name = 'TOP_OF_PAGE'."Event Name
w_events-form = 'TOP_OF_PAGE'."Callback event subroutine
APPEND w_events TO i_events.
CLEAR w_events.
w_events-name = 'USER_COMMAND' .
w_events-form = 'USER_COMMAND' .
APPEND w_events TO i_events.
CLEAR w_events.
w_events-name = 'PF_STATUS_SET' .
w_events-form = 'PF_STATUS_SET' .
APPEND w_events TO i_events.
CLEAR w_events.
ENDFORM. "build_events
*& Form build_layout
FORM build_layout .
w_layout-colwidth_optimize = 'X'.
w_layout-zebra = 'X'.
ENDFORM. " build_layout
*& Form list_display
FORM list_display .
DATA:
l_program TYPE sy-repid.
l_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_program
is_layout = w_layout
it_fieldcat = i_fieldcat
it_events = i_events
TABLES
t_outtab = i_t001
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. " list_display
*& Form top_of_page
FORM top_of_page.
DATA :
li_header TYPE slis_t_listheader,
w_header LIKE LINE OF li_header.
DATA:
l_date TYPE char10.
WRITE sy-datum TO l_date.
w_header-typ = 'H'.
CONCATENATE sy-repid ':' 'From Date' l_date INTO w_header-info SEPARATED BY space.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'S'.
w_header-info = sy-title.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'A'.
w_header-info = sy-uname.
APPEND w_header TO li_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = li_header.
ENDFORM. "top_of_page
*& Form pf_status_set
FORM pf_status_set USING extab TYPE slis_t_extab.
"Procedure to set own pf-status.
"1.Goto Transaction code SE41
"2.give program = SAPLKKBL and status = STANDARD_FULLSCREEN.
"3.Click on Application toolbar STATUS button
"4.Give ur program name Status name that is to be used in the program using SET pf-status statement
"5.Create ur button REMARKS.
SET PF-STATUS 'STATUS1' EXCLUDING extab.
ENDFORM. "pf_status_set
*& Form user_command
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm .
WHEN 'REMARKS'."When u click on remarks button.
LOOP AT i_t001 INTO w_t001 WHERE check = 'X'.
WRITE :/ w_t001-bukrs, 'Checked'.
ENDLOOP.
ENDCASE.
ENDFORM. "user_command
I hope that it helps u .
Regards,
Venkat.O -
Hi Gurus,
I developed one alv(grid) report. the grid having first three columns are with check boxes. Now my requirement is if I tick or on tick those check boxes I need to track which records check boxes are modiried.
But I canot tracking the modified records . after ticking or unticking those check boxs values are not modified in intrnal table.
plese help this is very urgent.
Regards,
Shashikumar.GHi Kiran,
I displayed internal table with check boxes that is ok.
after displaying the internal table if i tick or un tick the records those are not modified in internal table but I need to track the records which are modified.
please give me repply urgently.
Regards,
Shashikumar.G -
Hi,
i have a checkbox field in the output screen.
I need to capture the selected check box in the output screen of ALV grid display(using FM).
When i set the PF status to user defined PF Status in the FM, i am not able to capture the selected check boxes.
how ever, when i dont use the user defined PF status in the FM, its working fine. Any sugguestion how to do it with user defined PF status?
Thanks in advance,
Niyaz AhamedHi,
For doing this, you must activate the event 'DATA_CHANGED' of you alv object;
and implement a method on other object (event handler ) that will reacts to data_ changed.
Here below some sample code to help you .
Regards.
David
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
DATA: ucomm TYPE sy-ucomm.
Define and implement event handler to handle event DATA_CHANGED.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_event_receiver DEFINITION
DATA: event_receiver TYPE REF TO lcl_event_receiver.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
ENDMETHOD. "handle_data_changed
CREATE OBJECT grid1
EXPORTING
i_parent = g_custom_container
i_appl_events = p_appl_e.
g_repid = sy-repid.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_data_changed FOR grid1. -
Check box in ALV - how to remove line selectors?
Hai All,
I have to display sales orders in ALV grid.
A check box shoud be displayed against each row.
So if the user selects few sales orders & click on SAVE the data will be saved in custom table.
The problem now is,
I used the statement
field_cat-EDIT = 'X'
to make the checkbox editable.
But with this statement, the ALV grid is displaying
row selectors also.
is there any way to remove the line selectors?I need only check boxes to select a row.it should not contain line selectors.
Thanks & Regards,
Bhaskar.You can do that in OO ALV.
there is a field in layout
NO_ROWMARK = 'X'. this will remove the line selector.
But normal alv it is not possible.
if you dont want OO ALV, then use the Function module
REUSE_ALV_GRID_DISPLAY_LVC
Maybe you are looking for
-
My broadband speed has dropped drastically oner the last week! Just done three speed tests the highest was 1.69mbps. It was in the region of 76mbps. Apart from the usual suspects all of which I have checked what other reasons could there be for such
-
Hi Experts, Kindly gothrough the below codes and when i click on rb2 radiobutton only that selection option must appear but it is coming when i execute the program,, can any one help to resolve this issue..., *& Report ZPROGRAM_KPI RE
-
How is a Worker Role hosted?
Hi How is a worker role hosted in Azure. What process is it in? I'm thinking of how to test locally or an on premise version. Is the Azure host process simply a windows service? I'm writing a solution that uses the Service Bus for Window Server 1.1 a
-
Event 4, Kernel-eventTracing
I periodically see this warning in the event log: The maximum file size for session "McAfee.{E4367DA7-2B80-47f3-86D2-7626A18FC6F4}" has been reached. As a result, events might be lost (not logged) to file "C:\ProgramData\McAfee\MCLOGS\ETW\mclogs.etl"
-
I recently purchased iLife '06 and installed it on my Powerbook. It hasn't been perfect but the biggest problem was upgrading my photos for iPhoto. It says: "The photo library needs to be upgraded to work with this version of iPhoto." click upgrade..