ALV report truncated in Spool
Hi All,
When i run the program in background, there will be a spool request generated. However the ALV report in this spool is truncated which all not fully display with the column i needed. ( approximated 600 chars)
I have defined the line-size to 1000 in my program and create the new printer format type to X_65_1000, but it still unsuccesfully to display fully. Can anyone advise on this and what are the max size of width in the spool? 1023?
Hi,
Check the following link:
/people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job
Regards,
Bhaskar
Similar Messages
-
Print alv report directly to spool from a badi method
Hallo !
I am trying to save a log in spool on converting process
I am doing on Idoc data in Method of Badi implementation
(badi : HRALE00OUTBOUND_IDOC).
The spool request is created but the list there contains
no data.
Here is the code I put in the badi method :
DATA: LS_PRINT TYPE SLIS_PRINT_ALV,
LV_REPID LIKE SY-REPID,
LS_LAYOUT TYPE SLIS_LAYOUT_ALV,
LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LS_FIELDCAT LIKE LINE OF LT_FIELDCAT.
LV_REPID = SY-REPID.
SET LS_LAYOUT :
CLEAR LS_LAYOUT.
SET LS_PRINT :
CLEAR LS_PRINT.
LS_PRINT-PRINT = 'N'.
SET LT_FIELDCAT :
REFRESH LT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MESSAGE'.
LS_FIELDCAT-SELTEXT_L = 'MES'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
CREATE LOG IN SPOOL :
SY-BATCH = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = LV_REPID
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_FIELDCAT[]
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_PRINT = LS_PRINT
TABLES
T_OUTTAB = PT_LOG[]
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.
I have to remark that when I call this code in
an ABAP-PI function the log is created successfully in spool.
But here I call it from a method of IDOC Badi exit -
and the list is empty ....
The two cases are in processes that run in batch ...
Maybe ALV function can't be called from a method ?
Maybe I should use Object-Oriented ALV ?
Or maybe I fill the ALV function parameters in a wrong way ?
I really appreciate your help ,
Thanks in advance -
Nitzan S.Hey,
I am not sure if from the ALV list the SPOOL will be created properly. You said the spool is created but the spool is empty.
A Work around could be create a classical report with WRITE statements and then SUBMIT that report exporting the list into memory or you can even read the spool then.
Regards,
Ravi
Note :Please mark the helpful answers -
Spool not getting generated in OO ALV report
Hi,
I developed a report in which we are giving output in same selection screen through OO ALV.
But,when we are scheduling that report in background,spool is not getting generated.
Waiting for your reply.
BR,
PraveenHi Aparna,
I tried NEW-PAGE PRINT ON.
I am pasting source code extract below:
IMPORT DATA = ME->IT_FINAL2 FROM MEMORY ID SY-CPROG.
FREE MEMORY ID SY-CPROG.
CHECK ME->IT_FINAL2 IS NOT INITIAL.
CHECK LO_DOCK IS INITIAL.
CREATE OBJECT LO_DOCK
EXPORTING
REPID = SY-REPID
DYNNR = SY-DYNNR
RATIO = 70
SIDE = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_BOTTOM
NAME = 'DOCK_CONT'.
IF SY-SUBRC NE 0.
MESSAGE 'Error in Docking Control' TYPE 'S'.
ENDIF.
IF LO_ALV IS INITIAL.
TRY.
LO_CONT ?= LO_DOCK.
CALL METHOD CL_SALV_TABLE=>FACTORY
EXPORTING
LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE
R_CONTAINER = LO_CONT
CONTAINER_NAME = 'DOCK_CONT'
IMPORTING
R_SALV_TABLE = LO_ALV
CHANGING
T_TABLE = ME->IT_FINAL2.
CATCH CX_SALV_MSG.
ENDTRY.
CLEAR LR_COLUMN.
TRY.
LR_COLUMNS = LO_ALV->GET_COLUMNS( ).
LR_COLUMN = LR_COLUMNS->GET_COLUMN( 'KSCHL' ).
LR_COLUMN->SET_LONG_TEXT( 'Cond.Type' ).
CATCH CX_SALV_NOT_FOUND.
ENDTRY.
NEW-PAGE PRINT ON.
LO_ALV->DISPLAY( ).
NEW-PAGE PRINT OFF.
I am not getting spool list while executing it in background.
BR,
Praveen -
Eliminate page heading in the spool of ALV report
Hi,
We are running the ALV report in the background, and when we view the spool
the page heading and the column heading is displayed for all the pages, Is there some way to
eliminate this.
The download from the on-line exec is fine,but the download from the spool includes the column
headings for each page. Is there some way to check if the ALV report is run in the batch mode
and to disable the heading from Page 2 to N.
Appreciate any input.
Thank you
LalithaHi,
I need to avoid the column headings also, I need the heading in the first page, but not on the subsequent pages.
Is there any setting in the ALV function modules to prevent this ?
So wanted to know if there is some setting to accomplish that.
Thank you
Lalitha -
ALV report display online and generate in spool
Dear expert,
I have created an ALV report. I want to run this report online. After executed, the report is displayed. After display this report, I also want to generate the output report in the spool. Is there any way to do this? Thank you.
I have tried to use submit...to SAP Spool. in this way, it will generate the spool, but it will not display the report online. I want it both display online and generate a spool.well forget yout the new-page print on thingie, since you use ALV.
if you had a write list this trick would be cool since you just could do following:
Do 2 times.
if sy-index GT 1.
new page print on.
endif.
loop at itab into wa.
write stuff....
endloop.
if sy-index GT 1.
new page print off.
endif.
enddo.
/edit arrrgh forgot to write further...
with your ALV you could process a write list as well after displaying but you will have layout differences between your display and your spool then and i dont think that this is what you want/need.
you could however after display process your programm a second time, in background task and give it a printer where to print to. Since ALV wont get executed in background task you will get a spool instead.
Edited by: Florian Kemmer on Sep 15, 2010 2:40 PM -
ALV report run In background gives 2 spool numbers
Hi ,
The ALV report which I am running in Background gives me 2 spool numbers after the Job is created in sm37.
I am just executing my ALV report by running it in backgroung procressing, but I get 2 spool one has all the correct data of the ALV and 1 blank spool is created.
I have Passed the followin parameter to my ALV FM.
lwa_print-no_change_print_params = 'X'.
lwa_print-no_print_listinfos = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_default = space
is_layout = t_layout
is_print = lwa_print
it_fieldcat = t_fieldcat
TABLES
t_outtab = t_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
Unable to find the reason why I get 2 spool created for it?
Thanks
RiteshHi venkatesh,
Thanks for the reply.
I tried that also but issue was due to a SKIP statement called in the program and due to which a new spool which was blank was called.
The issue is resolved.
Thanks
Solanki Ritesh -
Text getting truncated in alv report...
hi friends,
i am doing an alv report..the requirement is i need to display the user inputs at the top of the alv grid..in that, for a particular field, if the user is not selecting any option, then i need to display all the values in that category...i have concatenated all those values into a variable and displayed it...but the problem is, it is not taking beyond 60 characters as P_HEADING-INFO is only defined as characters of length 60...how to expand the character value of p_heading? thanks all..max size is
types: begin of slis_listheader,
typ(1) type c, " H = Header, S = Selection, A = Action
key(20) type c,
info type slis_entry,
end of slis_listheader.
slis_entry(60) type c,
so try to create one more Line if u have to much more data to display.
regards
Prabhu -
Field value is truncated while downloading to excel sheet from ALV report
Hi All,
I developed ALV report and displaying output.
In that output i had a filed VBRP-PRODH filed.
In the output it is coming correctly but while i click downlaod to excel the valus is truncted.
for Example the value for VBRP-PRODH is 03322764170100201
while downlaoding this one to excel it is showing 3322764170100200
Any inputs please..
Regards
JaiWrong forum..post in ABAP
-
Hi experts 1 query regarding alv report running in background
when i run my alv report with 40 columns in background in spool when i get output disturbed 20 lines of first row is moving to second row so when i download to excel the o/p is completely disturbed and no use for me is there any way to solve this problem.please reply
hi ,
this will solve your problem
http://www.****************/Tutorials/ALV/Spool/width.htm
Increasing the width of the spool when using ALV List
By Aafaque Husain, YASH Technologies
Whenever an ALV report (with more number of columns) is scheduled in background, the output will be displayed in a zigzag fashion as shown below:
If we try to download the output from the spool or try to view the output, then we observe that the output is not in an appropriate fashion.
To get the right format of output in the spool we generally increase the u201Cno. of columns fieldu201D in the Format typesu201D. Have a look at the following screenshot:
Sometimes even when we change this field, we get the output truncated at the end, like last few columns are not displayed. There is certain limitation for this field, so that even if increase this value again, we find no change in the output display in spool.
This value is effective only when we check the check box u201CNumber of columns from list display formatu201D in the SPAD transaction.
Ø GO to SPAD Transaction code
Ø In the menu Settings -> Spool System as shown belowu2026
Ø In the others tab check the first check box in the Output Controller block, SAVE and exit.
Now Schedule the ALV report again by providing the output device and format, and then we get the full output in the spool as shown below:
Regards,
Madhavi -
Overlapping of Columns in the Print Preview of ALV Report
Hi ,
I have created a ALV report which has 62 columns, when i see the print preview, the rows overlaps one another. I want a printout where no line items or rows should overlap each other. Never mind if the extra overlapped columns get truncated. Kindly help me to solve this problem.
Regards,
shivuU need to increase u201Cno. of columns fieldu201D in the Format typesu201D. For details pl. see this link.
http://www.****************/Tutorials/ALV/Spool/width.htm
Regards,
Joy. -
ALV Report not getting displayed in Background
Hi All,
I am using Object Oriented approach of ALV to display the Report, in foreground it works fine but in background I don't get the Report.
I am using the below piece of code but doesn't seems to be working well.
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING
e_offline = OFF.
if OFF is initial.
*----Creating custom container instance
CREATE OBJECT gr_ccontainer
EXPORTING
container_name = gc_custom_control_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6 .
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = gr_ccontainer.
Its not working. If anyone of you could let me know what can be done to get the ALV report with all the fields in the background.
Thanks.Hi Geeta,
I was about to say this...
If that is the case u don hav to design a custom control in ur screen, instead use ur screen as a
dummy container which will work well in fore/back ground
CREATE OBJECT go_grid
EXPORTING
i_parent = cl_gui_container=>default_screen. "Default scrren taken as dummy container
But u got the answer in previous post : )..
For ur second question:
goto SP01->give spool no->exec->select the spool no(check)-> press shift+F4...
Cheers,
Jose. -
OOP ALV report custom control performance problem
HI
how to write OOP ALV report without custom control.. Actually with custom control which taking long time... and time out happens for huge selection of data..
Regards
Roops.timeout is not an alv problem. If you try to display a "huge" amount of data, any display technology will fail. Even sap programs fail, their wise solution is to ask user to restrict data to be displayed. Or reduce database selection time, or display amount. Or propose the user to download data as a spool, or output to a file on server.
Otherwise, read some advices about how to handle timeout in [Note 25528 - Parameter rdisp/max_wprun_time|http://service.sap.com/sap/support/notes/25528].
About your question, if you still want to try, look at [example code with alv class cl_salv_table for simple display|http://help.sap.com/saphelp_nw2004s/helpdata/en/f9/1ab54099de3726e10000000a1550b0/frameset.htm] -
Hi,
Please help with a solution:
my requirement is to add the following to an existing program.
i need to add 3 fields from a new table(a table which is not used in the program).
the fields are :
Vendor Part No. : Field ZWTYVND-Z_WTY_MAT_VPN
Mail To Vendor No.: Field ZWTYVND-Z_WTY_LIFNR_MAIL
Mail To Vendor Name: Field ZWTYVND-WTY_NAME1
here is the program code:
REPORT zwtyrep008
LINE-SIZE 500
MESSAGE-ID zpp02.
*& Report ZWTYREP008 *
*$*$----------------------------------------------------------------$*$*
*$*$---T A B L E S--------------------------------------------------$*$*
*$*$----------------------------------------------------------------$*$*
TABLES: wty_pnwtyh_dia, "
wty_pnwtyv_dia,
mara,
usr21,
pnwtyv,
adrp,
s084.
*$*$----------------------------------------------------------------$*$*
*$*$ CONSTANTS
*$*$----------------------------------------------------------------$*$*
CONSTANTS: true(1) VALUE 'X',
false(1) VALUE ' '.
CONSTANTS: c_year_low(4) VALUE '1960',
c_year_high(4) VALUE '9999',
c_zero LIKE wty_pvwty_dia-valiv VALUE '0.00',
c_claim_to_process TYPE i VALUE 3000.
CONSTANTS: c_save(1) VALUE 'U'.
*$*$----------------------------------------------------------------$*$*
*$*$ TYPES
*$*$----------------------------------------------------------------$*$*
TYPE-POOLS: slis, pwty.
TYPES: BEGIN OF lt_period,
year(4),
poper(2),
start TYPE d,
end TYPE d,
END OF lt_period.
TYPES: BEGIN OF tp_charac_value,
atwrt LIKE cawn-atwrt,
END OF tp_charac_value.
TYPES: BEGIN OF tp_submit_records,
header_guid LIKE wty_pnwtyv_dia-header_guid,
versn LIKE wty_pnwtyv_dia-versn,
prev_version LIKE wty_pnwtyv_dia-prev_version,
kateg LIKE wty_pnwtyv_dia-kateg,
aktiv LIKE wty_pnwtyv_dia-aktiv,
pnguid LIKE wty_pnwtyv_dia-pnguid,
knumv LIKE wty_pnwtyv_dia-knumv,
END OF tp_submit_records.
TYPES: BEGIN OF tp_cond_table,
kschl LIKE konv-kschl,
zaehk LIKE konv-zaehk,
kinak LIKE konv-kinak,
kbetr LIKE konv-kbetr,
END OF tp_cond_table.
*$*$----------------------------------------------------------------$*$*
*$*$---I N T E R N A L T A B L E S--------------------------------$*$*
*$*$----------------------------------------------------------------$*$*
* Report table to display with ALV
DATA: t_detail_info TYPE STANDARD TABLE OF zwty_claim_avg_rep_det
WITH HEADER LINE
INITIAL SIZE 0.
FIELD-SYMBOLS:<fs_detail_info> LIKE LINE OF t_detail_info.
DATA: t_summary_alv TYPE STANDARD TABLE OF zwty_claim_avg_rep_sum
WITH HEADER LINE
INITIAL SIZE 0.
FIELD-SYMBOLS:<fs_summary_alv> LIKE LINE OF t_summary_alv.
DATA: t_detail_alv TYPE STANDARD TABLE OF zwty_claim_avg_rep_det
WITH HEADER LINE
INITIAL SIZE 0.
FIELD-SYMBOLS:<fs_detail_alv> LIKE LINE OF t_detail_alv.
DATA: it_submit_records TYPE HASHED TABLE OF tp_submit_records
WITH UNIQUE KEY header_guid versn
WITH HEADER LINE
INITIAL SIZE 0.
FIELD-SYMBOLS: <fs_submit_rec_vs2> TYPE tp_submit_records.
DATA: it_period TYPE HASHED TABLE OF lt_period
WITH UNIQUE KEY year poper
WITH HEADER LINE
INITIAL SIZE 0.
FIELD-SYMBOLS: <fs_it_period> LIKE LINE OF it_period.
DATA: it_pvwty_dia_all TYPE wty_pvwty_dia_tab.
FIELD-SYMBOLS: <fs_pvwty_dia_es3> LIKE LINE OF it_pvwty_dia_all.
DATA: it_cond_table TYPE STANDARD TABLE OF tp_cond_table
WITH HEADER LINE
INITIAL SIZE 0.
FIELD-SYMBOLS: <fs_cond_table> TYPE tp_cond_table.
*$*$----------------------------------------------------------------$*$*
*$*$---G L O B A L D A T A ---------------------------------------$*$*
*$*$----------------------------------------------------------------$*$*
DATA: gt_fieldcat_sum TYPE slis_t_fieldcat_alv,
gt_fieldcat_det TYPE slis_t_fieldcat_alv,
gtw_fieldcat LIKE LINE OF gt_fieldcat_sum,
gt_top_of_page TYPE slis_t_listheader,
gtw_top_of_page LIKE LINE OF gt_top_of_page,
gt_end_of_page TYPE slis_t_listheader,
gtw_end_of_page LIKE LINE OF gt_end_of_page,
gs_layout TYPE slis_layout_alv,
gt_excluding TYPE slis_t_extab,
gtw_excluding LIKE LINE OF gt_excluding,
gs_variant1 TYPE disvariant,
gs_variant2 TYPE disvariant,
eventcat TYPE slis_t_event, "EVENEMENT
eventcat_ln LIKE LINE OF eventcat, "LIGNE D'EVENEMENT
gt_sort TYPE slis_t_sortinfo_alv,
gtw_sort LIKE LINE OF gt_sort.
DATA: wa_lis_progname LIKE sy-cprog,
wa_low_date TYPE d,
wa_high_date TYPE d,
wa_index_mat TYPE i,
wa_index_link TYPE i,
wa_level_alv TYPE i.
DATA: g_callback_pgm(40) TYPE c,
g_callback_user_command(30) TYPE c.
DATA: my_print TYPE slis_print_alv.
FIELD-SYMBOLS: <fs_pvwty_dia> TYPE wty_pvwty_dia.
* SELECTION SCREEN *
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK post WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_cpudt FOR s084-spmon NO-EXTENSION,
s_postdt FOR wty_pnwtyv_dia-fkdat NO-EXTENSION.
SELECTION-SCREEN END OF BLOCK post.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_vend FOR pnwtyv-v_parnr NO INTERVALS.
SELECT-OPTIONS: s_clgrp FOR wty_pnwtyh_dia-clmgrp.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_model FOR wty_pnwtyh_dia-z_wty_model.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK lay WITH FRAME TITLE text-004.
PARAMETERS: varn1 TYPE slis_vari MEMORY ID fit_alv_gl, "Dis. variant
varn2 TYPE slis_vari.
SELECTION-SCREEN END OF BLOCK lay.
*$*$----------------------------------------------------------------$*$*
*$*$---A T S E L E C T I O N - S C R E E N-------------------------$*$*
*$*$----------------------------------------------------------------$*$*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR varn1.
PERFORM alv_variant_f4 USING '0001' CHANGING varn1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR varn2.
PERFORM alv_variant_f4 USING '0002' CHANGING varn2.
AT SELECTION-SCREEN ON BLOCK post. "Validate posting parameters
PERFORM validate_posting_parameter.
AT SELECTION-SCREEN ON s_model. "Validate model
PERFORM validate_model.
AT SELECTION-SCREEN ON s_vend. "Validate vendor
PERFORM validate_vendor.
AT SELECTION-SCREEN ON s_matnr. "Validate material
PERFORM validate_material.
AT SELECTION-SCREEN ON s_clgrp. "Validate claim group
PERFORM validate_claim_group.
AT SELECTION-SCREEN OUTPUT.
* Initialization.
INITIALIZATION.
* Initialize default display variant for ALV report
CLEAR gs_variant1.
MOVE sy-repid TO: gs_variant1-report,
gs_variant2-report.
gs_variant1-handle = '0001'.
gs_variant2-handle = '0002'.
wa_lis_progname = sy-repid.
PERFORM set_default_variant CHANGING gs_variant1
varn1.
PERFORM set_default_variant CHANGING gs_variant2
varn2.
PERFORM get_fin_period USING c_year_low c_year_high.
PERFORM set_period_to_analyse.
*$*$----------------------------------------------------------------$*$*
*$*$---S T A R T - O F - S E L E C T I O N--------------------------$*$*
*$*$----------------------------------------------------------------$*$*
START-OF-SELECTION.
PERFORM select_claim_to_process.
*$*$----------------------------------------------------------------$*$*
*$*$---E N D - O F - S E L E C T I O N------------------------------$*$*
*$*$----------------------------------------------------------------$*$*
END-OF-SELECTION.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
text = text-m02.
IF sy-batch = 'X'.
PERFORM set_print_alv_grid.
ENDIF.
PERFORM show_alv_grid.
*& Form PRINT_DETAIL_ALV
FORM show_alv_grid.
* Prepare ALV_GRID before display
* ===============================
PERFORM init_field.
PERFORM init_layout.
PERFORM init_fieldcat.
PERFORM init_excluding.
PERFORM init_event.
* SORT report_data BY bukrs werks.
PERFORM call_alv_list_display_level_1.
ENDFORM. " PRINT_DETAIL
*& Form VARIANT_F4 copied from RPCWCCK3
* Display a list of all available display variants for the ALV.
* <--P_varn1 Return the selected variant and return
FORM variant_f4 CHANGING p_varn1 TYPE disvariant-variant.
DATA: l_variant LIKE disvariant.
* Get the list of available variants for the report
l_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = l_variant
i_save = 'A'
IMPORTING
es_variant = l_variant.
p_varn1 = l_variant-variant.
ENDFORM. " VARIANT_F4
*& Form INIT_FIELD
FORM init_field.
MOVE sy-repid TO g_callback_pgm.
MOVE 'MY_USER_COMMAND' TO g_callback_user_command.
ENDFORM. " INIT_FIELD
*& Form INIT_LAYOUT
FORM init_layout.
gs_layout-window_titlebar = sy-title.
gs_layout-colwidth_optimize = 'X'.
gs_layout-expand_all = 'X'.
gs_layout-no_subtotals = ''.
gs_layout-key_hotspot = 'X'. " Afficher Hotspot
gs_layout-zebra = 'X'.
gs_layout-group_change_edit = 'X'.
gs_layout-f2code = 'DISPLAY'.
* gs_layout-max_linesize = 400.
* gs_layout-totals_only = 'X'.
ENDFORM. " INIT_LAYOUT
*& Form INIT_FIELDCAT
FORM init_fieldcat.
DATA: lt_fieldcatalog TYPE lvc_t_fcat,
ltw_fieldcatalog TYPE lvc_s_fcat.
REFRESH: lt_fieldcatalog,
gt_fieldcat_sum,
gt_fieldcat_det.
CLEAR gtw_sort.
REFRESH gt_sort.
* ==============================================
* Set the label column for summary report leve 1
* ==============================================
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZWTY_CLAIM_AVG_REP_SUM'
i_client_never_display = 'X'
CHANGING
ct_fieldcat = lt_fieldcatalog.
* FIELD pos sub up down Group
PERFORM create_sort USING: 'V_PARNR' 1 'X' 'X' ' ' 'X',
'NAME' 2 'X' 'X' ' ' 'X',
'MAKTX' 3 'X' 'X' ' ' 'X',
'MATNR' 4 'X' 'X' ' ' 'X'.
LOOP AT lt_fieldcatalog INTO ltw_fieldcatalog.
CLEAR: gtw_fieldcat.
MOVE-CORRESPONDING ltw_fieldcatalog TO gtw_fieldcat.
PERFORM set_alv_field_desc USING ltw_fieldcatalog '1'.
APPEND gtw_fieldcat TO gt_fieldcat_sum.
ENDLOOP.
PERFORM set_hot_spot TABLES gt_fieldcat_sum USING 'CLAIM_NB'.
* =========================================
* Field Catalog for Detail report (level 2)
* =========================================
REFRESH: lt_fieldcatalog.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZWTY_CLAIM_AVG_REP_DET'
i_client_never_display = 'X'
CHANGING
ct_fieldcat = lt_fieldcatalog.
LOOP AT lt_fieldcatalog INTO ltw_fieldcatalog.
CLEAR: gtw_fieldcat.
MOVE-CORRESPONDING ltw_fieldcatalog TO gtw_fieldcat.
PERFORM set_alv_field_desc USING ltw_fieldcatalog '2'.
APPEND gtw_fieldcat TO gt_fieldcat_det.
ENDLOOP.
PERFORM set_hot_spot TABLES gt_fieldcat_det USING 'CLMNO'.
ENDFORM. " INIT_FIELDCAT
*& Form INIT_SORT
FORM create_sort USING p_fieldname p_spos
p_subtot TYPE char1
p_up TYPE char1
p_down TYPE char1
p_group TYPE char1.
CLEAR: gtw_sort.
gtw_sort-fieldname = p_fieldname.
gtw_sort-spos = p_spos.
gtw_sort-subtot = p_subtot.
gtw_sort-up = p_up.
gtw_sort-down = p_down.
gtw_sort-group = p_group.
APPEND gtw_sort TO gt_sort.
ENDFORM. "create_sort
*& Form INIT_EXCLUDING
* Exclude des option de l'application tool bar
FORM init_excluding.
CLEAR gtw_excluding.
REFRESH gt_excluding.
gtw_excluding-fcode = '&ABC'.
APPEND gtw_excluding TO gt_excluding.
ENDFORM. " INIT_EXCLUDING
*& Form call_alv_list_display_level_1
FORM call_alv_list_display_level_1.
* DATA: l_i_save VALUE 'U'. "User-specific variants only
DATA: l_i_save VALUE 'A'. "Any type of variants
gs_variant1-report = sy-repid.
gs_variant1-variant = varn1.
gs_layout-colwidth_optimize = true.
wa_level_alv = 1.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_callback_pgm
i_callback_user_command = g_callback_user_command
is_layout = gs_layout
it_fieldcat = gt_fieldcat_sum
it_excluding = gt_excluding
it_sort = gt_sort
i_save = l_i_save
is_variant = gs_variant1
it_events = eventcat
is_print = my_print
TABLES
t_outtab = t_summary_alv
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " call_alv_list_display_level_1
*& Form INIT_EVENT
* Determine quelle routine a executer selon l'event
FORM init_event.
eventcat_ln-name = 'TOP_OF_PAGE'.
eventcat_ln-form = 'ALV_PAGE_HEADER'.
APPEND eventcat_ln TO eventcat.
eventcat_ln-name = 'END_OF_PAGE'.
eventcat_ln-form = 'FOOTER_PAGE'.
APPEND eventcat_ln TO eventcat.
ENDFORM. " INIT_EVENT
*& Form ALV_PAGE_HEADER
FORM alv_page_header.
DATA: l_date_time(22),
l_char7(7),
l_char10(10).
DATA: p_date(10) TYPE c.
DATA: p_time(8) TYPE c.
DATA: p_name(80) TYPE c.
* Format current date and time
WRITE sy-datum TO p_date USING EDIT MASK '____/__/__'.
WRITE sy-uzeit TO p_time USING EDIT MASK '__:__:__'.
CONCATENATE p_date '-' p_time
INTO l_date_time SEPARATED BY space.
* Set the user name
SELECT SINGLE
persnumber addrnumber INTO (usr21-persnumber, usr21-addrnumber)
FROM usr21
WHERE bname = sy-uname.
SELECT SINGLE name_first name_last
INTO (adrp-name_first, adrp-name_last )
FROM adrp
WHERE persnumber = usr21-persnumber.
CONCATENATE adrp-name_first adrp-name_last INTO p_name
SEPARATED BY space.
REFRESH gt_top_of_page.
CLEAR gtw_top_of_page.
* Program title ------------------------------------------------
CLEAR gtw_top_of_page.
gtw_top_of_page-typ = 'H'.
gtw_top_of_page-info = sy-title.
APPEND gtw_top_of_page TO gt_top_of_page.
CLEAR gtw_top_of_page.
gtw_top_of_page-typ = 'S'.
gtw_top_of_page-key = 'Parameters :'.
* Period / Posting Date -----------------------------------------
IF s_cpudt[] IS INITIAL.
WRITE s_postdt-low TO l_char10.
CONCATENATE gtw_top_of_page-info
text-104
l_char10
INTO gtw_top_of_page-info SEPARATED BY space.
IF NOT s_postdt-high IS INITIAL.
WRITE s_postdt-high TO l_char10.
CONCATENATE gtw_top_of_page-info
text-105
l_char10
INTO gtw_top_of_page-info SEPARATED BY space.
ENDIF.
APPEND gtw_top_of_page TO gt_top_of_page.
ELSE.
CONCATENATE s_cpudt-low(4) '/' s_cpudt-low+4(2)
INTO l_char7 .
CONCATENATE gtw_top_of_page-info
text-103
l_char7
INTO gtw_top_of_page-info SEPARATED BY space.
IF s_cpudt-high NE space.
CONCATENATE s_cpudt-high(4) '/' s_cpudt-high+4(2)
INTO l_char7 .
CONCATENATE gtw_top_of_page-info
text-105
l_char7
INTO gtw_top_of_page-info SEPARATED BY space.
ENDIF.
APPEND gtw_top_of_page TO gt_top_of_page.
ENDIF.
* Display wich level we display -----------------------------
* IF wa_level_alv > 1.
* CLEAR gtw_top_of_page.
* IF wa_level_alv = 2.
* gtw_top_of_page-info = t_summary_alv-v_parnr.
* SHIFT gtw_top_of_page-info LEFT DELETING LEADING '0'.
* ENDIF.
* gtw_top_of_page-typ = 'S'.
* gtw_top_of_page-key = 'Partner:'.
* APPEND gtw_top_of_page TO gt_top_of_page.
* ENDIF.
* Executed by -----------------------------------------------
CLEAR gtw_top_of_page.
gtw_top_of_page-typ = 'S'.
gtw_top_of_page-key = 'Report executed by :'.
gtw_top_of_page-info = p_name.
* * Date & time of execution --------------------------------
APPEND gtw_top_of_page TO gt_top_of_page.
gtw_top_of_page-key = 'DATE :'.
gtw_top_of_page-info = l_date_time.
APPEND gtw_top_of_page TO gt_top_of_page.
* Name of the report ----------------------------------------
CLEAR gtw_top_of_page.
gtw_top_of_page-typ = 'A'.
* LS_LINE-KEY: not used for this type
gtw_top_of_page-info = sy-repid.
APPEND gtw_top_of_page TO gt_top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_top_of_page.
* IF sy-batch = 'X' AND sy-linsz > 255 AND l_ctr_newpage = 0.
* NEW-PAGE PRINT ON LINE-SIZE 255. "Pour wrapper !!!!!!
* ENDIF.
ENDFORM. "ALV_PAGE_HEADER
*& Form footer_page
FORM footer_page.
DATA: l_footer(300),
l_page_no(5).
l_page_no = sy-pagno.
CONCATENATE 'Page' l_page_no INTO l_footer SEPARATED BY space.
SKIP 2.
WRITE:/001 l_footer(sy-linsz) CENTERED.
ENDFORM. "footer_page
*& Form MY_USER_COMMAND
* text
* -->P_SY_UCOMM text
* -->P_GS_SELFIELD text
FORM my_user_command USING p_sy_ucomm
p_gs_selfield TYPE slis_selfield.
DATA: l_claim_no LIKE mcshier-hiername,
lv_tcode_last(15).
* ======================================================
* Call TX WTY to display the claim. Only possible at the
* detail report(level 3)
* ======================================================
CASE p_gs_selfield-fieldname.
WHEN 'CLMNO'.
READ TABLE t_detail_alv INDEX p_gs_selfield-tabindex.
SHIFT t_detail_alv-clmno LEFT DELETING LEADING '0'.
l_claim_no = t_detail_alv-clmno.
CONCATENATE sy-tcode syst-modno
INTO lv_tcode_last.
EXPORT wty_tcode_last_memoid FROM lv_tcode_last TO MEMORY
ID 'WTY_TCODE_LAST_MEMOID'.
SET PARAMETER ID 'CLMNO' FIELD l_claim_no.
CALL TRANSACTION 'WTY' AND SKIP FIRST SCREEN.
WHEN 'CLAIM_NB'.
* =====================================
* Display the next level of information
* =====================================
CASE wa_level_alv.
WHEN 1.
REFRESH: t_detail_alv.
wa_level_alv = 2.
READ TABLE t_summary_alv INDEX p_gs_selfield-tabindex.
LOOP AT t_detail_info
ASSIGNING <fs_detail_info>
WHERE v_parnr EQ t_summary_alv-v_parnr
AND crncy EQ t_summary_alv-crncy
AND item_type EQ t_summary_alv-item_type
AND ov_meinh EQ t_summary_alv-ov_meinh
AND iv_meinh EQ t_summary_alv-iv_meinh
AND matnr EQ t_summary_alv-matnr.
MOVE-CORRESPONDING <fs_detail_info> TO t_detail_alv.
APPEND t_detail_alv.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_callback_pgm
i_callback_user_command = g_callback_user_command
is_layout = gs_layout
it_fieldcat = gt_fieldcat_det
it_excluding = gt_excluding
* it_sort = gt_sort
i_save = c_save
is_variant = gs_variant2
it_events = eventcat
is_print = my_print
TABLES
t_outtab = t_detail_alv
EXCEPTIONS
program_error = 1
OTHERS = 2.
wa_level_alv = 1.
ENDCASE.
ENDCASE.
ENDFORM. " MY_USER_COMMAND
* FORM PRINT_ALV_GRID *
* Print the report not on screen for special batch processing. *
* --> IT Table to print - Z_HRF_BEN_CONF_FLEX
FORM set_print_alv_grid.
my_print-print = 'X'. "Force printing
my_print-no_print_selinfos = 'X'.
my_print-no_print_listinfos = 'X'.
my_print-no_new_page = ''. "Separate spool files
my_print-prnt_title = 'X'.
my_print-prnt_info = 'X'.
my_print-reserve_lines = 3.
ENDFORM. "set_print_alv_grid
*& Form ALV_VARIANT_F4
FORM alv_variant_f4 USING p_handle
CHANGING p_vari.
DATA: rs_variant LIKE disvariant.
DATA: nof4 TYPE c.
CLEAR nof4.
LOOP AT SCREEN.
IF screen-name = p_vari.
IF screen-input = 0.
nof4 = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
rs_variant-report = sy-repid.
rs_variant-username = sy-uname.
rs_variant-handle = p_handle.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = rs_variant
i_save = 'A'
IMPORTING
es_variant = rs_variant
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0 AND nof4 EQ space.
p_vari = rs_variant-variant.
ENDIF.
ENDFORM. " ALV_VARIANT_F4
*& Form validate_model
* text
* --> p1 text
* <-- p2 text
FORM validate_model .
DATA: l_matnr LIKE mara-matnr.
SELECT SINGLE matnr
INTO l_matnr
FROM mara
WHERE matnr IN s_model
AND mtart EQ 'ZKMA'.
IF sy-subrc NE 0.
MESSAGE e000 WITH text-e07.
ENDIF.
ENDFORM. " validate_model
*& Form select_claim_to_process
* text
* --> p1 text
* <-- p2 text
FORM select_claim_to_process .
DATA: lt_pnwtyh_dia TYPE wty_pnwtyh_dia_tab,
lt_pnwtyv_dia TYPE wty_pnwtyv_dia_tab,
lt_pvwty_dia TYPE wty_pvwty_dia_tab,
lt_pnwtyh_dia_tmp TYPE wty_pnwtyh_dia_tab,
lt_pnwtyv_dia_tmp TYPE wty_pnwtyv_dia_tab,
lt_pvwty_dia_tmp TYPE wty_pvwty_dia_tab,
lt_pvwty_dia_mat TYPE wty_pvwty_dia_tab,
lt_sel_fkdat TYPE pwty_sel_fkdat_pt,
lt_sel_v_parnr TYPE pwty_sel_v_parnr_pt,
lt_sel_clmty TYPE pwty_sel_clmty_pt,
lt_sel_clmgrp TYPE pwty_sel_clmgrp_pt.
DATA: lst_sel_fkdat LIKE LINE OF lt_sel_fkdat,
lst_sel_clmty LIKE LINE OF lt_sel_clmty.
DATA: BEGIN OF lt_clmno OCCURS 0,
clmno LIKE pnwtyh-clmno,
END OF lt_clmno,
lt_clmno_tmp LIKE lt_clmno OCCURS 0,
lt_claim TYPE pwty_sel_clmno_pt,
wa_clmno LIKE LINE OF lt_claim.
DATA: l_nb_claim TYPE i.
RANGES: lr_model FOR wty_pnwtyh_dia-z_wty_model.
FIELD-SYMBOLS: <lfs_pnwtyh_dia> LIKE LINE OF lt_pnwtyh_dia,
<lfs_pnwtyv_dia> LIKE LINE OF lt_pnwtyv_dia,
<lfs_pvwty_dia_es2> LIKE LINE OF lt_pvwty_dia,
<lfs_pvwty_dia_mat> LIKE LINE OF lt_pvwty_dia_mat.
REFRESH: lt_pnwtyh_dia, lt_pnwtyv_dia,lt_pvwty_dia, lt_sel_clmty,
lr_model, t_detail_info, t_summary_alv, lt_pvwty_dia_mat.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
text = text-m01. "Extracting claim
* ========================
* Get the Claim to process
* ========================
* SELECT clmno
* INTO TABLE lt_clmno
* FROM pnwtyh
* WHERE z_wty_convflg EQ space
* AND z_wty_error EQ space
* wa_clmno-sign = 'I'.
* wa_clmno-option = 'EQ'.
* LOOP AT lt_clmno.
* wa_clmno-low = lt_clmno-clmno.
* APPEND wa_clmno TO lt_claim.
* ENDLOOP.
lst_sel_fkdat-sign = 'I'.
lst_sel_fkdat-option = 'BT'.
lst_sel_fkdat-low = wa_low_date.
lst_sel_fkdat-high = wa_high_date.
APPEND lst_sel_fkdat TO lt_sel_fkdat.
lst_sel_clmty-sign = 'E'.
lst_sel_clmty-option = 'EQ'.
lst_sel_clmty-low = 'ZSBC'.
APPEND lst_sel_clmty TO lt_sel_clmty.
lt_sel_v_parnr[] = s_vend[].
lt_sel_clmgrp[] = s_clgrp[].
CALL FUNCTION 'PVSDBWTY_CLAIM_SELECT'
EXPORTING
it_sel_fkdat = lt_sel_fkdat
it_sel_clmgrp = lt_sel_clmgrp
it_sel_v_parnr = lt_sel_v_parnr
it_sel_clmty = lt_sel_clmty
* it_sel_clmno = lt_claim
IMPORTING
et_pnwtyh_dia = lt_pnwtyh_dia
et_pnwtyv_dia = lt_pnwtyv_dia
et_pvwty_dia = lt_pvwty_dia
EXCEPTIONS
no_entry_found = 1
authority_failed = 2
OTHERS = 3.
IF sy-subrc = 3 .
MESSAGE e309(wty) .
ENDIF .
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
text = text-m03. "Extracting claim
LOOP AT lt_pvwty_dia
ASSIGNING <fs_pvwty_dia>
WHERE poskt_cust = 'MAT'.
INSERT <fs_pvwty_dia> INTO TABLE lt_pvwty_dia_mat.
ENDLOOP.
it_pvwty_dia_all[] = lt_pvwty_dia[].
SORT lt_pnwtyh_dia BY pnguid.
SORT lt_pvwty_dia BY version_guid z_wty_posnr_hier.
SORT lt_pvwty_dia_mat BY version_guid.
SORT it_pvwty_dia_all BY version_guid posnr.
* Keep Version record OC or IV in a separate table for later use
LOOP AT lt_pnwtyv_dia
ASSIGNING <lfs_pnwtyv_dia>.
it_submit_records-header_guid = <lfs_pnwtyv_dia>-header_guid.
it_submit_records-versn = <lfs_pnwtyv_dia>-versn.
it_submit_records-prev_version = <lfs_pnwtyv_dia>-prev_version.
it_submit_records-kateg = <lfs_pnwtyv_dia>-kateg.
it_submit_records-aktiv = <lfs_pnwtyv_dia>-aktiv.
it_submit_records-knumv = <lfs_pnwtyv_dia>-knumv.
it_submit_records-pnguid = <lfs_pnwtyv_dia>-pnguid.
INSERT TABLE it_submit_records.
ENDLOOP.
* =============
* Process Claim
* =============
LOOP AT lt_pnwtyv_dia
ASSIGNING <lfs_pnwtyv_dia>
WHERE aktiv EQ true "Active version only
AND kateg EQ 'IV' "Category
AND fi_doc_exist EQ 'X'.
CLEAR: t_detail_info, t_summary_alv.
* Read Header detail
READ TABLE lt_pnwtyh_dia
WITH KEY pnguid = <lfs_pnwtyv_dia>-header_guid
ASSIGNING <lfs_pnwtyh_dia>
BINARY SEARCH.
* Claim must be without error -----------------------------
IF sy-subrc NE 0 OR
<lfs_pnwtyh_dia>-z_wty_error = true OR
<lfs_pnwtyh_dia>-z_wty_convflg = true.
CONTINUE. "Rejected this Claim
ENDIF.
* Check Model
IF <lfs_pnwtyh_dia>-z_wty_model IN s_model.
ELSE.
CONTINUE. "Rejected this Claim
ENDIF.
* Read first "MAT" Item information ------------------
READ TABLE lt_pvwty_dia_mat
WITH KEY version_guid = <lfs_pnwtyv_dia>-pnguid
ASSIGNING <lfs_pvwty_dia_mat>
BINARY SEARCH.
wa_index_mat = sy-tabix.
IF sy-subrc NE 0.
CONTINUE. "Rejected this Claim
ENDIF.
* ====================================================
* Process all item "MAT" linked to the current version
* ====================================================
WHILE sy-subrc = 0
AND
<lfs_pvwty_dia_mat>-version_guid = <lfs_pnwtyv_dia>-pnguid.
IF <lfs_pvwty_dia_mat>-matnr IN s_matnr.
* ======================================
* Process Items linked to the "MAT" Item
* ======================================
READ TABLE lt_pvwty_dia
WITH KEY version_guid = <lfs_pnwtyv_dia>-pnguid
z_wty_posnr_hier = <lfs_pvwty_dia_mat>-posnr
ASSIGNING <lfs_pvwty_dia_es2>
BINARY SEARCH.
wa_index_link = sy-tabix.
DO. "Execute only ONCE (to process all items linked to the)
"MAT Item
IF sy-subrc NE 0.
EXIT. "Exit the DO loop
ENDIF.
WHILE sy-subrc = 0
AND
<lfs_pvwty_dia_es2>-version_guid =
<lfs_pnwtyv_dia>-pnguid
AND
<lfs_pvwty_dia_es2>-z_wty_posnr_hier =
<lfs_pvwty_dia_mat>-posnr.
IF <lfs_pvwty_dia_es2>-valiv EQ c_zero.
ELSE.
* Initialize the detail information to display ---------
CLEAR: t_detail_info.
t_detail_info-v_parnr = <lfs_pnwtyv_dia>-v_parnr.
t_detail_info-matnr = <lfs_pvwty_dia_mat>-matnr.
t_detail_info-item_type = <lfs_pvwty_dia_es2>-poskt_cust.
t_detail_info-iv_versn = <lfs_pnwtyv_dia>-versn.
t_detail_info-clmno = <lfs_pnwtyh_dia>-clmno.
t_detail_info-crncy = <lfs_pnwtyv_dia>-v_crncy.
t_detail_info-iv_meinh = <lfs_pvwty_dia_es2>-meinh.
t_detail_info-z_wty_model = <lfs_pnwtyh_dia>-z_wty_model.
ADD <lfs_pvwty_dia_es2>-quant TO
t_detail_info-iv_appr_qty.
SELECT SINGLE kbetr
INTO t_detail_info-iv_appr_rate
FROM konv
WHERE knumv = <lfs_pnwtyv_dia>-knumv
AND kposn = <lfs_pvwty_dia_es2>-posnr
AND kschl = 'ZVAP'
AND kinak = space.
* t_detail_info-flat_indic = <lfs_pnwtyh_dia>-z_wty_model
* t_detail_info-pric_indic = <lfs_pnwtyh_dia>-z_wty_serno
PERFORM get_the_submit_record
USING <lfs_pnwtyv_dia>-header_guid
<lfs_pnwtyv_dia>-prev_version
<lfs_pnwtyh_dia>-clmno
<lfs_pvwty_dia_es2>-posnr.
ENDIF.
* =====================
* Read next Linked item
* =====================
PERFORM read_next_item TABLES lt_pvwty_dia
CHANGING wa_index_link.
IF sy-subrc = 0.
ASSIGN <fs_pvwty_dia> TO <lfs_pvwty_dia_es2>.
ENDIF.
ENDWHILE.
EXIT. "Exit the DO loop
ENDDO.
ENDIF.
* ====================
* Read next "MAT" item
* ====================
PERFORM read_next_item TABLES lt_pvwty_dia_mat
CHANGING wa_index_mat.
IF sy-subrc = 0.
ASSIGN <fs_pvwty_dia> TO <lfs_pvwty_dia_mat>.
ENDIF.
ENDWHILE.
ENDLOOP.
* ========================
* Get the description text
* ========================
LOOP AT t_detail_info
ASSIGNING <fs_detail_info>.
* Get the model text -------------------------------------
SELECT SINGLE mfrpn
INTO <fs_detail_info>-z_wty_model
FROM mara
WHERE matnr = <fs_detail_info>-z_wty_model.
* Set Node name to regroup later by group -----------------
SELECT SINGLE name1
INTO <fs_detail_info>-name
FROM lfa1
WHERE lifnr = <fs_detail_info>-v_parnr.
* Set Node name to regroup later by group -----------------
SELECT SINGLE maktx
INTO <fs_detail_info>-maktx
FROM makt
WHERE matnr = <fs_detail_info>-matnr
AND spras = sy-langu.
MOVE-CORRESPONDING <fs_detail_info> TO t_summary_alv.
t_summary_alv-claim_nb = 1.
COLLECT t_summary_alv.
ENDLOOP.
* ===========================================
* Calculate the average of the summary report
* ===========================================
LOOP AT t_summary_alv
ASSIGNING <fs_summary_alv>.
DIVIDE <fs_summary_alv>-ov_prop_qty BY <fs_summary_alv>-claim_nb.
DIVIDE <fs_summary_alv>-ov_prop_rate BY <fs_summary_alv>-claim_nb.
DIVIDE <fs_summary_alv>-ov_submit_qty BY <fs_summary_alv>-claim_nb.
DIVIDE <fs_summary_alv>-ov_submit_rate BY <fs_summary_alv>-claim_nb.
DIVIDE <fs_summary_alv>-iv_appr_qty BY <fs_summary_alv>-claim_nb.
DIVIDE <fs_summary_alv>-iv_appr_rate BY <fs_summary_alv>-claim_nb.
ENDLOOP.
DELETE t_summary_alv WHERE v_parnr NOT IN s_vend.
ENDFORM. " select_claim_to_process
*& Form SET_HOT_SPOT
* text
* -->P_0287 text
FORM set_hot_spot TABLES p_fieldcat TYPE slis_t_fieldcat_alv
USING value(p_field).
FIELD-SYMBOLS: <lfs_field_cat> LIKE LINE OF gt_fieldcat_sum.
READ TABLE p_fieldcat WITH KEY fieldname = p_field
ASSIGNING <lfs_field_cat>.
IF sy-subrc = 0.
<lfs_field_cat>-hotspot = 'X'.
<lfs_field_cat>-key = 'X'.
ENDIF.
ENDFORM. " SET_HOT_SPOT
*& Form set_screen_text
* text
* -->P_0997 text
FORM set_screen_text USING p_label
p_text.
MOVE p_label TO :gtw_fieldcat-seltext_l,
gtw_fieldcat-seltext_m,
gtw_fieldcat-seltext_s,
gtw_fieldcat-reptext_ddic.
IF p_text NE space.
gtw_fieldcat-ddictxt = p_text.
ENDIF.
ENDFORM. " set_screen_text
*& Form set_default_variant
* text
* -->P_0822 text
* <--P_GS_VARIANT1 text
FORM set_default_variant CHANGING p_variant TYPE disvariant
p_disvar TYPE slis_vari.
* Get default variant
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = c_save
CHANGING
cs_variant = p_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_disvar = p_variant-variant.
ENDIF.
ENDFORM. " set_default_variant
*& Form validate_vendor
* text
* --> p1 text
* <-- p2 text
FORM validate_vendor.
DATA: l_lifnr LIKE lfa1-lifnr.
IF s_vend[] IS INITIAL.
ELSE.
SELECT SINGLE lifnr
INTO l_lifnr
FROM lfa1
WHERE lifnr IN s_vend.
IF sy-subrc NE 0.
MESSAGE e000 WITH text-e01.
ENDIF.
ENDIF.
ENDFORM. " validate_vendor
*& Form inform_claim_error
* text
* --> p1 text
* <-- p2 text
FORM inform_claim_error USING value(p_claim_no)
value(p_version).
DATA: l_text1(50),
l_text2(50).
CONCATENATE text-301
p_claim_no
INTO l_text1 SEPARATED BY space.
CONCATENATE text-302
p_version
text-303
INTO l_text2 SEPARATED BY space.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-200
txt1 = l_text1
txt2 = l_text2
txt3 = ' '
txt4 = text-304.
ENDFORM. " inform_claim_error
*& Form validate_posting_parameter
* text
* --> p1 text
* <-- p2 text
FORM validate_posting_parameter .
DATA: l_low_date TYPE d,
l_high_date TYPE d.
CLEAR: wa_low_date, wa_high_date.
* Posting parameters must be entered
IF s_cpudt[] IS INITIAL AND s_postdt[] IS INITIAL.
MESSAGE e000 WITH text-e04.
ENDIF.
* Posting paramters can't be intered at the same time
IF s_cpudt[] IS INITIAL OR s_postdt[] IS INITIAL.
ELSE.
MESSAGE e000 WITH text-e03.
ENDIF.
* Validate posting period ---------------------------------------------
IF s_postdt[] IS INITIAL.
READ TABLE s_cpudt INDEX 1.
IF s_cpudt-low IS INITIAL.
MESSAGE e000 WITH text-e03.
ENDIF.
PERFORM validate_period USING s_cpudt-low
CHANGING l_low_date
l_high_date.
wa_low_date = l_low_date.
wa_high_date = l_high_date.
IF s_cpudt-high IS INITIAL.
ELSE.
PERFORM validate_period USING s_cpudt-high
CHANGING l_low_date
l_high_date.
IF s_cpudt-high LT s_cpudt-low.
MESSAGE ID 'DB' TYPE 'E' NUMBER '650' .
ENDIF.
wa_high_date = l_high_date.
ENDIF.
ELSE.
* Validate posting date --------------------------------------------
READ TABLE s_postdt INDEX 1.
wa_low_date = s_postdt-low.
IF s_postdt-high IS INITIAL.
wa_high_date = wa_low_date.
ELSE.
wa_high_date = s_postdt-high.
ENDIF.
ENDIF.
ENDFORM. " validate_posting_parameter
*& Form get_fin_period
* Get the financial period from 1960 to 9999
* --> p1 text
* <-- p2 text
FORM get_fin_period USING value(p_year_low)
value(p_year_high).
DATA : BEGIN OF fp_table OCCURS 0,
periv LIKE t009b-periv, "FINANCIAL YEAR VARIANT
bdatj LIKE t009b-bdatj, "CALENDAR YEAR
bumon LIKE t009b-bumon, "MONTH
butag LIKE t009b-butag, "DAY OF MONTH
poper LIKE t009b-poper, "COST PERIOD
reljr LIKE t009b-reljr, "YEAR SHIFT
END OF fp_table.
DATA: l_fin_bdatj LIKE t009b-bdatj,
l_period_start TYPE d,
l_period_end TYPE d,
l_prev_period_end TYPE d,
l_prev_fin_bdatj LIKE t009b-bdatj,
l_prev_poper LIKE t009b-poper,
l_count TYPE n.
* Get the Fiscal year variant periods
SELECT periv bdatj bumon butag poper reljr
INTO TABLE fp_table
FROM t009b
WHERE periv = 'ZB'.
LOOP AT fp_table.
IF l_prev_period_end NE '00000000'.
l_period_start = l_prev_period_end + 1.
ENDIF.
CONCATENATE fp_table-bdatj fp_table-bumon fp_table-butag
INTO l_period_end.
l_prev_period_end = l_period_end.
l_fin_bdatj = fp_table-bdatj + fp_table-reljr.
IF c_year_low NE '' AND l_fin_bdatj LT p_year_low.
CONTINUE.
ELSEIF p_year_high NE '' AND l_fin_bdatj GT p_year_high.
CONTINUE.
ELSEIF p_year_low NE '' AND p_year_high EQ '' AND
l_fin_bdatj GT c_year_low.
CONTINUE.
ENDIF.
IF l_prev_fin_bdatj EQ l_fin_bdatj AND
l_prev_poper EQ fp_table-poper.
it_period-end = l_period_end.
MODIFY it_period TRANSPORTING end
WHERE year = it_period-year
AND poper = it_period-poper.
ELSE.
it_period-year = l_fin_bdatj.
it_period-poper = fp_table-poper+1.
it_period-start = l_period_start.
it_period-end = l_period_end.
INSERT TABLE it_period.
ENDIF.
l_prev_fin_bdatj = l_fin_bdatj.
l_prev_poper = fp_table-poper.
IF l_count EQ 0.
l_count = l_count + 1.
ENDIF.
ENDLOOP.
ENDFORM. " get_fin_period
*& Form set_period_to_analyse
* Find the fiscal period for a specific date
* --> p1 text
* <-- p2 text
FORM set_period_to_analyse.
LOOP AT it_period
ASSIGNING <fs_it_period>
WHERE start LE sy-datum
AND end GE sy-datum.
CONCATENATE <fs_it_period>-year
<fs_it_period>-poper
INTO s_cpudt-low.
s_cpudt-sign = 'I'.
s_cpudt-option = 'EQ'.
APPEND s_cpudt.
EXIT.
ENDLOOP.
ENDFORM. " set_period_to_analyse
*& Form validate_material
* text
* --> p1 text
* <-- p2 text
FORM validate_material .
DATA: l_matnr LIKE mara-matnr.
IF s_matnr[] IS INITIAL.
ELSE.
SELECT SINGLE matnr
INTO l_matnr
FROM mara
WHERE matnr IN s_matnr.
IF sy-subrc NE 0.
MESSAGE e000 WITH text-e02.
ENDIF.
ENDIF.
ENDFORM. " validate_material
*& Form validate_claim_group
* text
* --> p1 text
* <-- p2 text
FORM validate_claim_group .
DATA: l_clmgrp LIKE cwty006-clmgrp.
IF s_clgrp[] IS INITIAL.
ELSE.
SELECT SINGLE clmgrp
INTO l_clmgrp
FROM cwty006
WHERE clmgrp IN s_clgrp.
IF sy-subrc NE 0.
MESSAGE e000 WITH text-e06.
ENDIF.
ENDIF.
ENDFORM. " validate_claim_group
*& Form set_alv_field_desc
* text
* -->P_LTW_FIELDCATALOG text
* <--P_GTW_FIELDCAT text
FORM set_alv_field_desc USING value(p_fieldcat) TYPE lvc_s_fcat
value(p_level).
gtw_fieldcat-seltext_l = p_fieldcat-scrtext_l.
gtw_fieldcat-seltext_m = p_fieldcat-scrtext_m.
gtw_fieldcat-seltext_s = p_fieldcat-scrtext_s.
gtw_fieldcat-reptext_ddic = p_fieldcat-reptext.
CASE p_fieldcat-fieldname.
WHEN 'NAME'.
PERFORM set_screen_text USING 'Vendor Name' 'L'.
WHEN 'MAKTX'.
PERFORM set_screen_text USING 'Material Description' 'L'.
WHEN 'CLAIM_NB'.
PERFORM set_screen_text USING '#Claims' 'L'.
WHEN 'IV_MEINH'.
PERFORM set_screen_text USING 'IV UoM' 'L'.
WHEN 'OV_MEINH'.
PERFORM set_screen_text USING 'OV UoM' 'L'.
WHEN 'FLAT_INDIC'.
PERFORM set_screen_text USING 'Flat Rate Ind.' 'L'.
WHEN 'PRIC_INDIC'.
PERFORM set_screen_text USING 'Price Ind.' 'L'.
WHEN 'OV_PROP_QTY'.
IF p_level = 1. "Summary report
*BEGIN OF TR#D03K935718
* PERFORM set_screen_text USING 'OV avg. Prop. Qty' 'L'.
PERFORM set_screen_text USING 'Avg Prop Qty Sub' 'L'. "RFC2917
*END OF TR#D03K935718
ELSE.
PERFORM set_screen_text USING 'OV Prop. Qty' 'L'.
ENDIF.
WHEN 'OV_PROP_RATE'.
IF p_level = 1. "Summary report
*BEGIN OF TR#D03K935718
* PERFORM set_screen_text USING 'OV avg. Prop. Rate $' 'L'.
PERFORM set_screen_text USING 'Avg Prop Rate Sub' 'L'. "RFC2917
*END OF TR#D03K935718
ELSE.
PERFORM set_screen_text USING 'OV Prop. Rate $' 'L'.
ENDIF.
WHEN 'OV_SUBMIT_QTY'.
IF p_level = 1. "Summary report
*BEGIN OF TR#D03K935718
* PERFORM set_screen_text USING 'OV avg. Submit Qty' 'L'.
PERFORM set_screen_text USING 'Avg Qty Sub' 'L'. "RFC2917
*END OF TR#D03K935718
ELSE.
PERFORM set_screen_text USING 'OV Submit Qty' 'L'.
ENDIF.
WHEN 'OV_SUBMIT_RATE'.
IF p_level = 1. "Summary report
*BEGIN OF TR#D03K935718
* PERFORM set_screen_text USING 'OV avg. Submit Rate $' 'L'.
PERFORM set_screen_text USING 'Avg Rate Sub' 'L'. "RFC2917
*END OF TR#D03K935718
ELSE.
PERFORM set_screen_text USING 'OV Submit Rate $' 'L'.
ENDIF.
WHEN 'IV_APPR_QTY'.
IF p_level = 1. "Summary report
*BEGIN OF TR#D03K935718
* PERFORM set_screen_text USING 'IV Avg. Appr. Qty' 'L'.
PERFORM set_screen_text USING 'Avg Qty Pd' 'L'. "RFC2917
*END OF TR#D03K935718
ELSE.
PERFORM set_screen_text USING 'IV Appr. Qty' 'L'.
ENDIF.
WHEN 'IV_APPR_RATE'.
IF p_level = 1. "Summary report
*BEGIN OF TR#D03K935718
* PERFORM set_screen_text USING 'IV Avg. Appr. Rate $' 'L'.
PERFORM set_screen_text USING 'Avg Rate Pd' 'L'. "RFC2917
*END OF TR#D03K935718
ELSE.
PERFORM set_screen_text USING 'IV Appr. Rate $' 'L'.
ENDIF.
WHEN 'OV_VERSN'.
PERFORM set_screen_text USING 'OV Versn.' 'L'.
WHEN 'IV_VERSN'.
PERFORM set_screen_text USING 'IV Versn.' 'L'.
WHEN OTHERS.
gtw_fieldcat-ddictxt = p_fieldcat-selddictxt.
ENDCASE.
* Initialisation des Labels des entetes de colonne -------------------
gtw_fieldcat-no_out = p_fieldcat-no_out.
gtw_fieldcat-emphasize = p_fieldcat-emphasize.
gtw_fieldcat-fix_column = p_fieldcat-fix_column.
gtw_fieldcat-icon = p_fieldcat-icon.
gtw_fieldcat-no_zero = 'X'.
gtw_fieldcat-do_sum = p_fieldcat-do_sum.
ENDFORM. " set_alv_field_desc
*& Form validate_period
* text
* -->P_S_CPUDT_LOW text
FORM validate_period USING value(p_period)
CHANGING p_low_date TYPE d
p_high_date TYPE d.
DATA: l_year(4),
l_poper(2).
l_year = p_period(4).
l_poper = p_period+4(2).
READ TABLE it_period WITH KEY year = l_year
poper = l_poper
ASSIGNING <fs_it_period>.
IF sy-subrc NE 0.
MESSAGE e000 WITH text-e04.
ENDIF.
p_low_date = <fs_it_period>-start.
p_high_date = <fs_it_period>-end.
ENDFORM. " validate_period
*& Form read_next_item
* text
* --> p1 text
* <-- p2 text
FORM read_next_item TABLES pt_pvwty_dia STRUCTURE wty_pvwty_dia
CHANGING p_index TYPE i.
p_index = p_index + 1.
* Read next Item information ------------------------------
READ TABLE pt_pvwty_dia INDEX p_index
ASSIGNING <fs_pvwty_dia>.
ENDFORM. " read_next_item
*& Form get_the_submit_record
* text
* -->P_<LFS_PNWTYV_DIA>_HEADER_GUID text
* -->P_<LFS_PNWTYV_DIA>_PREV_VERSION text
FORM get_the_submit_record USING p_header_guid
p_prev_version
p_claim_no
p_posnr.
DATA: l_nb_while TYPE i,
l_zaehk LIKE konv-zaehk,
l_submit_found(1).
* ... USD1092841 - Add Start
FIELD-SYMBOLS: <fs_submit_rec_vs3> TYPE tp_submit_records.
* ... USD1092841 - Add End
CLEAR: l_submit_found, l_nb_while.
READ TABLE it_submit_records
WITH KEY header_guid = p_header_guid
versn = p_prev_version
ASSIGNING <fs_submit_rec_vs2>.
WHILE sy-subrc = 0 .
ADD 1 TO l_nb_while.
* if more than 30 loop(endless loop), it means somHi Siddarth
As per query, if you want to display sums automatically when you report is displayed for the first time, you'll have to modify your field catalog a bit.
To acheive this, you need to identify the field for which the totals are calculated ex- for every new material num, or for every new documnet number etc.
once you have this info, you identify the field that has to be totaled.
then while building your fieldcatalog, set this parameter :
l_wa_fieldcat-do_sum = 'X' for the field that has to be totaled.
and when you build a sort table then set this parameter:
l_t_sort TYPE slis_t_sortinfo_alv.
l_s_sort-subtot = 'X'. for the field for which totals are calculated.
Hope this helps.
Cheers
Ravish
Reward if helpful -
Hi Gurus,
I have create one report which should monitor the batch jobs.
I some small requirements in that report. Can one can help in updating my code.
Reuirements:
Last run date and time should allow only one entry and these should be placed in one line as shown in the requirements.
· F4 on Job status should show the description also.
· F4 on user name should give user details. It should be similar to the f4 in transaction SU01D
· Donu2019t show the entire log on the report. Show only 1 line per job with similar to what is shown in the SM37 report. Job Name, Start Date, Start Time, Job Created By, Sppol, Status, Duration. User can double click on it to see job log or spool list.
below is the report. Please help me out
REPORT ZJOB_MONITORING.
T A B L E S
TABLES: tbtco.
T Y P E - S P O O L S
TYPE-POOLS: slis.
T Y P E D E C L A R A T I O N S
*TYPES: BEGIN OF type_tbtco,
include TYPE tbtco,
END OF type_tbtco.
TYPES: BEGIN OF type_output,
STRTTIME TYPE tbtco-STRTTIME,
strtdate TYPE tbtco-strtdate,
jobname TYPE tbtco-jobname,
line TYPE string,
END OF type_output.
S T R U C T U R E S
DATA: s_tbtco TYPE tbtco,
s_joblog TYPE zsbb_uc4_joblog,
s_output TYPE type_output.
I N T E R N A L T A B L E S
DATA: i_tbtco TYPE STANDARD TABLE OF tbtco,
i_joblog TYPE STANDARD TABLE OF zsbb_uc4_joblog,
i_output TYPE STANDARD TABLE OF type_output.
DATA: Begin of itab_jobname OCCURS 0,
jobname type tbtco-jobname,
end of itab_jobname.
DATA: Begin of itab_user OCCURS 0,
jobname type tbtco-sdluname,
end of itab_user.
DATA: Begin of itab_stat OCCURS 0,
jobname type tbtco-status,
end of itab_stat.
DATA: Begin of itab_uzeit occurs 0,
uzeit type sy-uzeit,
end of itab_uzeit.
Heading of the report.
DATA: t_heading TYPE slis_t_listheader.
DATA : t_fieldcat TYPE slis_t_fieldcat_alv.
S E L E C T I O N S C R E E N
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_strtda FOR sy-datum,
s_lstrun FOR sy-uzeit OBLIGATORY,
s_jobnam FOR tbtco-jobname,
s_user FOR tbtco-sdluname,
s_status FOR tbtco-status.
PARAMETERS: p_email AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK bl1.
" AT SELECTION-SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_JOBNAM-LOW.
PERFORM f4_JOBNAM-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_JOBNAM-HIGH.
PERFORM f4_JOBNAM-HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_user-low.
PERFORM f4_USER-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_user-high.
PERFORM f4_USER-HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_status-low.
PERFORM f4_STATUS-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_status-high.
PERFORM f4_STATUS-HIGH.
S T A R T O F S E L E C T I O N
START-OF-SELECTION.
PERFORM select_data.
If email is checked.
Send the output table as an email attachment to the distribution list.
Get the email list from the config table. " ask from where to get it
IF p_email = 'X'.
Call FM 'SO_OBJECT_SEND'.
Fill the fields which are not commented accordingly.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
OBJECT_HD_CHANGE = OBJECT_HD_CHANGE
OBJECT_TYPE = 'RAW'
OWNER = SY-UNAME
TABLES
OBJCONT = TEXT
OBJPARA = OBJPARA
RECEIVERS = RECEIVERS
EXCEPTIONS
OTHERS = 01.
IF SY-SUBRC NE 0.
RAISE ERROR.
ENDIF.
ENDIF.
Prepare the ALV Report.
PERFORM alv_grid_display.
*& Form alv_grid_display
text
FORM alv_grid_display .
alv required data objects.
DATA: w_repid TYPE syrepid,
x_layout TYPE slis_layout_alv,
t_event TYPE slis_t_event,
t_fieldcat TYPE slis_t_fieldcat_alv,
w_title TYPE lvc_title,
w_print TYPE slis_print_alv,
w_comm TYPE slis_formname,
flag TYPE c VALUE 'N'.
REFRESH t_fieldcat.
REFRESH t_event.
CLEAR x_layout.
CLEAR w_title.
Field Catalog
PERFORM set_fieldcat2 USING:
1 'strttime' 'BTCXTIME' space t_fieldcat ,
2 'jobname' 'BTCJOB' space t_fieldcat ,
3 'line' space 'Job Log' t_fieldcat .
*PERFORM set_fieldcat2 USING:
1 'strttime' 'BTCXTIME' space 'I_OUTPUT' t_fieldcat ,
2 'jobname' 'BTCJOB' space 'I_OUTPUT' t_fieldcat ,
3 'line' space 'Job Log' 'I_OUTPUT' t_fieldcat .
PERFORM set_fieldcat.
Layout
x_layout-zebra = 'X'.
x_layout-colwidth_optimize = 'X'.
GUI Status
w_repid = sy-repid .
Top of page heading
PERFORM set_top_page_heading USING t_heading t_event flag.
call the FM 'REUSE_ALV_GRID_DISPLAY'
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = x_layout
it_fieldcat = t_fieldcat
IT_SORT =
i_save = 'X'
it_events = t_event
TABLES
t_outtab = i_output
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_grid_display
*& Form set_top_page_heading
text
FORM set_top_page_heading USING
t_heading TYPE slis_t_listheader
t_events TYPE slis_t_event
flag TYPE c.
DATA: x_heading TYPE slis_listheader,
x_event TYPE LINE OF slis_t_event.
Report title
CLEAR t_heading[].
CLEAR x_heading.
x_heading-typ = 'H'.
x_heading-info = 'Job Details'(002).
APPEND x_heading TO t_heading.
Name of the report program
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Report ID:'.
x_heading-info = sy-repid.
APPEND x_heading TO t_heading.
User who is running the report
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-key = 'User: '.
x_heading-info = sy-uname.
APPEND x_heading TO t_heading.
Date of execution
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Date: '.
WRITE sy-datum TO x_heading-info.
APPEND x_heading TO t_heading.
Time of execution
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Time: '.
WRITE sy-uzeit TO x_heading-info.
APPEND x_heading TO t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
APPEND x_event TO t_events.
ENDFORM. " set_top_page_heading
*& Form set_fieldcat2
text
FORM set_fieldcat2 USING
p_colpos p_fieldname p_ref_fieldname
p_seltext_m
p_tabname
t_fieldcat TYPE slis_t_fieldcat_alv.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
the ref_fieldname given is a data element.
IF NOT p_ref_fieldname IS INITIAL.
wa_fieldcat-rollname = p_ref_fieldname.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
wa_fieldcat-tabname = 'I_OUTPUT'.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. " set_fieldcat2
*& Form F4_JOBNAM-LOW
text
--> p1 text
<-- p2 text
FORM F4_JOBNAM-LOW .
SELECT jobname FROM tbtco
INTO TABLE itab_jobname.
DELETE ADJACENT DUPLICATES FROM itab_jobname.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
DDIC_STRUCTURE = ' '
retfield = 'jobname'
PVALKEY = ' '
DYNPPROG = 'sy-repid'
DYNPNR = '1000'
DYNPROFIELD = 's_jobnam-low'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
tables
value_tab = itab_jobname
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " F4_JOBNAM-LOW
*& Form F4_JOBNAM-HIGH
text
--> p1 text
<-- p2 text
FORM F4_JOBNAM-HIGH .
SELECT jobname FROM tbtco
INTO TABLE itab_jobname.
DELETE ADJACENT DUPLICATES FROM itab_jobname.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
DDIC_STRUCTURE = ' '
retfield = 'jobname'
PVALKEY = ' '
DYNPPROG = 'sy-repid'
DYNPNR = '1000'
DYNPROFIELD = 's_jobnam-high'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
tables
value_tab = itab_jobname
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " F4_JOBNAM-HIGH
*& Form F4_USER-LOW
text
--> p1 text
<-- p2 text
FORM F4_USER-LOW .
SELECT sdluname FROM tbtco
INTO TABLE itab_user.
DELETE ADJACENT DUPLICATES FROM itab_user.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
DDIC_STRUCTURE = ' '
retfield = 'user'
PVALKEY = ' '
DYNPPROG = 'sy-repid'
DYNPNR = '1000'
DYNPROFIELD = 's_user-low'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
tables
value_tab = itab_user
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " F4_USER-LOW
*& Form F4_USER-HIGH
text
--> p1 text
<-- p2 text
FORM F4_USER-HIGH .
SELECT sdluname FROM tbtco
INTO TABLE itab_user.
DELETE ADJACENT DUPLICATES FROM itab_user.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
DDIC_STRUCTURE = ' '
retfield = 'user'
PVALKEY = ' '
DYNPPROG = 'sy-repid'
DYNPNR = '1000'
DYNPROFIELD = 's_user-high'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
tables
value_tab = itab_user
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " F4_USER-HIGH
*& Form F4_STATUS-LOW
text
--> p1 text
<-- p2 text
FORM F4_STATUS-LOW .
SELECT status FROM tbtco
INTO TABLE itab_stat.
DELETE ADJACENT DUPLICATES FROM itab_stat.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
DDIC_STRUCTURE = ' '
retfield = 'status'
PVALKEY = ' '
DYNPPROG = 'sy-repid'
DYNPNR = '1000'
DYNPROFIELD = 's_status-low'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
tables
value_tab = itab_stat
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " F4_STATUS-LOW
*& Form F4_STATUS-HIGH
text
--> p1 text
<-- p2 text
FORM F4_STATUS-HIGH .
SELECT status FROM tbtco
INTO TABLE itab_stat.
DELETE ADJACENT DUPLICATES FROM itab_stat.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
DDIC_STRUCTURE = ' '
retfield = 'status'
PVALKEY = ' '
DYNPPROG = 'sy-repid'
DYNPNR = '1000'
DYNPROFIELD = 's_status-high'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'C'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
tables
value_tab = itab_stat
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " F4_STATUS-HIGH
*& Form SELECT_DATA
text
--> p1 text
<-- p2 text
FORM SELECT_DATA .
select the entries from the table TBTCO
as per the selection screen
SELECT * FROM tbtco
INTO TABLE i_tbtco
WHERE STRTTIME IN s_lstrun AND
strtdate IN s_strtda AND
jobname IN s_jobnam AND
sdluname IN s_user AND
status IN s_status.
Get the job details for the above jobs.
LOOP AT i_tbtco INTO s_tbtco.
CALL FUNCTION 'ZSBB_UC4_JOB_READ_LOG'
EXPORTING
client = sy-mandt
jobcount = s_tbtco-jobcount
joblog = s_tbtco-joblog
jobname = s_tbtco-jobname
TABLES
joblog_tab = i_joblog
EXCEPTIONS
cant_read_joblog = 1
jobcount_missing = 2
joblog_does_not_exist = 3
joblog_is_empty = 4
joblog_name_missing = 5
jobname_missing = 6
job_does_not_exist = 7
OTHERS = 8.
Write the Error handling as needed.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
Append entries to main table.
s_output-STRTTIME = s_tbtco-STRTTIME.
s_output-jobname = s_tbtco-jobname.
LOOP AT i_joblog INTO s_joblog.
s_output-line = s_joblog-text.
APPEND s_output TO i_output.
CLEAR s_output.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDFORM. " SELECT_DATA
*& Form SET_FIELDCAT
text
--> p1 text
<-- p2 text
form SET_FIELDCAT .
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'STRTTIME'.
wa_fieldcat-seltext_m = 'Start Time'.
wa_fieldcat-tabname = 'I_OUTPUT'.
wa_fieldcat-reptext = p_reptext.
APPEND wa_fieldcat to t_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'JOBNAME'.
wa_fieldcat-seltext_m = 'Job Name'.
wa_fieldcat-tabname = 'I_OUTPUT'.
wa_fieldcat-reptext = p_reptext.
APPEND wa_fieldcat to t_fieldcat.
wa_fieldcat-col_pos = 3.
wa_fieldcat-fieldname = 'LINE'.
wa_fieldcat-seltext_m = 'Job Log'.
wa_fieldcat-tabname = 'I_OUTPUT'.
APPEND wa_fieldcat to t_fieldcat.
endform. " SET_FIELDCATsolved
-
How to extract the column width in ALv report if its executed in background
I am executing an ALV report in background , in front end i am getting data properly, in back end for some columns some of the digits are missing.For example if PO no is of 10 digits it will display only 8 becos column size is like that , how to extract coulmns in back ground.
I have executed in background and checked the spool and for some of the columns width is not sufficient to display comeplete data so please suggest how to extract the columns sizes if executed inj background for an ALVHi Deepthi,
you can try with the above mentioned suggestions ,if its worked its fine ,
If not use Docking container instead of custom container, For ALV in back ground jobs, its suggest to use docking container instead of custom container , below you can find the declaration for docking container and code to use docking and custom container in your program for fore and back ground.
or you can use docking container alone for both operations.
Data : G_DOCK1 TYPE REF TO CL_GUI_DOCKING_CONTAINER,
IF CCON IS INITIAL. (ccon is container name )
*Check whether the program is run in batch or foreground
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
*Run in foreground
CREATE OBJECT CCON
EXPORTING
CONTAINER_NAME = 'CON1'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = parent_1.
ELSE.
*Run in background
CREATE OBJECT GRID1
EXPORTING
I_PARENT = G_DOCK1.
ENDIF.
ENDIF.
B&R,
Saravana.S
Maybe you are looking for
-
Blue Question marks appear...
Blue Question marks appear when websites like Facebook have pictures. This began after Uverse was installed in my home. It did not do this previously with ATT High Speed Internet. Uverse claims this is a computer issue. SOMEONE HELP! Yes my compu
-
How to set 1 field in anothers converter
I have a converter on a field. I also have a field for an informational message. I either need to be able to set a FacesMessage in the backingBean method, or be able to blank out the informational message field in the converter. Here is part of the J
-
Subinventory transfer integer quantity.
Hello, Is there any way to enforce integer primary unit of measure quantities in the subinventory transfer transaction? I need to make sure I don't end up with half a laptop in the subinventory. But I still would need to transact 0.5 DZ (6 PZ) of lap
-
Duplex printing no longer working
I occasionally use duplex printing, but when I tried recently it no longer worked. I am using 10.5.8 on a MBP. Used to work just fine, even say 3 months ago, but not now. I tried with VMWare Fusion running XP and selected the same printer and duplex.
-
Does Premiere Pro CS4 really support Vista 64-bit?
I have installed Premiere Pro CS4 on my Vista 64-bit server and recognized in the task manager that Premiere is listed as a 32-bit application "Adobe Premiere Pro.exe *32" which makes me wonder if Adobe's statement given in the FAQ is correct, where