Clearing Check box
Hi,
I have to create the credit memo based on user selected records. My program is doing it, but I am having two problems,
1)After creating the credit memo it is not clearing those records, if I choose next set it is adding 2nd time selected records to the first time selected records and adding to previous credit memo number.
2)If the credit memo number is already there to a record, it should not allow the same record to create another CM.
Please help me to solve these.
Thanks,
Neelu.
REPORT zsd_creditmemo NO STANDARD PAGE HEADING.
TABLES: zppprice, kna1.
TYPES: BEGIN OF ty_zprice,
mandt TYPE mandt,
vkorg TYPE vkorg,
vtweg TYPE vtweg,
spart TYPE spart,
kunnr TYPE kunnr,
matnr TYPE matnr,
crdate TYPE zcrdate,
efdate TYPE zefdate,
sprice TYPE zprice3,
eprice TYPE zprice4,
eohqty TYPE zquantity1,
aohqty TYPE zquantity2,
auart TYPE auart,
bstkd TYPE bstkd,
werks TYPE werks_d,
augru TYPE augru,
xblnr TYPE xblnr,
crmemo TYPE vbeln,
index TYPE sy-index,
END OF ty_zprice.
DATA: it_ztable TYPE TABLE OF zppprice WITH HEADER LINE,
gt_zprice TYPE TABLE OF zppprice WITH HEADER LINE,
gt1_zprice TYPE TABLE OF zppprice,
gt2_zprice TYPE TABLE OF ty_zprice,
gt3_zprice TYPE TABLE OF ty_zprice,
gt4_zprice TYPE TABLE OF ty_zprice,
gs_zprice TYPE zppprice,
gs_zprice1 TYPE ty_zprice,
ls_zprice TYPE ty_zprice,
wa LIKE zppprice.
DATA: salesdocument TYPE bapivbeln-vbeln.
DATA: header LIKE bapisdhd1.
DATA: headerx LIKE bapisdhd1x.
DATA: item LIKE bapisditm OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditmx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapiparnr OCCURS 0 WITH HEADER LINE.
DATA: return1 LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: conditions1 LIKE bapicond OCCURS 0 WITH HEADER LINE.
DATA: order_text LIKE bapisdtext OCCURS 0 WITH HEADER LINE.
DATA: lv_index TYPE sy-index,
v_tabix TYPE sytabix,
chbox(1) TYPE c VALUE ' ',
repid TYPE sy-repid,
lv_itemno TYPE i VALUE 10,
lv_pprice TYPE zprice3,
lv_lines TYPE i,
lv_flg TYPE c,
lv_cnt TYPE i.
repid = sy-repid.
PERFORM displaydata.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'CMEMO'.
DESCRIBE TABLE gt_zprice LINES lv_cnt.
* lv_index = 1.
DO lv_cnt TIMES.
lv_index = sy-index + 1.
READ LINE lv_index FIELD VALUE chbox.
IF chbox = 'X'.
READ TABLE gt_zprice INTO gs_zprice1 INDEX sy-index.
IF sy-subrc EQ 0.
gs_zprice1-index = sy-index.
APPEND gs_zprice1 TO gt2_zprice.
CLEAR gs_zprice1.
ENDIF.
* ELSE.
* WRITE: /01(253) 'Please Select At least One Record'.
ENDIF.
clear chbox.
ENDDO.
gt4_zprice[] = gt2_zprice[].
SORT gt2_zprice BY vkorg vtweg spart kunnr.
DELETE ADJACENT DUPLICATES FROM gt2_zprice
COMPARING vkorg vtweg spart kunnr.
DESCRIBE TABLE gt2_zprice LINES lv_lines.
IF lv_lines = 1.
LOOP AT gt4_zprice INTO gs_zprice1.
AT NEW kunnr.
MOVE 'Y' TO lv_flg.
ENDAT.
IF lv_flg EQ 'Y'.
PERFORM headerdata.
PERFORM texts.
CLEAR lv_flg.
ENDIF.
PERFORM itemdata.
APPEND gs_zprice1 TO gt3_zprice.
ENDLOOP.
PERFORM call_function.
PERFORM update_pricetable.
PERFORM errorcheckandcommit.
PERFORM displaydata.
* WRITE: /01(253) 'Please Select Again To Create Another Credit Memo'.
REFRESH gt2_zprice.
CLEAR chbox.
CLEAR lv_lines.
ELSE.
* WRITE: /01(253) 'Please Select Same Customer'.
REFRESH gt2_zprice.
CLEAR chbox.
EXIT.
ENDIF.
ENDCASE.
*& Form headerdata
* text
* --> p1 text
* <-- p2 text
FORM headerdata.
* header data
* Sales document type
header-doc_type = gs_zprice1-auart.
headerx-doc_type = 'X'.
* Sales organization
header-sales_org = gs_zprice1-vkorg.
headerx-sales_org = 'X'.
* Distribution channel
header-distr_chan = gs_zprice1-vtweg.
headerx-distr_chan = 'X'.
* Division
header-division = gs_zprice1-spart.
headerx-division = 'X'.
* Customer PO Number
header-purch_no_c = gs_zprice1-bstkd.
headerx-purch_no_c = 'X'.
* Order Reason
header-ord_reason = gs_zprice1-augru.
headerx-ord_reason = 'X'.
* Ref Doc Number
header-ref_doc_l = gs_zprice1-xblnr.
headerx-ref_doc_l = 'X'.
headerx-updateflag = 'I'.
ENDFORM. " headerdata
*& Form Texts
* text
* --> p1 text
* <-- p2 text
FORM texts.
*Texts
order_text-itm_number = '000000'.
order_text-text_id = '0001'.
order_text-langu = sy-langu.
order_text-text_line = gs_zprice1-xblnr.
APPEND order_text.
ENDFORM. " Texts
*& Form itemdata
* text
* --> p1 text
* <-- p2 text
FORM itemdata.
* Partner data
* Sold to
partner-partn_role = 'AG'.
partner-partn_numb = gs_zprice1-kunnr.
APPEND partner.
* ITEM DATA
itemx-updateflag = 'I'.
* Line item number.
item-itm_number = lv_itemno.
itemx-itm_number = 'X'.
* Material
item-material = gs_zprice1-matnr.
itemx-material = 'X'.
* Plant
item-plant = gs_zprice1-werks.
itemx-plant = 'X'.
* Quantity
item-target_qty = gs_zprice1-eohqty.
itemx-target_qty = 'X'.
APPEND item.
APPEND itemx.
*Fill schedule lines
lt_schedules_in-itm_number = lv_itemno.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = gs_zprice1-eohqty.
APPEND lt_schedules_in.
*Fill schedule line flags
lt_schedules_inx-itm_number = lv_itemno.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'I'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
*Conditions
lv_pprice = gs_zprice1-sprice - gs_zprice1-eprice.
conditions1-itm_number = lv_itemno.
conditions1-cond_type = 'ZCPP'.
conditions1-cond_value = lv_pprice.
conditions1-currency = 'USD'.
conditions1-cond_unit = 'EA'.
conditions1-cond_p_unt = 1.
APPEND conditions1.
lv_itemno = lv_itemno + 10.
ENDFORM. " itemdata
*& Form call_function
* text
* --> p1 text
* <-- p2 text
FORM call_function.
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = salesdocument
TABLES
return = return1
sales_items_in = item
sales_items_inx = itemx
sales_partners = partner
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_conditions_in = conditions1
sales_text = order_text.
ENDFORM. " call_function
*& Form errorcheck
* text
* --> p1 text
* <-- p2 text
FORM errorcheckandcommit.
* Check the return table.
LOOP AT return1 WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
break singireddyn.
IF sy-subrc = 0.
WRITE: / 'Error in creating document'.
ELSE.
*Commit the work.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
ENDFORM. " errorcheckandcommit
*& Form update_pricetable
* text
* --> p1 text
* <-- p2 text
FORM update_pricetable.
LOOP AT gt3_zprice INTO ls_zprice.
READ TABLE gt_zprice INTO gs_zprice INDEX ls_zprice-index.
IF sy-subrc EQ 0.
v_tabix = sy-tabix.
gs_zprice-crmemo = salesdocument.
MODIFY gt_zprice
FROM gs_zprice INDEX v_tabix TRANSPORTING crmemo.
ENDIF.
ENDLOOP.
* REFRESH:gt3_zprice.
LOOP AT gt_zprice.
wa-vkorg = gt_zprice-vkorg.
wa-vtweg = gt_zprice-vtweg.
wa-spart = gt_zprice-spart.
wa-kunnr = gt_zprice-kunnr.
wa-matnr = gt_zprice-matnr.
wa-crdate = gt_zprice-crdate.
wa-efdate = gt_zprice-efdate.
wa-sprice = gt_zprice-sprice.
wa-eprice = gt_zprice-eprice.
wa-eohqty = gt_zprice-eohqty.
wa-aohqty = gt_zprice-aohqty.
wa-auart = gt_zprice-auart.
wa-bstkd = gt_zprice-bstkd.
wa-werks = gt_zprice-werks.
wa-augru = gt_zprice-augru.
wa-xblnr = gt_zprice-xblnr.
wa-crmemo = gt_zprice-crmemo.
MODIFY zppprice FROM wa.
CLEAR: wa, zppprice.
ENDLOOP.
ENDFORM.
*& Form Displaydata
* text
* --> p1 text
* <-- p2 text
FORM displaydata.
SET PF-STATUS 'LIST'.
NEW-PAGE LINE-SIZE 253.
SELECT * FROM zppprice
INTO TABLE gt_zprice.
WRITE: /01(253) sy-uline.
LOOP AT gt_zprice INTO gs_zprice.
SELECT SINGLE name1 FROM kna1 INTO kna1-name1
WHERE kunnr = gs_zprice-kunnr.
WRITE: /01 sy-vline,
02 chbox AS CHECKBOX,
04 sy-vline,
05 gs_zprice-vkorg,
10 sy-vline,
11 gs_zprice-vtweg,
14 sy-vline,
15 gs_zprice-spart,
18 sy-vline,
19 gs_zprice-kunnr,
30 sy-vline,
31 kna1-name1,
67 sy-vline,
68 gs_zprice-matnr,
87 sy-vline,
88 gs_zprice-crdate,
98 sy-vline,
99 gs_zprice-efdate,
110 sy-vline,
111 gs_zprice-sprice,
127 sy-vline,
128 gs_zprice-eprice,
145 sy-vline,
146 gs_zprice-eohqty,
157 sy-vline,
158 gs_zprice-aohqty,
169 sy-vline,
170 gs_zprice-auart,
175 sy-vline,
176 gs_zprice-bstkd,
212 sy-vline,
213 gs_zprice-werks,
218 sy-vline,
219 gs_zprice-augru,
223 sy-vline,
224 gs_zprice-xblnr,
241 sy-vline,
242 gs_zprice-crmemo,
253 sy-vline.
* CLEAR zppprice.
ENDLOOP.
WRITE: /01(253) sy-uline.
* CLEAR zppprice.
* CLEAR chbox.
ENDFORM. " Displaydata
Hello Neelu,
once user select check box and it will create credit memo,so selected records it contains one value would be 'X'.,
After BAPI FM use delete command where field = 'X'. so it will delete those records. so now you have remaining records.
do not use exit or someother command,here you are just deleting the internal table data and so no worries.
<b>it any of the selected records have CM number can I come out of the loop and exit.</b>
look at real time requirement ,some time user will select one check box and create credit memo ,again he will select other check boxes too. so use simple delete command.
Thanks
Seshu
Similar Messages
-
Adding a check box to my page clears the value in a hidden field on page 0
Hello, I hope that someone can assist me. I have a page that has multiple submit buttons on it. When I click a submit button the page refreshes to render the new content. I have a hidden field, and its region is set to one on page 0. Without any check boxes on my page, I can set a value in the hidden field, and it remains there even if I click on any submit buttons. If I put a check box on the page and then press a submit button, the value is cleared in the hidden element which is not desired. I did notice that in this case with the check box, if I refresh the browser the hidden field value is not cleared. Perhaps the page is being rendered differently after the submit because of the checkbox. Does anyone have any ideas of what is happening?
That doesn't sound right. Adding a checkbox shouldn't have that effect. Please try to reproduce this on htmldb.oracle.com so we can take a look or post a screenshot of your relevant page components.
-
When I start firefox, it used to send me directly to my home page, now I have to login and enter password everytime, even when checking box to leave me logged in. Also, its not rememberin ids and passwords for my bookmarked sites.
Make sure that you do not run Firefox in permanent Private Browsing mode.
*https://support.mozilla.org/kb/Private+Browsing
To see all History and Cookie settings, choose:
*Tools > Options > Privacy, choose the setting <b>Firefox will: Use custom settings for history</b>
*Deselect: [ ] "Always use private browsing mode"
If clearing the cookies doesn't help then it is possible that the file <i>cookies.sqlite</i> that stores the cookies is corrupted.<br />
Rename (or delete) <b>cookies.sqlite</b> (cookies.sqlite.old) and delete other present cookie files like <b>cookies.sqlite-journal</b> in the Firefox Profile Folder in case the file cookies.sqlite got corrupted.
*http://kb.mozillazine.org/Cookies
You can also try to update to Firefox 9.0.1 -
Selection using check box in std ALV grid!
Hi all,
I have written a custom report to show the O/p in ALV grid.
This is my code:
TABLES :zpo_loi.
TYPE-POOLS : slis.
TYPE-POOLS: icon.
TABLES : sscrfields.
DATA : ls_composer TYPE ssfcompop,
ls_control TYPE ssfctrlop.
DATA : wa_return TYPE TABLE OF bapiret2 ,
wa_address TYPE bapiaddr3.
DATA : wa_crmd_orderadm_h TYPE zpo_loi,
it_po TYPE TABLE OF crmd_orderadm_h,
wa_po TYPE bbp_pds_header.
DATA : it_tab TYPE TABLE OF zpo_loi.
DATA : it_data TYPE TABLE OF crmd_orderadm_h,
wa_data TYPE bbp_pds_header,
et_data TYPE bbps_sf_po_output.
DATA : w_formname TYPE tdsfname ,
w_sfname TYPE rs38l_fnam.
DATA :it_po_no TYPE TABLE OF select_be_obj_id,
wa_it_po_no LIKE LINE OF it_po_no.
DATA :r_itab TYPE ddshretval OCCURS 0.
DATA : it_output LIKE TABLE OF zloi,
wa_output TYPE zloi.
DATA : w_answer TYPE c.
DATA : g_repid LIKE sy-repid,
g_title TYPE lvc_title,
g_set_pf_stat TYPE slis_formname VALUE 'SET_PF_STATUS',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_layout TYPE slis_layout_alv,
g_print_alv TYPE slis_print_alv,
g_variant LIKE disvariant,
c_char_a(1) VALUE 'A',
c_char_x(1) VALUE 'X',
itab_alv_sort TYPE slis_t_sortinfo_alv,
itab_alv_fcat TYPE slis_t_fieldcat_alv.
* Internal tables Begin with IT_ *
DATA : it_fcat TYPE slis_t_fieldcat_alv, "---ALV
it_disp TYPE TABLE OF zloi.
* Work Area for Internal tables Begin with WA_ *
DATA : wa_fcat TYPE slis_fieldcat_alv , "---ALV
wa_layout TYPE lvc_s_layo, "---ALV
wa_it_disp LIKE LINE OF it_disp.
DATA : it_sf_po TYPE TABLE OF crmd_orderadm_h,
wa_sf_po TYPE bbp_pds_header.
*SELECTION-SCREEN:
* BEGIN OF SCREEN 500 AS WINDOW TITLE title,
* END OF SCREEN 500.
*DATA : functxt TYPE smp_dyntxt.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS sel_po FOR zpo_loi-zobject_id.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : pr_loi RADIOBUTTON GROUP grp1 USER-COMMAND ucom,
pr_fondo RADIOBUTTON GROUP grp1.
SELECTION-SCREEN END OF BLOCK b2.
* At selection-screen output *
AT SELECTION-SCREEN OUTPUT.
IF pr_fondo = 'X'.
REFRESH sel_po.
LOOP AT SCREEN.
IF screen-name = text-003 OR screen-name = text-004.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF pr_loi = 'X'.
LOOP AT SCREEN.
IF screen-name = text-003 OR screen-name = text-004.
screen-input = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
* At selection-screen on radiobutton *
AT SELECTION-SCREEN ON RADIOBUTTON GROUP grp1.
IF pr_fondo = 'X'.
REFRESH sel_po.
LOOP AT SCREEN.
IF screen-name = text-003 OR screen-name = text-004.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF pr_loi = 'X'.
LOOP AT SCREEN.
IF screen-name = text-003 OR screen-name = text-004.
screen-input = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_po-low.
PERFORM populate_table.
PERFORM f4_help.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_po-high.
PERFORM populate_table.
PERFORM f4_help.
* At selection-screen *
AT SELECTION-SCREEN.
*---CHECKING THE INPUT >>>
IF sy-ucomm = 'ONLI'.
PERFORM f002-check_input.
PERFORM f001-check.
ENDIF.
*& Form POPULATE_TABLE
* text
* --> p1 text
* <-- p2 text
FORM populate_table .
SELECT zobject_id
description
FROM zpo_loi
INTO CORRESPONDING FIELDS OF TABLE it_tab.
SORT it_tab BY zobject_id ASCENDING.
ENDFORM. " POPULATE_TABLE
*& Form F4_HELP
* text
* --> p1 text
* <-- p2 text
FORM f4_help .
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
ddic_structure = ' '
retfield = 'ZOBJECT_ID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'A'
value_org = 'S'
TABLES
value_tab = it_tab
return_tab = r_itab.
ENDFORM. " F4_HELP
*& Form F001-CHECK
* text
* --> p1 text
* <-- p2 text
FORM f001-check .
IF pr_fondo = 'X'.
PERFORM display_expiring_fondos.
ELSEIF pr_loi = 'X'.
PERFORM fetch_po_det.
PERFORM build_fcat.
PERFORM alv_display.
ENDIF.
ENDFORM. " F001-CHECK
*& Form F002-CHECK_INPUT
* text
* --> p1 text
* <-- p2 text
FORM f002-check_input .
IF pr_loi = 'X'.
REFRESH it_po.
IF sel_po-low IS NOT INITIAL.
SELECT object_id
FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_po
WHERE object_type = 'BUS2201'
AND object_id = sel_po-low.
IF sy-subrc NE 0.
IF sel_po-high IS NOT INITIAL.
SELECT object_id
FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_po
WHERE object_type = 'BUS2201'
AND object_id = sel_po-high.
IF sy-subrc NE 0.
MESSAGE e009(zsrm).
ENDIF.
ENDIF.
MESSAGE e007(zsrm).
ENDIF.
ELSE.
MESSAGE e010(zsrm).
ENDIF.
IF sel_po-high IS NOT INITIAL.
SELECT object_id
FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_po
WHERE object_type = 'BUS2201'
AND object_id = sel_po-high.
IF sy-subrc NE 0.
MESSAGE e008(zsrm).
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " F002-CHECK_INPUT
*& Form FETCH_PO_DET
* text
* --> p1 text
* <-- p2 text
FORM fetch_po_det .
REFRESH it_po.
it_po_no[] = sel_po[].
DATA : w_count TYPE i,
w_lines TYPE c,
wa_header TYPE bbp_pds_po_header_d.
REFRESH : it_po,it_output.
IF sel_po-high IS NOT INITIAL.
SELECT object_id
description
posting_date
created_by
FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_po
WHERE object_type = 'BUS2201'
AND object_id BETWEEN sel_po-low AND sel_po-high.
ELSE.
SELECT object_id
description
posting_date
created_by
FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_po
WHERE object_type = 'BUS2201'
AND object_id = sel_po-low.
ENDIF.
w_lines = sy-dbcnt.
w_count = 1.
DO.
IF w_count LE w_lines.
READ TABLE it_po INTO wa_po INDEX w_count.
MOVE wa_po-object_id TO wa_output-zzpono.
MOVE wa_po-description TO wa_output-zzpodesc.
MOVE wa_po-posting_date TO wa_output-zzpodate.
MOVE wa_po-created_by TO wa_output-zzpocreator.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_object_id = wa_output-zzpono
IMPORTING
e_header = wa_header.
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = wa_output-zzpocreator
IMPORTING
address = wa_address
TABLES
return = wa_return.
CLEAR wa_output-zzpocreator.
CONCATENATE wa_address-firstname ' ' wa_address-lastname INTO wa_output-zzpocreator .
MOVE wa_header-total_value TO wa_output-zzpoval.
MOVE wa_header-currency TO wa_output-zzpocur.
APPEND wa_output TO it_output.
w_count = w_count + 1.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " FETCH_PO_DET
*& Form BUILD_FCAT
* text
* --> p1 text
* <-- p2 text
FORM build_fcat .
g_repid = sy-repid.
g_title = 'Print LOI details'.
g_print_alv-no_print_listinfos = 'X'.
g_variant-report = sy-repid.
g_variant-variant = sy-title.
CLEAR g_layout.
g_layout-f2code = ' '.
wa_layout-zebra = 'X'.
g_layout-flexible_key = 'X'.
g_layout-colwidth_optimize = 'X'.
g_layout-detail_initial_lines = 'X'.
g_layout-box_fieldname = 'ZZCHECK'.
REFRESH it_fcat.
*Po no
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPONO' .
wa_fcat-tabname = 'IT_DISP'.
wa_fcat-seltext_m = 'Purchase Order'.
*wa_fcat-seltext_s = 'Purchase Order.
wa_fcat-icon = 'X'.
wa_fcat-col_pos = '2'.
wa_fcat-outputlen = 10.
APPEND wa_fcat TO it_fcat.
*Description
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPODESC' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Description'.
wa_fcat-seltext_m = 'Description'.
*wa_fcat-seltext_s = 'Description'.
wa_fcat-col_pos = '3'.
wa_fcat-outputlen = 10.
APPEND wa_fcat TO it_fcat.
*Posting date
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPODATE' .
wa_fcat-tabname = 'IT_DISP'.
wa_fcat-seltext_l = 'Posting Date'.
wa_fcat-seltext_m = 'Posting Date'.
*wa_fcat-seltext_s = 'Posting Date'.
wa_fcat-col_pos = '4'.
wa_fcat-outputlen = 8.
APPEND wa_fcat TO it_fcat.
*value
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPOVAL' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO value'.
wa_fcat-seltext_m = 'PO value'.
*wa_fcat-seltext_s = 'PO value'.
wa_fcat-col_pos = '5'.
wa_fcat-outputlen = 15.
wa_fcat-no_zero = 'X'.
APPEND wa_fcat TO it_fcat.
*Currency
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPOCUR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO Currency'.
wa_fcat-seltext_m = 'PO Currency'.
*wa_fcat-seltext_s = 'PO Currency'.
wa_fcat-col_pos = '6'.
wa_fcat-outputlen = 5.
APPEND wa_fcat TO it_fcat.
*Creator
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPOCREATOR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Buyer'.
wa_fcat-seltext_m = 'Buyer'.
*wa_fcat-seltext_s = 'Buyer'.
wa_fcat-col_pos = '7'.
wa_fcat-outputlen = 12.
APPEND wa_fcat TO it_fcat.
ENDFORM. " BUILD_FCAT
*& Form ALV_DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM alv_display .
SORT it_output BY zzpono.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_pf_status_set = g_set_pf_stat
i_callback_user_command = g_user_command
i_grid_title = g_title
is_layout = g_layout
it_fieldcat = it_fcat[]
is_variant = g_variant
is_print = g_print_alv
TABLES
t_outtab = it_output[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " ALV_DISPLAY
*& Form user_command
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
DATA: gd_repid LIKE sy-repid, "Exists
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 NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data .
ENDIF.
rs_selfield-refresh = 'X'.
CASE r_ucomm.
WHEN 'PRINTLOI'.
PERFORM call_sf.
WHEN 'BACK'.
CALL SELECTION-SCREEN 1000.
WHEN 'CANCEL'.
CALL SELECTION-SCREEN 1000.
WHEN 'EXIT'.
CALL SELECTION-SCREEN 1000.
ENDCASE.
ENDFORM. "user_command
*& Form set_pf_status
* text
* -->RT_EXTAB text
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZALV' EXCLUDING rt_extab.
SET TITLEBAR 'ZALV'.
ENDFORM. "set_pf_status
*& Form CALL_SF
* text
* --> p1 text
* <-- p2 text
FORM call_sf .
REFRESH it_sf_po.
LOOP AT it_output INTO wa_output WHERE zzcheck = 'X'.
wa_sf_po-object_id = wa_output-zzpono.
APPEND wa_sf_po TO it_sf_po.
ENDLOOP.
w_formname = 'ZSR_EBP_DOCU_LETTEROFINTENT1'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_formname
IMPORTING
fm_name = w_sfname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
ls_composer-tdnewid = 'X'.
ls_control-no_dialog = 'X'.
LOOP AT it_sf_po INTO wa_sf_po.
CALL FUNCTION w_sfname
EXPORTING
control_parameters = ls_control
output_options = ls_composer
wa_object = wa_sf_po
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
ENDIF.
ENDLOOP.
ENDFORM. " CALL_SF
*& Form DISPLAY_EXPIRING_FONDOS
* text
* --> p1 text
* <-- p2 text
FORM display_expiring_fondos .
SET PF-STATUS 'ZLOI'.
SET TITLEBAR 'ZLOI'.
TYPES : BEGIN OF ty_output1,
guid TYPE bbp_guid,
object_id TYPE crmt_object_id_db,
description TYPE crmt_process_description,
posting_date TYPE crmt_posting_date,
zzfondo_dat TYPE zfondo_dat,
created_by TYPE crmt_created_by,
END OF ty_output1.
DATA : it_output1 TYPE TABLE OF ty_output1,
wa_output1 TYPE ty_output1,
w_lines,
w_count,
it_fondo TYPE TABLE OF zsr_fondo,
it_temp_fondo TYPE TABLE OF zsr_fondo,
wa_temp_fondo TYPE zsr_fondo,
wa_fondo TYPE zsr_fondo,
w_diff TYPE p,
wa_header1 TYPE bbp_pds_po_header_d.
CONSTANTS : c_otype(8) VALUE 'BUS2201'.
REFRESH : it_output1,it_temp_fondo,it_fondo.
SELECT b~zzfondo_dat
a~guid
a~object_id
a~description
a~posting_date
a~created_by
INTO CORRESPONDING FIELDS OF TABLE it_output1
FROM bbp_pdhsc AS b
LEFT OUTER JOIN crmd_orderadm_h AS a ON b~guid = a~guid
AND a~object_type = c_otype.
LOOP AT it_output1 INTO wa_output1.
CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
EXPORTING
date1 = sy-datum
date2 = wa_output1-zzfondo_dat
IMPORTING
datediff = w_diff
EXCEPTIONS
invalid_datetime = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
IF w_diff <= '7'.
wa_temp_fondo-zzpono = wa_output1-object_id.
APPEND wa_temp_fondo TO it_temp_fondo.
ENDIF.
ENDLOOP.
*select the final entries for PO whose FONDO is expiring
DESCRIBE TABLE it_temp_fondo LINES w_lines.
w_count = 1.
DO.
IF w_count LE w_lines.
READ TABLE it_temp_fondo INTO wa_temp_fondo INDEX w_count.
IF sy-subrc = 0.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_object_id = wa_temp_fondo-zzpono
IMPORTING
e_header = wa_header1.
wa_fondo-zzpono = wa_temp_fondo-zzpono.
wa_fondo-zzpodesc = wa_header1-description.
wa_fondo-zzpodate = wa_header1-posting_date.
wa_fondo-zzexpdate = wa_header1-zzfondo_dat.
wa_fondo-zzpoval = wa_header1-total_value.
wa_fondo-zzpocur = wa_header1-currency.
wa_fondo-zzpocreator = wa_header1-created_by.
CLEAR : wa_address.
REFRESH wa_return.
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = wa_header1-created_by
IMPORTING
address = wa_address
TABLES
return = wa_return.
CLEAR wa_fondo-zzpocreator.
CONCATENATE wa_address-firstname ' ' wa_address-lastname INTO wa_fondo-zzpocreator .
w_count = w_count + 1.
APPEND wa_fondo TO it_fondo.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'ZSR_FONDO'
i_grid_title = 'EXPIRING FONDOS'
TABLES
t_outtab = it_fondo[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " DISPLAY_EXPIRING_FONDOS
Now in my ALV grid o/p i can see the check box but if i select one row and then try to select another the first one gets deselected.
Can anybody tell me what is missing?Hi,
Try like changing this
insted of
g_layout-f2code = ' '.
use this
g_layout-f2code = 'DISP'. " Sets fcode for when double
and
g_layout-f2code = '&ETA'. " it will display POPUP screen
Best Regards
Ranga
Edited by: Ranga Swamy on Nov 1, 2008 11:07 PM
Edited by: Ranga Swamy on Nov 1, 2008 11:17 PM -
Check box in ALV grid gets unselected for new selection
Hi all,
This is my code :
TYPE-POOLS : slis.
Variable
DATA: g_repid LIKE sy-repid,
g_title TYPE lvc_title,
g_set_pf_stat TYPE slis_formname VALUE 'SET_PF_STATUS',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_layout TYPE slis_layout_alv,
g_print_alv TYPE slis_print_alv,
g_variant LIKE disvariant,
c_char_a(1) VALUE 'A',
c_char_x(1) VALUE 'X',
itab_alv_sort TYPE slis_t_sortinfo_alv,
itab_alv_fcat TYPE slis_t_fieldcat_alv,
fm_name type rs38l_fnam," Function Module Name
* l_sfctrlparams LIKE ssfctrlop, " Form Print Parameter
* l_sfoutopt LIKE ssfcompop,
pri_params LIKE pri_params,
c_x type c .
* Internal tables Begin with IT_ *
DATA : it_fcat TYPE SLIS_T_FIELDCAT_ALV, "---ALV
it_disp type table of ZLOI.
* Work Area for Internal tables Begin with WA_ *
data : wa_fcat TYPE slis_fieldcat_alv , "---ALV
wa_layout TYPE lvc_s_layo, "---ALV
wa_it_disp like line of it_disp.
* Objects *
DATA : cref TYPE REF TO cl_gui_custom_container, "---ALV
gref TYPE REF TO cl_gui_alv_grid. "---ALV
* Start-of-selection
Start-of-selection.
perform fetch_po_det.
perform build_fcat.
perform alv_display.
*& Form FETCH_PO_DET
* text
* --> p1 text
* <-- p2 text
FORM FETCH_PO_DET .
data : it_po type table of crmd_orderadm_h,
wa_po like line of it_po,
wa_header type BBP_PDS_PO_HEADER_D.
select guid
object_id
DESCRIPTION
POSTING_DATE
CREATED_BY
from crmd_orderadm_h
into corresponding fields of table it_po
where object_type = 'BUS2201'.
loop at it_po into wa_po.
move wa_po-object_id to wa_it_disp-ZZPONO.
move wa_po-DESCRIPTION to wa_it_disp-ZZPODESC.
move wa_po-posting_date to wa_it_disp-ZZPODATE.
move wa_po-created_by to wa_it_disp-ZZPOCREATOR.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
I_OBJECT_ID = wa_it_disp-zzpono
IMPORTING
E_HEADER = wa_header.
move wa_header-total_value to wa_it_disp-ZZPOVAL.
move wa_header-currency to wa_it_disp-ZZPOCUR.
append wa_it_disp to it_disp.
endloop.
* write : wa_it_disp-zzpono.
ENDFORM. " FETCH_PO_DET
*& Form BUILD_FCAT
* text
* --> p1 text
* <-- p2 text
FORM BUILD_FCAT .
g_repid = sy-repid.
g_title = 'LOI details'.
g_print_alv-no_print_listinfos = 'X'.
g_variant-report = sy-repid.
g_variant-variant = sy-title.
CLEAR g_layout.
g_layout-f2code = ' '.
wa_layout-zebra = 'X'.
g_layout-flexible_key = 'X'.
g_layout-colwidth_optimize = 'X'.
g_layout-detail_initial_lines = 'X'.
g_layout-box_fieldname = 'ZZCHECK'.
*g_layout-box_tabname = 'ITAB_REPORT'.
*Check box
wa_fcat-fieldname = 'ZZCHECK'.
wa_fcat-checkbox = 'X'.
wa_fcat-outputlen = '1'.
wa_fcat-col_pos = '1'.
wa_fcat-edit = '1'.
wa_fcat-seltext_m = 'No'.
append wa_fcat to it_fcat.
*Po no
clear wa_fcat.
wa_fcat-fieldname = 'ZZPONO' .
wa_fcat-tabname = 'IT_DISP'.
* wa_fcat-seltext = 'Purchase Order'.
wa_fcat-seltext_m = 'Purchase Order'.
*wa_fcat-seltext_s = 'Purchase Order.
wa_fcat-icon = 'X'.
wa_fcat-col_pos = '2'.
wa_fcat-outputlen = 10.
append wa_fcat to it_fcat.
*Desc
wa_fcat-fieldname = 'ZZPODESC' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Description'.
wa_fcat-seltext_m = 'Description'.
*wa_fcat-seltext_s = 'Description'.
wa_fcat-col_pos = '3'.
wa_fcat-outputlen = 10.
append wa_fcat to it_fcat.
*Postign date
wa_fcat-fieldname = 'ZZPODATE' .
wa_fcat-tabname = 'IT_DISP'.
wa_fcat-seltext_l = 'Posting Date'.
wa_fcat-seltext_m = 'Posting Date'.
*wa_fcat-seltext_s = 'Posting Date'.
wa_fcat-col_pos = '4'.
wa_fcat-outputlen = 8.
append wa_fcat to it_fcat.
*value
wa_fcat-fieldname = 'ZZPOVAL' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO value'.
wa_fcat-seltext_m = 'PO value'.
*wa_fcat-seltext_s = 'PO value'.
wa_fcat-col_pos = '5'.
wa_fcat-outputlen = 15.
append wa_fcat to it_fcat.
*Currency
wa_fcat-fieldname = 'ZZPOCUR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO Currency'.
wa_fcat-seltext_m = 'PO Currency'.
*wa_fcat-seltext_s = 'PO Currency'.
wa_fcat-col_pos = '6'.
wa_fcat-outputlen = 5.
append wa_fcat to it_fcat.
*Creator
wa_fcat-fieldname = 'ZZPOCREATOR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Buyer'.
wa_fcat-seltext_m = 'Buyer'.
*wa_fcat-seltext_s = 'Buyer'.
wa_fcat-col_pos = '7'.
wa_fcat-outputlen = 12.
append wa_fcat to it_fcat.
ENDFORM. " BUILD_FCAT
*& Form ALV_DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM ALV_DISPLAY .
sort it_disp by ZZPONO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = g_repid
I_CALLBACK_PF_STATUS_SET = g_set_pf_stat
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 = g_title
* I_GRID_SETTINGS =
IS_LAYOUT = g_layout
IT_FIELDCAT = it_fcat[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
IS_VARIANT = g_variant
* IT_EVENTS =
* IT_EVENT_EXIT =
IS_PRINT = g_print_alv
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = it_disp[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " ALV_DISPLAY
*& Form user_command
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
CASE R_UCOMM.
WHEN 'PRINT'.
READ TABLE IT_disp INTO WA_IT_DISP WITH KEY ZZCHECK = 'X'.
IF SY-SUBRC EQ 0.
loop at it_DISP INTO WA_IT_DISP.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TEXT_QUESTION = 'Print the LOI details?'
TEXT_BUTTON_1 = 'Yes'
TEXT_BUTTON_2 = 'No'.
* IMPORTING
* ANSWER = w_answer.
IF SY-SUBRC 0.
ENDIF.
* PERFORM CALL_SF.
endloop.
ENDIF.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
rs_selfield-refresh = 'X'.
ENDFORM. "user_command
*& Form set_pf_status
* text
* -->RT_EXTAB text
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.
SET TITLEBAR sy-tcode.
ENDFORM. "set_pf_status
Now in my ALV grid o/p i can see the check box but if i select one row and then try to slect another the first one gets deselected.
Can anybody tell me what is missing?Hi,
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 read the check box value in alv report
hi experts,
i m working on one alv report where i m using the check box for field selection in alv display.
but i don't know how to read the only selected fields.
wa_fieldcat-fieldname = 'BOX'.
wa_fieldcat-tabname = 'IT_HEADER'.
wa_fieldcat-seltext_m = 'Box'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'AUFNR'.
wa_fieldcat-tabname = 'IT_HEADER'.
wa_fieldcat-seltext_m = 'Sales Doc'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
it_fieldcat = i_fieldcat[]
i_save = 'A'
it_events = v_events
TABLES
t_outtab = it_header
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
when '&RELEAS'.
endcase
endform.
i gone through some already posted que for same problem i tried options like
loop at it_header.
endloop.
but i m getting box field empty.
is there i missed something? plz sugeest.. if u have any other solution plz post...Have this code in your user command fm:
* For capturing changed data
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = w_grid.
CALL METHOD w_grid->check_changed_data
IMPORTING
e_valid = w_valid.
IF w_valid = 'X'.
loop at itab where mark = 'X'.
endloop.
ENDIF.
Regards,
Ravi -
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 select the output list check boxes
Hi ABAP gurus,
I am developing the on report, it display the output list, in that output list first column is Check box,
here i created the 3 Pushbuttons on application tool bar, one pushbutton is SELECT ALL, 2nd one is DESELECT ALL , 3rd one is CREDIT NOT CREATE,
here when i click on the Select all button it will select all the check boxs and click on the credit not button it will create credit memos for all the customers, if i select the one or more than one check boxs, it will not working means (Credit note will not be created for that paricular customer)
plz tell me answer, if u know the any example programs related to this program plz send me.Hi,
refer this sample code.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'F2'.
PERFORM selection.
WHEN 'SELECTALL'.
PERFORM selectall.
WHEN 'DESELECTAL'.
PERFORM deselectall.
ENDCASE. " CASE SY-UCOMM
*& Form selection *
Selecting records of basic list and display flight information *
No parameters transferred *
FORM selection .
DO w_lines TIMES.
READ LINE w_lineno FIELD VALUE w_checkbox INTO w_checkbox
fs_spfli-carrid INTO fs_spfli-carrid
fs_spfli-connid INTO fs_spfli-connid
w_mark INTO w_mark.
IF sy-subrc EQ 0.
IF w_checkbox EQ 'X' AND w_mark NE '*'.
w_mark = '*'.
MODIFY CURRENT LINE FIELD VALUE w_mark
FIELD FORMAT w_checkbox INPUT OFF.
SELECT carrid " Airline Code
connid " Flight Connection Number
fldate " Flight date
seatsmax " Maximum capacity
seatsocc " Occupied seats
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE t_sflight
WHERE carrid EQ fs_spfli-carrid AND connid EQ fs_spfli-connid.
IF sy-subrc EQ 0.
LOOP AT t_sflight INTO fs_sflight.
WRITE :/2 fs_sflight-carrid,
10 fs_sflight-fldate,
25 fs_sflight-seatsmax,
45 fs_sflight-seatsocc.
ENDLOOP. " LOOP AT T_SFLIGHT INTO....
ULINE.
CLEAR t_sflight.
ELSE.
MESSAGE text-001 TYPE 'S'.
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF W_CHECKBOX EQ 'X' AND .....
ENDIF. " IF SY-SUBRC EQ 0
ADD 1 TO w_lineno.
CLEAR w_checkbox.
ENDDO. " DO W_LINES TIMES
w_lineno = 3.
ENDFORM. " Selection -
How to display check box in the search help restriction pop-up window
Hi Experts,
I have created one searc help with dialog value restrictions. Search help contains 4 fields.
Out of which one field has length one character.
As oon as user press on F4 on particular field, it will display pop-up window with restrictions and displayed 4 fields.
I would like to show that field ( one character length field) as check box in search help restrictions pop-up window.
Pls help me ,... How can we acheive this..
Thanks
RaghuUr Exact Requirement,
Types : begin of itab,
fields type c,
Check type c,(For Check Box)
end of itab.
data it_tab type standard table of itab.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_input-low.(If it is in select-options)
CLEAR v_input.
GET CURSOR FIELD s_input VALUE v_input.
CALL FUNCTION 'AIPC_CONVERT_TO_UPPERCASE'
EXPORTING
i_input = v_input
i_langu = sy-langu
IMPORTING
e_output = v_input.
CLEAR s_input-low.
IF v_input NE '' .
IF v_input NE '?'..
v_input1-sign = 'I'.
v_input1-option = 'CP'.
v_input1-low = v_input.
APPEND v_input1.
ENDIF.
ENDIF.
SELECT DISTINCT Field
FROM Table
INTO TABLE it_tab
WHERE field IN v_input.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Select Colors'
i_selection = 'X'
i_zebra = 'X'
i_screen_start_column = 5
i_screen_start_line = 5
i_screen_end_column = 30
i_screen_end_line = 12
i_checkbox_fieldname = 'CHECK'
i_tabname = 'IT_TAB'
i_scroll_to_sel_line = 'X'
it_fieldcat = it_fieldcat1
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND1'
IMPORTING
es_selfield = selfield
TABLES
t_outtab = it_tab
EXCEPTIONS
program_error = 1.
Cheers,
Naveen -
How to handle check box events in alv tree.
hi,
i am working in CL_GUI_COLUMN_TREE class.Also using Check box. Now i want to handle events for check box . I am new to ABAP Objects.
Pls expaline in detail or send code
thanks in advance,
senthil kumar.rHello Senthil
Have a look at the sample report
SAPCOLUMN_TREE_CONTROL_DEMO
. The crucial points are:
<b>(1) Register the required events at the control</b>
* define the events which will be passed to the backend
" checkbox change
event-eventid = CL_GUI_COLUMN_TREE=>EVENTID_checkbox_change.
event-appl_event = 'X'.
append event to events.
CALL METHOD G_TREE->SET_REGISTERED_EVENTS
EXPORTING
EVENTS = EVENTS
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
ILLEGAL_EVENT_COMBINATION = 3.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
<b>(2) Set the event handler</b>
assign event handlers in the application class to each desired event
SET HANDLER G_APPLICATION->HANDLE_CHECKBOX_CHANGE FOR g_tree.
<b>(3) Define and implement event handler method</b>
METHOD HANDLE_CHECKBOX_CHANGE.
" this method handles the checkbox_change event of the tree
" control instance
" show the key of the node and the name of the item
" of the clicked checkbox in a dynpro field
G_EVENT = 'CHECKBOX_CHANGE'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ITEM_NAME.
CLEAR G_HEADER_NAME.
ENDMETHOD.
Regards
Uwe -
How to insert check box fields in a htmlb: tableview
Hi,
Can anybody tell me how to insert check box fields in a htmlb: tableview in a sequence of rows in a table view. How to generate the sequence no for the checkbox inorder to know the row that is checked.
Thanks in advance,
Aruna.Here is the code which has the custom "Checkbox" in the tableview & Triggers the event. <b>You can identify the checkbox based on cell ID (p_cell_id)</b> in the method "IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START" & Based on the event name + Cell ID. Look at the code & let me know if you any issue.
<b>Layout:</b>
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content id = "content"
design = "design2002+design2003"
controlRendering = "SAP"
rtlAutoSwitch = "true"
forceEncode = "ENABLED" >
<htmlb:page title="Test " >
<htmlb:form>
<%
data TV_ITERATOR Type Ref To zcl_itr.
data iterator type ref to IF_HTMLB_TABLEVIEW_ITERATOR.
create object tv_iterator exporting appl_cons = application.
iterator = tv_iterator.
%>
<htmlb:tableView id = "fligts"
headerText = "Flight"
width = "100"
headerVisible = "true"
design = "alternating"
visibleRowCount = "10"
fillUpEmptyRows = "true"
showNoMatchText = "true"
filter = "server"
sort = "server"
onHeaderClick = "MyEventHeaderClick"
table = "<%= APPLICATION->itab %>"
iterator = "<%= ITERATOR %>" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
<b>Event Handling:</b>
DATA: EVENT_ID1 TYPE REF TO IF_HTMLB_DATA.
EVENT_ID1 = CL_HTMLB_MANAGER=>GET_EVENT_EX( REQUEST ).
CASE EVENT_ID1->EVENT_SERVER_NAME.
IF NOT event_id1 IS INITIAL.
if event_id1->server_event+0(9) = 'chkevent'.
SPLIT event_id1->server_event AT '-' INTO v_event v_dummy v_row v_col.
endif.
endif.
method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS.
CLEAR p_column_definitions.
CLEAR p_overwrites.
DATA: tv_column TYPE TABLEVIEWCONTROL.
tv_column-COLUMNNAME = 'FLDATE'.
tv_column-edit = 'X'.
tv_column-sort = 'X'.
tv_column-TITLE = 'Flight Date'.
tv_column-WIDTH = '100'.
APPEND tv_column TO p_column_definitions.
CLEAR tv_column.
tv_column-edit = 'X'.
tv_column-COLUMNNAME = 'CONNID'.
tv_column-TITLE = 'Conn.ID'.
tv_column-WIDTH = '70'.
tv_column-HORIZONTALALIGNMENT = 'center'.
APPEND tv_column TO p_column_definitions.
CLEAR tv_column.
tv_column-edit = 'X'.
tv_column-COLUMNNAME = 'CHECKBOX1'.
tv_column-TITLE = 'Check Box'.
tv_column-WIDTH = '30'.
tv_column-HORIZONTALALIGNMENT = 'center'.
APPEND tv_column TO p_column_definitions.
endmethod.
METHOD IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.
DATA: L_EVENT TYPE STRING.
CASE P_TABLEVIEW_ID.
WHEN 'fligts'.
CASE P_COLUMN_KEY.
WHEN 'CHECKBOX1'.
* CONCATENATE 'chk_event' '123' '2323' INTO L_EVENT SEPARATED BY '-' .
CONCATENATE 'chkevent' p_cell_id INTO l_event SEPARATED BY '-'.
P_REPLACEMENT_BEE = CL_HTMLB_CHECKBOX=>FACTORY( ID = P_CELL_ID
ONCLICK = L_EVENT CHECKED = 'false' ).
ENDCASE.
ENDCASE.
ENDMETHOD.
Hope this will solve your problem.
<b><i>* Reward each helpful answer.</i></b>
Raja T
Message was edited by:
Raja T -
How to add check box in the ALV list
dear Experts,
i have a requirement.
i want show the check boxes in my ALV list.
can u please give the solution.
thanksTYPE-POOLS: slis.
*---internal tables
DATA: BEGIN OF it_flight OCCURS 0,
SEL, " add a single character field in the final output table
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
END OF it_flight,
*--internal tables for alv
it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fcat LIKE LINE OF it_fieldcat,
layout TYPE slis_layout_alv,
it_sort type slis_t_sortinfo_alv,
wa_sort like line of it_sort.
DATA: BEGIN OF it_flight_sel OCCURS 0,
SEL,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
END OF it_flight_sel.
data: wa_flight like it_flight.
In the layout set give the name of the field
whose checkbox will be created ( SEL as it has 1 char only )
layout-box_fieldname = 'SEL'.
*---start-of-selection .
START-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_FLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
*----get data
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_flight
UP TO 20 ROWS.
wa_fcat-do_sum = 'X'.
MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
WHERE fieldname = 'SEATSOCC' .
wa_sort-fieldname = 'CARRID'.
wa_sort-group = 'UL'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
clear wa_sort.
wa_sort-fieldname = 'CONNID'.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
clear wa_sort.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
is_layout = layout
it_fieldcat = it_fieldcat
it_sort = it_sort
TABLES
t_outtab = it_flight
EXCEPTIONS
program_error = 1.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
WHEN '&IC1'. "'&DATA_SAVE'. "user presses SAVE
loop at it_flight into wa_flight.
if wa_flight-Sel EQ 'X'.
collecting records in table it_flight_sel to process further
append wa_flight to it_flight_sel.
clear wa_flight.
TYPE-POOLS: slis.
*---internal tables
DATA: BEGIN OF it_flight OCCURS 0,
SEL, " add a single character field in the final output table
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
END OF it_flight,
*--internal tables for alv
it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fcat LIKE LINE OF it_fieldcat,
layout TYPE slis_layout_alv,
it_sort type slis_t_sortinfo_alv,
wa_sort like line of it_sort.
DATA: BEGIN OF it_flight_sel OCCURS 0,
SEL,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
END OF it_flight_sel.
data: wa_flight like it_flight.
In the layout set give the name of the field
whose checkbox will be created ( SEL as it has 1 char only )
layout-box_fieldname = 'SEL'.
*---start-of-selection .
START-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_FLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
*----get data
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_flight
UP TO 20 ROWS.
wa_fcat-do_sum = 'X'.
MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
WHERE fieldname = 'SEATSOCC' .
wa_sort-fieldname = 'CARRID'.
wa_sort-group = 'UL'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
clear wa_sort.
wa_sort-fieldname = 'CONNID'.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
clear wa_sort.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
is_layout = layout
it_fieldcat = it_fieldcat
it_sort = it_sort
TABLES
t_outtab = it_flight
EXCEPTIONS
program_error = 1.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
WHEN '&IC1'. "'&DATA_SAVE'. "user presses SAVE
loop at it_flight into wa_flight.
if wa_flight-Sel EQ 'X'.
collecting records in table it_flight_sel to process further
append wa_flight to it_flight_sel.
clear wa_flight.
Please follow the code. -
Hello Sir,
I am Developing One Report In ALV, But I want One Column Of ALV Should Be In Checkboxes .How Can I set Check Box In Field Catalog.
Plz Help Me.hi,
Try like this.
*& Report ZTEST_ALV
REPORT ztest_alv.
TYPE-POOLS
TYPE-POOLS: slis. " Type pool for ALV
Tables
TABLES: vbak, vbap.
INTERNAL TABLES
DATA: BEGIN OF g_t_itab OCCURS 0,
sel TYPE c,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
vbtyp LIKE vbak-vbtyp,
vkorg LIKE vbak-vkorg,
vtweg LIKE vbak-vtweg,
spart LIKE vbak-spart,
netwr LIKE vbak-netwr,
kunnr LIKE vbak-kunnr,
END OF g_t_itab.
DATA: BEGIN OF g_t_item OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
arktx LIKE vbap-arktx,
END OF g_t_item.
Data fields used for ALV call - simple list
DATA : g_f_repid LIKE sy-repid.
DATA : g_t_fieldcat TYPE slis_t_fieldcat_alv.
DATA : g_r_fieldcat TYPE slis_fieldcat_alv.
DATA : g_t_events TYPE slis_t_event.
DATA : g_r_events TYPE slis_alv_event.
DATA : g_r_layout TYPE slis_layout_alv.
DATA : g_r_x_variant LIKE disvariant.
DATA : g_r_variant LIKE disvariant.
DATA : g_f_exit(1) TYPE c.
DATA : g_f_save(1) TYPE c.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
SELECTION-SCREEN END OF BLOCK b1.
START OF SELECTION
START-OF-SELECTION.
PERFORM get_data.
END OF SELECTION
END-OF-SELECTION.
PERFORM set_alv_parameters.
PERFORM display_list.
*& Form get_data
Get data from DB tables
FORM get_data.
CLEAR: g_t_itab.
REFRESH: g_t_itab.
SELECT vbeln erdat vbtyp vkorg vtweg spart netwr kunnr
FROM vbak
INTO CORRESPONDING FIELDS OF TABLE g_t_itab
WHERE
vbeln IN s_vbeln.
ENDFORM. " get_data
*& Form set_alv_parameters
Set alv parameters , layout, events, fieldcatlog
FORM set_alv_parameters.
PERFORM set_filedcatlog.
ENDFORM. " set_alv_parameters
*& Form display_list
text
FORM display_list.
g_f_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_f_repid
is_layout = g_r_layout
it_fieldcat = g_t_fieldcat[]
it_events = g_t_events[]
TABLES
t_outtab = g_t_itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " display_list
*& Form set_filedcatlog
text
FORM set_filedcatlog.
DATA: l_r_fieldcat TYPE slis_fieldcat_alv. " For column heading
CLEAR : g_t_fieldcat,
g_t_fieldcat[].
<b> l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'SEL'.
l_r_fieldcat-checkbox = 'X'.
l_r_fieldcat-outputlen = 2.
l_r_fieldcat-col_pos = 1.
l_r_fieldcat-edit = 'X'.
l_r_fieldcat-input = 'X'.
APPEND l_r_fieldcat TO g_t_fieldcat.
CLEAR l_r_fieldcat.</b>
Sales Order
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'VBELN'.
l_r_fieldcat-ref_tabname = 'VBAK'.
l_r_fieldcat-ref_fieldname = 'VBELN'.
l_r_fieldcat-col_pos = 2.
APPEND l_r_fieldcat TO g_t_fieldcat.
CLEAR l_r_fieldcat.
Creation date
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'ERDAT'.
l_r_fieldcat-ref_tabname = 'VBAK'.
l_r_fieldcat-ref_fieldname = 'ERDAT'.
l_r_fieldcat-col_pos = 3.
APPEND l_r_fieldcat TO g_t_fieldcat.
CLEAR l_r_fieldcat.
document category
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'VBTYP'.
l_r_fieldcat-ref_tabname = 'VBAK'.
l_r_fieldcat-ref_fieldname = 'VBTYP'.
l_r_fieldcat-col_pos = 4.
APPEND l_r_fieldcat TO g_t_fieldcat.
CLEAR l_r_fieldcat.
Sales organization
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'VKORG'.
l_r_fieldcat-ref_tabname = 'VBAK'.
l_r_fieldcat-ref_fieldname = 'VKORG'.
l_r_fieldcat-col_pos = 5.
APPEND l_r_fieldcat TO g_t_fieldcat.
CLEAR l_r_fieldcat.
Distribution channel
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'VTWEG'.
l_r_fieldcat-ref_tabname = 'VBAK'.
l_r_fieldcat-ref_fieldname = 'VTWEG'.
l_r_fieldcat-col_pos = 6.
APPEND l_r_fieldcat TO g_t_fieldcat.
CLEAR l_r_fieldcat.
Division
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'SPART'.
l_r_fieldcat-ref_tabname = 'VBAK'.
l_r_fieldcat-ref_fieldname = 'SPART'.
l_r_fieldcat-col_pos = 7.
APPEND l_r_fieldcat TO g_t_fieldcat.
CLEAR l_r_fieldcat.
Net Value
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'NETWR'.
l_r_fieldcat-ref_tabname = 'VBAK'.
l_r_fieldcat-ref_fieldname = 'NETWR'.
l_r_fieldcat-col_pos = 8.
l_r_fieldcat-do_sum = 'X'.
l_r_fieldcat-emphasize = 'C500'.
APPEND l_r_fieldcat TO g_t_fieldcat.
CLEAR l_r_fieldcat.
Distribution channel
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'KUNNR'.
l_r_fieldcat-ref_tabname = 'VBAK'.
l_r_fieldcat-ref_fieldname = 'KUNNR'.
l_r_fieldcat-col_pos = 9.
APPEND l_r_fieldcat TO g_t_fieldcat.
CLEAR l_r_fieldcat.
ENDFORM. " set_filedcatlog -
How to display check box in atable control
hi
here is my requirement
how can i display check box in table control and also when i check that check box it has to dispaly one pop up screen with the records of table control row
points will be rewarded
Thanks&Regards
Nagesh.ParuchuriHi,
See this code for how to display check box in atable control
*---- Table declaration.
TABLES: KNA1.
CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 200.
CONTROLS TC2 TYPE TABLEVIEW USING SCREEN 300.
*---- Data declaration.
DATA:OKCODE LIKE SY-UCOMM.
DATA:V_KNA1 LIKE KNA1.
*DATA:ERROR TYPE C.
*---- Internal Table declaration.
DATA:BEGIN OF IT_TAB OCCURS 0,
CHK,
VBELN TYPE VBELN_VA,
KUNNR TYPE KUNAG,
ERDAT TYPE ERDAT,
AUDAT TYPE AUDAT,
VBTYP TYPE VBTYP,
END OF IT_TAB.
DATA:BEGIN OF IT_TAB1 OCCURS 0,
VBELN TYPE VBELN_VA,
POSNR TYPE POSNR_VA,
MATNR TYPE MATNR,
MATWA TYPE MATWA,
PMATN TYPE PMATN,
END OF IT_TAB1.
*& Module USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0100 INPUT.
OKCODE = SY-UCOMM.
CASE OKCODE.
WHEN 'DISP' OR SPACE.
SELECT *
FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE IT_TAB
WHERE KUNNR = KNA1-KUNNR.
IF SY-SUBRC <> 0.
MESSAGE 'No sales document exists'(001) TYPE 'I'.
ENDIF.
LEAVE TO SCREEN 200.
CLEAR OKCODE.
*--- To leave Transaction
WHEN 'BACK' .
LEAVE PROGRAM.
CLEAR OKCODE.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module validate_kunnr INPUT
MODULE VALIDATE_KUNNR INPUT.
V_KNA1 = KNA1.
SELECT SINGLE *
FROM KNA1
WHERE KUNNR = KNA1-KUNNR.
*-----Process error condition
IF SY-SUBRC <> 0.
CLEAR KNA1.
KNA1-KUNNR = V_KNA1-KUNNR.
CASE OKCODE..
WHEN 'BACK' OR 'EXIT' .
LEAVE PROGRAM.
ENDCASE.
MESSAGE 'Customer Does Not Exist'(002) TYPE 'I'.
LEAVE TO SCREEN 100.
ENDIF.
ENDMODULE. " validate_kunnr INPUT
*& Module STATUS_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'PF'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0200 INPUT
MODULE USER_COMMAND_0200 INPUT.
CASE OKCODE.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
LEAVE TO SCREEN 100.
CLEAR OKCODE.
CLEAR IT_TAB1.
WHEN 'DISP' .
CLEAR OKCODE.
READ TABLE IT_TAB WITH KEY CHK = 'X'.
IF SY-SUBRC = 0.
SELECT VBELN POSNR MATNR MATWA PMATN
FROM VBAP
INTO TABLE IT_TAB1
WHERE VBELN = IT_TAB-VBELN.
IF SY-SUBRC = 0.
SORT IT_TAB.
DESCRIBE TABLE IT_TAB LINES TC1-LINES.
LEAVE TO SCREEN 300.
ELSE.
MESSAGE E016(YBHV).
ENDIF.
ELSE.
MESSAGE 'Please select one record' TYPE 'I'.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Module STATUS_0200 OUTPUT
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'PF3'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_C.OMMAND_0300 INPUT
text
MODULE USER_COMMAND_0300 INPUT.
SET PF-STATUS 'PF3'.
CASE OKCODE.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
CLEAR OKCODE.
LEAVE TO SCREEN 200.
ENDCASE.
ENDMODULE. " USER_COMMAND_0300 INPUT
*& Module modify INPUT
MODULE MODIFY INPUT.
MODIFY IT_TAB INDEX TC1-CURRENT_LINE.
ENDMODULE. " modify INPUT
*& Module okcode OUTPUT
text
MODULE OKCODE OUTPUT.
CLEAR OKCODE.
ENDMODULE. " okcode OUTPUT
Reward Pointsa If usefull
Regards
Fareedas -
How to show check box in ALV grid??
Hi All,
I am using an option edit in the feild catalogue which allows me to change the values in a few columns in the ALV list.
What I want is to be able to show a check box in a few columns which user can check and use the value X in the program for the later processing....
Can somebody tell me how to show a check box in the ALV screen in the changeable format??
Win full point by answering this typical question..
Thanks - Chandanhi go through the fallowing 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.
Maybe you are looking for
-
New Airport Time Capsule Dropping Wifi/Internet with 7.7.1
Last week I bought a new Airport 2TB Time Capsule and had everything up and running within minutes. However, less than 24 hours later, the wifi signal started dropping devices all around the house. It started with the AppleTV, and eventually dropped
-
Formatting system date in list format
Dear all, in building a list format I need to format the system date, coming from the '@{currentDateODBC}{}' function. It comes as YYYY-MM-DD, while I need DD/MM/YYYY. Anybody knows how to do it? thank you in advance Arnaldo
-
Videos not appearing in TV Shows in iPod...
When I add a video to iTunes and set it so it goes in the TV Shows section all works well. However, when i drag it onto my iPod, it will not appear in TV Shows, infact, the TV Shows dosen't even say there's no videos there, but it just won't let me i
-
Solution (or possible) to Undetected Ipods!
Important note: The author of this message doesn't have english as its natal languaje, so there may be some errors especially on verb conjugations. Continue reading: I had the same problems with my brother's new incredible Ipod Video. He almost not k
-
I am having trouble getting on to facetime. I sign on using the correct apple id and passsword...It then verify and then goes back to sign in again ...pls help. I used facetime a week agao and it worked great