Alv report for multiple record insertion
hi,
i'm new to abap. i'm using alv report for record display and insertion. how can i insert multiple records from alv to my table??
well that can be achieved only by running BDC inside alv report to enter the entries.and in that too you can append or edit single entries only
reward if useful
regards
vivek
Similar Messages
-
ALV Report for multiple headers with Line Items
Hi Sap All.
here i have got a requirement to change the exisiting Zprogram which writes all the header information with line items in a normal simple report,now i have got to change the program in order to display in an ALV Format .
in the exisiting program they are using EXTRACT ,INSERT Statement and multiple select statements for getting the values into each field ofheader and line items for writing in a simple report.
so ijust want to know how i can populate all the data into alv grid.
can any one help me in this.
regards.
Varmayou have to store all header records in an internal table and all item records in a second table
then you call function module REUSE_ALV_HIERSEQ_LIST_DISPLAY with both parameters T_OUTTAB_HEADER and T_OUTTAB_ITEM -
Hi all,
using this ZUS_SDN_THREE_ALV_GRIDS program structure i have generated the all the fields from table.
could you please guide me how to generate the ALV report for splecific fileds from individual tables.
if i click in click on grid1 (that is sales header details) we need populate the item details in grid2 and paralally customer details in grid3.
please guide me how to resolve the issuee..
thanks in advance
Srinivas...Hi,
I have done an example, like on 1st grid it displays header data (EKKO) and when you double click on any record, for that PO you will get item details (EKPO) on 2nd grid,
In the similar way, you can add one more grid and populate it with your own data simultaneously along with 2nd grid.
*& Report ZOOABAP1_SOW
report zabap2.
* TABLES
tables:ekko.
* DATA DECLARATIONS
data: grid1 type ref to cl_gui_alv_grid,
grid2 type ref to cl_gui_alv_grid,
container1 type ref to cl_gui_custom_container,
container2 type ref to cl_gui_custom_container,
flag.
* INTERNAL TABLES
data: it_ekko type table of ekko.
data: wa_ekko like line of it_ekko.
data: it_ekpo type table of ekpo.
data: it_fcat1 type lvc_t_fcat,
wa_fcat1 type lvc_s_fcat,
it_fcat2 type lvc_t_fcat,
wa_fcat2 type lvc_s_fcat,
wa_layout1 type lvc_s_layo,
wa_layout2 type lvc_s_layo,
wa_variant type disvariant.
* SELECTION-SCREEN
selection-screen begin of block b with frame title text-s01.
select-options: s_ebeln for ekko-ebeln.
selection-screen end of block b.
* CLASS lcl1 DEFINITION
class lcl1 definition.
public section.
methods:
handler_dbl_clk for event double_click
of cl_gui_alv_grid
importing e_row.
endclass. "lcl1 DEFINITION
* CLASS lcl1 IMPLEMENTATION
class lcl1 implementation.
method handler_dbl_clk.
read table it_ekko into wa_ekko index e_row-index.
if sy-subrc = 0.
perform get_ekpo.
endif.
endmethod. "handler_dbl_clk
endclass. "lcl1 IMPLEMENTATION
* START_OF_SELECTION
start-of-selection.
* Get PO header data
perform get_ekko.
* screen for container
call screen 100.
*& Module STATUS_0100 OUTPUT
* text
module status_0100 output.
set pf-status 'PFS'.
set titlebar 'TIT'.
data: obj type ref to lcl1.
if flag is initial.
create object container1
exporting
container_name = 'CONT1'.
create object container2
exporting
container_name = 'CONT2'.
create object grid1
exporting
i_parent = container1.
create object grid2
exporting
i_parent = container2.
create object obj.
set handler obj->handler_dbl_clk for grid1.
perform build_fcat.
perform build_layout.
call method grid1->set_table_for_first_display
exporting
* i_buffer_active =
* i_bypassing_buffer =
* i_consistency_check =
* i_structure_name = 'EKKO'
* is_variant = wa_variant
i_save = 'X'
* i_default = 'X'
is_layout = wa_layout1
* is_print =
* it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
changing
it_outtab = it_ekko
it_fieldcatalog = it_fcat1
* it_sort =
* it_filter =
* EXCEPTIONS
* invalid_parameter_combination = 1
* program_error = 2
* too_many_lines = 3
* others = 4
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
flag = 'X'.
endif.
endmodule. " STATUS_0100 OUTPUT
*& Form get_ekko
* text
* --> p1 text
* <-- p2 text
form get_ekko .
select ebeln bsart lifnr
from ekko
into corresponding fields of table it_ekko
where ebeln in s_ebeln.
endform. " get_ekko
*& Form GET_EKPO
* text
* --> p1 text
* <-- p2 text
form get_ekpo .
select ebeln ebelp menge meins peinh from ekpo
into corresponding fields of table it_ekpo
where ebeln = wa_ekko-ebeln.
if not it_ekpo[] is initial.
call method grid2->set_table_for_first_display
exporting
* i_buffer_active =
* i_bypassing_buffer =
* i_consistency_check =
* i_structure_name =
* is_variant =
* i_save =
* i_default = 'X'
is_layout = wa_layout2
* is_print =
* it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
changing
it_outtab = it_ekpo
it_fieldcatalog = it_fcat2
* it_sort =
* it_filter =
* EXCEPTIONS
* invalid_parameter_combination = 1
* program_error = 2
* too_many_lines = 3
* others = 4
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endif.
endform. " GET_EKPO
*& Module USER_COMMAND_0100 INPUT
* text
module user_command_0100 input.
case sy-ucomm.
when 'BACK' or 'EXIT' or 'CANC'.
call method container1->free.
call method container2->free.
leave to screen 0.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*& Form build_fcat
* text
* --> p1 text
* <-- p2 text
form build_fcat .
* fieldcatalog for EKKO table
wa_fcat1-col_pos = '1'.
wa_fcat1-fieldname = 'EBELN'.
wa_fcat1-tabname = 'EKKO'.
wa_fcat1-coltext = 'PO No.'.
append wa_fcat1 to it_fcat1.
clear wa_fcat1.
wa_fcat1-col_pos = '2'.
wa_fcat1-fieldname = 'BSART'.
wa_fcat1-tabname = 'EKKO'.
wa_fcat1-coltext = 'PO Type'.
append wa_fcat1 to it_fcat1.
clear wa_fcat1.
wa_fcat1-col_pos = '3'.
wa_fcat1-fieldname = 'LIFNR'.
wa_fcat1-tabname = 'EKKO'.
wa_fcat1-coltext = 'Vendor No.'.
append wa_fcat1 to it_fcat1.
clear wa_fcat1.
* fieldcatalog for EKPO table
wa_fcat2-col_pos = '1'.
wa_fcat2-fieldname = 'EBELN'.
wa_fcat2-tabname = 'EKPO'.
wa_fcat2-coltext = 'PO No.'.
append wa_fcat2 to it_fcat2.
clear wa_fcat2.
wa_fcat2-col_pos = '2'.
wa_fcat2-fieldname = 'EBELP'.
wa_fcat2-tabname = 'EKPO'.
wa_fcat2-coltext = 'PO Item'.
append wa_fcat2 to it_fcat2.
clear wa_fcat2.
wa_fcat2-col_pos = '3'.
wa_fcat2-fieldname = 'MENGE'.
wa_fcat2-tabname = 'EKPO'.
wa_fcat2-coltext = 'Quantity'.
append wa_fcat2 to it_fcat2.
clear wa_fcat2.
wa_fcat2-col_pos = '4'.
wa_fcat2-fieldname = 'MEINS'.
wa_fcat2-tabname = 'EKPO'.
wa_fcat2-coltext = 'UOM'.
append wa_fcat2 to it_fcat2.
clear wa_fcat2.
wa_fcat2-col_pos = '5'.
wa_fcat2-fieldname = 'PEINH'.
wa_fcat2-tabname = 'EKPO'.
wa_fcat2-coltext = 'Price Unit'.
append wa_fcat2 to it_fcat2.
clear wa_fcat2.
endform. " build_fcat
*& Form build_layout
* text
* --> p1 text
* <-- p2 text
form build_layout .
clear wa_layout1.
wa_layout1-grid_title = 'Header data'.
* wa_layout-sel_mode = 'A'. "allow to select multiple lines
clear wa_layout2.
wa_layout2-grid_title = 'Item Data'.
endform. " build_layout
If you have any poblems while doing this, post it.
Do reward points for all helpful answers
Regards,
Sowjanya -
Multiple record insert thru PROCEDURE - Urgent
All,
My requirement is, I have to invoke a procedure which accepts two input and 1 out variable. The operation of the procedure is to insert the data to two tables(head_tab and line_tab-accepts multiple record). I used %rowtype for the two inputs i.e procedure proc(head_var head_tab%rowtype, line_var line_tab%rowtype, out_var out number). The incoming doc comes from 3rd party application which sends a header record and multiple line record for the same header.
I used the transformation activity, to insert line record I used for-each loop for multiple record. But %rowtype being a scalar data type, it doesn't accept array of record to it! I'm stuck here. Can we achieve this scenario with using of procedure? or should I configure DBAdapter to insert the data directly to the table rather the procedure does this? If we can achieve it thru procedure, how can I go about?
Thanks,
SenHi,
I believe you should change the signature of the procedure.
I tried below code for my proc to send multiple records without use of for loop.
Type line_var_rec IS RECORD(
Var1;
var2;
Type line_var_tab IS TABLE OF line_var_rec INDEX BY BINARY INTEGER;
Type head_var_rec IS RECORD(
var3;
var4;
line_var line_var_tab ;
Type head_var_tab IS TABLE OF head_var_rec INDEX BY BINARY INTEGER;
proc(head_var IN head_var_tab, out_var out number);
With the above code you can insert multiple header records each having multiple line records.
Pls let me know if u have any questions. -
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 -
Devolped an ALV report for daily cash receipts for selected date range
hi,
how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.hi,
how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report. -
Devloped an ALV report for daily cash receipts for selected date range
hi,
how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.Hi,
You can develop simple reports using Report Painter.
You may be also interested in:
Check report SAPMF05A for credit memo
See the following Std reports on Payment Advices execute the Tcodes:
S_ALR_87009888
S_ALR_87009889
S_ALR_87009890
S_ALR_87009891
S_ALR_87009892
S_ALR_87009893
S_ALR_87009978
S_ALR_87009979
S_ALR_87009980
S_ALR_87009981
S_ALR_87009982
S_ALR_87009983
S_ALR_87010056
S_ALR_87010057
S_ALR_87010058
S_ALR_87010059
S_ALR_87010060
S_ALR_87010061
S_ALR_87010066
S_ALR_87010067
S_ALR_87012106
S_ALR_87012107
S_ALR_87012108
S_ALR_87012109
S_ALR_87012110
S_ALR_87012111
S_ALR_87012116
S_ALR_87012117
S_ALR_87012200
S_ALR_87012201
S_ALR_87012202
S_ALR_870122
S_ALR_87012204
S_ALR_87012205
S_ALR_87012350
S_ALR_87012351
S_ALR_87012352
S_ALR_87012353
S_ALR_87012354
S_ALR_87012355
sample ALV report:
tables:
marav. "Table MARA and table MAKT
Data to be displayed in ALV
Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
" intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
"make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
Other data needed
field to store report name
data i_repid like sy-repid.
field to check table length
data i_lines like sy-tabix.
Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
select-options:
s_matnr for marav-matnr matchcode object MAT1.
start-of-selection.
read data into table imat
select * from marav
into corresponding fields of table imat
where
matnr in s_matnr.
end-of-selection.
Now, we start with ALV
To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
The fieldcatalouge can be generated by FUNCTION
'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
report source, including this report.
The only problem one might have is that the report and table names
need to be in capital letters. (I had it )
Store report name
i_repid = sy-repid.
Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = sy-repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = i_repid
I_STRUCTURE_NAME = 'marav'
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = imat.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC .
ENDIF.
Hope this will help.
Regards,
Naveen. -
SSRS 2008 R2 - Separate report for Each record?
Hi,
How do I create new pdf reports for each records from a table? The pdf files should be named as customerid.pdf and needs to be delivered in email or share path?
Each record has enough content for 5 page of pdf report.
How do we achieve this?
Thanks
RajYou can create a data driven subscription to loop through records in the table and create pdf based on number of customerid.
Have a look at this for DD subscriptions :
http://msdn.microsoft.com/en-us/library/ms169673.aspx
Kind Regards, Vikram Kansal Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker -
ALV report for Purchase Requisitions(PR)
Hai All!
i am developing an ALV report for Purchase Requisitions(PR) tht are not approved ( ie IN RELEASE status), so i want to get who has approved PR and who has not approved it... from which table & which field i can get this data...
plz help meHi Following fields are used to set / reset release of PR
EBAN-FRGKZ
EBAN-FRGZU
EBAN-FRGST.
You will have to understand combination of these field from MM Fuctional Consultant.
rgds
rajesh
Edited by: RAJESH KUMAR on Aug 6, 2008 12:18 PM -
How to schedule one report for multiple company code?
How you can schedule reports in BW 3.5? Suppose I need to schedule one report for multiple company code, how can you do that and notify the users? I do not want to send multiple emails to the same user if the report runs for 20 times (for 20 different companies).
points are given for ASAP replies.
Thanks in advance
PeterDear Peter,
Try to restrict the Company Code with those 20 values and schedule.
Regards,
Ramkumar. -
ALV Report for Purchasing Each Vendor
Hi Anybody,
I am developing Purchasing Report. But I want display records in ALV Report based Vendor ID and Name.
Like Standard Report ME2M.
Ex:
Vendor ID : A0002 Name : UMS SEMICONDUCTOR PTE LTD.,
sNO po no item Price Qty
1. 10001 10 12.30 10
2. 10002 20 30.30 50
3. 10003 30 40.30 150
Vendor ID : X0012 Name : ALPHA PTE LTD.,
sNO po no item Price Qty
1. 10004 10 1.30 10
2. 10005 20 50.30 50
3. 10006 30 620.30 150
How to I will do?. Anybody please tell me.
Tks
S.Muthu.
IT Dept.hi..follow this code..
===================================================================
===================================================================
report .
========================== Global definitions ====================
Data Types
type-pools: slis.
types: begin of tp_data,
lifnr like ekko-lifnr,
end of tp_data,
tp_tbl_data type standard table of tp_data.
Constants
Data objects (variable declarations and definitions)
Report data to be shown.
data: it_data type standard table of tp_data.
Heading of the report.
data: t_heading type slis_t_listheader.
======================= Selection Screen ==========================
selection-screen: begin of block b1 with frame title text-t01.
DATA: w_aux_lifnr like ekko-lifnr.
SELECT-OPTIONS s_lifnr for w_aux_lifnr
DEFAULT LIFNR .
selection-screen: end of block b1.
======================== Event Blocks =============================
at selection-screen.
start-of-selection.
perform get_data using it_data.
end-of-selection.
perform build_alv using it_data t_heading.
======================== Subroutines ==============================
*& Form get_data
Gets the information to be shown in the report.
form get_data using t_data type tp_tbl_data.
SELECT ekko~lifnr
INTO CORRESPONDING FIELDS OF TABLE t_data
FROM ekko as ekko
WHERE ekko~lifnr in s_lifnr
endform. " get_data
*& Form build_alv
Builds and display the ALV Grid.
form build_alv using t_data type tp_tbl_data
t_heading type slis_t_listheader.
ALV required data objects.
data: w_title type lvc_title,
w_repid type syrepid,
w_comm type slis_formname,
w_status type slis_formname,
x_layout type slis_layout_alv,
t_event type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv,
t_sort type slis_t_sortinfo_alv.
refresh t_fieldcat.
refresh t_event.
refresh t_sort.
clear x_layout.
clear w_title.
Field Catalog
perform set_fieldcat2 using:
1 'LIFNR' 'LIFNR' 'EKKO' space space space space space space space space space space space space t_fieldcat .
Layout
x_layout-zebra = 'X'.
Top of page heading
perform set_top_page_heading using t_heading t_event.
Events
perform set_events using t_event.
GUI Status
w_status = ''.
w_repid = sy-repid.
Title
w_title = <<If you want to set a title for
the ALV, please, uncomment and edit this line>>.
User commands
w_comm = 'USER_COMMAND'.
Order
Example
PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
Displays the ALV grid
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = w_repid
it_fieldcat = t_fieldcat
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
tables
t_outtab = t_data
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. " build_alv.
*& Form set_top_page_heading
Creates the report headings.
form set_top_page_heading using t_heading type slis_t_listheader
t_events type slis_t_event.
data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = ''(001).
append x_heading to t_heading.
Program name
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Program: '.
x_heading-info = sy-repid.
append x_heading to t_heading.
User who is running the report
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'User: '.
x_heading-info = sy-uname.
append x_heading to t_heading.
Date of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Date: '.
write sy-datum to x_heading-info.
append x_heading to t_heading.
Time of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Time: '.
write sy-uzeit to x_heading-info.
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
endform.
*& Form set_events
Sets the events for ALV.
The TOP_OF_PAGE event is alredy being registered in
the set_top_page_heading subroutine.
form set_events using t_events type slis_t_event.
data: x_event type line of slis_t_event.
Example
clear x_event.
x_event-name = .
x_event-form = .
append x_event to t_event.
endform.
*& Form set_order
Adds an entry to the order table.
FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
t_sort TYPE slis_t_sortinfo_alv.
DATA: x_sort TYPE slis_sortinfo_alv.
CLEAR x_sort.
x_sort-fieldname = p_fieldname.
x_sort-tabname = p_tabname.
x_sort-up = p_up.
x_sort-down = p_down.
x_sort-subtot = p_subtot.
APPEND x_sort TO t_sort.
ENDFORM. "set_order
*& Form set_fieldcat2
Adds an entry to the field catalog.
p_colpos: Column position.
p_fieldname: Field of internal table which is being described by
* this record of the field catalog.
p_ref_fieldname: (Optional) Table field / data element which
* describes the properties of the field.
* If this field is not given, it is copied from
* the fieldname.
p_ref_tabname: (Optional) Table which holds the field referenced
* by <<p_ref_fieldname>>.
If this is not given, the parameter
<<p_ref_fieldname>> references a data element.
p_outputlen: (Optional) Column width.
p_noout: (Optional) If set to 'X', states that the field is not
* showed initially. If so, the field has to be
included in the report at runtime using the display
options.
p_seltext_m: (Optional) Medium label to be used as column header.
p_seltext_l: (Optional) Long label to be used as column header.
p_seltext_s: (Optional) Small label to be used as column header.
p_reptext_ddic: (Optional) Extra small (heading) label to be
* used as column header.
p_ddictxt: (Optional) Set to 'L', 'M', 'S' or 'R' to select
whether to use SELTEXT_L, SELTEXT_M, SELTEXT_S,
or REPTEXT_DDIC as text for column header.
p_hotspot: (Optional) If set to 'X', this field will be used
* as a hotspot area for cursor, alolowing the user
* to click on the field.
p_showasicon: (Optional) If set to 'X', this field will be shown
as an icon and the contents of the field will set
* which icon to show.
p_checkbox: (Optional) If set to 'X', this field will be shown
as a checkbox.
p_edit: (Optional) If set to 'X', this field will be editable.
p_dosum: (Optional) If set to 'X', this field will be summed
(aggregation function) according to the grouping set
by the order functions.
t_fieldcat: Table which contains the whole fieldcat.
FORM set_fieldcat2 USING
p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-hotspot = p_hotspot.
wa_fieldcat-checkbox = p_checkbox.
wa_fieldcat-icon = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set reference fieldname, tablenam and rollname.
If p_ref_tabname is not given, the ref_fieldname given
is a data element.
If p_ref_tabname is given, the ref_fieldname given is a
field of a table.
In case ref_fieldname is not given,
it is copied from the fieldname.
IF p_ref_tabname IS INITIAL.
wa_fieldcat-rollname = p_ref_fieldname.
ELSE.
wa_fieldcat-ref_tabname = p_ref_tabname.
IF p_ref_fieldname EQ space.
wa_fieldcat-ref_fieldname = wa_fieldcat-fieldname.
ELSE.
wa_fieldcat-ref_fieldname = p_ref_fieldname.
ENDIF.
ENDIF.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
Set as editable or not.
IF NOT p_edit IS INITIAL.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
======================== Subroutines called by ALV ================
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = <<If you want to set a logo, please,
uncomment and edit this line>>
it_list_commentary = t_heading.
endform. " alv_top_of_page
*& Form user_command
Called on user_command ALV event.
Executes custom commands.
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
Example Code
Executes a command considering the sy-ucomm.
CASE r_ucomm.
WHEN '&IC1'.
Set your "double click action" response here.
Example code: Create and display a status message.
DATA: w_msg TYPE string,
w_row(4) TYPE n.
w_row = rs_selfield-tabindex.
CONCATENATE 'You have clicked row' w_row
'field' rs_selfield-fieldname
'with value' rs_selfield-value
INTO w_msg SEPARATED BY space.
MESSAGE w_msg TYPE 'S'.
ENDCASE.
End of example code.
endform. "user_command -
Calling infotype 0002 in ALV report for showing employee photo
Hi all,
The requirment from business side is a report in which employees personal data shuold be shown with employee photo, I had tried for employee photo in ALV report but it didnt sucessed, then I went for other solution like calling transaction in ALV report.
In this case I am calling Infotype 0002 but the issue is that the transaction PA20 is coming with PERNR but I am not able to go directlly to infotype which shows employee Photo,please suggest any solution.
Thaks.
JAYHi Jay,
It is possible. Please refer the syntax for the CALL TRANSACTION
CALL TRANSACTION ta { [AND SKIP FIRST SCREEN]
| [USING bdc_tab [bdc_options]] }.
You can do a recording till the required page comes & call the transaction accordingly. Hope, you are aware about the same.
For example, I just had a solution to go to the roles tab in the user profile and I did as below:
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLSUU5'.
wa_bdcdata-dynpro = '0050'.
wa_bdcdata-dynbegin = k_ok.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = 'USR02-BNAME'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'USR02-BNAME'.
wa_bdcdata-fval = g_value.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = 'SHOW'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLSUU5'.
wa_bdcdata-dynpro = '0100'.
wa_bdcdata-dynbegin = k_ok.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=ACTG'.
APPEND wa_bdcdata TO it_bdcdata.
g_opt-dismode = 'E'.
g_opt-defsize = k_ok.
*** if user click on the User Name, call SU01
CALL TRANSACTION 'SU01' USING it_bdcdata
OPTIONS FROM g_opt.
Regards,
Selva K. -
Custom button on ALV report for Tcode FL10G ?
Hi All,
I want to add custom button in the AVL report for FL10G transaction. And then need to implement logic for that button (calling BAPI to create shipment for the selected records).
For VL10G alv program GUI Status - STANDARD001 I think I can add button in this gui by using access key.
But how to implement logic for this custom button? Where I can put the code for this button logic?
Please let me know if any one has any ideas on this issue.
I appreciate your help and time on this.
Thanks.
MHi Murali,
The standard program it will not allow to copy the GUI Status. Because source and target program should not same.
It will definitely debug will work. Yo can create the GUI Status through SE41. In SE41 Just give Program name :SAPLV50R_VIEW click the button status. here you should not give any gui status. just blindy say create the then it will popup screen appears in the screen. Here you can mention your Z GUI Status. It is not required to create all the menus manually instead of the there is button which is located in the screen next to blue i button. here you can click and select the standard interface. You can get all the menus as similar to standard. Like that you should create Menu Bar, Application Toolbar and Function Keys Menus. Then you can add your custom button in the Application tool bar button.
When you execute the Transaction VL10G and check your cusom menu button will appears. Once you click custom button only exit will trigger. Find the below code for your reference.
CODE
loop at ct_postab assigning <fs>
where selkz = 'X'.
*To Fill the BAPI Header Parameters
str_ordhdr-ship_cond = w_sval-value.
*To Fill the BAPI HeaderX Parameters
str_ordhdrx-updateflag = 'U'.
str_ordhdrx-ship_cond = 'X'.
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = <fs>-vbelv
order_header_in = str_ordhdr
order_header_inx = str_ordhdrx
tables
return = str_return.
endloop.
read table str_return into w_return index 1.
if sy-subrc eq 0.
if not w_return-type = 'S'.
message w_return-message type 'E'.
leave to current transaction.
endif.
endif.
*Do the BAPI Commit
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
endif.
endif.
endif.
Let me know if you have anything to discuss on the same. -
ALV REPORT FOR TOP 10 CUSTOMERS
hI,
sap guys
I need a help on alv. iam getting alv report. now i need to get TOP 10 customers in my report.
My report having selling price , cost price , GP , GP% .
Final internal table iam sorting based on Selling price. But how to Get the Top 10 customers in my report.
Plz help me..hi
good day brother
Before youve given the solution for top 20 cust as well as subtot.. iam getting a prob for one branch for subtot.
Plz see the code..
Ive dev the smart form for top 20 customers by Branch wise.. I have 17 branches in final itab.
Every thing is fine except one branch for the Subtot.
For getting Subtot as well as Getting the top 20 cust.. the below code ive used.
First branch like lt_br_out2 got 503 records
lt_br_out3 == 213
lt_br_out4 == 0
lt_br_out5== 82
lt_br_out6 ==89
lt_br_out7 ==118
lt_br_out8 == 45
lt_br_out9 == 64
lt_br_out10 == 53
lt_br_out11 == 47
lt_br_out12 == 56
lt_br_out13 == 20 *************** "Problem with this internal table.
lt_br_out14 ==170
Problem: All Branches are getting subtotal and top 20 cust except " LT_BR_OUT13"...Before its going to cal the top 20 cust. its has only 20 records.
Actually iam counting the top 20 cust as well as cal subtot and passing to Final Internal Table..
SORT lt_br_out13 BY p1_a_p DESCENDING.
CLEAR : lwa_out6.
LOOP AT lt_br_out13 INTO lwa_out6.
IF sy-tabix > 20.
CLEAR: lwa_out6.
***adding the subtot
lwa_out6-ort01 = lv_text.
lwa_out6-p1_a_p = lv_brtot.
lwa_out6-p2_a_p = lv_brtot1.
lwa_out6-act_gross_p = lv_br.
lwa_out6-act_gross_perc1 = lv_brperc1.
APPEND lwa_out6 TO lt_br_final.
EXIT.
ELSE.
***calc the sub tot
lv_text = 'Sub Total'.
lv_brtot = lv_brtot + lwa_out6-p1_a_p. " selling price
lv_brtot1 = lv_brtot1 + lwa_out6-p2_a_p. " Cost price
lv_br = lv_brtot - lv_brtot1.
lv_brperc = ( lv_br / lv_brtot ) * 100.
IF lv_brperc NE 0.
WRITE lv_brperc TO lv_brperc1 LEFT-JUSTIFIED.
CONCATENATE lv_brperc1 '%' INTO lv_brperc1 SEPARATED BY space.
ENDIF.
APPEND lwa_out6 TO lt_br_final.
ENDIF.
ENDLOOP.
If i put sy-tabix >= 20, thne iam getting subtotal but iam getting only 19 records.
Could u plz advice me.. Ive solved yesterday problem
Regards -
Slow response of ALV report for a high volume internal table
We have a requirement in which we have to display more than 5 lac records (= 500,000) in a single alv report. The internal table has 30 fields. it takes around five minutes to display the alv.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_pf_status_set = pfstatus
it_fieldcat = it_fcat[]
i_save = 'A'
is_layout = gs_layout
is_variant = import_variant
it_events = events[]
TABLES
t_outtab = i_tab.
above is the code used to display the alv. Any change in the coding to be done to improve the performance?
Thanks in advance.
K Mohan
Edited by: Thomas Zloch on May 23, 2011 4:16 PMHi,
As Thomas said ALV is not designed to display such a huge data, any how you can limit the data in the selection screen. one more reason is if you display 5Lak records in one ALV list then if you download them to excel sheet, you can download upto 65000 records only. So limit the display not more than 60000 for a better performance.
Thanks,
Bhargav.
Maybe you are looking for
-
MBA (2010) & Dual Monitors
I have a 2010 model MBA with the 2.13 GHz Intel Core Duo and the NVIDIA GeForce 320M 256 MB graphics, a 30" HP LP3065 display and a 24" Apple cinema display, and corresponding Apple mini DisplayPort to DVI adapters (dual and single link respectively)
-
Does the Mac Mini support a Flash Player?
-
Hi, I just bought a new adapter for my iBook G4 and now it doesn't charge the battery all the way anymore. My old power adapter ALWAYS charged the battery all the way up to 96%-100% (the reason I got a new adapter is because my old one was smoking an
-
Backups in a cluster environment?
What do the rest of you do for backups in clustered environments? You can backup the cluster level configuration very easily but if you have a failure you need a machine level backup. Do you take the time to remove the machines from the cluster to ge
-
Installing 9iAS 1.0.2.0.0
Hi, I'm trying to install/configure 9iAS 1.0.2.0.0 on a Win2K machine. A few questions: -> is there a way to install individual components (I need reports server but not Forms Server) with OUI? I did not find any clue... thanks. XtoF. null