ALV Report Interesting requirment ?
Hello,
I have got a Peculiar requirment like i am have generated a ALV report based on my material number, for the each material number(Material) i am having a word document in my local desktop.
After displaying the list of material if i want to see the details of a particular material, my client want like if he double click on Material-1 then the document related to material-1 which is present on local machine has to open automatically.
Is this requirment can be possible.
The concept that i am having is like i have created a button in my application tool bar where when i click on that button i am able to open the Browser there by he can open the document that he want but, its like when he choose Material-1 in the list and click draw button the doument related to Materail-1 should automatically open.
The Code that i am having at present is like...
TABLES: ZAAA.
TYPE-POOLS:
SLIS.
DATA:
BEGIN OF T_AAA OCCURS 0,
CHECKBOX,
COLOR(3).
INCLUDE STRUCTURE ZAAA.
DATA: END OF T_AAA.
DATA:
T_TAAA LIKE STANDARD TABLE OF T_AAA .
DATA:
FS_AAA LIKE LINE OF T_TAAA.
DATA:
FS_LAYOUT TYPE SLIS_LAYOUT_ALV,
W_PROGRAM TYPE SY-REPID.
*DATA: fname TYPE localfile .
DATA: v_rc TYPE i.
data: v_file type string.
DATA: lt_filetab TYPE filetable.
DATA: ls_filetab LIKE LINE OF lt_filetab.
data: p_file TYPE localfile.
*AT SELECTION-SCREEN on VALUE-REQUEST FOR p_file.
SELECT *
FROM ZAAA
INTO CORRESPONDING FIELDS OF TABLE T_AAA.
FS_LAYOUT-INFO_FIELDNAME = 'COLOR'.
FS_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
W_PROGRAM = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_PROGRAM
I_CALLBACK_PF_STATUS_SET = 'DRAWING'
I_CALLBACK_USER_COMMAND = 'AAA_INFO'
I_STRUCTURE_NAME = 'ZAAA'
IS_LAYOUT = FS_LAYOUT
TABLES
T_OUTTAB = T_AAA
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.
*& Form ZAAA
text
-->RT_EXTAB text
FORM DRAWING USING RT_EXTAB TYPE SLIS_T_EXTAB..
SET PF-STATUS 'DRAWING' EXCLUDING RT_EXTAB.
ENDFORM. "FLIGHT
*& Form &----
text
-->UCOMM text
-->SELFIELD text
FORM AAA_INFO USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
SELFIELD-REFRESH = 'X'.
CASE UCOMM.
WHEN 'DRAW'.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = fname
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = lt_filetab
rc = v_rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
READ TABLE lt_filetab INTO ls_filetab INDEX 1.
IF sy-subrc = 0.
v_file = ls_filetab-filename.
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
document = v_file.
ENDIF.
ENDCASE.
ENDFORM. "SPFLI_INFO
For security resons i changed the table name.
Please can anyone share there views on this requirement.
Thks
First Keep all the material related documents in a folder
and name the documents with your material name.doc
In your ALV Function module REUSE_ALV_GRID
pass this parameter
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'.
In your abap program create a sub routine USER_COMMAND.
if u double click on ALV your sy-ucomm is &IC1.
so if u double click this user_command form will be called.
check whether they click on material.
FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM.
if ucomm = '&IC1' and selfield-fieldname = 'MATNR'.
CALL FUNCTION 'ITS_FILE_OPEN_DIALOG'
EXPORTING
WINDOW_TITLE = WINDOW_TITLE
DEFAULT_EXTENSION = DEFAULT_EXTENSION
DEFAULT_FILENAME = DEFAULT_FILENAME
FILE_FILTER = FILTER
WITH_ENCODING = WITH_ENCODING
INITIAL_DIRECTORY = INITIAL_DIRECTORY
MULTISELECTION = MULTISELECTION
CHANGING
FILE_TABLE = FILE_TABLE
RC = RC
EXCEPTIONS
OTHERS = 1.
endif.
for this function module pass initial directory as your folder.
default extension is your extension.
default file name is your material code available in selfield-fieldname.
automatically it will open
Similar Messages
-
Information required on ALV report
Hello,
I am working on ALV report my requirement is I have to display output in colors like first line is as in white color and second line is light blue....this is applicable for all records in ALV Grid output.
Could you please help me how to get the alternate rows in color.
Thank you in Advance.Hi Kishore ,
See This links
Row color in ALV grid
selecting multiple rows in alv grid -
In an alv report how to get data in next and previous pages.
in my alv report i require the output such that
when i will press the next button in the application tool bar the alv report will be displayed for the next inventory document number in the next page. like wise previous
would anybody please help me out.
thanks and regards
pappsIn your servlet you could set the arraylist into the HttpRequest object so that it is visible in the JSP you are forwarding to.
RegistrationDAO rdao=new RegistrationDAO();
ArrayList arr1=rdao.getsearchresults(af);
request.setAttribute("someArrayList",arr1);Then in the JSP you could use JSTL 1.1 and jsp:useBean tag to access the ArrayList like this
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="someArrayList" class="java.util.ArrayList" scope="request"/>
<c:forEach var="currentRecord" items="${someArrayList}">
Some property of the AddressForm object: ${currentRecord.propertyName} <br/>
Another property of the AddessForm object : ${currentRecord.someOtherPropertyName} <br/>
<hr/>
</c:forEach>I guess you are using struts, so instead of JSTL there might be some struts tags that do the same as above JSTL tags. You can research further on that.
If you can't use struts tags or JSTL tags then you could write it with JSP scriptlets (highly discouraged option). -
Display Color for sigle CELL in ALV report
Hi all,
I have one doubt is it possible to make a particular cell as read color in ALV.
Ex: I have one field which shows amount in my ALV report,My requirement is that when ever the amount is less then 'ZERO', I have to show that particular cell in read color.
Regards
Anil Kumar.Nhi,
here code for coloring a perticular cell
TYPE-POOLS:slis.
TABLES:mara,
makt,
marc.
DATA:BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
werks LIKE marc-werks,
mtart LIKE mara-mtart,
matkl LIKE mara-matkl,
meins LIKE mara-meins,
ntgew LIKE mara-ntgew,
rowcolor(4) TYPE c,
cellcolors TYPE lvc_t_scol,
END OF itab.
DATA:t_fcat TYPE slis_t_fieldcat_alv,
t_eve TYPE slis_t_event.
DATA : st_layout TYPE slis_layout_alv.
SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:mat FOR mara-matnr. " no intervals no-extension.
*PARAMETERS:mat LIKE mara-matnr.
SELECTION-SCREEN:END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_cata USING t_fcat.
PERFORM build_event.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM display_data.
*& Form build_cata
text
-->TEMP_FCAT text
FORM build_cata USING temp_fcat TYPE slis_t_fieldcat_alv.
sy-tvar0 = sy-uname.
WRITE sy-datum TO sy-tvar1.
DATA:wa_fcat TYPE slis_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material'.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MAKTX'.
wa_fcat-seltext_m = 'Description'.
wa_fcat-fix_column = 'x'.
wa_fcat-key = 'X'. "To color a column
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
wa_fcat-key = ' '.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MTART'.
wa_fcat-seltext_m = 'Type'.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATKL'.
wa_fcat-seltext_m = 'Group'.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MEINS'.
wa_fcat-seltext_m = 'Measurement Unit'.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'NTGEW'.
wa_fcat-seltext_m = 'Net Value'.
APPEND wa_fcat TO temp_fcat.
ENDFORM. "build_cata
*& Form build_event
text
FORM build_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_eve
EXCEPTIONS
list_type_wrong = 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. "build_event
*& Form data_retrieval
text
FORM data_retrieval.
SELECT maramatnr maramtart maramatkl marameins mara~ntgew
maktmaktx marcwerks
INTO CORRESPONDING FIELDS OF TABLE itab
FROM mara INNER JOIN makt ON
maramatnr = maktmatnr
INNER JOIN marc ON
maramatnr = marcmatnr
WHERE mara~matnr IN mat.
SORT itab BY matnr.
DELETE ADJACENT DUPLICATES FROM itab.
ENDFORM. "data_retrieval
*& Form display_data
text
FORM display_data.
*******************************For setting Cell Color*******************************************
DATA ls_cellcolor TYPE lvc_s_scol .
st_layout-coltab_fieldname = 'CELLCOLORS'.
READ TABLE itab INDEX 5 .
ls_cellcolor-fname = 'MATNR' .
ls_cellcolor-color-col = '1' .
ls_cellcolor-color-int = '1' .
APPEND ls_cellcolor TO itab-cellcolors .
MODIFY itab INDEX 5 .
st_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_DS'
is_layout = st_layout
i_save = 'A'
it_fieldcat = t_fcat
it_events = t_eve
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display_data
Please reward if useful... -
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 -
ALV report requirement for peculiar SUBTOTAL
The following table is required for ALV report for inventory calculation.
The last column is the physical balance.
No......A.......... B....... C......D (D=A+B-C)
1......50........8........ 2.......56
2...... 20.........3.........1......22
3.......56.........10.......6...... 60
........50........21...... 9...... 60 (SUBTOTAL ROW)
Requirement for the subtotal row:
The subtotal for column A should be 50, It should take the first value 50 in the opening column in 1st row.
The subtotal for D column should be 60, It should be same as the value 60, in the LAST row that is 60
all other column subtotals are mathemetical totals as usual.
thanx
gaut
Edited by: gautam gautam on May 6, 2009 1:31 AMHi,
Try this
In side the loop
at new matnr.
capture the column1 (A)value into one variable
at end of matnr
capture the column 4 (D) value into one variable
and print it in subtotal row
Regards
Krishna -
To develope an alv report or module pool and field link.. and effor require
HI,
I want to display the fields with sort functionality with fields
kunnr kna1 table
name1 kna1
and email id from table ADR6 field SMTP_ADDR
my question ison mapping
from kna1 we can get field kunnr and name1
and adrnr
to put in adr6 to fetch email id
can anyoe suggest on select statements link as table kna1 has one unique kunnr
but it can have multiple name1 and adrnr
so how to pick the kunnr ,name 1 and adrnr from table kna1 and map to
adr6 table
as witinn the table kna1 there can be multiple name1 related to one single kunnr
so wil it be like
select kunnr from kna1..into it_kunnr
then select nam1 from table kna2 for all entrirs in It_kunnr
or firse selet kunnr name1 from kna1 into table it_kunnr
pls suggest an appropiat select statament
and i suppose this can be achevied by alv report no need for moudle pool
regards
Aroraopened a new thread with changes subject
-
hi
can anyone send me a simple and easily understandable ALV report.
points will be rewarded....Hi,
I think this will help u a lot...Plz reward if helpful to u...
REPORT ZSDR_SOSA NO STANDARD PAGE HEADING
LINE-COUNT 65 LINE-SIZE 100.
--Tables--
tables: vbap, vbak, vbpa, vbkd, makt,konv.
--Data Fetching--
TYPE-POOLS: slis.
data:begin of i_vbap occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
arktx like vbap-arktx,
kdmat like vbap-kdmat,
taxm1 like vbap-taxm1,
end of i_vbap.
data:begin of i_vbak occurs 0,
vbeln like vbak-vbeln,
audat like vbak-audat,
vbtyp like vbak-vbtyp,
vkorg like vbak-vkorg,
knumv like vbak-knumv,
kunnr like vbak-kunnr,
end of i_vbak.
data:begin of i_vbpa occurs 0,
vbeln like vbpa-vbeln,
posnr like vbpa-posnr,
parvw like vbpa-parvw,
kunnr like vbpa-kunnr, "SH
kunnr1 like vbpa-kunnr, "SP
end of i_vbpa.
data:begin of i_konv occurs 0,
knumv like konv-knumv,
kschl like konv-kschl,
kbetr like konv-kbetr,
mwsk1 like konv-mwsk1,
end of i_konv.
data:begin of i_vbkd occurs 0,
vbeln like vbkd-vbeln,
posnr like vbkd-posnr,
bstkd like vbkd-bstkd,
bstdk like vbkd-bstdk,
end of i_vbkd.
data:begin of i_makt occurs 0,
matnr like makt-matnr,
spras like makt-spras,
maktx like makt-maktx, "MAt. Desc
maktx1 like makt-maktx, "Cust mat. no.
end of i_makt.
data:wa_makt like makt.
DATA:BEGIN OF itab OCCURS 0,
vbeln like vbap-vbeln, "SD no.
audat like vbak-audat, "Order date
kunnr like vbpa-kunnr, "sold to party
kunnr1 like vbpa-kunnr, "ship to party
matnr like vbap-matnr, "Mat. No.
maktx like makt-maktx, "Material Desc.
kdmat like vbap-kdmat, "Cust. Mat.no.
maktx1 like makt-maktx, "Customer Mat. desc.
bstkd like vbkd-bstkd, "PO number
bstdk like vbkd-bstdk, "PO date
kbetr like konv-kbetr, "Basic Price
knumv like vbak-knumv,
vkorg like vbak-vkorg,
vbtyp like vbak-vbtyp,
parvw like vbpa-parvw,
kschl like konv-kschl,
mwsk1 like konv-mwsk1,
posnr like vbap-posnr,
arktx like vbap-arktx,
taxm1 like vbap-taxm1,
END OF itab.
--ALV DECLARATION--
DATA :v_pgm LIKE sy-repid.
DATA :col_pos TYPE i.
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid,
gt_events TYPE slis_t_event,
gd_prntparams TYPE slis_print_alv.
DATA:fcat TYPE slis_t_fieldcat_alv,
fcat1 TYPE slis_t_fieldcat_alv,
fcat2 TYPE slis_t_fieldcat_alv,
eve TYPE slis_t_event,
eve1 TYPE slis_t_event,
subtot TYPE slis_t_sortinfo_alv,
g_subtot LIKE LINE OF subtot.
--SELECTION SCREEN--
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_audat FOR vbak-audat,
s_vkorg for vbak-vkorg,
s_kunnr for vbak-kunnr.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS:p_sorder RADIOBUTTON GROUP rad1,
p_agree RADIOBUTTON GROUP rad1,
p_order radiobutton group rad1.
SELECTION-SCREEN END OF BLOCK b2.
--Initialization--
INITIALIZATION.
v_pgm = sy-repid.
--Start-of-selection--
Start-of-selection.
if p_sorder = 'X'.
perform get_sorder_data.
perform process_data.
perform display_data1.
elseif p_agree = 'X'.
perform get_agree_data.
perform process_data.
perform display_data1.
elseif p_order = 'X'.
perform get_order_data.
perform process_data.
perform display_data1.
endif.
*& Form get_sorder_data
text
--> p1 text
<-- p2 text
FORM get_sorder_data .
*Get from VBAK table.
select vbeln audat vbtyp vkorg knumv kunnr
from vbak into table i_vbak
where audat in s_audat
and vkorg in s_vkorg
and kunnr in s_kunnr
and vbtyp in ('C','E').
*Get from VBAP table.
if not i_vbak[] is initial.
clear:i_vbap. refresh:i_vbap.
select vbeln posnr matnr arktx kdmat taxm1
from vbap into table i_vbap
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
*Get from VBPA table.
if not i_vbap[] is initial.
clear:i_vbpa. refresh:i_vbpa.
select vbeln posnr parvw kunnr
from vbpa into table i_vbpa
for all entries in i_vbap
where vbeln = i_vbap-vbeln
and parvw in ('AG','KB','RE','RG','VE','WE','ZM').
endif.
*Get from KONV table.
if not i_vbak[] is initial.
clear:i_konv. refresh:i_konv.
select knumv kschl kbetr mwsk1
from konv into table i_konv
for all entries in i_vbak
where knumv = i_vbak-knumv
and kschl = 'PR00'.
endif.
*Get from VBKD table.
if not i_vbak[] is initial.
clear:i_vbkd. refresh:i_vbkd.
select vbeln posnr bstkd bstdk
from vbkd into table i_vbkd
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
**Get from MAKT table.
if not i_vbap[] is initial.
clear:i_makt. refresh:i_makt.
select single maktx
from makt into i_makt
for all entries in i_vbap
where matnr = i_vbap-matnr
and spras = sy-langu.
endif.
ENDFORM. " get_sorder_data
*& Form process_data
text
--> p1 text
<-- p2 text
FORM process_data .
Loop at i_vbap.
itab-vbeln = i_vbap-vbeln.
itab-posnr = i_vbap-posnr.
itab-matnr = i_vbap-matnr.
itab-arktx = i_vbap-arktx.
itab-kdmat = i_vbap-kdmat.
itab-taxm1 = i_vbap-taxm1.
*Get from MAKT table.
select single maktx from makt
into wa_makt-maktx
where matnr = itab-matnr
and spras = sy-langu.
if sy-subrc = 0.
itab-maktx = wa_makt-maktx.
itab-maktx1 = wa_makt-maktx.
endif.
read table i_vbak with key vbeln = itab-vbeln.
if sy-subrc = 0.
itab-audat = i_vbak-audat.
itab-knumv = i_vbak-knumv.
itab-vkorg = i_vbak-vkorg.
itab-vbtyp = i_vbak-vbtyp.
endif.
read table i_vbpa with key vbeln = itab-vbeln.
if sy-subrc = 0.
itab-parvw = i_vbpa-parvw.
itab-kunnr = i_vbpa-kunnr.
itab-kunnr1 = i_vbpa-kunnr.
endif.
read table i_konv with key knumv = itab-knumv.
if sy-subrc = 0.
itab-kschl = i_konv-kschl.
itab-kbetr = i_konv-kbetr.
itab-mwsk1 = i_konv-mwsk1.
endif.
read table i_vbkd with key vbeln = itab-vbeln.
if sy-subrc = 0.
itab-bstkd = i_vbkd-bstkd.
itab-bstdk = i_vbkd-bstdk.
endif.
read table i_makt with key matnr = itab-matnr.
if sy-subrc = 0.
itab-maktx = i_makt-maktx.
itab-maktx1 = i_makt-maktx1.
endif.
append itab.
clear itab.
endloop.
delete itab where not audat in s_audat.
delete itab where not vkorg in s_vkorg.
delete itab where not kunnr in s_kunnr.
ENDFORM. " process_data
*& Form display_data1
text
--> p1 text
<-- p2 text
FORM display_data1 .
PERFORM get_buildfieldcat1.
PERFORM display_alv.
ENDFORM. " display_data1
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
IF itab[] IS INITIAL.
MESSAGE 'No Data Exist' TYPE 'E'.
ENDIF.
DATA: title TYPE lvc_title
, datelow(10) TYPE c
, datehigh(10) TYPE c
DATA: gd_repid LIKE sy-repid
, gd_layout TYPE slis_layout_alv
***************Layout Formatting***************
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-zebra = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
***************Layout Formatting***************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_pgm
i_callback_top_of_page = 'ALV_TOP_OF_PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND' "'ALV_USER_COMMAND'
i_grid_title = title
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
it_sort = subtot
is_variant = z_template
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " display_alv
*& Form ALV_TOP_OF_PAGE
ALV Report Header *
--> p1 text
<-- p2 text
FORM alv_top_of_page .
*ALV Header declarations
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
FORM alv_top_of_page1 .
DATA: i_header TYPE slis_t_listheader,
wa1_header TYPE slis_listheader,
i_line LIKE wa1_header-info,
lld_lines TYPE i,
lld_linesc(10) TYPE c.
Title
wa1_header-typ = 'H'.
wa1_header-info = 'Schedule Line-Basic Price Details'.
APPEND wa1_header TO t_header.
CLEAR wa1_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
APPEND wa_header TO t_header.
CLEAR: wa_header.
wa_header-typ = 'S'.
wa_header-key = 'Time: '.
CONCATENATE
sy-uzeit(2) ':'
sy-uzeit+2(2) ':'
sy-uzeit+4(2) INTO wa_header-info. "time
APPEND wa_header TO t_header.
CLEAR: wa_header.
wa_header-typ = 'A'.
wa_header-info = t_line.
APPEND wa_header TO t_header.
CLEAR: wa_header, t_line.
Total No. of Rows Displayed
DESCRIBE TABLE itab LINES ld_lines.
ld_linesc = ld_lines.
CONCATENATE 'Total No. of Rows: ' ld_linesc
INTO t_line SEPARATED BY space.
wa_header-typ = 'A'.
wa_header-info = t_line.
APPEND wa_header TO t_header.
CLEAR: wa_header, t_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header
i_logo = 'Z_LOGO'
ENDFORM. "alv_top_of_page
*& Form get_buildfieldcat1
text
--> p1 text
<-- p2 text
FORM get_buildfieldcat1 .
DATA position TYPE i.
position = -1.
position = position + 1.
fieldcatalog-fieldname = 'VBELN'.
fieldcatalog-seltext_m = 'Sales Order No.'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'AUDAT'.
fieldcatalog-seltext_m = 'Order Date'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 15.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'KUNNR'.
fieldcatalog-seltext_m = 'Sold to Party'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'KUNAG'.
fieldcatalog-seltext_m = 'Ship to Party'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material No.'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'MAKTX'.
fieldcatalog-seltext_m = 'Material Desc.'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'KDMAT'.
fieldcatalog-seltext_m = 'Customer Material No.'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'MAKTX1'.
fieldcatalog-seltext_m = 'Customer Material Desc'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'BSTKD'.
fieldcatalog-seltext_m = 'Purchase Order No.'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'BSTDK'.
fieldcatalog-seltext_m = 'Purchase Order Date'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'KBETR'.
fieldcatalog-seltext_m = 'Basic Price'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " get_buildfieldcat1
*& Form get_agree_data
text
--> p1 text
<-- p2 text
FORM get_agree_data .
*Get from VBAK table.
select vbeln audat vbtyp vkorg knumv kunnr
from vbak into table i_vbak
where audat in s_audat
and vkorg in s_vkorg
and kunnr in s_kunnr
and vbtyp in ('C','E').
*Get from VBAP table.
if not i_vbak[] is initial.
clear:i_vbap. refresh:i_vbap.
select vbeln posnr matnr arktx kdmat taxm1
from vbap into table i_vbap
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
*Get from VBPA table.
if not i_vbap[] is initial.
clear:i_vbpa. refresh:i_vbpa.
select vbeln posnr parvw kunnr
from vbpa into table i_vbpa
for all entries in i_vbap
where vbeln = i_vbap-vbeln
and parvw in ('AG','KB','RE','RG','VE','WE','ZM').
endif.
*Get from KONV table.
if not i_vbak[] is initial.
clear:i_konv. refresh:i_konv.
select knumv kschl kbetr mwsk1
from konv into table i_konv
for all entries in i_vbak
where knumv = i_vbak-knumv
and kschl = 'PR00'.
endif.
*Get from VBKD table.
if not i_vbak[] is initial.
clear:i_vbkd. refresh:i_vbkd.
select vbeln posnr bstkd bstdk
from vbkd into table i_vbkd
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
ENDFORM. " get_agree_data
*& Form get_order_data
text
--> p1 text
<-- p2 text
FORM get_order_data .
*Get from VBAK table.
select vbeln audat vbtyp vkorg knumv kunnr
from vbak into table i_vbak
where audat in s_audat
and vkorg in s_vkorg
and kunnr in s_kunnr
and vbtyp in ('C','E').
*Get from VBAP table.
if not i_vbak[] is initial.
clear:i_vbap. refresh:i_vbap.
select vbeln posnr matnr arktx kdmat taxm1
from vbap into table i_vbap
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
*Get from VBPA table.
if not i_vbap[] is initial.
clear:i_vbpa. refresh:i_vbpa.
select vbeln posnr parvw kunnr
from vbpa into table i_vbpa
for all entries in i_vbap
where vbeln = i_vbap-vbeln
and parvw in ('AG','KB','RE','RG','VE','WE','ZM').
endif.
*Get from KONV table.
if not i_vbak[] is initial.
clear:i_konv. refresh:i_konv.
select knumv kschl kbetr mwsk1
from konv into table i_konv
for all entries in i_vbak
where knumv = i_vbak-knumv
and kschl = 'PR00'.
endif.
*Get from VBKD table.
if not i_vbak[] is initial.
clear:i_vbkd. refresh:i_vbkd.
select vbeln posnr bstkd bstdk
from vbkd into table i_vbkd
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
ENDFORM. " get_order_data
With Regards,
Seevangi -
Sample ALV report required for FI module
Hello friends,
I am develoing ALV report for FI module for that i need some sample ALV report. If someone have than please send it to me.
Thanx & Regards,
Rahul TaleleHI,
SEE THE SAMPLE REPORT
Fringe Benefit Tax Report
Program Name :
Object ID :
Functional Analyst :
Programmer :
Start date :
Initial CTS :
Description : FRINGE Benefit Tax
Includes :
Function Modules :
Logical database :
Transaction Code :
External references :
Modification Log
Date | Modified by | CTS number | Comments
| | | Initial Version *
REPORT ZFI_FBT NO STANDARD PAGE HEADING LINE-SIZE 255.
TYPE-POOLS: SLIS.
TYPES : BEGIN OF
T_BSIS,
BUKRS TYPE BUKRS, " Company Code
HKONT TYPE HKONT, " General Ledger Account
GJAHR TYPE GJAHR,
BELNR TYPE BELNR_D, " Accounting Document Number
BUDAT TYPE BUDAT, " Posting Date in the Document
BLDAT TYPE BLDAT, " Document Date in Document
XBLNR TYPE XBLNR1, " Reference Document Number
BSCHL TYPE BSCHL, " Posting Key
DMBTR TYPE DMBTR, " Amount in Local Currency
AUFNR TYPE AUFNR_NEU, " Order Number
NONFBT TYPE DMBTR, " non fbt amount
SUBFBT TYPE DMBTR, " subject to fbt amount
ZFI_FBT TYPE ZFI_FBT, " Qualifying amount.
AMOUNT TYPE DMBTR,
FBTPAY TYPE DMBTR,
ZFI_PAY TYPE ZFI_PAY,
END OF T_BSIS,
T_IT_BSIS TYPE STANDARD TABLE OF T_BSIS.
TYPES : BEGIN OF T_FRINGE,
ZFI_HKONT TYPE HKONT,
ZFI_FBT TYPE ZFI_FBT,
ZFI_PAY TYPE ZFI_PAY,
END OF T_FRINGE,
T_IT_FRINGE TYPE STANDARD TABLE OF T_FRINGE.
DATA : GIT_FRINGE TYPE T_IT_FRINGE,
GWA_FRINGE TYPE T_FRINGE.
DATA : GIT_BSIS TYPE T_IT_BSIS,
GWA_BSIS TYPE T_BSIS.
DATA : G_HKONT TYPE HKONT,
G_BUDAT TYPE BUDAT,
G_AUFNR TYPE AUFNR_NEU.
FIELD-SYMBOLS : <BSIS> TYPE T_BSIS.
DATA : G_REPID TYPE SY-REPID,
GIT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
GWA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV.
GS_LAYOUT-ZEBRA = 'X'.
GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CONSTANTS : C_50(2) TYPE C VALUE '50'.
SELECTION SCREEN DEFINITIONS
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_BUKRS TYPE BUKRS DEFAULT 'H901' OBLIGATORY.
SELECT-OPTIONS : S_HKONT FOR G_HKONT,
S_BUDAT FOR G_BUDAT.
*PARAMETERS : P_AUFNR TYPE AUFNR_NEU DEFAULT '000000100001' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
EVENTS
INITIALIZATION.
INITIALIZATION.
G_REPID = SY-REPID.
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
PERFORM GET_ZTABLE. " get data from ZFII_FRINGE table
START-OF-SELECTION.
START-OF-SELECTION.
PERFORM GET_DATA. " get data from BSIS table
IF NOT GIT_BSIS IS INITIAL.
PERFORM GET_PERCENTAGE. " to get the percentages from table ZFII_FRINGE
PERFORM CHK4_INTERNAL. " checking for the posting key wheather th document is reversed
" and checking wheather internal order is FBT or non-FBT
ENDIF.
END-OF-SELECTION.
END-OF-SELECTION.
IF NOT GIT_BSIS IS INITIAL.
PERFORM DISPLAY. " display ALV GRID display
ENDIF.
*& Form get_data
text
--> p1 text
<-- p2 text
FORM GET_DATA .
SELECT
BUKRS
HKONT
GJAHR
BELNR
BUDAT
BLDAT
XBLNR
BSCHL
DMBTR
AUFNR FROM BSIS
INTO TABLE GIT_BSIS
WHERE BUKRS EQ P_BUKRS AND
HKONT IN S_HKONT AND
BUDAT IN S_BUDAT.
IF SY-SUBRC NE 0.
MESSAGE I000(ZFI) WITH 'No data exist'.
EXIT.
ENDIF.
ENDFORM. " get_data
*& Form display
FORM DISPLAY .
PERFORM BUILD_FIELD_CATALOUGE.
PERFORM GET_EVENTS.
PERFORM DETERMINE_SORT_SEQUENCE.
PERFORM SUB_COMMENTERY_BUILD.
PERFORM ALV_DISPLAY.
ENDFORM. " display
*& Form build_field_catalouge
FORM BUILD_FIELD_CATALOUGE.
DATA : L_POS TYPE I.
L_POS = 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'HKONT' " InTab Field Name
'GIT_BSIS' " InTab Name
'10' " Output Length
'GL Account' " Column Name Text
' ' " Datatype
'X' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
' '. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'BELNR' " InTab Field Name
'GIT_BSIS' " InTab Name
'10' " Output Length
'Document No.' " Column Name Text
' ' " Datatype
'X' " Key?
'1' " Row Position
'X' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
' '. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'BUDAT' " InTab Field Name
'GIT_BSIS' " InTab Name
'10' " Output Length
'Posting Date' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
' '. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'BLDAT' " InTab Field Name
'GIT_BSIS' " InTab Name
'10' " Output Length
'Docu. Date' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
' '. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'XBLNR' " InTab Field Name
'GIT_BSIS' " InTab Name
'16' " Output Length
'Ref. Doc. Number' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'DMBTR' " InTab Field Name
'GIT_BSIS' " InTab Name
'16' " Output Length
'Gross Amount' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'SUBFBT' " InTab Field Name
'GIT_BSIS' " InTab Name
'16' " Output Length
'FBT Amount' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'NONFBT' " InTab Field Name
'GIT_BSIS' " InTab Name
'16' " Output Length
'Non FBT Amount' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'ZFI_FBT' " InTab Field Name
'GIT_BSIS' " InTab Name
'12' " Output Length
'Percentage' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
' '. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'AMOUNT' " InTab Field Name
'GIT_BSIS' " InTab Name
'16' " Output Length
'Qualifying Amount' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'FBTPAY' " InTab Field Name
'GIT_BSIS' " InTab Name
'12' " Output Length
'FBT payable' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
ENDFORM. " build_field_catalouge
*& Form init_field_catalog
text
FORM INIT_FIELD_CATALOG USING P_GIT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV
PV_POS LIKE GWA_FIELDCAT-COL_POS
PV_FIELDNAME LIKE GWA_FIELDCAT-FIELDNAME
PV_TABNAME LIKE GWA_FIELDCAT-TABNAME
PV_OUTPUT LIKE GWA_FIELDCAT-OUTPUTLEN
PV_SELTEXT LIKE GWA_FIELDCAT-SELTEXT_M
PV_DATATYPE LIKE GWA_FIELDCAT-DATATYPE
PV_KEY LIKE GWA_FIELDCAT-KEY
PV_ROW LIKE GWA_FIELDCAT-ROW_POS
PV_HOTSPOT LIKE GWA_FIELDCAT-HOTSPOT
PV_EMPHASIZE LIKE GWA_FIELDCAT-EMPHASIZE
PV_KEY_SEL LIKE GWA_FIELDCAT-KEY_SEL
PV_JUST LIKE GWA_FIELDCAT-JUST
PV_SUM LIKE GWA_FIELDCAT-DO_SUM.
DATA: LT_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
LT_FIELDCAT-OUTPUTLEN = PV_OUTPUT.
LT_FIELDCAT-COL_POS = PV_POS.
LT_FIELDCAT-FIELDNAME = PV_FIELDNAME.
LT_FIELDCAT-TABNAME = PV_TABNAME.
LT_FIELDCAT-SELTEXT_M = PV_SELTEXT.
LT_FIELDCAT-KEY = PV_KEY.
LT_FIELDCAT-ROW_POS = PV_ROW.
LT_FIELDCAT-HOTSPOT = PV_HOTSPOT.
LT_FIELDCAT-EMPHASIZE = PV_EMPHASIZE.
LT_FIELDCAT-KEY_SEL = PV_KEY_SEL.
LT_FIELDCAT-DO_SUM = PV_SUM.
LT_FIELDCAT-JUST = PV_JUST.
LT_FIELDCAT-DATATYPE = PV_DATATYPE.
APPEND LT_FIELDCAT TO P_GIT_FIELDCAT.
CLEAR LT_FIELDCAT.
ENDFORM. " init_field_catalog
*& Form alv_display
text
--> p1 text
<-- p2 text
FORM ALV_DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
i_grid_title = 'Fringe Benefit Tax'
I_GRID_SETTINGS =
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GIT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = GIT_BSIS
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " alv_display
*& Form chk4_internal
text
--> p1 text
<-- p2 text
FORM CHK4_INTERNAL .
LOOP AT GIT_BSIS ASSIGNING <BSIS>.
IF <BSIS> IS ASSIGNED.
IF <BSIS>-BSCHL = C_50.
<BSIS>-DMBTR = <BSIS>-DMBTR * -1.
ENDIF.
IF NOT <bsis>-aufnr IS INITIAL.
IF <BSIS>-AUFNR = '000000100000'. " P_AUFNR.
<BSIS>-SUBFBT = <BSIS>-DMBTR.
<BSIS>-AMOUNT = ( <BSIS>-SUBFBT * <BSIS>-ZFI_FBT ) / 100.
ELSE.
IF <bsis>-aufnr = '000000100020'.
<BSIS>-NONFBT = <BSIS>-DMBTR.
ENDIF.
ENDIF.
<BSIS>-FBTPAY = ( <BSIS>-AMOUNT * <BSIS>-ZFI_PAY ) / 100.
ENDIF.
ENDLOOP.
UNASSIGN <BSIS>.
ENDFORM. " chk4_internal
*& Form get_ztable
text
--> p1 text
<-- p2 text
FORM GET_ZTABLE .
REFRESH : GIT_FRINGE.
SELECT HKONT
ZFI_FBT
ZFI_PAY
FROM ZFI_FBT_DETL
INTO TABLE GIT_FRINGE
FOR ALL ENTRIES IN s_hkont
WHERE HKONT IN S_HKONT.
CHECK SY-SUBRC EQ 0.
SORT GIT_FRINGE BY ZFI_HKONT.
ENDFORM. " get_ztable
*& Form get_percentage
text
--> p1 text
<-- p2 text
FORM GET_PERCENTAGE .
CLEAR : GWA_FRINGE.
LOOP AT GIT_BSIS ASSIGNING <BSIS>.
IF <BSIS> IS ASSIGNED.
READ TABLE GIT_FRINGE INTO GWA_FRINGE WITH KEY
ZFI_HKONT = <BSIS>-HKONT
BINARY SEARCH.
CHECK SY-SUBRC EQ 0.
<BSIS>-ZFI_FBT = GWA_FRINGE-ZFI_FBT.
<BSIS>-ZFI_PAY = GWA_FRINGE-ZFI_PAY.
ENDIF.
ENDLOOP.
UNASSIGN <BSIS>.
ENDFORM. " get_percentage
*& Form determine_sort_sequence
text
--> p1 text
<-- p2 text
FORM DETERMINE_SORT_SEQUENCE .
DATA : LS_SORT TYPE SLIS_SORTINFO_ALV.
LS_SORT-SPOS = 1. " Sort order
LS_SORT-FIELDNAME = 'HKONT'.
LS_SORT-TABNAME = 'GIT_BSIS'.
LS_SORT-UP = 'X'.
LS_SORT-SUBTOT = 'X'. " Sub total allowed
APPEND LS_SORT TO GT_SORT.
CLEAR LS_SORT.
ENDFORM. " determine_sort_sequence
*& Form get_events
text
--> p1 text
<-- p2 text
FORM GET_EVENTS .
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
GC_FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = GT_EVENTS.
READ TABLE GT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO GT_EVENTS.
ENDIF.
READ TABLE GT_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_USER_COMMAND TO LS_EVENT-FORM.
APPEND LS_EVENT TO GT_EVENTS.
ENDIF.
ENDFORM. " get_events
*& Form sub_commentery_build
text
--> p1 text
<-- p2 text
FORM SUB_COMMENTERY_BUILD .
DATA: LS_LINE TYPE SLIS_LISTHEADER.
DATA : L_LOW TYPE CHAR10,
L_HIGH TYPE CHAR10,
L_DATE TYPE CHAR25.
CONCATENATE S_BUDAT-LOW6(2) '.' S_BUDAT-LOW4(2) '.' S_BUDAT-LOW+0(4) INTO L_LOW.
CONCATENATE S_BUDAT-HIGH6(2) '.' S_BUDAT-HIGH4(2) '.' S_BUDAT-HIGH+0(4) INTO L_HIGH.
CONCATENATE L_LOW ' - ' L_HIGH INTO L_DATE.
***header
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Fringe Benefit Tax'.
APPEND LS_LINE TO GT_LIST_TOP_OF_PAGE.
***Selection
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Company Code'.
LS_LINE-INFO = P_BUKRS.
APPEND LS_LINE TO GT_LIST_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Posting Date'.
LS_LINE-INFO = L_DATE.
APPEND LS_LINE TO GT_LIST_TOP_OF_PAGE.
ENDFORM. " sub_commentery_build
FORM TOP_OF_PAGE *
When TOP-OF-PAGE will be fired , this event will be called and it
will use the contents of i_list_top_of_page for output in the header
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'ENJOYSAP_LOGO'
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM. "top_of_page
*& Form USER_COMMAND
Called from within the ALV processes. Currently, '&IC1' is used to
process the hotspot and display the document 'picked' by the user.
FORM USER_COMMAND USING PV_UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CLEAR : GWA_BSIS.
CASE PV_UCOMM.
WHEN '&IC1'.
READ TABLE GIT_BSIS INTO GWA_BSIS INDEX SELFIELD-TABINDEX.
CASE SELFIELD-SEL_TAB_FIELD.
WHEN 'GIT_BSIS-BELNR'.
IF NOT GWA_BSIS-BELNR IS INITIAL.
SET PARAMETER ID: 'BUK' FIELD GWA_BSIS-BUKRS,
'BLN' FIELD GWA_BSIS-BELNR,
'GJR' FIELD GWA_BSIS-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
WHEN OTHERS.
ENDCASE.
WHEN OTHERS.
ENDCASE.
CLEAR : GWA_BSIS.
ENDFORM. "user_command
*& Form SET_PF_STATUS
text
FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'.
ENDFORM. "SET_PF_STATUSENDFORM. "SET_PF_STATUS
AWARD POINTS IF USEFUL.... -
In ALV report how to do this..
Hi,
I worte one zreport, it displays the output in the Grid format.
Goto tr code : coois-> give some material number u will get output in the grid format..->above the grid u will look the bar on that u will see ENDUSER DOC, DISPLAY GRAPHIC, LAYOUT SETTINGS....
My requirement is : I have to add this bar to my grid report, please explain to me.
Thanks and Regards,
SuryaHi Jai.
We can not display barcode in ALV but in Smartform and Script is possible becuase we can set font "BARCODE" or any fonts to our variable.
What you should do is create general ALV report ,Smatform for printing barcode and botton for call
Smartform in ALV program.When a line is selected and click botton then take data in that line and call
Smartform for printing barcode that what I have done.
Hope it help .
SayC. -
Hi,
How to increase the field width of a field in ALV report.
I mean, in a ALV report, the field description of a field is not showing correctly. IF i try to extend the field width by the mouse/coursor, it displays the correct description.
IS there any way where for displaying the field description correctly?
Thanks,
KumarHi,
Go through the sample code,
*& Report ZDEMO_ALVLIST *
*& Example of a simple ALV List Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvlist .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*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).
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.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
endform.
Regards,
Raj. -
Summation of a field in ALV report
Hi,
I hv created an ALV Report. But i m not getting the summation sign in the Application Toolbar. What can be the problem? I am trying to find out the sum of the the field NETWR in table VBAK.
Thanks,
Mohit.See the ALV function module used by you and me ... the below program gives the summation icon in the alv bar .
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*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-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
* i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
* IT_EVENTS = GT_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.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
reward points if it is usefull
Girish -
Insert extra field in ALV report
Hi All,
Ive requirement like need to add Vendors Country Code very next to Tax code field in standard SAP standard ALV report S_ALR_87012357 .
Ive copied program (RFUMSV00) into z-program.
But Im not getting any idea how can I add extra field in field catalogue and corresponding value in internal table.
Any ideas please ..
Full points will be rewarded for useful answersI didn´t understand the question very well, but if i am in certain, you will have to modify the internal table to add the field. If the table which shows the alv is like a data base type, you will have to modify this in this way:
data: begin of gt_table occurs 0,
include structure ,
new_field type XXXX.
data: end of gt_table.
Then, you will have to add this new field to the field catalogue, in this form:
ls_catalogue-fialdname = 'NEW_FIELD'.
ls_catalogue-tabname = 'GT_TABLE'.
etc...
Luck in your requeriment.
ls_catalogue-tabname = 'GT_TABLE'.
etc...
Luck in your travel. -
Oops alv report not getting displayed
Hi experts,
I have REQUIREMENT WHERE I NEED TO DISPLAY THREE REPORTS USING ALAV OOPS.
I have maintained a FM to call alv rport.
,I have two validations to make at to different location in report. The report needs to be displayed only after I perform two different validations.
Issue is
I call this ALV reprt Fm once at : AT SELECTION SCREEN OUTPUT
and second time at : START OF SELECTION...
Now I can see the ALV report ( oops with three reports in one container) very well when i call it from : AT SECETION SCREEN OUTPUT( Here I perform one of teh two validations which I have mentioned above...The validation performed here is of Selction screen valiudation).
ButNow when I perform another validation at START OF SELECTIOn...here I cannot see the ALV report...TEH screen appearing is blank...
I am calling teh SAME OOPS ALV Function Module from both the locations...( START of SEL and AT selc O/p)..
I have debugged teh code and checked teh feidcatalogue genration as well s output table .and also structure
parameteers .. all of tehm are getting populated in both the cases ,,, but dont know why thye output doesnot appear in th last call..
please help ., I am stuck up...
TX a ton in adv...
Regards,
KTHi Kshitija T,
START-OF-SELECTION is processed in PAI of selection screen - as soon as all processing is done, the program flow will return, initialize your program an all of it's objects and display the selection screen again.
I solved this by disabling the default report status EXECUTE button and used AT-SELECTION-SCREEN events.
Regards,
Clemens -
Alv Report for invoice details
Dear All,
I need to develop one alv report for following details. i developed coding for this requirment but i am getting some error.kindley help me to how to move data from different internal table to final internal table. I used LOOP AT and READ Statement even i didn't get any output.
kindley help me out.
TYPES: BEGIN OF XT_TAB,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
STCD1 LIKE LFA1-STCD1,
STCD2 LIKE LFA1-STCD2,
STCD3 LIKE LFA1-STCD3,
STCD4 LIKE LFA1-STCD4,
END OF XT_TAB.
TYPES: BEGIN OF YT_TAB,
BUKRS LIKE BSEG-BUKRS,
BELNR LIKE BSEG-BELNR,
BUZEI LIKE BSEG-BUZEI,
LIFNR LIKE BSEG-LIFNR,
GJAHR LIKE BSEG-GJAHR,
END OF YT_TAB.
TYPES: BEGIN OF ZT_TAB,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
STCD2 LIKE LFA1-STCD2,
BELNR LIKE BSEG-BELNR,
BUZEI LIKE BSEG-BUZEI,
GJAHR LIKE BSEG-GJAHR,
END OF ZT_TAB.
I N T E R N A L T A B L E D E C L A R A T I O N S *
*-----Internal table to store data
DATA: ITAB1 TYPE STANDARD TABLE OF XT_TAB INITIAL SIZE 0,
WA_TAB1 TYPE XT_TAB.
DATA: ITAB2 TYPE STANDARD TABLE OF YT_TAB INITIAL SIZE 0,
WA_TAB2 TYPE YT_TAB.
DATA: ITAB TYPE STANDARD TABLE OF ZT_TAB WITH HEADER LINE,
WA_ITAB TYPE ZT_TAB,
ITAB_FINAL2 TYPE STANDARD TABLE OF ZT_TAB.
DATA: ITAB_TEMP1 TYPE STANDARD TABLE OF ZT_TAB WITH HEADER LINE.
Selection Screen Declarations *
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN begin OF LINE.
SELECTION-SCREEN COMMENT (23) text-003 FOR FIELD P_LIFNR.
PARAMETERS P_LIFNR LIKE LFA1-LIFNR OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK bk1.
START-OF-SELECTION.
PERFORM XTRACT_DATA.
END-OF-SELECTION.
*-----Filling the Output table
PERFORM populate_main_table.
PERFORM BUILD_FIELDCATALOG.
PERFORM SORTING.
PERFORM BUILD_LAYOUT.
PERFORM BUILD_ALV_GRID_DISPLAY.
Form XTRACT_DATA
FORM XTRACT_DATA .
*SELECT
a~LIFNR
a~NAME1
a~STCD2
b~BELNR
b~BUZEI
b~GJAHR
INTO TABLE ITAB
FROM LFA1 as a INNER JOIN BSEG as b
ON aLIFNR = bLIFNR
WHERE a~LIFNR = P_LIFNR.
SELECT LIFNR
NAME1
STCD1
STCD2
STCD3
STCD4
FROM LFA1
INTO TABLE ITAB1
WHERE LIFNR = P_LIFNR.
IF NOT ITAB1[] IS INITIAL.
SORT ITAB1 BY LIFNR.
SELECT BELNR
BUZEI
LIFNR
GJAHR
INTO TABLE ITAB2
FROM BSEG
FOR ALL ENTRIES IN ITAB1
WHERE LIFNR = ITAB1-LIFNR.
ENDIF.
ENDFORM. " XTRACT_DATA
*& Form POPULATE_MAIN_TABLE
text
--> p1 text
<-- p2 text
FORM POPULATE_MAIN_TABLE .
LOOP AT ITAB1 INTO WA_TAB1.
ITAB-LIFNR = ITAB1-LIFNR.
ITAB-NAME1 = ITAB1-NAME1.
ITAB-STCD2 = ITAB1-STCD2.
READ TABLE ITAB2 INTO WA_TAB2 WITH KEY LIFNR = WA_TAB1-LIFNR.
IF sy-subrc = 0.
ITAB-BELNR = ITAB1-BELNR.
ITAB-BUZEI = ITAB1-BUZEI.
ITAB-GJAHR = ITAB1-GJAHR.
ENDIF.
ENDLOOP.
ENDFORM. " POPULATE_MAIN_TABLE
Form BUILD_FIELDCATALOG
FORM BUILD_FIELDCATALOG .
REFRESH t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 1.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Vendor Number'.
wa_fcat-seltext_m = 'Vendor Number'.
wa_fcat-seltext_l = 'Vendor Number'.
wa_fcat-fieldname = 'LIFNR'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 2.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Vendor Name'.
wa_fcat-seltext_m = 'Vendor Name'.
wa_fcat-seltext_l = 'Vendor Name'.
wa_fcat-fieldname = 'NAME1'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 3.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Vendor TIN Number'.
wa_fcat-seltext_m = 'Vendor TIN Number'.
wa_fcat-seltext_l = 'Vendor TIN Number'.
wa_fcat-fieldname = 'STCD2'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 4.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Document No'.
wa_fcat-seltext_m = 'Document No'.
wa_fcat-seltext_l = 'Document No'.
wa_fcat-fieldname = 'BELNR'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 5.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Item Number'.
wa_fcat-seltext_m = 'Item Number'.
wa_fcat-seltext_l = 'Item Number'.
wa_fcat-fieldname = 'BUZEI'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 6.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Fiscal Year'.
wa_fcat-seltext_m = 'Fiscal Year'.
wa_fcat-seltext_l = 'Fiscal Year'.
wa_fcat-fieldname = 'GJAHR'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
ENDFORM. " BUILD_FIELDCATALOG
Form BUILD_LAYOUT
FORM BUILD_LAYOUT .
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-TOTALS_TEXT = 'TOTALS'.
ENDFORM. " BUILD_LAYOUT
Form BUILD_ALV_GRID_DISPLAY
FORM BUILD_ALV_GRID_DISPLAY .
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
is_layout = gd_layout
it_fieldcat = t_fcat[]
it_events = gt_events
is_print = gd_prntparams
it_sort = it_sortcat[]
i_save = 'X'
TABLES
t_outtab = ITAB
EXCEPTIONS
program_error = 1
OTHERS = 2.
thanks and regards
MurugeshTYPES: BEGIN OF XT_TAB,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
STCD1 LIKE LFA1-STCD1,
STCD2 LIKE LFA1-STCD2,
STCD3 LIKE LFA1-STCD3,
STCD4 LIKE LFA1-STCD4,
END OF XT_TAB.
TYPES: BEGIN OF YT_TAB,
BUKRS LIKE BSEG-BUKRS,
BELNR LIKE BSEG-BELNR,
BUZEI LIKE BSEG-BUZEI,
LIFNR LIKE BSEG-LIFNR,
GJAHR LIKE BSEG-GJAHR,
END OF YT_TAB.
TYPES: BEGIN OF ZT_TAB,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
STCD2 LIKE LFA1-STCD2,
BELNR LIKE BSEG-BELNR,
BUZEI LIKE BSEG-BUZEI,
GJAHR LIKE BSEG-GJAHR,
END OF ZT_TAB.
I N T E R N A L T A B L E D E C L A R A T I O N S *
*-----Internal table to store data
DATA: ITAB1 TYPE STANDARD TABLE OF XT_TAB INITIAL SIZE 0,
WA_TAB1 TYPE XT_TAB.
DATA: ITAB2 TYPE STANDARD TABLE OF YT_TAB INITIAL SIZE 0,
WA_TAB2 TYPE YT_TAB.
DATA: ITAB TYPE STANDARD TABLE OF ZT_TAB WITH HEADER LINE,
WA_ITAB TYPE ZT_TAB,
ITAB_FINAL2 TYPE STANDARD TABLE OF ZT_TAB.
DATA: ITAB_TEMP1 TYPE STANDARD TABLE OF ZT_TAB WITH HEADER LINE.
Selection Screen Declarations *
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN begin OF LINE.
SELECTION-SCREEN COMMENT (23) text-003 FOR FIELD P_LIFNR.
PARAMETERS P_LIFNR LIKE LFA1-LIFNR OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK bk1.
START-OF-SELECTION.
PERFORM XTRACT_DATA.
END-OF-SELECTION.
*-----Filling the Output table
PERFORM populate_main_table.
PERFORM BUILD_FIELDCATALOG.
PERFORM SORTING.
PERFORM BUILD_LAYOUT.
PERFORM BUILD_ALV_GRID_DISPLAY.
Form XTRACT_DATA
FORM XTRACT_DATA .
*SELECT
a~LIFNR
a~NAME1
a~STCD2
b~BELNR
b~BUZEI
b~GJAHR
INTO TABLE ITAB
FROM LFA1 as a INNER JOIN BSEG as b
ON aLIFNR = bLIFNR
WHERE a~LIFNR = P_LIFNR.
SELECT LIFNR
NAME1
STCD1
STCD2
STCD3
STCD4
FROM LFA1
INTO TABLE ITAB1
WHERE LIFNR = P_LIFNR.
IF NOT ITAB1[] IS INITIAL.
SORT ITAB1 BY LIFNR.
SELECT BELNR
BUZEI
LIFNR
GJAHR
INTO TABLE ITAB2
FROM BSEG
FOR ALL ENTRIES IN ITAB1
WHERE LIFNR = itab1-lifnr.
ENDIF.
ENDFORM. " XTRACT_DATA
*& Form POPULATE_MAIN_TABLE
text
--> p1 text
<-- p2 text
FORM POPULATE_MAIN_TABLE .
LOOP AT ITAB1 INTO WA_TAB1.
ITAB-LIFNR = ITAB1-LIFNR.
ITAB-NAME1 = ITAB1-NAME1.
ITAB-STCD2 = ITAB1-STCD2.
READ TABLE ITAB2 INTO WA_TAB2 WITH KEY LIFNR = WA_TAB1-LIFNR.
IF sy-subrc = 0.
ITAB-BELNR = ITAB1-BELNR.
ITAB-BUZEI = ITAB1-BUZEI.
ITAB-GJAHR = ITAB1-GJAHR.
ENDIF.
ENDLOOP.
LOOP AT itab1 INTO wa_tab1.
MOVE: wa_tab1-lifnr TO itab-lifnr,
wa_tab1-name1 TO itab-name1,
wa_tab1-stcd2 TO itab-stcd2.
Append itab.
READ TABLE itab2 TRANSPORTING NO FIELDS WITH KEY lifnr = wa_tab1-lifnr.
IF sy-subrc eq 0.
MOVE: wa_tab2-lifnr TO itab-lifnr,
wa_tab2-belnr TO itab-belnr,
wa_tab2-buzei TO itab-buzei,
wa_tab2-gjahr TO itab-gjahr.
Append itab.
endif.
endloop.
*LOOP AT t_agr_tcodes INTO s_agr_tcodes.
READ TABLE t_tstc
TRANSPORTING NO FIELDS
WITH KEY tcode = s_agr_tcodes-tcode.
IF sy-subrc eq 0.
MOVE: s_agr_tcodes-tcode TO it_agr_tcodes-tcode,
s_agr_tcodes-agr_name to it_agr_tcodes-agr_name,
t_tstc-pgmna to it_agr_pgmna.
*Append it_agr_tcodes.
*endif.
*endloop.
ENDFORM. " POPULATE_MAIN_TABLE
Form BUILD_FIELDCATALOG
FORM BUILD_FIELDCATALOG .
REFRESH t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 1.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Vendor Number'.
wa_fcat-seltext_m = 'Vendor Number'.
wa_fcat-seltext_l = 'Vendor Number'.
wa_fcat-fieldname = 'LIFNR'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 2.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Vendor Name'.
wa_fcat-seltext_m = 'Vendor Name'.
wa_fcat-seltext_l = 'Vendor Name'.
wa_fcat-fieldname = 'NAME1'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 3.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Vendor TIN Number'.
wa_fcat-seltext_m = 'Vendor TIN Number'.
wa_fcat-seltext_l = 'Vendor TIN Number'.
wa_fcat-fieldname = 'STCD2'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 4.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Document No'.
wa_fcat-seltext_m = 'Document No'.
wa_fcat-seltext_l = 'Document No'.
wa_fcat-fieldname = 'BELNR'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 5.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Item Number'.
wa_fcat-seltext_m = 'Item Number'.
wa_fcat-seltext_l = 'Item Number'.
wa_fcat-fieldname = 'BUZEI'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
wa_fcat-col_pos = 6.
wa_fcat-row_pos = 1.
wa_fcat-seltext_s = 'Fiscal Year'.
wa_fcat-seltext_m = 'Fiscal Year'.
wa_fcat-seltext_l = 'Fiscal Year'.
wa_fcat-fieldname = 'GJAHR'.
wa_fcat-tabname = 'ITAB'.
APPEND wa_fcat TO t_fcat.
CLEAR t_fcat.
ENDFORM. " BUILD_FIELDCATALOG
Form BUILD_LAYOUT
FORM BUILD_LAYOUT .
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-TOTALS_TEXT = 'TOTALS'.
ENDFORM. " BUILD_LAYOUT
Form BUILD_ALV_GRID_DISPLAY
FORM BUILD_ALV_GRID_DISPLAY .
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
is_layout = gd_layout
it_fieldcat = t_fcat[]
it_events = gt_events
is_print = gd_prntparams
it_sort = it_sortcat[]
i_save = 'X'
TABLES
t_outtab = ITAB
EXCEPTIONS
program_error = 1
OTHERS = 2.
Edited by: Murugesh P on Apr 6, 2009 10:54 AM
Edited by: Murugesh P on Apr 6, 2009 10:54 AM
Maybe you are looking for
-
How do I uncheck a radio button
I have a set of three radio buttons: Field type: exclusion group Value type: User entered optional, Default: none When one accidentally checks one of these buttons, it cannot be unchecked - or at least so it seems. The question is: Does anyone know o
-
Tax calculation in CRM using R/3 pricing procedure
Hello Experts We are using R/3 pricing procedure to calculate list prices in CRM. The condition record for Taxes are maintained for condition type UTXJ in SD which is calling for tax procedure TAXUSJ and condition type JR1. The records are maintaine
-
Printing from LCD-Form in Adobe Reader 9 - Fonts-Problem
hey there, I posted this in Adobe Reader forum, but probab. its better here... HELP PLS! I have a strange problem.I created a form in Adobe Live Cycle Designer and use this in an Adobe-PDF-package. By printing it on another PC (Windows) the fonts did
-
How to restore purchased ringtones before erasing the data on iph through iTunes
i forgot my passcode and it says connect to iTunes , when i followed the steps it tells me to restorer iph but it will erase my purchased data also , is there anyway i can keep my purchased ringtones n erase the iph?
-
Dear All, I have a existing alv list in which customer wants a refresh button to fetch the most recent data. In the report they have used LDB. Hence they are using Get LQUA statement which works as a loop along with end-of-selection. I have created a