Reading checkbox entries in classical report
Hi, I have a non-alv report. The report writes out the contents of an itab. The last field in the itab is checkbox field. The user can check the fields as expected. However how can I determine which ones were selected?
I have tried using at line-selection and at user-command. However as the fields are part of a header line I don't see how it is possible.
write:/001 wa_deleted_materials-matnr,
020 wa_deleted_materials-maktx,
062 wa_deleted_materials-mtart,
070 wa_deleted_materials-matkl,
080 wa_deleted_materials-werks,
090 wa_deleted_materials-inv_flag,
095 wa_deleted_materials-mass_change as checkbox.
I don't want to go to secondary list. I just want to check the desired fields and then when I trigger an event I want the selected fields moved to a separate itab. Any ideas?
Thanks in advance,
Kevin
Yes, it's possible - you have to read the list back in to determine which checkboxes are selected. Do F1 on READ (a list).
Essentially:
READ LINE 1 FIELD VALUE wa_deleted_materials-mass_change INTO f1.
Rob
Message was edited by:
Rob Burbank
Similar Messages
-
How to Get checkbox value when List value changed in classic report
hi ,
i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list
take value of checkbox item and show it in message .
SQL for report
SELECT
'<INPUT TYPE="checkbox" NAME="f01" VALUE="'
||SEQ
||'">' SEQ,
ID,
DEPT_NO,
EMP_NAME} i change the column attributes of Dept_NO to Display as Select list of department name (named lov).
now i want when user change name of department the value of SEQ SHOW IN ALERT MESSAGE
i create JavaScript on the page
function test(pThis) {
var f01_value = $('select[name="f01"]').value;
alert('#SEQ : '+ f01_value);
</script>
I call this javascript function when list change but the value undefined..
My Question :
How can get this value Or any value of item in reports
regards
AhmedHi Ahmed,
>
i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list
take value of checkbox item and show it in message .
SQL for report
SELECT
'<INPUT TYPE="checkbox" NAME="f01" VALUE="'
||SEQ
||'">' SEQ,
ID,
DEPT_NO,
EMP_NAME} i change the column attributes of Dept_NO to Display as Select list of department name (named lov).
>
You should not create checkboxes like this. Either use the APEX_ITEM.CHECKBOX2 API or change the Column Type to Simple Checkbox.
>
now i want when user change name of department the value of SEQ SHOW IN ALERT MESSAGE
i create JavaScript on the page
function test(pThis) {
var f01_value = $('select[name="f01"]').value;
alert('#SEQ : '+ f01_value);
</script>
>
name="f01" returns an array, what you need is single element value.
Try
<script type="text/javascript>
function test(pThis) {
var f01_value = $v(pThis);
alert('#SEQ : '+ f01_value);
</script>
{code}
{quote}
I call this javascript function when list change but the value undefined..
My Question :
How can get this value Or any value of item in reports
{quote}
Depends in how you are invoking/triggering the change event. Are you using DA or have you written an "onchange" event on the element?
Cheers, -
Reading check boxi n a multiline classical report...
hi,
in my report, i have multiline data displayed...like for e.g.
first line displays shipment data, second line is a continuation of shipment data. third line is a header line to show deliveries under that shipment, fourth line shows the deliveries , one per line and then next shipment and so on.
now the first line of every shipment has a checkbox displayed.
when the user finally chooses to print this report, i need to read only those shipments that are selecte by user and process only them.
this is a simple classical report. please tell me how to write the code to capture the checkbox selection.
thksPlease don't duplicate the Post: handling check box in a report...
Logic for Reading Checkbox values will remain same as per my reply in your previous post.
The only thing you have to make sure is, don't write anything under the Checkbox field... Generally, in this type of requirement you should write your Checkbox in 1st or 2nd place and than start all your data from 5th place onwards.
Regards,
Naimesh Patel -
In classical report list output checkbox is value is not changed
Hi Abapers,
I am developing one classical report program, out put list hast one check box.
I need to read wheather checkbox is checked or not dynamically .
but the check box value is not changed if I check or uncheck How can I
solve this problem.
Regards.
Shashikumar.GHi Abapers,
I codded as.
DATA: CHKBOX TYPE C.
WRITE: CHKBOX AS CHECKBOX INPUT ON.
it will be displayd on output list if click on it It will be ticked or unticked it is fine.
but the value of chkbox is not changed.
but I need to change the value of chkbox regarding to clicking on it(check, uncheck).
Regards,
Shashikumar.G -
I have question about checkbox in classic report.
I need to choose only one checkbox in every row, hot to ensure that only one checkbox can be checked at same time?
Checkboxes are defined in SQL query as:
apex_item.checkbox(1,msisdn,'UNCHECKED') as clear,
apex_item.checkbox(2,msisdn,'UNCHECKED') as to_analysis,
apex_item.checkbox(3,msisdn,'UNCHECKED') as to_barring
here is the picture:
http://www.deviantpics.com/images/mNgGR.jpg
Tnx!amend your api calls to add onclick event to every checkbox column
apex_item.checkbox(1,msisdn,'UNCHECKED onclick="chkckbox(1,this);"' ) as clear,
apex_item.checkbox(2,msisdn,'UNCHECKED onclick="chkckbox(2,this);"') as to_analysis,
apex_item.checkbox(3,msisdn,'UNCHECKED onclick="chkckbox(3,this);"') as to_barringCreate a javascript function in your page header > Javascript
function chkckbox(pId, pThis) {
//get current row index
var currIndex = $('input[name="f0'+pId+'"]').index(pThis);
if (pThis.checked) {
//simply uncheck other check boxes
if (pId == 1) {
$('select[name="f02"]')[currIndex].checked = false;
$('select[name="f03"]')[currIndex].checked = false;
} else if (pId == 2) {
$('select[name="f01"]')[currIndex].checked = false;
$('select[name="f03"]')[currIndex].checked = false;
} else if (pId == 3) {
$('select[name="f02"]')[currIndex].checked = false;
$('select[name="f03"]')[currIndex].checked = false;
}Please note that I have not tested this code but it should work, if you have any problem just try debugging using console.log -
Adding the Checkbox for each row in classic report
Hello,
I have created classic report with checkboxes in each row and added the On-Submit process, BUTTON CONDITIONAL, to determine the behavior of the checkboxes. The PL/SQL process is suppose to delete the selected row from database.
I am getting the Success message, but When I check the database, the row still persist in the database.
PLSQL CODE:
FOR i IN 1..apex_application.g_f01.count LOOP
DELETE
FROM
registry
WHERE
reg_id = apex_application.g_f01(i);END LOOP;
ORACLE APEX: 4.2
Thank youHi ApexNewLearner,
Try this
DECLARE
j number;
BEGIN
FOR i IN 1..apex_application.g_f01.count LOOP
j := apex_application.g_f01(i);
DELETE FROM registry
WHERE reg_id = apex_application.g_f01(j);
END LOOP;
END;
or better try to replicate your issue on apex.oracle.com , that is easy for users to investigate the issue and give you appropriate solution.
Hope this helps you,
Regards,
Jitendra -
How to put checkbox into classical report header row?
Hi,
I have a classical report that has a check item as a first column. I would like to put a check box item into the header row too, When checked it is supposed to set the check box item in all report rows. Something like in APEX Shared components / Links / Grid Edit.
Is this possible to do? TIA.
TamasHi,
See e.g. this post
Re: Tabular form check all checkbox header
Regards,
Jari -
Classical Report on clicking button on ALV Report
I have a requirement where I have to display a classical report based on the user-click on a "custom button" on my ALV. I am unable to display the classical report. Please help with code example..
Hi,
See the example.Change the code according to your requirement.
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
endform.
FORM USER_COMMAND *
--> R_UCOMM *
--> RS_SELFIELD *
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.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
Pls. reward if useful... -
Getting selected row values of a classic report
Hi Guys,
i'm using Apex 4.1,
I have a classic report on my apex page. First column of this report is check box for row selection. and its binded to primary key of a table. i know that i can get the selected row's primary key (Check box value) using APPLICATION_ITEM.G_FO1() function. What i need is how can i get the other cell values of the selected row ?
Appreciate if someone can help on this,
Thanks.Apex-Ape wrote:
i'm using Apex 4.1,
I have a classic report on my apex page. First column of this report is check box for row selection. and its binded to primary key of a table. i know that i can get the selected row's primary key (Check box value) using APPLICATION_ITEM.G_FO1() function. What i need is how can i get the other cell values of the selected row ?If you really have a report with just one checkbox column and the rest of the data standard read-only report columns then it's not clear exactly what the requirement is. What do you want to do with them when you get them?
I can think of 2 possible approaches:
<li>Stick with the current report. On page submit you get an array of zero or more PKs. Create a collection with a row containing each PK. Whatever it is that you want to do next can then use a query that is a clone of the original report query plus a join to the PK values in the collection.
<li>Recreate the report with shadow <tt>apex_item.hidden</tt> columns in the query for each value. In the report column attributes, do not display the <tt>apex_item.hidden</tt> columns, but include them with each displayed column (or stuff them all into one column for convenience) using HTML Expressions. The values will then be available in <tt>apex_application.g_fxx</tt> arrays like the row selector checkbox.
I prefer the first one, but really it depends on what the next step is...
(If it's actually a tabular form then the values will be in other <tt>apex_application.g_fxx</tt> arrays.) -
Apex 4.0.1 classic report export
Hello once again all you Application Express experts.
I am having some difficulty getting an apex classic report to export the results of the report grid.
This is a classic report being run, not interactive.
It is also as an SQL Query (PL/SQL function body returning sql query) for the report identification type.
The function body is of decent size, maybe 200 lines at most, but i have narrowed it down a couple of problematic lines.
The report runs perfectly when I take out the follow line from the function...
v_return := v_return || 'AND instr('':'' || ''' || :p3_status || ''' || '':'','':'' || xel.employment_status || '':'') > 0 ';
So :p3_status is a checkbox item on the page, with three options: Active, Terminated, Retired.
In the repeatable failure scenario :p3_status = 'Active'.
One of the interesting parts is the report grid always returns the right results to the screen, it is just the report export that fails.
It never errors, it just returns a no data response to the file being exported.
This is Application Express v 4.0.1 running on Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit.
Any thoughts or any troubleshooting hints anyone can provide?
Thanks,
HaydenHayden,
Why do u need to append the item value in the PLSQL function body when apex will take of that(using its bind value).
Your predicate is actually a static one since only the item value changes (and that can be handled by its bind value). So avoid concatenating it in the function body to build the clause(which has the additional problem of passing in the item value to the function)
Change it to
v_return := v_return || q'!AND INSTR(':'||:p3_status||':',xel.employment_status) > 0!';
Notice that the :p3_status item evaluation happens only in the apex page
Also making use of the q function to escape quotes, it makes life much more easier in these cases. -
Enter command in Classical Report
Hi ,
I have a classical report with one of the fields editable , when the user modifed one of the rows and presses enter i want to do some processing , how can this be implemeted. i.e. how can i handle ENTER command in a classical report.
Regards,
ArunHi Arun,
You have to set your own GUI staus and then set the function code for enter key in Function key of the GUI STATUS .After that write the code in At user-command event to handle the user-input in the list.
The following code change the color of the list line in which user has entered the telephone no for vendor.
START-OF-SELECTION.
SET PF-STATUS 'GUI_LIST1'.
SELECT * FROM lfa1 INTO TABLE it_lfa1 WHERE lifnr IN s_lifnr.
FORMAT COLOR 2 ON.
LOOP AT it_lfa1 INTO x_lfa1.
val = sy-tabix MOD 2.
IF val = 0.
FORMAT INTENSIFIED ON.
ELSE.
FORMAT INTENSIFIED OFF.
ENDIF.
WRITE :/2 x_lfa1-sel AS CHECKBOX,6 x_lfa1-lifnr,17 x_lfa1-name1,
46 x_lfa1-telf1 INPUT.
HIDE: x_lfa1-sel,x_lfa1-lifnr.
ENDLOOP.
AT USER-COMMAND.
CASE sy-ucomm .
WHEN 'ENTER'.
CLEAR cnt.
DO.
READ LINE sy-index FIELD VALUE x_lfa1-sel x_lfa1-lifnr x_lfa1-telf1.
IF sy-subrc = 0 .
MODIFY LINE sy-index FIELD VALUE x_lfa1-sel LINE FORMAT COLOR 4 INTENSIFIED ON.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDCASE. -
Formatting problem when downloading classical report output to excel sheet.
Dear Experts,
My classical report o/p looks like:
SI Name ID
1 xyz 11
2 abc 22
3 eet 33
4 jnc 44
When I download the same to a excel sheet from List->Save->file->Spreadsheet and save it.
The formatting looks like this:
SI Name ID
1 xyz 11
2 abc 22
3 eet 33
4 inc 44
That is the heading and column entries are in different columns.
There is no GUI_Download used.
Kindly help what may be the issue.Hi,
In the report output the formatting looks fine. It is exactly below the heading. But only when I save it to excel, this alignment issue is coming. Even the columns after this column are are properly aligned and there is no issue at all. Only this column in the middle has issue. -
Hi Experts,
I have written a classical report with write statements and when i am downloading in excel the format is mismatching and now i want to convert into PDF format.
How to convert into PDF format from Classical report ?
YusufHi yusuf,
please find the below report,,
please make two include programs before executing it,
there codes are pasted below,
INCLUDE zimpr_data_declaration.
INCLUDE zimpr_performs_wrap.
REPORT zimpr_word_wrap NO STANDARD PAGE HEADING LINE-SIZE 115..
INCLUDE for DATA DECLARATION *
INCLUDE zimpr_data_declaration.
INCLUDE for all performs. *
INCLUDE zimpr_performs_wrap.
TOP-OF-PAGE--
TOP-OF-PAGE.
PERFORM f_top_page. "TOP OF THE REPORT PAGE,I.E. HEADER.
START-OF-SELECTION.
SET PF-STATUS 'SEL_SCREEN'. "PF-STATUS OF THE SELECTION SCREEN.
PERFORM f_data_retrieval. "PERFORM FOR ALL SELECT STATEMENTS.
PERFORM f_report_display. "REPORT DISPLAY,WRITE STATEMENTS.
--Define the actions to be performed for pf-status-----
AT USER-COMMAND.
wf_ok_code = sy-ucomm.
wf_save_ok = wf_ok_code.
CLEAR wf_ok_code.
CASE wf_save_ok.
WHEN 'PDF'. "WHEN PDF ICON IS CLICKED,REPORT WILL CONVERT INTO PDF.
loc_repid = sy-repid. "PROGRAM NAME
--THIS FM SETS THE PARAMETERS FOR LAYOUT OF PDF OUTPUT--
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
layout = loc_paart "LANDSCAPE LAYOUT
line_size = loc_linsz "CHARACTER WIDTH OF REPORT
no_dialog = 'X'
user = sy-uname "USERNAME
IMPORTING
out_parameters = loc_print_parms "OUTPUT PARAMETERS WILL BE COLLECTED HERE.
valid = loc_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
--FOR GENERATING THE SPOOL NUMBER--
NEW-PAGE PRINT ON NO DIALOG PARAMETERS loc_print_parms. " This allocates the spool no
"to the screen without the dialog screen.
PERFORM f_top_page.
PERFORM f_report_display.
NEW-PAGE PRINT OFF. "This marks the end of the screen for which the spool no was generated.
wf_id = sy-spono. " This assign the spool no of the screen to the variable.
--PERFORM FOR GETTING THE PDF OUTPUT--
PERFORM f_pdf_display.
--PERFORM FOR DOWLOADING FILE TO A LOCAL DISK--
PERFORM f_download_local.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
include data declaration----
*& Include ZIMPR_DATA_DECLARATION
TYPE-POOLS : shlp.
DATA : wf_ordert TYPE aufk-auart. "ORDER TYPE
DATA : wf_order TYPE aufk-aufnr. "ORDER NUMBER
DATA : wf_bdate TYPE afko-gstrp. "BASIC START DATE
DATA : wf_status(4) TYPE c ."rihea-i_astatin. "STATUS
DATA : wf_objnr TYPE jest-objnr VALUE 'OR%'. "Object number
DATA : wf_aufnr TYPE aufk-aufnr.
DATA : wf_name TYPE thead-tdname. "NAME TO PASS IN FM READ_TEXT
DATA : wf_date1(12) TYPE c. "DATE
DATA : wf_i1(3) TYPE n,wc_i1(3) TYPE n VALUE '1'. "COUNTERS FOR REPORT DISPLAY
DATA : wf_i2(3) TYPE n,wc_i2(3) TYPE n VALUE '1'.
DATA : wf_kopf TYPE tdid VALUE 'KOPF',wf_aufk TYPE tdobject VALUE 'AUFK'.
DATA : wf_save_ok TYPE sy-ucomm ,wf_ok_code TYPE sy-ucomm.
DATA: wf_id TYPE tsp01-rqident , " For storing Spool request number
wf_bytes TYPE i . " For storing the bytes of data to be converted to PDF.
DATA : wf_langu(2) TYPE c VALUE 'EN'.
DATA: wf_pripar TYPE pri_params, " Structure for Passing Print Parameters
wf_rcpar TYPE arc_params. " ImageLink structure
DATA : wf_statu TYPE dfies-fieldname VALUE 'STATUS',
wf_field TYPE help_info-dynprofld VALUE 'S_STATUS'.
&--SELECTION SCREEN--
SELECTION-SCREEN BEGIN OF BLOCK b_1 WITH FRAME TITLE text-000.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_ordert FOR wf_ordert . "ORDER TYPE
SELECT-OPTIONS: s_order FOR wf_order OBLIGATORY. "ORDER NUMBER
SELECT-OPTIONS: s_bdate FOR wf_bdate. "BASIC START DATE
SELECT-OPTIONS: s_status FOR wf_status matchcode object zei_sys . "SYSTEM STATUS
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK b_1.
*--INTERNAL TABLES--
TYPES : BEGIN OF ty_aufk,
aufnr TYPE aufk-aufnr, "OREDR NUMBER
auart TYPE aufk-auart, "ORDER TYPE
objnr TYPE aufk-objnr, "OBJECT NUMBER
ktext type aufk-ktext, "SHORT TEXT
gstrp TYPE afko-gstrp, "BASIC START DATE
END OF ty_aufk.
TYPES : BEGIN OF ty_tj02t,
objnr TYPE aufk-objnr, "OBJECT NUMBER
txt04 TYPE tj02t-txt04, "STATUS
istat TYPE tj02t-istat, "Object status
spras TYPE tj02t-spras, "LANGUAGE KEY
END OF ty_tj02t.
TYPES : BEGIN OF ty_temp,
objnr TYPE aufk-objnr,
status(300) TYPE c,
END OF ty_temp.
TYPES : BEGIN OF ty_wrap,
line(54) TYPE c, "LONG TEXT
END OF ty_wrap.
TYPES : BEGIN OF ty_wrap2,
line(25) TYPE c, "STATUS
END OF ty_wrap2.
TYPES : BEGIN OF ty_f4,
txt04 TYPE tj02t-txt04,
txt30 TYPE tj02t-txt30,
END OF ty_f4.
types : begin of ty_sta,
istat type tj02t-istat,
objnr type jest-objnr,
end of ty_sta.
data : int_sta type table of ty_sta with header line.
DATA : int_f4 TYPE TABLE OF ty_f4 WITH HEADER LINE.
DATA: int_pdf TYPE TABLE OF tline WITH HEADER LINE. "TABLE FOR PDF CONVERSION
DATA: int_wrap TYPE TABLE OF ty_wrap WITH HEADER LINE. "TABLE FOR LONGTEXT
DATA: int_wrap2 TYPE TABLE OF ty_wrap2 WITH HEADER LINE. "TABLE FOR STATUS
DATA: int_temp TYPE TABLE OF ty_temp WITH HEADER LINE. "Table for concatenation of system status.
DATA: int_aufk TYPE TABLE OF ty_aufk WITH HEADER LINE.
DATA: int_tj02t TYPE TABLE OF ty_tj02t WITH HEADER LINE.
DATA: int_tline TYPE STANDARD TABLE OF tline WITH HEADER LINE. "TABLE FOR READ_TEXT.
DATA : int_fld TYPE TABLE OF dfies ,wa_fld LIKE LINE OF int_fld. " Field Type for FM for F4 help
DATA :int_return TYPE TABLE OF ddshretval WITH HEADER LINE .
DATA:
loc_print_parms LIKE pri_params, "PRINT PARAMETERS
loc_valid(1) TYPE c,
loc_file type SDOK_CHTRD,
loc_bytecount TYPE i, "NUMBER OF BYTES TRANSFERRED
loc_length TYPE i, "LINE-LENGTH
loc_rqident LIKE tsp01-rqident, "SPOOL NUMBER
loc_rq2name(12) TYPE c.
DATA: loc_filename LIKE rlgrap-filename. "FILENAME
DATA:loc_repid LIKE sy-repid, " Report to execute
loc_linsz LIKE sy-linsz VALUE 115, " Line size
loc_paart LIKE sy-paart VALUE 'X_65_132'. " Paper Format
Include ZIMPR_PERFORMS_WRAP----
*& Include ZIMPR_PERFORMS_WRAP
*& Form f_top_page
top-of the page
--> p1 text
<-- p2 text
FORM f_top_page .
*--HEADER--
FORMAT COLOR 1 .
WRITE : text-010.
FORMAT COLOR 1 OFF.
WRITE : / text-011,sy-datum NO-GAP.
WRITE : / text-012,sy-uzeit NO-GAP,90 text-013,101 sy-uname.
ULINE .
FORMAT COLOR 1 INTENSIFIED OFF .
WRITE : 1 sy-vline, "HEADINGS
2 text-014 NO-GAP,
7 sy-vline,
8 text-015 NO-GAP,
20 sy-vline,
21 text-016 NO-GAP,
76 sy-vline,
77 text-017 NO-GAP,
88 sy-vline,
89 text-018 NO-GAP,
115 sy-vline.
WRITE : /1 sy-vline,
2 text-019 NO-GAP,7 sy-vline,
20 sy-vline,76 sy-vline,77 text-020 NO-GAP,88 sy-vline,115 sy-vline.
ULINE.
FORMAT COLOR 1 OFF.
ENDFORM. " f_top_page
*& Form f_data_retrieval
select statements
--> p1 text
<-- p2 text
FORM f_data_retrieval .
SELECTING ORDER TYPE,ORDER NO.,OBJECT NO. AND BASIC START DATE
SELECT p~aufnr
p~auart
p~objnr
p~ktext
r~gstrp
FROM ( aufk AS p INNER JOIN afko AS r ON raufnr = paufnr )
INTO TABLE int_aufk
WHERE p~aufnr IN s_order AND
p~auart IN s_ordert AND
r~gstrp IN s_bdate AND
p~objnr LIKE wf_objnr.
IF sy-subrc <> 0.
MESSAGE s101(zipm). "no values found for selection criteria.
STOP.
ENDIF.
SORT int_aufk BY aufnr.
DELETE ADJACENT DUPLICATES FROM int_aufk.
SELECT q~istat
p~objnr
FROM ( jest AS p INNER JOIN tj02t AS q ON pstat = qistat )
INTO TABLE int_sta
FOR ALL ENTRIES IN int_aufk
WHERE p~objnr = int_aufk-objnr
AND q~txt04 IN s_status and
q~spras = wf_langu and
p~inact = ''.
IF sy-subrc <> 0.
MESSAGE s101(zipm). "no values found for selection criteria.
STOP.
ENDIF.
SORT int_sta BY objnr.
DELETE ADJACENT DUPLICATES FROM int_sta.
*--SELECTING OBJECT NO.,STATUS AND LANGUAGE--
IF int_sta[] IS NOT INITIAL.
SELECT p~objnr
q~txt04
q~istat
q~spras
FROM ( jest AS p INNER JOIN tj02t AS q ON pstat = qistat )
INTO TABLE int_tj02t
FOR ALL ENTRIES IN int_sta
WHERE p~inact = '' AND
p~objnr = int_sta-objnr AND
q~spras = wf_langu AND
q~txt04 IN s_status AND
p~objnr LIKE wf_objnr.
IF sy-subrc <> 0.
MESSAGE s101(zipm). "no values found for selection criteria.
STOP.
ENDIF.
ENDIF.
ENDFORM. " f_data_retrieval
*& Form f_report_display
report display
--> p1 text
<-- p2 text
FORM f_report_display .
LOOP AT int_tj02t. "concatenating the status into a internal table
AT NEW objnr.
CLEAR int_temp-status.
ENDAT.
CONCATENATE int_temp-status int_tj02t-txt04 INTO int_temp-status SEPARATED BY space.
AT END OF objnr.
int_temp-objnr = int_tj02t-objnr. "key field.
APPEND int_temp.
CLEAR int_temp.
ENDAT.
CLEAR int_tj02t.
ENDLOOP.
LOOP AT int_aufk.
CONCATENATE sy-mandt int_aufk-aufnr INTO wf_name . "concatenating client number and order number
*--THIS FM CAPTURES THE LONG TEXT AND STORES IT IN INTERNAL TABLE--
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = wf_kopf "TEXT ID
language = sy-langu "LANGUAGE
name = wf_name "TEXT NAME
object = wf_aufk "TEXT OBJECT
TABLES
lines = int_tline "LINES OF LONG TEXT.
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
int_tline-tdline = int_aufk-ktext.
APPEND int_tline.
CLEAR :int_tline.
ENDIF.
LOOP AT int_tline.
*--THIS FM WRAPS THE LONG TEXT INTO 54 CHARACTERS EACH--
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = int_tline-tdline "LONG TEXT LINE
outputlen = 54 "OUTPUT LENGTH
TABLES
out_lines = int_wrap "INTERNAL TABLE
EXCEPTIONS
outputlen_too_large = 1
OTHERS = 2.
IF sy-subrc <> 0.
CLEAR :int_tline.
ENDIF.
ENDLOOP.
*-- THIS FM WRAPS THE STATUS INTO 25 CHARACTERS EACH--
READ TABLE int_temp WITH KEY objnr = int_aufk-objnr.
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = int_temp-status
outputlen = 25
TABLES
out_lines = int_wrap2
EXCEPTIONS
outputlen_too_large = 1
OTHERS = 2.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
IF NOT int_wrap2[] IS INITIAL.
ULINE AT (115).
ENDIF.
DESCRIBE TABLE int_wrap LINES wf_i2. "COUNTING THE NO. OF LINES FOR TABLE INT_WRAP
DESCRIBE TABLE int_wrap2 LINES wf_i1. "COUNTING THE NO. OF LINES FOR TABLE INT_WRAP2
WHILE ( wc_i1 LE wf_i1 OR wc_i2 LE wf_i2 ).
IF ( wc_i2 LE wf_i2 ).
READ TABLE int_wrap INDEX wc_i2 . "READING THE INTERNAL TABLE INT_WRAP WITH INDEX
wc_i2 = wc_i2 + 1.
ENDIF.
IF ( wc_i1 LE wf_i1 ).
READ TABLE int_wrap2 INDEX wc_i1 . "READING THE INTERNAL TABLE INT_WRAP2 WITH INDEX
wc_i1 = wc_i1 + 1.
ENDIF.
*--THIS FM CONVERTS THE DATE FROM SYSTEM FORMAT TO OUTPUT FORMAT--
CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
input = int_aufk-gstrp
IMPORTING
output = wf_date1.
IF NOT int_wrap2[] IS INITIAL .
*--REPORT DISPLAY--
WRITE : /1 sy-vline, 2 int_aufk-auart COLOR = 4 INTENSIFIED OFF NO-GAP ,
7 sy-vline ,8 int_aufk-aufnr COLOR = 4 INTENSIFIED OFF NO-GAP,
20 sy-vline,21 int_wrap-line,
76 sy-vline ,77 wf_date1 ,
88 sy-vline ,89 int_wrap2-line,
115 sy-vline.
*--CLEARING THE VARIABLES--
wf_date1 = ''.
CLEAR: int_aufk,int_temp,int_wrap2-line,int_wrap-line.
ENDIF.
ENDWHILE.
wc_i1 = 1.
wc_i2 = 1.
CLEAR :int_wrap,int_wrap2.
REFRESH : int_wrap,int_wrap2,int_tline.
ENDLOOP.
ULINE AT (115).
ENDFORM. " f_report_display
*& Form F_PDF_DISPLAY
pdf conversion
--> p1 text
<-- p2 text
FORM f_pdf_display .
*--THIS FM CONVERTS THE SPOOL REQUEST INTO PDF REPORT--
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = wf_id "SPOOL NUMBER
no_dialog = space
pdf_destination = 'X'
IMPORTING
pdf_bytecount = loc_bytecount "NUMBER OF BYTES TRANSFERRED
TABLES
pdf = int_pdf "TABLE FOR PDF REPORT
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
ENDFORM. " F_PDF_DISPLAY
*& Form f_download_local
download to local system
--> p1 text
<-- p2 text
FORM f_download_local .
---------------------THIS FM DOWNLOADS THE PDF REPORT INTO LOCAL MACHINE
data loc_ret TYPE iwerrormsg.
CALL FUNCTION 'IW_C_GET_SAPWORKDIR'
IMPORTING
SAPWORKDIR = loc_file
ERROR_MSG = loc_ret
loc_filename = loc_file.
if loc_ret is initial.
concatenate loc_filename '\work order header long text_ ' sy-timlo '.pdf' into loc_filename.
endif.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
bin_filesize = loc_bytecount "NO. OF BYTES
filename = loc_filename "DEFAULT FILE NAME
filetype = 'BIN'
IMPORTING
act_filename = loc_filename
TABLES
data_tab = int_pdf.
ENDFORM. " f_download_local
if you have any doubts,,
please revert
Regards,
Talwinder -
Problem in getting previous screen in Classic report.
Hello everyone,
I am facing a serious problem in getting the previous screen in classical report.
let me tell you in detail.
When i run the report, i will have a selection screen with some checkboxes and select-options. Now in the report i have functionality to get some more select-options from user selection. Here i am calling the pop-up screen, wherein if user selects checkboxes, then those fields will be visible on the default selection screen.
To display them i am using Modif-id concept. Depending on the checkbox values, i am setting up the variables. Using those variables i am modifying screen.
Now suppose user has got some extra fields and run the report. It will get the output in the desired format.
Now the problem is when i am pressing 'BACK' button on the report output. The fields which are appended using modif-id are getting cleared. After that what i have is only the default selection-screen.
I want those fields to be restored. How do i go for it. Please help me out.
thanks in advance.Hi thanks for reply.
Actually code is too big to post. But have you understood my problem. Some part of code ia am sending.
AT SELECTION-SCREEN OUTPUT.
IF SY-UCOMM <> 'ONLI' AND SY-UCOMM <> 'FLDS' AND SY-UCOMM <> 'OK' AND
SY-DYNNR <> '0100' AND SY-UCOMM = ' '.
LEAVE TO SCREEN 1000.
ENDIF.
Now i want to know, whether i could get bcak those fields which which are appended using Modif-id,
how do i get the information about screen fiedls which was there after leaving the screen.
Thanks. -
Refresh Classical report/basic list
Hi,
I have created a classical report/basic list where user can select check boxes and adjacent rows should be deleted. But after the action, I wish to refresh the report and remove the selected lines from displaying.
Please let me know how to achieve this.
Thanks in advance.
NitinHi Nitin,
Check the following program.
Here on pressing the delete push button(FCODE: DELETE) it will delete all
rows which has adjacent checkboxes checked.
REPORT ztest_list_processing NO STANDARD PAGE HEADING .
TYPES: BEGIN OF ty_tab,
delete,
f1(3) TYPE c,
f2(3) TYPE c,
f3(3) TYPE c,
END OF ty_tab.
DATA: it_tab TYPE TABLE OF ty_tab,
wa_tab TYPE ty_tab.
DATA: w_delete TYPE c,
w_lines TYPE i,
w_ind TYPE i.
wa_tab-f1 = '111'.
wa_tab-f2 = 'ABC'.
wa_tab-f3 = '123'.
APPEND wa_tab TO it_tab.
wa_tab-f1 = '222'.
wa_tab-f2 = 'DEF'.
wa_tab-f3 = '456'.
APPEND wa_tab TO it_tab.
wa_tab-f1 = '333'.
wa_tab-f2 = 'GHI'.
wa_tab-f3 = '789'.
APPEND wa_tab TO it_tab.
wa_tab-f1 = '444'.
wa_tab-f2 = 'JKL'.
wa_tab-f3 = '987'.
APPEND wa_tab TO it_tab.
wa_tab-f1 = '555'.
wa_tab-f2 = 'MNO'.
wa_tab-f3 = '654'.
APPEND wa_tab TO it_tab.
SET PF-STATUS '100'. "Contains Delete button
PERFORM print_output.
"Logic which you can implement
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'DELETE'.
DESCRIBE TABLE it_tab LINES w_lines.
DO w_lines TIMES. "To read all rows
CLEAR: wa_tab.
READ LINE w_ind FIELD VALUE wa_tab-delete
wa_tab-f1. "Getting the values
IF wa_tab-delete EQ 'X'. "Delete when check box is 'X'
DELETE it_tab WHERE f1 = wa_tab-f1.
ENDIF.
ADD 1 TO w_ind."Index for next line
ENDDO.
IF it_tab IS INITIAL.
WRITE: / 'There are no data in the table'.
ELSE.
PERFORM print_output. "Reprint the updated data(like refreshing)
ENDIF.
"Modified the existing Back button in standard Toolbar so that on
"pressin the back button it will come to program and not to
"previous displayed list
WHEN '&BACK'.
LEAVE SCREEN.
ENDCASE.
*& Form print_output
* text
* --> p1 text
* <-- p2 text
FORM print_output.
LOOP AT it_tab INTO wa_tab.
WRITE:/ wa_tab-delete AS CHECKBOX INPUT ON, "Display as checkbox
wa_tab-f1,
wa_tab-f2,
wa_tab-f3.
IF sy-tabix EQ 1.
w_ind = sy-linno. "Get the line position of first row
ENDIF.
ENDLOOP.
Hope this helps you.
Regards,
Manoj Kumar P
Maybe you are looking for
-
How do I get to Internet Radio Stations on Apple TV After The Upgrade?
I recently updated my Apple TV software and can no longer get the internet radio stations list. Is there no way to access that now that Apple TV Radio is all the new itunes radio? I listen to the local public radio station on my TV and had a lot o
-
Is there any way to use osmf plugin with videodisplay component?
Hello i use flex sdk hero (17689 build) i want to use OSMF plugin for the captioning. i created object of media element with metadata for captioning plugin so eventually i get object of CaptioningProxyElement type from mediaFactory , than i pass i
-
I created the trigger on database level to moniter the server error. However, the error message contains just numbers which are not very readable. Where can I find more meaningful message for those numbers? Here is the trigger: CREATE OR REPLACE TRIG
-
EPM 11.1.1.3 Shared Services and Registration
Hi all, I installed EPM 11.1.1..3 on a windows 2003 server Install is ok. I then used config tool to configure repositories (Oracle 10g) , deploy ( Websphere 6.1) and register with shared services : Here is my issue : I can log to shared services but
-
G3 os 10.3.9- question- beating a dead horse
i know i am beating a dead horse and this has probably been asked a million times. ibook g3- 500mhz os 10.3.9 i have always had pc's and i got the first iphone when they first came out, and had every once since, loved those **** phones.(really loving