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
Similar Messages
-
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. -
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 -
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 -
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 -
Report with Top 5 Customers per year for last 5 years (total 25 records)
Hello
Can anyone help?
How to display top 5 customers per year for last 5 years in a report
E.g.
Year Customer name Revenue
2009 A1 5000
A2 4000
A3 3000
A4 2000
A5 1500
2008 B1 3000
B2 1200
B3 800
Regards,
SMAHi
see this...
http://oraclebi.soundvoid.net/2008/09/using-the-top-n-filter/
And close your all threads if they answered... -
FR financial reporting - top 10 products for top 10 customers
We are trying to do top 10 based on two dimensions - for example customers and product. First get top 10 customers and then get top 10 products for each of those customers. We have tried the top 10 feature and also ranking, but we always get the combination - top 10 customer/product combinations ratrher than the two-step approach.
Any ideas how to do this with Financial Reporting?
This is an Essbase ASO application.
Thanks muchHi,
Try this:
SELECT top 10 (T1.[Volume]), T0.[DocNum], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], sum(T1.[LineTotal]) FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.[DocDate] between [%0] and [%1] GROUP BY T0.[DocNum], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription],T1.[Volume]
Thanks & Regards,
Nagarajan -
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 -
Nee help on ALV report for Total of BSEG-BUZEI & F1 document in FB03
Hi friends,
I need to diplay line items total & when double clicked on BELNR field it should open the F1 document in FB03.
Could anyone plz guide me on this.
Waiting for response.
below is my code,
Kindly needed help.
REPORT YALV_1.
TABLES : BKPF,BSEG.
Data for ALV display
TYPE-POOLS: SLIS.
data : int_fcat type SLIS_T_FIELDCAT_ALV,
fieldcatalog type slis_t_fieldcat_alv with header line.
DATA: wa_sortinfo TYPE slis_sortinfo_alv,
i_sortcat TYPE slis_t_sortinfo_alv.
TYPES : BEGIN OF T_BKPF,
BUKRS TYPE BKPF-BUKRS,
BELNR TYPE BKPF-BELNR,
GJAHR TYPE BKPF-GJAHR,
BLART TYPE BKPF-BLART,
BLDAT TYPE BKPF-BLDAT,
BUDAT TYPE BKPF-BUDAT,
END OF T_BKPF.
types: begin of t_bseg,
BUZEI TYPE BSEG-BUZEI,
end of t_bseg.
DATA : it_bkpf TYPE STANDARD TABLE OF t_bkpf with header line,
wa_bkpf TYPE t_bkpf,
it_bseg type standard table of t_bseg.
wa_bseg type t_bseg.
field to store report name
DATA : i_repid like sy-repid.
select bukrs belnr gjahr blart bldat budat from bkpf into table
it_bkpf where blart = 'AA'.
field to check table length
*data i_lines like sy-tabix.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
PERFORM sortcat_init CHANGING i_sortcat.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but
*can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such
*as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'BUKRS'.
fieldcatalog-seltext_m = 'Company Code'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 4.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BELNR'.
fieldcatalog-seltext_m = 'Doc No'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'GJAHR'.
fieldcatalog-seltext_m = 'Fiscal Year'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLART'.
fieldcatalog-seltext_m = 'DOC Type'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLDAT'.
fieldcatalog-seltext_m = 'Doc Date'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BUDAT'.
fieldcatalog-seltext_m = 'Popsting Date'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BUZEI'.
fieldcatalog-seltext_m = 'Line Items'.
fieldcatalog-col_pos = 6.
fieldcatalog-do_sum = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
FORM sortcat_init CHANGING i_sortcat TYPE slis_t_sortinfo_alv.
CLEAR wa_sortinfo.
wa_sortinfo-fieldname = 'BUKRS'.
wa_sortinfo-tabname = 'T_BKPF'.
wa_sortinfo-spos = 1. " First sort by this field.
wa_sortinfo-up = 'X'. " Ascending
wa_sortinfo-subtot = 'X'. " Subtotal at Name1
APPEND wa_sortinfo TO i_sortcat.
CLEAR wa_sortinfo.
wa_sortinfo-fieldname = 'BELNR'.
wa_sortinfo-tabname = 'T_BKPF'.
wa_sortinfo-spos = 2. " Sec sort by this field.
wa_sortinfo-up = 'X'. " Ascending
wa_sortinfo-subtot = 'X'. " Subtotal at Name1
APPEND wa_sortinfo TO i_sortcat.
ENDFORM. " sortcat_init
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
i_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_sort = i_sortcat
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
tables
t_outtab = IT_BKPF
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
form data_retrieval.
IF it_bkpf[] IS NOT INITIAL.
select buzei from bseg into
table it_bseg for all entries in it_bkpf
where bukrs = it_bkpf-bukrs
and belnr = it_bkpf-belnr
and gjahr = it_bkpf-gjahr.
endif.
endform. " DATA_RETRIEVAL.Hello
1.
form display_alv_report.
i_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = IT_BKPF
exceptions
program_error = 1
others = 2.
2.
* FORM USER_COMMAND
FORM user_command USING u_com LIKE sy-ucomm sel_lin TYPE slis_selfield.
CASE u_com.
WHEN '&IC1'.
CASE sel_lin.
WHEN 'BELNR'.
read TABLE IT_BKPF INDEX sel_lin-tabindex.
SET PARAMETER ID 'BLN' FIELD IT_BKPF-BELNR.
SET PARAMETER ID 'BUK' FIELD IT_BKPF-BUKRS.
SET PARAMETER ID 'GJR' FIELD IT_BKPF-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDCASE.
CLEAR u_com.
ENDCASE.
ENDFORM. "USER_COMMAND -
Cant send an e-mail in ALV report for background executaion
Hello friends,
I am displaying ALV report using container.
Now when i run this report in background, an e-mail should be go with an EXCEL attachment of report.
I am able to send e-mail and attachment in foreground .
I am also able to run alv report in background.
now, only problem is that i am am not able to send e-mail in background.
any sujjetions ?
Points will rewarded if little bit useful.
Regards,
nimesh
if cl_gui_alv_grid=>offline( ) is initial.
Create custom container
CREATE OBJECT g_r_cust_container
EXPORTING
container_name = gv_ctrl_custom.
Create TOP-Document
CREATE OBJECT g_r_dd_document
EXPORTING
style = 'ALV_GRID'.
Create Splitter for custom_container
CREATE OBJECT g_r_splitter
EXPORTING
parent = g_r_cust_container
rows = 2
columns = 1.
Split the grid in two parts- top and grid
CALL METHOD g_r_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = g_r_parent_top.
CALL METHOD g_r_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = g_r_parent_grid.
Set height for g_parent_html
CALL METHOD g_r_splitter->set_row_height
EXPORTING
id = 1
height = 1.
Create grid object
CREATE OBJECT g_r_alvgrid
EXPORTING
i_parent = g_r_parent_grid. "g_r_cust_container.
else .
Create grid object
CREATE OBJECT g_r_alvgrid
EXPORTING
i_parent = or_doc. "g_r_cust_container.
endif .
Create object handler object (of type local class)
CREATE OBJECT g_r_handler.
SET HANDLER g_r_handler->top_of_page FOR g_r_alvgrid.
SET HANDLER g_r_handler->print_top_of_page FOR g_r_alvgrid.
w_disvariant-report = sy-repid.
w_disvariant-variant = p_vari.
CALL METHOD g_r_alvgrid->set_table_for_first_display
EXPORTING
i_structure_name = 'ysds_sox_price_change'
is_layout = w_layout
is_variant = w_disvariant
i_save = yc_chara
CHANGING
it_outtab = t_st_result
it_fieldcatalog = t_fieldcat[]
it_sort = t_sortinfo[].
CALL METHOD g_r_dd_document->initialize_document
EXPORTING
background_color = cl_dd_area=>col_textarea.no i am using container for ALV.
In above code i have mantioned If.......ELSE.....Condition.
which give me allow to run ALV in background mode but my problem is that i am not able to send e-mail with attachment in background mode.
DATA : or_doc type ref to cl_gui_docking_container .
My report is working fine in foreground but not able to send email in background.
so anybody can solve it? -
ALV report for 5 Grids using Objects and Method
I have few questions in ALV 5Grids ,could you please correct me in the following program logic...
Using this program logic i am able to generate the five Grids and able to populate Header details from VBAK into Grid1,If you click in the Grid 1 and it is populating item details in Grid2 from VBAP,parallally populating the customer data in Grid5 from KNA1.
Now the pending issue is ,
if you click in the Grid2 then we should populate the shipping details in Grid3 and
if you click in the Grid3 then we should populate the billing details in Grid4.
Program Logic;
REPORT ZAREPAS20.
Tables : vbak,vbap,likp,lips,vbrk,vbrp,kna1.
DATA : OK_CODE LIKE SY-UCOMM,
G_CONTAINER TYPE SCRFNAME VALUE 'BCALV7_GRID_DEMO_0100_VASU',
DOCKING TYPE REF TO CL_GUI_DOCKING_CONTAINER,
SPLITTER_1 TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
SPLITTER_2 TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
splitter_3 TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
CELL_TOP1 TYPE REF TO CL_GUI_CONTAINER,
CELL_BOTTOM1 TYPE REF TO CL_GUI_CONTAINER,
CELL_TOP2 TYPE REF TO CL_GUI_CONTAINER,
CELL_BOTTOM2 TYPE REF TO CL_GUI_CONTAINER,
CELL_LEFT TYPE REF TO CL_GUI_CONTAINER,
CELL_middle TYPE REF TO CL_GUI_CONTAINER,
CELL_RIGHT TYPE REF TO CL_GUI_CONTAINER,
GRID1 TYPE REF TO CL_GUI_ALV_GRID,
GRID2 TYPE REF TO CL_GUI_ALV_GRID,
GRID3 TYPE REF TO CL_GUI_ALV_GRID,
GRID4 TYPE REF TO CL_GUI_ALV_GRID,
GRID5 TYPE REF TO CL_GUI_ALV_GRID.
DATA : GT_VBAK TYPE STANDARD TABLE OF VBAK,
GT_VBAP TYPE STANDARD TABLE OF VBAP,
GT_LIKP TYPE STANDARD TABLE OF likp,
GT_LIPS TYPE STANDARD TABLE OF lips,
GT_VBRK TYPE STANDARD TABLE OF vbrk,
GT_VBRP TYPE STANDARD TABLE OF vbrp,
GT_KNA1 TYPE STANDARD TABLE OF kna1.
DATA:begin of itab1 occurs 0,
vbeln type likp-VBELN,
erzet type likp-ERZET,
lfart type likp-LFART,
posnr type lips-POSNR,
END OF ITAB1.
DATA:begin of itab2 occurs 0,
vbeln like vbrk-vbeln,
posnr like vbrk-fktyp,
fkart like vbrk-fkart,
fklmg like vbrp-fklmg,
end of itab2.
*selection screen for selecting range of values
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
select-options: S_vbeln for VBAK-vbeln.
selection-screen end of block b1.
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender. " sending control, i.e. ALV grid that raised event
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD HANDLE_DOUBLE_CLICK.
*DEFINE LOCAL DATA.
DATA : itab_vbak type VBAK,
itab_vbap type VBAP,
itab_likp type likp,
itab_lips type lips,
itab_vbrk type vbrk,
itab_vbrp type vbrp,
itab_kna1 type kna1.
*DISTINGUISH ACCORDING TO SENDING GRID INSTANCE
CASE SENDER.
WHEN GRID1.
READ TABLE gt_VBAK INTO itab_vbak INDEX e_row-index.
CHECK ( itab_vbak-vbeln IS NOT INITIAL ).
CALL METHOD GRID1->set_current_cell_via_id
EXPORTING
is_ROW_ID =
is_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
WHEN GRID2.
READ TABLE gt_VBAP INTO itab_vbap INDEX e_row-index.
CHECK ( itab_vbap-vbeln IS NOT INITIAL ).
CALL METHOD GRID2->set_current_cell_via_id
EXPORTING
is_ROW_ID =
is_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
WHEN GRID3.
READ TABLE gt_LIPS INTO itab_LIPS INDEX e_row-index.
CHECK ( itab_lips-vgbel IS NOT INITIAL ).
CALL METHOD GRID3->set_current_cell_via_id
EXPORTING
is_ROW_ID =
is_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DELIVERY_DETAILS' ).
WHEN GRID4.
READ TABLE gt_VBRP INTO itab_VBRP INDEX e_row-index.
CHECK ( itab_vbrp-vgbel IS NOT INITIAL ).
CALL METHOD GRID4->set_current_cell_via_id
EXPORTING
is_ROW_ID =
is_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'BILLING_DETAILS' ).
WHEN GRID5.
READ TABLE gt_KNA1 INTO itab_KNA1 INDEX e_row-index.
CHECK ( itab_kna1-kunnr IS NOT INITIAL ).
SET PARAMETER ID 'KUN' FIELD itab_KNA1-KUNNR.
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
WHEN OTHERS.
RETURN.
ENDCASE.
endmethod.
endclass. "lcl_eventhandler IMPLEMENTATION
start-of-selection.
*write :/ 'FEDEX INT''''L' .
SELECT * FROM vbak INTO TABLE gt_VBAK
where vbeln IN S_VBELN.
creating docking container
create object docking
exporting
parent = cl_gui_container=>screen0
ratio = 90
exceptions
others = 6.
if sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Create splitter container
CREATE OBJECT splitter_1
EXPORTING
parent = docking
rows = 1
columns = 3
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Get cell container
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cell_left.
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = cell_middle.
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 3
RECEIVING
container = cell_right.
Create 2nd splitter container
CREATE OBJECT splitter_2
EXPORTING
parent = cell_left
rows = 2
columns = 1
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Get cell container
CALL METHOD splitter_2->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cell_top1.
CALL METHOD splitter_2->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = cell_bottom1.
Create 3rd splitter container
CREATE OBJECT splitter_3
EXPORTING
parent = cell_middle
rows = 2
columns = 1
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Get cell container
CALL METHOD splitter_3->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cell_top2.
CALL METHOD splitter_3->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = cell_bottom2.
Create ALV grids
CREATE OBJECT grid1
EXPORTING
i_parent = cell_top1
EXCEPTIONS
OTHERS = 5.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT grid2
EXPORTING
i_parent = cell_bottom1
EXCEPTIONS
OTHERS = 5.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT grid3
EXPORTING
i_parent = cell_top2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT grid4
EXPORTING
i_parent = cell_bottom2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT grid5
EXPORTING
i_parent = cell_right
EXCEPTIONS
OTHERS = 5.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid1.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid2.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid3.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid4.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid5.
Display data
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAK'
CHANGING
it_outtab = gt_VBAK
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_vbap.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAP'
CHANGING
it_outtab = gt_VBAP " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_LIPS.
CALL METHOD grid3->set_table_for_first_display
EXPORTING
i_structure_name = 'LIPS'
CHANGING
it_outtab = gt_LIPS " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_VBRP.
CALL METHOD grid4->set_table_for_first_display
EXPORTING
i_structure_name = 'VBRP'
CHANGING
it_outtab = gt_VBRP " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_KNA1.
CALL METHOD grid5->set_table_for_first_display
EXPORTING
i_structure_name = 'KNA1'
CHANGING
it_outtab = gt_KNA1 " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Link the docking container to the target dynpro
CALL METHOD docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
CALL SCREEN '0100'.
Flow logic of dynpro:
*PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
end-of-selection.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
SET TITLEBAR 'xxx'.
Refresh display of detail ALV list
CALL METHOD grid2->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Refresh display of detail ALV list
CALL METHOD grid3->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Refresh display of detail ALV list
CALL METHOD grid4->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Refresh display of detail ALV list
CALL METHOD grid5->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK' OR
'EXIT' OR
'CANCEL'.
SET SCREEN 0.LEAVE SCREEN.
USER HAS PUSHED BUTTON "DISPLAY OREDERS"
WHEN 'ORDER_DETAILS'.
PERFORM ORDER_SHOW_DETAILS.
when 'DELIVERY_DETAILS'.
PERFORM DELIVERY_SHOW_DETAILS.
WHEN 'BILLING_DETAILS'.
PERFORM BILLING_SHOW_DETAILS.
WHEN OTHERS.
ENDCASE.
CLEAR : OK_CODE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ORDER_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM order_show_details .
define local data
DATA:
ld_row TYPE i,
itab_VBAK TYPE VBAK.
CALL METHOD grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_VBAK INTO itab_VBAK INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM KNA1 INTO TABLE gt_KNA1
WHERE KUNNR = itab_VBAK-KUNNR.
SELECT * FROM VBAP INTO TABLE gt_VBAP
WHERE VBELN = ITAB_VBAK-VBELN.
*REFRESH: gt_LIPS.
ENDFORM. " ORDER_SHOW_DETAILS
*& Form DELIVERY_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM DELIVERY_SHOW_DETAILS .
define local data
DATA:
ld_row TYPE i,
itab_VBAP TYPE VBAP.
CALL METHOD grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_VBAP INTO itab_VBAP INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT LIKPVBELN LIKPERZET LIKPLFART LIPSVBELN
INTO CORRESPONDING FIELDS OF TABLE ITAB1
FROM ( LIKP INNER JOIN LIPS ON LIKPVBELN = LIPSVBELN )
WHERE LIKP~VBELN IN S_VBELN.
*REFRESH: gt_LIPS.
ENDFORM. " DELIVERY_SHOW_DETAILS
*& Form BILLING_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM BILLING_SHOW_DETAILS .
define local data
DATA:
ld_row TYPE i,
itab_LIPS TYPE LIPS.
CALL METHOD grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_LIPS INTO itab_LIPS INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT VBRKVBELN VBRKFKTYP VBRKFKART VBRPFKLMG
INTO CORRESPONDING FIELDS OF TABLE ITAB2
FROM ( VBRK INNER JOIN VBRP ON VBRKVBELN = VBRPVBELN )
WHERE VBRK~VBELN IN S_VBELN.
ENDFORM. " BILLING_SHOW_DETAILSHi,
ALV means ABAP List Viewer. Most convenient way to use it is through reuse library (cf.
transaction se83) available from release 4.6 of SAP R/3.
ALV is available in two modes: list and grid. List mode is good old list processing with
standard functionnalities, and grid mode is using a new OCX object displaying grids.
Classical reports needs more coding to set the horizontal and vertical lines.we need to adjust
the lines manually.Even interactive also takes lot of code.
ALV reports reduces the code when compared to classical reports.we use function modules to
generate the output.
that r REUSE_ALV_LIST_DISPLAY,REUSE_ALV_GRID_DISPLAY,REUSE_ALV_HIERSEQ_LIST_DISPLAY etc..
the following threads will give some examples of the functions which you are expecting
Header
regarding function module
hide ALV field
Simply Display selection parameter values in the ALV OUTPUT
Drag and drop in a report
https://www.sdn.sap
Reprots
http://www.sapgenie.com/abap/reports.htm
http://www.allsaplinks.com/material.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you
use - ABAP Objects calls or simple function modules. -
Subtotals in ALV report for ALPHA-NUMERIC field
Hi Experts,
I have problem while subtotalling values in ALV report.
I have 8 fields in my fieldcatalog. Now, I have to do the subtotal based on 3rd field having name 'ABC'. This field is having type CHAR & having lenght 3.
Now I wanted to do subtotalling for field 7 & 8 as 'NETWR' & 'MENGE' based on 3rd field.
How we can do the subtotal?Hi,
Refer this code
*& Form sub_display_data
text
FORM sub_display_data .
*--To sort the output through material number
DATA : lwa_sort TYPE slis_sortinfo_alv.
DATA : lit_sort TYPE slis_t_sortinfo_alv.
*--Pass the values to the table
lwa_sort-fieldname = 'PERNR'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '1'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = 'X'. "Subtotal
APPEND lwa_sort TO lit_sort.
*--Pass the values to the table
lwa_sort-fieldname = 'WORKDATE'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '2'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = ' '. "Subtotal
APPEND lwa_sort TO lit_sort.
*--Pass the values to the table
lwa_sort-fieldname = 'WEKLY'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '3'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = ' '. "Subtotal
APPEND lwa_sort TO lit_sort.
wa_layout-colwidth_optimize = 'X'.
IF NOT it_final2[] IS INITIAL.
*--Call the function module to display the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = wa_layout
i_callback_program = v_repid
it_fieldcat = it_fieldcat1[]
i_default = c_chk
i_save = c_save
it_sort = lit_sort
TABLES
t_outtab = it_final2
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.
ELSE.
*--Message No data found
MESSAGE i888 WITH text-017.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " sub_display_data
Regards,
Prashant -
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.
Maybe you are looking for
-
animated gif images are flickering: final ImageView imgView = new ImageView(); final Image tempImg = new Image(getClass().getResource("logo1.gif").toExternalForm()); imgView.setImage(tempImg); imgView.setLayoutX(50);
-
Can't login SQL Server 2008 R2 Express management studio
Hi i recently installed SQL Server 2008 R2 management studio. When I try to login i select 'Database engine' as the server type, I'm not sure what server name I'm supposed to be using but I tried .\SQLEXPRESS and authentication is 'SQL server Authent
-
Quick question about expensive SQL
Hello I want to run queries to get the most expensive and most often run SQL statements without running the statspack snapshots. Which tables/views would I need to query? Would V$SQL or V$SQL_TEXT be ok or would other tables be better? Cheers David
-
I need to compile java file in CRM 11i .
-
Periodic Billing plan -Contracts
Hi mates I am just creating Quantity contract and trying to activate periodic billing plan.When i select the line item and click the billing plan tab iam getting following error "ITEM 000010 CANNOT BE INVOICED ACCORDING TO THE BILLING PLAN" Can anybo