Help,Webdynpro ALV report
Hello,
My Webdynpro ALV report display SFLIGHT all fields .
But I want to show only five fields,
how code?
CODE::
data:node_flights type ref to if_wd_context_node,
it_flights type sflight_tab1,
is_flights type sflight,
it_final type IF_MAIN=>elements_flights,
is_final type IF_MAIN=>element_flights.
select * from sflight into table it_flights up to 10 rows.
node_flights = wd_context->get_child_node( 'FLIGHTS' ).
data:l_ref_cmp_usage type ref to if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
data:l_ref_interfacecontroller type ref to iwci_salv_wd_table.
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
navigate from <CONTEXT> to <NODE_FLIGHT> via lead selection
node_flights = wd_context->get_child_node( name = `NODE_FLIGHT` ).
fill context node
node_flights ->bind_table( it_flight ).
endmethod.
thanks
HI,
There is no need to change your code.
Do one thing.
Create a node SFLIGHT and do not add dictionary structure SFLIGHT.
Then create what are the required five attributes under it.
Make sure all these five refer to the dictionary data elements.
example: If you want carrid declare dectionary structure S_CARR_ID.
Like wise.
Now finally goto component usage->ALV->INTERFACECONTROLLER in the
left side tree of web dynpro component.
Then create component usage and drag SFLIGHT node to DATA of the context.
It is one of the way.
Second way is.
Create SFLIGHT node and mention SFLIGHT as stricture and select five required attributes that you need.
Now after creation of SFLIGHT NODE just delete the structure name present in the PROPERTIES of
SFLIGHT NODE.
Now finally goto component usage->ALV->INTERFACECONTROLLER in the
left side tree of web dynpro component.
Then create component usage and drag SFLIGHT node to DATA of the context.
I hope it helped you.
Regards and Best wishes.
Similar Messages
-
F4 help in ALV report output (FM REUSE_ALV_GRID_DISPLAY)
Hello,
I have developed ALV report using the FM REUSE_ALV_GRID_DISPLAY.
My requirement is to have a customized search help on the output of ALV on one field.
I tried to find it on SDN but all the methods are using OO ALV.
How we can attaché customized search help in ALV developed using the FM REUSE_ALV_GRID_DISPLAY.
Kindly Help
Regards
SachinHii..
If you use OO then it is very easy to create a F4 help on the ALV..
try this sample code
<removed by moderator>
Hope this will help u..
Regards,
Jhings
Moderator message: please post only relevant code parts, your post must be less than 5000 characters to preserve formatting.
Edited by: Thomas Zloch on Mar 28, 2011 12:51 PM -
Nee help on ALV report for Total of BSEG-BUZEI & F1 document in FB03
Hi friends,
I need to diplay line items total & when double clicked on BELNR field it should open the F1 document in FB03.
Could anyone plz guide me on this.
Waiting for response.
below is my code,
Kindly needed help.
REPORT YALV_1.
TABLES : BKPF,BSEG.
Data for ALV display
TYPE-POOLS: SLIS.
data : int_fcat type SLIS_T_FIELDCAT_ALV,
fieldcatalog type slis_t_fieldcat_alv with header line.
DATA: wa_sortinfo TYPE slis_sortinfo_alv,
i_sortcat TYPE slis_t_sortinfo_alv.
TYPES : BEGIN OF T_BKPF,
BUKRS TYPE BKPF-BUKRS,
BELNR TYPE BKPF-BELNR,
GJAHR TYPE BKPF-GJAHR,
BLART TYPE BKPF-BLART,
BLDAT TYPE BKPF-BLDAT,
BUDAT TYPE BKPF-BUDAT,
END OF T_BKPF.
types: begin of t_bseg,
BUZEI TYPE BSEG-BUZEI,
end of t_bseg.
DATA : it_bkpf TYPE STANDARD TABLE OF t_bkpf with header line,
wa_bkpf TYPE t_bkpf,
it_bseg type standard table of t_bseg.
wa_bseg type t_bseg.
field to store report name
DATA : i_repid like sy-repid.
select bukrs belnr gjahr blart bldat budat from bkpf into table
it_bkpf where blart = 'AA'.
field to check table length
*data i_lines like sy-tabix.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
PERFORM sortcat_init CHANGING i_sortcat.
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 = 'BUKRS'.
fieldcatalog-seltext_m = 'Company Code'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 4.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BELNR'.
fieldcatalog-seltext_m = 'Doc No'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'GJAHR'.
fieldcatalog-seltext_m = 'Fiscal Year'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLART'.
fieldcatalog-seltext_m = 'DOC Type'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLDAT'.
fieldcatalog-seltext_m = 'Doc Date'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BUDAT'.
fieldcatalog-seltext_m = 'Popsting Date'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BUZEI'.
fieldcatalog-seltext_m = 'Line Items'.
fieldcatalog-col_pos = 6.
fieldcatalog-do_sum = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
FORM sortcat_init CHANGING i_sortcat TYPE slis_t_sortinfo_alv.
CLEAR wa_sortinfo.
wa_sortinfo-fieldname = 'BUKRS'.
wa_sortinfo-tabname = 'T_BKPF'.
wa_sortinfo-spos = 1. " First sort by this field.
wa_sortinfo-up = 'X'. " Ascending
wa_sortinfo-subtot = 'X'. " Subtotal at Name1
APPEND wa_sortinfo TO i_sortcat.
CLEAR wa_sortinfo.
wa_sortinfo-fieldname = 'BELNR'.
wa_sortinfo-tabname = 'T_BKPF'.
wa_sortinfo-spos = 2. " Sec sort by this field.
wa_sortinfo-up = 'X'. " Ascending
wa_sortinfo-subtot = 'X'. " Subtotal at Name1
APPEND wa_sortinfo TO i_sortcat.
ENDFORM. " sortcat_init
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
i_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = i_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_sort = i_sortcat
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
tables
t_outtab = IT_BKPF
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
form data_retrieval.
IF it_bkpf[] IS NOT INITIAL.
select buzei from bseg into
table it_bseg for all entries in it_bkpf
where bukrs = it_bkpf-bukrs
and belnr = it_bkpf-belnr
and gjahr = it_bkpf-gjahr.
endif.
endform. " DATA_RETRIEVAL.Hello
1.
form display_alv_report.
i_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = IT_BKPF
exceptions
program_error = 1
others = 2.
2.
* FORM USER_COMMAND
FORM user_command USING u_com LIKE sy-ucomm sel_lin TYPE slis_selfield.
CASE u_com.
WHEN '&IC1'.
CASE sel_lin.
WHEN 'BELNR'.
read TABLE IT_BKPF INDEX sel_lin-tabindex.
SET PARAMETER ID 'BLN' FIELD IT_BKPF-BELNR.
SET PARAMETER ID 'BUK' FIELD IT_BKPF-BUKRS.
SET PARAMETER ID 'GJR' FIELD IT_BKPF-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDCASE.
CLEAR u_com.
ENDCASE.
ENDFORM. "USER_COMMAND -
i need to develop alv report which displays po and corresponding invoice receipt information.
what all fields can i include in invoice receipt information.please help on this.thanks in advance.credit will be given.Hi,
Check the following link:
http://www.sapbrain.com/TUTORIALS/TECHNICAL/ALV_tutorial.html
http://www.sapbrain.com/ARTICLES/TECHNICAL/ABAP/company%20logo%20in%20the%20top%20of%20alv%20report.html
Regards,
Bhaskar -
F4 help in alv report ( after execution )
hi all,
i want f4 help in my alv report( after execute it) in a particular filed.
is this possible???
In Advance Thanks
Amit Singhhi,
use ref_fieldname and ref_tabname
like below
wa_fieldcat-ref_fieldname= 'NAME1'.
wa_fieldcat-ref_tabname = 'KNA1'.
Hope this helps
Regards
Ritesh J -
Hi All,
I am working on ALV report.I need one logic.
When Ever I executed report, The output should looks 'Selected Total data' like Yellow color. How can i do that.
The report out should show sthe ' All the data is selected'. Just like Ctrl+A.
regards,
AjayHi
if you wants to see the totals in separate color , you develop the I_SORT table with the respective fields and pass to the fun module
then that total field will be always displayed with yelloe color
or
See this sample code to color the ALV fields
and accordingly assign the color for your field
REPORT zsharad_test1.
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,
line_color(4) TYPE c, "Used to store row color attributes
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.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
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-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).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
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_LIST_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_XEVENTS
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.
DATA: ld_color(1) TYPE c.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
*Populate field with color attributes
LOOP AT it_ekko INTO wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
MODIFY it_ekko FROM wa_ekko.
ENDLOOP.
ENDFORM. " DATA_RETRIEVAL
Regards
Anji -
Is there any help for ALV report development with funcation modules?
Hi,
please tell me any help or example to understand the ALV function module.Hi neha,
1. very simple alv
(with minimum code)
2. just copy paste
3.
report abc.
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvfcwa TYPE slis_fieldcat_alv.
data : begin of itab occurs 0.
include structure usr02.
data : end of itab.
START-OF-SELECTION.
select * from usr02
into table itab.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
regards,
amit m. -
hi,
i am new to ALV programming,i awant to generate the report with three teable mseg,mkpf,mard.
i need selection screen also.
in the selection screen following is the field names.
Matdoc number-mseg-mblnr
mat number - mseg-matnr
plant - mseg-werks
sloc mseg-lgort
movtype- mseg-bwart.
batch number- mseg-charg.
ordernumber -mseg-aufnr.
costcenter- mseg-kostl.
reservation number- mseg-rsnum.
storage bin - mard-lgpbe.
i want to fetch the data from three tables
mseg,mard,mkpf.
after featch report should disply in alv grid following items.
Matdoc number-mseg-mblnr
mat number - mseg-matnr
plant - mseg-werks
sloc mseg-lgort
movtype- mseg-bwart.
batch number- mseg-charg.
ordernumber -mseg-aufnr.
costcenter- mseg-kostl.
reservation number- mseg-rsnum.
storage bin - mard-lgpbe.
posting date - mkpf-budat.
if any body have the code kindly send it as early as posible.
Thanks,
Rammohan.here is a sample program i think almost containing the same tables and fields
*& Report ZSD_R_ENHANCEMENT2 *
*& REPORT PROGRAMMING FOR THE FURTHER ENHANCEMENT OF THE PRE-GENERATED
*& MB51. REQUIREMENT IS TO ADD FIVE MORE FIELDS.
*& OLD MATERIAL ON THE TOP LEFT CORNER OF THE HEADER AND
*& Batch number the right of material document.
*& Serial number if found should be placed to the right of the batch number.
*& Handling unit/ storage unit to the right of serial number.
*& Transaction description at the last of the report.
REPORT ZSD_R_ENHANCEMENT2 MESSAGE-ID ZB6T2 .
*& STRUCTURE CREATION FOR INTERNAL TABLES *
*STRUCUTRE CREATION FOR HEADER MATERIAL DOCMENT AND DOCUMENT SEGEMNT MATERIAL
TYPES: BEGIN OF TY_MKPF_MSEG,
MBLNR TYPE MBLNR, " NUMBER OF MATERIAL DOC
MJAHR TYPE MJAHR, " MATERIAL DOCUMENT YEAR
VGART TYPE VGART, " TRANSACTION EVENT TYPE
BLART TYPE BLART, " DOCUMENT TYPE
BUDAT TYPE BUDAT, " POSTING DATE INT THE DOC
USNAM TYPE USNAM, " USERNAME
XBLNR TYPE XBLNR1, " REFERENCE DOCUMENT NUMBER
MATNR TYPE MATNR, " MATERIAL NUMBER
WERKS TYPE WERKS_D, " PLANT
LGORT TYPE LGORT_D, " STORAGE LOCATION
CHARG TYPE CHARG_D, " BATCH NUM
LIFNR TYPE ELIFN, " ACC OF VENDOR
KUNNR TYPE EKUNN, " CUSTOMER NUM
SOBKZ TYPE SOBKZ, " SPECIAL STOKING
BWART TYPE BWART, " MOVEMENT TYPE
ZEILE TYPE MBLPO, " ITEM IN MATERIAL DOCUMENT
ERFMG TYPE ERFMG, " QUANTITY IN UNIT OF ENTERY
ERFME TYPE ERFME, " UNIT OF ENTRY
END OF TY_MKPF_MSEG,
*STRUCTURE FOR MATERIAL MASTER DATA
BEGIN OF TY_MARA,
MATNR TYPE MATNR, " MATERIAL TYPE
BISMT TYPE BISMT, " OLD MATERIAL NUMBER
END OF TY_MARA,
*STRUCTURE DECLARATION FOR MATERIAL DESCRIPTION
BEGIN OF TY_MAKT,
MATNR TYPE MATNR, " MATERIAL NUM
SPRAS TYPE SPRAS, " LANGUAGE KEY
MAKTX TYPE MAKTX, " MATERIAL DESC
END OF TY_MAKT,
*STRUCTURE DECLARATION FOR MOVEMENT TYPE TEXT
BEGIN OF TY_T156T,
BWART TYPE BWART, " MOVEMENT TYPE
BTEXT TYPE BTEXT, " MOVEMENT TYPE TEXT
SPRAS TYPE SPRAS, " LANGUAGE KEY
END OF TY_T156T,
*STRUCTURE CREATION FOR DOCUMENT HEADER FOR SERIALNUMBERS FOR GOOD MOVEMENTS
BEGIN OF TY_SER03,
MBLNR TYPE MBLNR, " NUMBER OF MATERIAL DOC
MJAHR TYPE MJAHR, " MATERIAL DOCU YEAR
ZEILE TYPE MBLPO, " OUTPUT IN MATERIAL DOC
OBKNR TYPE OBJKNR, " OBJECT LIST NUMBER
END OF TY_SER03,
*STRUCUTRE DECLARATION FOR PLANTS MAINTANENCE OBKECT LIST
BEGIN OF TY_OBJK,
OBKNR TYPE OBJKNR, " OBJECT LIST NUMBER
OBZAE TYPE OBJZA, " OBLECT LIST COUNTERS
SERNR TYPE GERNR, " SERIAL NUMBER
END OF TY_OBJK,
*STRUCUTRE DECLARATION FOR PLANTS/BRANCHES
BEGIN OF TY_T001W,
WERKS TYPE WERKS_D, " PLANT
NAME1 TYPE NAME1, " NAME
END OF TY_T001W,
*STRUCUTRE DECLARATION FOR OUTPUT TABLE
BEGIN OF TY_OUTPUT,
MATNR TYPE MATNR, " MATERIAL NUMBER
BISMT TYPE BISMT, " OLD MATERIAL NUMBER
MAKTX TYPE MAKTX, " MATERIAL DESC
WERKS TYPE WERKS_D, " PLANT
NAME1 TYPE NAME1, " NAME
LGORT TYPE LGORT_D, " Storage Location
BWART TYPE BWART, " Movement Type
MBLNR TYPE MBLNR, " NUMBER OF MATERIAL DOC
CHARG TYPE CHARG_D, " BATCH NUM
SERNR TYPE GERNR, " SERIAL NUMBER
ZEILE TYPE MBLPO, " OUTPUT IN MATERIAL DOC
BUDAT TYPE BUDAT, " POSTING DOCU DATE
ERFMG TYPE ERFMG, " QUANTITY IN UNIT OF ENTRY
ERFME TYPE ERFME, " UNINT OF ENTRY
BTEXT TYPE BTEXT, " MOVEMENT TYPE TEXT
MJAHR TYPE MJAHR, " MATEREIAL DOC YEAR
VGART TYPE VGART, " TRANSACTION EVENT TYPE
BLART TYPE BLART, " DOCUMENT TYPE
USNAM TYPE USNAM, " USERNAME
XBLNR TYPE XBLNR1, " REFERENCE DOCUMENT NUM
SOBKZ TYPE SOBKZ, " SPECIAL STOCKING
LIFNR TYPE ELIFN, " ACC OF VENDOR
KUNNR TYPE EKUNN, " CUSTOMER
OBKNR TYPE OBJKNR, " OBJECT LIST NUMBER
END OF TY_OUTPUT.
*&INTERNAL TABLE DECLARATION FOR STRUCUTRES *
INTERNAL TABLE DECLARATION FOR HEADER MATERIAL DOCMENT AND DOCUMENT SEGEMNT MATERIAL
DATA : T_MKPF_MSEG TYPE STANDARD TABLE OF TY_MKPF_MSEG INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR MATERIAL MASTER DAT
T_MARA TYPE STANDARD TABLE OF TY_MARA INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR MATERIAL TYPE DESC
T_MAKT TYPE STANDARD TABLE OF TY_MAKT INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR MOVEMENT TYPE TEXT
T_T156T TYPE STANDARD TABLE OF TY_T156T INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR Document Header for Serial Numbers for Goods Movements
T_SER03 TYPE STANDARD TABLE OF TY_SER03 INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR Plant Maintenance Object List
T_OBJK TYPE STANDARD TABLE OF TY_OBJK INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR Plants/Branches
T_T001W TYPE STANDARD TABLE OF TY_T001W INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR OUTPUT
T_OUTPUT TYPE STANDARD TABLE OF TY_OUTPUT INITIAL SIZE 0,
*&WORK AREA DECLARATIONS FOR INTERNAL TABLES *
*WORK AREA DECLARATION HEADER MATERIAL DOCMENT AND DOCUMENT SEGEMNT MATERIAL
W_MKPF_MSEG TYPE TY_MKPF_MSEG,
*WORK AREA DECLARATION MATERIAL MASTER DATA
W_MARA TYPE TY_MARA,
*WORK AREA DECLARATION MATERIAL TYPE DESC
W_MAKT TYPE TY_MAKT,
*WORK AREA DECLARATION MOVEMENT TYPE TEXT\
W_T156T TYPE TY_T156T,
*WORK AREA DECLARATION Document Header for Serial Numbers for Goods Movements
W_SER03 TYPE TY_SER03,
*WORK AREA DECLARATION PLANT MAINTENANCE OBJECT LIST
W_OBJK TYPE TY_OBJK,
*WORK AREA DECLARATION PLANTS AND BRANCHES
W_T001W TYPE TY_T001W,
*WORK AREA DECLARATION FOR OUTPUT TABLE.
W_OUTPUT TYPE TY_OUTPUT,
*& GLOBAL VARIABLE DECLARATIONS *
G_MATNR TYPE MSEG-MATNR,
G_WERKS TYPE MSEG-WERKS,
G_LGORT TYPE MSEG-LGORT,
G_CHARG TYPE MSEG-CHARG,
G_LIFNR TYPE MSEG-LIFNR,
G_KUNNR TYPE MSEG-KUNNR,
G_BWART TYPE MSEG-BWART,
G_SOBKZ TYPE MSEG-SOBKZ,
G_BUDAT TYPE MKPF-BUDAT,
G_USNAM TYPE MKPF-USNAM,
G_VGART TYPE MKPF-VGART,
G_XBLNR TYPE MKPF-XBLNR.
*& SELECTION SCREEN EVENT *
*SELECT OPTIONS EVENTS FOR ITEM DETAILS
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS: S_MATNR FOR G_MATNR,
S_WERKS FOR G_WERKS,
S_LGORT FOR G_LGORT,
S_CHARG FOR G_CHARG,
S_LIFNR FOR G_LIFNR,
S_KUNNR FOR G_KUNNR,
S_BWART FOR G_BWART,
S_SOBKZ FOR G_SOBKZ.
SELECTION-SCREEN END OF BLOCK B1.
*SELECT OPTIONS EVENTS FOR HEADER DETAILS
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
SELECT-OPTIONS: S_BUDAT FOR G_BUDAT,
S_USNAM FOR G_USNAM,
S_VGART FOR G_VGART,
S_XBLNR FOR G_XBLNR.
SELECTION-SCREEN END OF BLOCK B2.
*&INITIALIZATION EVENTS *
INITIALIZATION.
CLEAR: W_MKPF_MSEG,
W_MARA,
W_MAKT,
W_T156T,
W_SER03,
W_OBJK,
W_T001W,
W_OUTPUT.
REFRESH: T_MKPF_MSEG,
T_MARA,
T_MAKT,
T_T156T,
T_SER03,
T_OBJK,
T_T001W,
T_OUTPUT.
*& At Selection screen Event
AT SELECTION-SCREEN.
PERFORM SUB_VALID_MATNR.
PERFORM SUB_VALID_WERKS.
PERFORM SUB_VALID_LGORT.
PERFORM SUB_VALID_CHARG.
PERFORM SUB_VALID_LIFNR.
PERFORM SUB_VALID_KUNNR.
PERFORM SUB_VALID_BWART.
PERFORM SUB_VALID_SOBKZ.
PERFORM SUB_VALID_BUDAT.
PERFORM SUB_VALID_USNAM.
PERFORM SUB_VALID_VGART.
PERFORM SUB_VALID_XBLNR.
*& Start of selection event.
START-OF-SELECTION.
PERFORM SUB_GET_MKPF_MSEG.
PERFORM SUB_GET_MARA.
PERFORM SUB_GET_MAKT.
PERFORM SUB_GET_T156T.
PERFORM SUB_GET_SER03.
PERFORM SUB_GET_T001W.
PERFORM SUB_BSLIST_DISP.
*& Form SUB_VALID_MATNR
*VALIDATION FOR MATERIAL NUM
FORM SUB_VALID_MATNR .
DATA : L_MATNR TYPE MATNR.
SELECT SINGLE MATNR
FROM MARA
INTO L_MATNR
WHERE MATNR IN S_MATNR.
IF SY-SUBRC <> 0.
MESSAGE E001.
ENDIF.
ENDFORM. " SUB_VALID_MATNR
*& Form SUB_VALID_WERKS
text
FORM SUB_VALID_WERKS .
DATA L_WERKS TYPE WERKS_D.
SELECT SINGLE WERKS
FROM T001W
INTO L_WERKS
WHERE WERKS IN S_WERKS.
IF SY-SUBRC <> 0.
MESSAGE E002.
ENDIF.
ENDFORM. " SUB_VALID_WERKS
*& Form SUB_VALID_LGORT
text
FORM SUB_VALID_LGORT .
DATA L_LGORT TYPE LGORT_D.
SELECT SINGLE LGORT
FROM T001L
INTO L_LGORT
WHERE LGORT IN S_LGORT.
IF SY-SUBRC <> 0.
MESSAGE E003.
ENDIF.
ENDFORM. " SUB_VALID_LGORT
*& Form SUB_VALID_CHARG
text
FORM SUB_VALID_CHARG .
DATA L_CHARG TYPE CHARG_D.
SELECT SINGLE CHARG
FROM MCHA
INTO L_CHARG
WHERE CHARG IN S_CHARG.
IF SY-SUBRC <> 0.
MESSAGE E004.
ENDIF.
ENDFORM. " SUB_VALID_CHARG
*& Form SUB_VALID_LIFNR
text
FORM SUB_VALID_LIFNR .
DATA L_LIFNR TYPE LIFNR.
SELECT SINGLE LIFNR
FROM LFA1
INTO L_LIFNR
WHERE LIFNR IN S_LIFNR.
IF SY-SUBRC <> 0.
MESSAGE E005.
ENDIF.
ENDFORM. " SUB_VALID_LIFNR
*& Form SUB_VALID_KUNNR
text
FORM SUB_VALID_KUNNR .
DATA L_KUNNR TYPE KUNNR.
SELECT SINGLE KUNNR
FROM KNA1
INTO L_KUNNR
WHERE KUNNR IN S_KUNNR.
IF SY-SUBRC <> 0.
MESSAGE E006.
ENDIF.
ENDFORM. " SUB_VALID_KUNNR
*& Form SUB_VALID_BWART
text
FORM SUB_VALID_BWART .
DATA L_BWART TYPE BWART.
SELECT SINGLE BWART
FROM T156
INTO L_BWART
WHERE BWART IN S_BWART.
IF SY-SUBRC <> 0.
MESSAGE E007.
ENDIF.
ENDFORM. " SUB_VALID_BWART
*& Form SUB_VALID_SOBKZ
text
FORM SUB_VALID_SOBKZ .
DATA L_SOBKZ TYPE SOBKZ.
SELECT SINGLE SOBKZ
FROM T148
INTO L_SOBKZ
WHERE SOBKZ IN S_SOBKZ.
IF SY-SUBRC <> 0.
MESSAGE E008.
ENDIF.
ENDFORM. " SUB_VALID_SOBKZ
*& Form SUB_VALID_BUDAT
text
FORM SUB_VALID_BUDAT .
DATA L_BUDAT TYPE BUDAT.
SELECT SINGLE BUDAT
FROM MKPF
INTO L_BUDAT
WHERE BUDAT IN S_BUDAT.
IF SY-SUBRC <> 0.
MESSAGE E009.
ENDIF.
ENDFORM. " SUB_VALID_BUDAT
*& Form SUB_VALID_USNAM
text
FORM SUB_VALID_USNAM .
DATA L_USNAM TYPE USNAM.
SELECT SINGLE USNAM
FROM MKPF
INTO L_USNAM
WHERE USNAM IN S_USNAM.
IF SY-SUBRC <> 0.
MESSAGE E010.
ENDIF.
ENDFORM. " SUB_VALID_USNAM
*& Form SUB_VALID_VGART
text
FORM SUB_VALID_VGART .
DATA L_VGART TYPE VGART.
SELECT SINGLE VGART
FROM MKPF
INTO L_VGART
WHERE VGART IN S_VGART.
IF SY-SUBRC <> 0.
MESSAGE E011.
ENDIF.
ENDFORM. " SUB_VALID_VGART
*& Form SUB_VALID_XBLNR
text
FORM SUB_VALID_XBLNR .
DATA L_XBLNR TYPE XBLNR.
SELECT SINGLE XBLNR
FROM MKPF
INTO L_XBLNR
WHERE XBLNR IN S_XBLNR.
IF SY-SUBRC <> 0.
MESSAGE E012.
ENDIF.
ENDFORM. " SUB_VALID_XBLNR
*& Form SUB_GET_MKPF_MSEG
text
FORM SUB_GET_MKPF_MSEG .
REFRESH T_MKPF_MSEG.
SELECT KMBLNR KMJAHR K~VGART
KBLART KBUDAT K~USNAM
K~XBLNR
SMATNR SWERKS S~LGORT
SCHARG SLIFNR S~KUNNR
SSOBKZ SBWART S~ZEILE
SERFMG SERFME
INTO TABLE T_MKPF_MSEG
FROM MKPF AS K INNER JOIN MSEG AS S
ON KMBLNR = SMBLNR AND KMJAHR = SMJAHR
WHERE K~VGART IN S_VGART
AND K~BUDAT IN S_BUDAT
AND K~USNAM IN S_USNAM
AND K~XBLNR IN S_XBLNR
AND S~MATNR IN S_MATNR
AND S~WERKS IN S_WERKS
AND S~LGORT IN S_LGORT
AND S~CHARG IN S_CHARG
AND S~SOBKZ IN S_SOBKZ
AND S~LIFNR IN S_LIFNR
AND S~KUNNR IN S_KUNNR.
ENDFORM. " SUB_GET_MKPF_MSEG
*& Form SUB_GET_MARA
text
FORM SUB_GET_MARA .
IF T_MKPF_MSEG IS NOT INITIAL.
SORT T_MKPF_MSEG BY MATNR.
REFRESH T_MARA.
SELECT MATNR
BISMT
FROM MARA
INTO TABLE T_MARA
FOR ALL ENTRIES IN T_MKPF_MSEG
WHERE MATNR = T_MKPF_MSEG-MATNR.
ENDIF.
ENDFORM. " SUB_GET_MARA
*& Form SUB_GET_MAKT
text
FORM SUB_GET_MAKT .
REFRESH T_MAKT.
SELECT MATNR
SPRAS
MAKTX
FROM MAKT
INTO TABLE T_MAKT
FOR ALL ENTRIES IN T_MKPF_MSEG
WHERE SPRAS = SY-LANGU AND MATNR = T_MKPF_MSEG-MATNR.
ENDFORM. " SUB_GET_MAKT
*& Form SUB_GET_T156T
text
FORM SUB_GET_T156T .
SELECT BWART
BTEXT
SPRAS
FROM T156T
INTO TABLE T_T156T
FOR ALL ENTRIES IN T_MKPF_MSEG
WHERE SPRAS = SY-LANGU AND BWART = T_MKPF_MSEG-BWART.
ENDFORM. " SUB_GET_T156T
*& Form SUB_GET_SER03
text
FORM SUB_GET_SER03 .
SELECT MBLNR
MJAHR
ZEILE
OBKNR
FROM SER03
INTO TABLE T_SER03
FOR ALL ENTRIES IN T_MKPF_MSEG
WHERE MBLNR = T_MKPF_MSEG-MBLNR
AND MJAHR = T_MKPF_MSEG-MJAHR
AND ZEILE = T_MKPF_MSEG-ZEILE.
IF T_SER03 IS NOT INITIAL.
SELECT OBKNR
OBZAE
SERNR
FROM OBJK
INTO CORRESPONDING FIELDS OF TABLE T_OBJK
FOR ALL ENTRIES IN T_SER03
WHERE OBKNR = T_SER03-OBKNR.
ENDIF.
ENDFORM. " SUB_GET_SER03
*& Form SUB_GET_T001W
text
FORM SUB_GET_T001W .
SELECT WERKS
NAME1
FROM T001W
INTO TABLE T_T001W
FOR ALL ENTRIES IN T_MKPF_MSEG
WHERE WERKS = T_MKPF_MSEG-WERKS.
ENDFORM. " SUB_GET_T001W
*& Form SUB_BSLIST_DISP
FOR DISPLAY OUT
FORM SUB_BSLIST_DISP .
REFRESH T_OUTPUT.
CLEAR W_MKPF_MSEG.
SORT T_MKPF_MSEG BY MBLNR MJAHR ZEILE MATNR.
LOOP AT T_MKPF_MSEG INTO W_MKPF_MSEG.
W_OUTPUT-MBLNR = W_MKPF_MSEG-MBLNR .
W_OUTPUT-MJAHR = W_MKPF_MSEG-MJAHR.
W_OUTPUT-VGART = W_MKPF_MSEG-VGART.
W_OUTPUT-BLART = W_MKPF_MSEG-BLART.
W_OUTPUT-BUDAT = W_MKPF_MSEG-BUDAT.
W_OUTPUT-USNAM = W_MKPF_MSEG-USNAM.
W_OUTPUT-XBLNR = W_MKPF_MSEG-XBLNR.
W_OUTPUT-ZEILE = W_MKPF_MSEG-ZEILE.
W_OUTPUT-BWART = W_MKPF_MSEG-BWART.
W_OUTPUT-MATNR = W_MKPF_MSEG-MATNR.
W_OUTPUT-WERKS = W_MKPF_MSEG-WERKS.
W_OUTPUT-LGORT = W_MKPF_MSEG-LGORT.
W_OUTPUT-CHARG = W_MKPF_MSEG-CHARG.
W_OUTPUT-SOBKZ = W_MKPF_MSEG-SOBKZ.
W_OUTPUT-LIFNR = W_MKPF_MSEG-LIFNR.
W_OUTPUT-KUNNR = W_MKPF_MSEG-KUNNR.
W_OUTPUT-ERFMG = W_MKPF_MSEG-ERFMG.
W_OUTPUT-ERFME = W_MKPF_MSEG-ERFME.
CLEAR W_MARA.
READ TABLE T_MARA INTO W_MARA WITH KEY MATNR = W_OUTPUT-MATNR.
IF SY-SUBRC = 0.
W_OUTPUT-BISMT = W_MARA-BISMT.
ENDIF.
CLEAR W_MAKT.
READ TABLE T_MAKT INTO W_MAKT WITH KEY MATNR = W_OUTPUT-MATNR .
IF SY-SUBRC = 0.
W_OUTPUT-MAKTX = W_MAKT-MAKTX.
ENDIF.
CLEAR W_T156T.
READ TABLE T_T156T INTO W_T156T WITH KEY BWART = W_OUTPUT-BWART .
IF SY-SUBRC = 0.
W_OUTPUT-BTEXT = W_T156T-BTEXT.
ENDIF.
CLEAR W_T001W.
READ TABLE T_T001W INTO W_T001W WITH KEY WERKS = W_MKPF_MSEG-WERKS.
IF SY-SUBRC = 0.
W_OUTPUT-NAME1 = W_T001W-NAME1.
ENDIF.
CLEAR W_SER03.
READ TABLE T_SER03 INTO W_SER03 WITH KEY MBLNR = W_OUTPUT-MBLNR
MJAHR = W_OUTPUT-MJAHR
ZEILE = W_OUTPUT-ZEILE.
IF SY-SUBRC = 0.
W_OUTPUT-OBKNR = W_SER03-OBKNR.
ENDIF.
CLEAR W_OBJK.
READ TABLE T_OBJK INTO W_OBJK WITH KEY OBKNR = W_OUTPUT-OBKNR.
IF SY-SUBRC = 0.
W_OUTPUT-SERNR = W_OBJK-SERNR .
ENDIF.
APPEND W_OUTPUT TO T_OUTPUT.
CLEAR W_OUTPUT.
ENDLOOP.
PERFORM SUB_DISPLAY.
ENDFORM.
*& Form SUB_DISPLAY
HIERARICAL DISPLAY
FORM SUB_DISPLAY .
SORT T_OUTPUT BY MATNR BISMT MAKTX WERKS NAME1 LGORT BWART MBLNR CHARG SERNR ZEILE BUDAT ERFMG ERFME BTEXT.
CLEAR W_OUTPUT.
LOOP AT T_OUTPUT INTO W_OUTPUT.
AT NEW NAME1.
WRITE:/ W_OUTPUT-MATNR,
W_OUTPUT-BISMT,
W_OUTPUT-MAKTX,
W_OUTPUT-WERKS,
W_OUTPUT-NAME1.
ENDAT.
AT NEW BTEXT.
WRITE:/ W_OUTPUT-LGORT,
W_OUTPUT-BWART,
W_OUTPUT-MBLNR,
W_OUTPUT-CHARG,
W_OUTPUT-SERNR,
W_OUTPUT-ZEILE,
W_OUTPUT-BUDAT,
W_OUTPUT-ERFMG,
W_OUTPUT-ERFME,
W_OUTPUT-BTEXT.
ENDAT.
CLEAR W_OUTPUT.
ENDLOOP.
REFRESH T_OUTPUT.
ENDFORM. " SUB_DISPLAY -
What are the events in alv reports
hai this is siva
Hi siva:
This is technical question. you should post this query to an ABAPer.
However this link may help you.
alv report
Please let me know if you need more information.
Assign points if useful.
Regards
MSReddy -
Select Options use in ALV Report in ABAP Webdynpro
Hello Experts,
I Already Done ALV Report In webdynpro with use of view Container UI element.But i do not know ALV report with help of select option.so
Kindly Give Me simple Example of Use in select Option In ALV.
Reply ASAP.
Regards,
Ameya KaradkhedkarFirst you need to add the component WDR_SELECT_OPTIONS to the tab "Used components" of your Web Dynpro component and then also in the properties tab of your view. In the layout you need to create another view container and embed the view WND_SELECTION_SCREEN of the new used component to it.
Then in the WDDOINIT method of your view you can write this code (where SEL_OPT is the given name for the used component) in order to set the select option (This example is a select option for a date):
DATA: lo_cmp_usage TYPE REF TO if_wd_component_usage,
lo_interfacecontroller TYPE REF TO iwci_wdr_select_options,
lo_r_helper_class TYPE REF TO if_wd_select_options,
rt_range_date TYPE REF TO data.
* Instantiate used component WDR_SELECT_OPTIONS (SEL_OPT)
lo_cmp_usage = wd_this->wd_cpuse_sel_opt( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
* Call method in used controller
lo_interfacecontroller = wd_this->wd_cpifc_sel_opt( ).
lo_r_helper_class = lo_interfacecontroller->init_selection_screen( ).
* Create select option for the date
CALL METHOD lo_r_helper_class->create_range_table
EXPORTING
i_typename = 'DATS'
RECEIVING
rt_range_table = rt_range_date.
CALL METHOD lo_r_helper_class->add_selection_field
EXPORTING
i_id = 'DATS'
it_result = rt_range_date
i_read_only = ABAP_FALSE.
* Hide unnecessary buttons
CALL METHOD lo_r_helper_class->set_global_options
EXPORTING
i_display_btn_cancel = abap_false
i_display_btn_check = abap_false
i_display_btn_reset = abap_false
i_display_btn_execute = abap_false.
Finally you need to write the following code in the action of the button in order to fetch the range table selected by the user.
DATA: lo_cmp_usage TYPE REF TO if_wd_component_usage,
lo_interfacecontroller TYPE REF TO iwci_wdr_select_options,
lo_r_helper_class TYPE REF TO if_wd_select_options,
rt_date TYPE REF TO data.
FIELD-SYMBOLS: <fs_date> TYPE table.
* Instantiate used component WDR_SELECT_OPTIONS (SEL_OPT)
lo_cmp_usage = wd_this->wd_cpuse_sel_opt( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
* Call method in used controller
lo_interfacecontroller = wd_this->wd_cpifc_sel_opt( ).
lo_r_helper_class = lo_interfacecontroller->init_selection_screen( ).
* get selected range of inspections date
CALL METHOD lo_r_helper_class->get_range_table_of_sel_field
EXPORTING
i_id = 'DATS'
RECEIVING
rt_range_table = rt_date.
ASSIGN rt_date->* TO <fs_date>.
Then you can use the value that is assigned to the field symbol <fs_date> to continue with your ALV. -
Dynamic report output in a webdynpro alv
Hi,
I have created a dynamic report in the R/3 system . In this report, i am creating a report program within the report and subsequently executing this dynamically created report and displaying in the ALV..
Is it possible to handle such a scenario in a webdynpro ALV. One option is to use ITS and display the report in the portal but is there some other way so that i can directly view this report in an alv grid in a view.
all help appreciated!!
regards,
PriyankHi Priyank,
This could be one of the solution:
1] Run the report in background mode (using submit statement, dn't forget to give printer as LOCL), get the spool id programatically. Use the FM's CONVERT_OTFSPOOLJOB_2_PDF or CONVERT_ABAPSPOOLJOB_2_PDF.
Which returns the ouput of table tline, convert this to xtring and bind it to xtring attribute.
In view add a interactive form and bind the xstring attribute to the Interactive form.
By following the above steps, we can display the result in the PDF in WD ABAP.
2] The report result is ALV and in most of the cases we generally do not have function modules or any other easy way to get the output.
In such cases the best approach which we follow is, to run this in background mode and generate the spool and display the ouput in PDF.
3] But if intertactive form is not present in your requirement then we need to debug the logic of the report (if no FM or class present) and get the results and display it in the View.
You can create a service which takes the parameters of the report, submits it and
transfers the result to HTML. In a view you use an IFRame which takes the URL of the service and shows the result HTML.
just additionally read this thread,
Display simple ABAPLIST
Here an IFrame is used to display HTML output of report. But as IFRame gets obsolete the Suresh's solution seems to be pretty cool.
Hope this will help you!
Cheers,
Darshna. -
Hierarchical ALV Report in webdynpro abap
Hi Experts,
I'm facing the trouble with requirement as below. Please help me to resolve this issue.
Output as:
Material Number Description Created Date
- 10001(Header data) abc 09-09-2013
1001 (item level data) abc 10-09-2013
1002 xyz 11-09-2013
1003 xyz 11-09-2013
- 10002(Header data) abc 09-09-2013
2001 (item level data) abc 10-09-2013
2002 xyz 11-09-2013
2003 xyz 11-09-2013
- 10003(Header data) abc 09-09-2013
3001 (item level data) abc 10-09-2013
3002 xyz 11-09-2013
3003 xyz 11-09-2013
.... and so on...
- when I expand on header Materail number, it has to be display with item level data with in alv report in webdynpro abap.
Looking forward your valuable comments.
Regards,
VenkatHi Venkat,
We can achieve the HIERARCHY through the following code.In this case I have used CARRID as the drill down column.
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_flight_tree( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
lo_INTERFACECONTROLLER = wd_this->wd_cpifc_flight_tree( ).
DATA lv_value TYPE ref to cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model(
lv_value->IF_SALV_WD_TABLE_SETTINGS~SET_DISPLAY_TYPE( IF_SALV_WD_C_TABLE_SETTINGS=>DISPLAY_TYPE_HIERARCHY ).
"Enable HIERARCHY structure
data lr_col type ref to CL_SALV_WD_COLUMN.
lr_col = lv_value->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'CARRID' )." Enable HIERARCHY for the col. specified
lr_col->IF_SALV_WD_COLUMN_HIERARCHY~SET_HIERARCHY_COLUMN( ABAP_TRUE ).
Regards,
Harsha -
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
-
ALV Report: How to pass the variable in Work area to the FM ? Please help !
I want to pass the field in the work area which contains the floating point numbers to FM 'FLTP_CHAR_CONVERSION_FROM_SI'. This the correct FM, I have tested.
If I specify the field with Tab name in FM , It says its not an internal table with header line.
Please help me, How should can I proceed further and pass the field to FM and get it back in work area.
And an other issue is I want to sum the particular field in the output.
Is there a way to do using 'PF-STATUS', if so how ? or what is the alternative for this ?
Please help me with my issues.
I'm new to ALV reports.
Thanks in Advance !Hi,
For your FM issue, i think you are trying to pass the field in the FM as ITAB-field, while you should be taking the data in the work area first and then pass this work area in the FM as WA_ITAB-field.
I hope this will resolve your prob.
I mean loop at the table and take the values into work area, update the internal table with changed value. This way by the end of loop you will have all your fields converted.
Please explain a little more about your second doubt, it is unclear(to me atleast).
Edited by: DeepakNagar on Jul 28, 2011 6:08 PM
Maybe you are looking for
-
Just like the topic Is AA3.0 running under Win8 ?? thanks
-
Final Delivery checkbox/indicator in SRM
Hello Experts, We are using SRM 5.0 connected to an ECC 6.0 system using Extended Classic Scenario. How exactly is the "Final delivery" checkbox activated in the backend? I don't see any box in SRM by this name... I only find the following at the Ite
-
Hello, I have an issue with a file that is sitting on my desktop and I can't delete, neither pop an info window, I right clicked on it and try to show the package content and is all blank, can't rename it... well, I have no clue what to do with this
-
I have both a Performa 6400/200 and MacIntosh IIcx. Both I want to transfer the data from each to my G5. The Performa has the following ports: 1. 25 pin scsi female connector. 2. 8 pin din female connector (printer icon) 3. 8 pin din female connector
-
Moving nonXML flatfiles; straight txt and pdf
Hello All, I am relatively new to PI. We are being forced to migrate from "old" technology to PI for the movement of files from one location to another. There files are either nonXML; meaning they are just files of data... variable in width (meanin