ALV report-Add a count row at teh botttom.
Hi!
I would like to adda row to my ALV report at the bottom of the report which will show me the count of number of billing documents existing in the repport. Even when the report is fileterd on certain conditions , the total at teh bottom should change as per the records showing. basically I need to add a total row at teh bottom of my report which will give the number of billintg documents that show up in the report.
Is it possible ? If so how do I go about please.
Thanks
I have this , but not sure where to insert the line count in this .
*& Form CALL_ALV
Call the ALV Grid function.
FORM call_alv .
SORT it_extract BY vbeln.
repid is necessary since the ALV F.M. does not work properly with
sy-repid.
repid = sy-repid.
alv_variant-variant = pa_vari.
alv_variant-report = sy-repid.
alv_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = t_fieldcat[]
it_sort = gt_sort[]
i_default = 'X'
i_save = 'A'
is_variant = alv_variant
it_events = gt_events[]
is_print = tp_print
TABLES
t_outtab = it_extract2
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE w000 WITH text-004 ' ' ' ' ' '.
ENDIF.
ENDFORM. " CALL_ALV
*& Form alv_eventtab_build
Pass list of events to be triggered by the ALV function module
FORM alv_eventtab_build USING u_name TYPE slis_alv_event-name
u_form TYPE slis_alv_event-form
alv_lt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event. " structure for event handling
ls_event-name = u_name.
ls_event-form = u_form.
APPEND ls_event TO alv_lt_events.
ENDFORM. " alv_eventtab_build
FORM TOP_OF_PAGE *
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'NEWALTA_LOGO'
it_list_commentary = gt_list_top_of_page.
ENDFORM. " TOP_OF_PAGE
You said the count will show along with or below the LOGO on top , but how do I incorporate the line count ihn it?
Similar Messages
-
What is 'C601' means in WA_FCAT-EMPHASIZE = 'C601' in ALV Reports?
HI all,
Can I know the meaning of 'C601' means in WA_FCAT-EMPHASIZE = 'C601' in ALV Reports?
Regards
Darshan MSHi Darshan,
Please find the Color details below. we can give the below color codes to the ALV report to differentiate the rows.
C601:
* Populate color variable with colour properties
* Char 1 = C (This is a color property)
* Char 2 = 3 (Color codes: 1 - 7)
* Char 3 = Intensified on/off ( 1 or 0 )
* Char 4 = Inverse display on/off ( 1 or 0 )
* i.e. wa_ekko-line_color = 'C610'
Colors:
1 gray-blue headers
2 light gray list bodies
3 yellow totals
4 blue-green key columns
5 green positive threshold value
6 red negative threshold value
7 orange Control levels
For More details, please find the link below
Changing SAP ALV cell / field colour
Regards
Rajkumar Narasimman -
Add a row after Total row in ALV report
Hi Experts,
I have a report is displayed by ALV format(not use function module to display it but use Class cl_gui_custom_container),I want to add a row after the total row. for example,
Customer amount1 amount2 amount3
10000 1,234 1,000 2,000
10001 4,000 2,000 1,000
10002 1,300 1,000 3,000
11000 1,200 4,000 3,000
Total: 7,734 8,000 9,000
Ratio% 31.27 32.34 36.39
the row of 'Total' is calculated by fieldcat-do_sum = 'X' But after the Total row we need a Ratio row to display the ratio. Yes we can calculate the total amout and ratio and then append it into the output itab, but we don't like this solution.We want to keep the total function in the ALV report.Any experts can poit me a direction. Thanks in advance.
JoeDjoe,
First you need to handle the user command,in order to capture the button action. For this you need to implment a class, i am attaching sample codes here
In top include write the following code
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
handle_toolbar FOR EVENT toolbar " To add new functional buttons to the ALV toolbar
OF cl_gui_alv_grid
IMPORTING e_object,
handle_user_command FOR EVENT user_command " To implement user commands
OF cl_gui_alv_grid
IMPORTING e_ucomm .
PRIVATE SECTION.
ENDCLASS. " Lcl_event_handler DEFINITION
Now <b>Class implementation</b>
CLASS lcl_event_handler IMPLEMENTATION .
METHOD handle_toolbar. " Handle Toolbar
PERFORM f9500_handle_toolbar USING e_object.
ENDMETHOD . " Handle_toolbar
METHOD handle_user_command . " Handle User Command
PERFORM f9600_handle_user_command USING e_ucomm .
ENDMETHOD.
ENDCLASS . " lcl_event_handler IMPLEMENTATION
FORM f9600_handle_user_command USING p_e_ucomm TYPE sy-ucomm.
CONSTANTS:c_newl(4) TYPE c
VALUE 'NEWL', " New line
c_copy(4) TYPE c
VALUE 'COPY', " Copy
c_corr(4) TYPE c
VALUE 'CORR'. " Correction
CASE p_e_ucomm .
WHEN c_newl.
Create a new line
PERFORM f9610_insert_new_line.
ENDFORM. " f9600_handle_user_command
FORM f9610_insert_new_line .
*Data Declarations
DATA: lt_rows TYPE lvc_t_row, " Itab for row property
ls_rows TYPE lvc_s_row, " Work area for row
lv_cntid TYPE i. " Counter
DATA: gv_index TYPE sy-index.
CLEAR gs_last.
CALL METHOD gr_alvgrid->get_selected_rows
IMPORTING
et_index_rows = lt_rows.
READ TABLE lt_rows INTO ls_rows INDEX 1.
IF sy-subrc EQ 0.
gv_index = ls_rows-index + 1.
ELSE.
gv_index = 1.
ENDIF.
DESCRIBE TABLE gt_last LINES lv_cntid.
lv_cntid = lv_cntid + 1.
gs_last-cntid = lv_cntid.
INSERT gs_last INTO gt_last INDEX gv_index.
LOOP AT gt_last INTO gs_last FROM gv_index TO gv_index.
Make the new line editable
PERFORM f9611_style.
ENDLOOP.
CALL METHOD gr_alvgrid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
ENDFORM. " f9610_insert_new_line
You can ask questions doubts if any!
regards
Antony Thomas -
To add additonal rows(text) in ALV report
Hi there,
I want to add additional ROWS at the bottom of each grouping.
Right now I am getting customer wise total comission amount but the requirement is on commsion amt ,i need to calculate 10 % tax and 2% tax and these taxes should get genrated below the commsion amt column as like below:
Company code Customer Commsion Amt
2000 101 1000
2000 101 2000
Total Comsion 3000
10% Service Tax 300
2% Edn Tax 6
Total 3306
2000 102 1230
2000 102 678
The output should be like this in ALV report .Could anyone plz help me out on this.
I will really appreciate your help.
Thanks,Hi Archana,
You can have the subtotal displayed for each company code and commision in the alv.
At end of each comp code and customer , pass the total of the whole amount into a line and you can display a line of this total.
Your alv gets displayed like this .
2000 101 1000
2000 101 2000
Total Comsion 3000
10% Service Tax 300
2% Edn Tax 6
3306
Thanks,
Guru -
Hi!
I would like to get the count of rows in my ALV report . How to get the count of the rows ? Can anyone guide me in getting it dome please.
ThanksHi Gaddemmedi!
I am attaching the report as you had asked for. I have added the things you asked me to do and now I am getting the count on the top of the page. The problem is that though it shows me the count of the lines from the LAV report on top but when I try to filter the records in the report that count first of all dosent change and remain the same as the initial number of record though after filtering records reduce and over that the count lines keep on increasing I mean the count is shown in repeated lines afet lines. Kindly help please.
Thanks
*& Report ZSD_BILLING_HDR_TEXT_sum *
*& billing doc. and associated header text report *
*& CHANGE LOG *
*& jpoon 2007.08.03 Change request: DEVK905095 *
*& Move request: SD_1451_01 Requestor: Mona Fox *
*& FP14134 - original code. *
REPORT zsd_billing_hdr_text_sum MESSAGE-ID zsd NO STANDARD PAGE HEADING.
* For ALV usage
TYPE-POOLS: slis.
DATA: gs_layout TYPE slis_layout_alv,
tp_print TYPE slis_print_alv,
gt_sort TYPE slis_t_sortinfo_alv,
gt_events TYPE slis_t_event,
t_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
repid TYPE syrepid, " ABAP Program.
gt_list_top_of_page TYPE slis_t_listheader, " Top of page text.
alv_variant TYPE disvariant," Customize Disp. Variant
w_event type slis_alv_event.
DATA: w_field TYPE slis_fieldcat_alv.
TABLES: vbrk, vbrp, vbpa.
DATA SLIS_EV_AFTER_OUTPUT.
data: gs_list_top_of_page type slis_listheader.
*data: gt_list_top_of_page type slis_t_listheader.
* Definition of selection screen *
* By plant, storage location, sold-to customers, material and *
* posting date of the sales orders *
SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbrk-vbeln, " billing doc.
s_kunnr FOR vbpa-kunnr, " bill-to customer number.
s_werks FOR vbrp-werks, " line item plant.
s_fkdat FOR vbrk-fkdat, " billing date.
s_fkart FOR vbrk-fkart, " billing type.
s_vkorg FOR vbrk-vkorg. " sales org.
PARAMETERS: p_hold AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK one.
* ALV display layout
SELECTION-SCREEN BEGIN OF BLOCK layout WITH FRAME TITLE text-003.
PARAMETERS: pa_vari TYPE slis_vari DEFAULT ' '. " Display variant.
SELECTION-SCREEN END OF BLOCK layout.
* Data Definitions *
* Storing Extracted Info.
TYPES: BEGIN OF t_extract,
vbeln TYPE vbeln_vf, " Sales order number.
posnr TYPE posnr, " line item
fkart TYPE fkart, " billing type.
vtext TYPE BEZEI20, " billing type description.
fkdat TYPE fkdat, " billing date.
werks TYPE werks_d, " line item plant.
werks_name1 TYPE name1, " plant description.
kunnr TYPE kunnr, " bill-to customer.
kunnr_name1 TYPE name1_gp, " bill-to description.
netwr TYPE netwr, " net value,invoice total $
zzflag TYPE boolean, " hold indicator
zzreason TYPE char30, " header text2 (reason)
zzuser TYPE ernam, " last changed by
zz_changed_date TYPE dats, " last changed date
zz_changed_time TYPE tims, " last changed time
END OF t_extract.
DATA: it_extract TYPE TABLE OF t_extract WITH HEADER LINE,
it_extract2 TYPE TABLE OF t_extract WITH HEADER LINE.
DATA: it_text TYPE TABLE OF tline WITH HEADER LINE.
DATA: wa_thead type thead.
DATA: w_tdname type TDOBNAME.
DATA: L_COUNT TYPE I.
* initialization
INITIALIZATION.
gs_layout-colwidth_optimize = 'X'.
tp_print-no_print_listinfos = 'X'.
tp_print-no_coverpage = 'X'.
PERFORM set_fieldcat.
PERFORM alv_eventtab_build USING:
** Event name Form to execute Event internal table
'TOP_OF_PAGE' 'TOP_OF_PAGE' gt_events[].
* Dropdown list for all created ALV layouts, global or user-specific
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_vari.
PERFORM alv_variant_f4 CHANGING pa_vari.
* Main BODY of processing logic
START-OF-SELECTION.
IF s_vbeln IS INITIAL
AND s_kunnr IS INITIAL
AND s_werks IS INITIAL
AND s_fkdat IS INITIAL
AND s_fkart IS INITIAL
AND s_vkorg IS INITIAL.
MESSAGE i000 WITH text-037 ' ' ' ' ' '.
ELSE.
PERFORM extract_data.
ENDIF.
END-OF-SELECTION.
IF it_extract2[] IS INITIAL.
MESSAGE i000 WITH text-002 ' ' ' ' ' '.
ELSE.
* Build headings for report.
* PERFORM build_top_of_page USING gt_list_top_of_page[].
* describe table it_extract2 lines l_count.
*write :/ 'TOTAL NO OF ENTRIES', SY-VLINE, 32 L_COUNT.
PERFORM call_alv.
*write :/ 'TOTAL NO OF ENTRIES', SY-VLINE, 32 L_COUNT.
ENDIF.
*& Form EXTRACT_KEY_DATA
* Retreive the data for the report.
FORM extract_data.
CLEAR: it_extract. REFRESH: it_extract.
* read and select billing documents
IF p_hold IS INITIAL.
SELECT vbrk~vbeln vbrk~fkart vbrk~fkdat vbrk~netwr
vbrk~zzflag vbrk~zzreason vbrk~zzuser
vbrk~zz_changed_date vbrk~zz_changed_time
vbrp~posnr vbrp~werks
INTO CORRESPONDING FIELDS OF TABLE it_extract
FROM vbrk INNER JOIN vbrp ON
vbrk~vbeln = vbrp~vbeln
WHERE vbrk~vbeln IN s_vbeln
AND vbrk~fkart IN s_fkart
AND vbrk~fkdat IN s_fkdat
AND vbrk~vkorg IN s_vkorg
AND vbrk~fksto NE 'X'
AND vbrp~werks IN s_werks.
ELSE.
* read 'held' documents only as per selection
SELECT vbrk~vbeln vbrk~fkart vbrk~fkdat vbrk~netwr
vbrk~zzflag vbrk~zzreason vbrk~zzuser
vbrk~zz_changed_date vbrk~zz_changed_time
vbrp~posnr vbrp~werks
INTO CORRESPONDING FIELDS OF TABLE it_extract
FROM vbrk INNER JOIN vbrp ON
vbrk~vbeln = vbrp~vbeln
WHERE vbrk~vbeln IN s_vbeln
AND vbrk~fkart IN s_fkart
AND vbrk~fkdat IN s_fkdat
AND vbrk~vkorg IN s_vkorg
AND vbrk~fksto NE 'X'
AND vbrk~zzflag = 'X'
AND vbrp~werks IN s_werks.
ENDIF.
IF sy-subrc <> 0.
MESSAGE i000 WITH text-002 ' ' ' ' ' '.
ENDIF.
CHECK sy-subrc = 0.
* only need first line item for this report.
SORT it_extract BY vbeln posnr.
DELETE ADJACENT DUPLICATES FROM it_extract COMPARING vbeln.
LOOP AT it_extract.
* Retrieve and select by sales order bill-to on header level
* as well as lookup bill-to customer name/description
SELECT SINGLE kunnr FROM vbpa INTO it_extract-kunnr
WHERE vbeln = it_extract-vbeln
AND posnr = '000000'
AND parvw = 'RE'.
IF it_extract-kunnr IN s_kunnr.
it_extract-kunnr_name1 = zcl_kna1=>get_name1( it_extract-kunnr ).
ELSE.
DELETE it_extract.
CONTINUE.
ENDIF.
* lookup billing type description
SELECT SINGLE vtext FROM tvfkt
INTO it_extract-vtext
WHERE spras = sy-langu
AND fkart = it_extract-fkart.
IF sy-subrc <> 0.
clear it_extract-vtext.
ENDIF.
* lookup plant description
SELECT SINGLE name1 FROM t001w
INTO it_extract-werks_name1
WHERE werks = it_extract-werks.
IF sy-subrc <> 0.
clear it_extract-werks_name1.
ENDIF.
MOVE-CORRESPONDING it_extract TO it_extract2.
APPEND it_extract2.
ENDLOOP.
describe table it_extract2 lines l_count.
ENDFORM. " EXTRACT_DATA
*& Form SET_FIELDCAT
* Create the field catalogue.
FORM set_fieldcat .
*CLEAR W_EVENT.
*W_EVENT-FORM = SLIS_EV_AFTER_OUTPUT.
*W_EVENT-NAME = SLIS_EV_AFTER_LINE_OUTPUT.
*APPEND W_EVENT TO GT_EVENTS.
CLEAR w_field.
CLEAR t_fieldcat. REFRESH t_fieldcat.
w_field-col_pos = 1.
w_field-fieldname = 'ZZFLAG'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Hold Printing'(005).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 2.
w_field-fieldname = 'ZZREASON'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Reason'(036).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 3 .
w_field-fieldname = 'VBELN'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Billing Doc'(028).
w_field-emphasize = 'X'.
w_field-hotspot = 'X'.
APPEND w_field TO t_fieldcat.
CLEAR w_field.
w_field-col_pos = 4 .
w_field-fieldname = 'VTEXT'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Type Description'(030).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 5 .
w_field-fieldname = 'FKDAT'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Billing Date'(031).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 6 .
w_field-fieldname = 'WERKS'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Plant'(012).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 7 .
w_field-fieldname = 'WERKS_NAME1'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Plant Description'(032).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 8.
w_field-fieldname = 'KUNNR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Bill-to Customer'(033).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 9 .
w_field-fieldname = 'KUNNR_NAME1'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Bill-to Description'(034).
w_field-emphasize = 'X'.
w_field-hotspot = 'X'.
APPEND w_field TO t_fieldcat.
CLEAR w_field.
w_field-col_pos = 10 .
w_field-fieldname = 'NETWR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Invoice Amount'(035).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 11 .
w_field-fieldname = 'ZZUSER'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Changed By'.
APPEND w_field TO t_fieldcat.
w_field-col_pos = 12 .
w_field-fieldname = 'ZZ_CHANGED_DATE'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Last Changed Date'(006).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 13 .
w_field-fieldname = 'ZZ_CHANGED_TIME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Last Changed Time'(007).
APPEND w_field TO t_fieldcat.
* W_event-NAME = slis_ev_end_of_list.
* W_event-FORM = 'END_OF_LIST'.
* APPEND W_event TO GT_EVENTS.
* CLEAR W_event .
* w_field-col_pos = 14 .
* w_field-fieldname = 'COUNT'.
* w_field-tabname = 'IT_EXTRACT2'.
* w_field-seltext_l = 'COUNT'.
* APPEND w_field TO t_fieldcat.
ENDFORM. " SET_FIELDCAT
*& Form CALL_ALV
* Call the ALV Grid function.
FORM call_alv .
SORT it_extract BY vbeln.
* repid is necessary since the ALV F.M. does not work properly with
* sy-repid.
repid = sy-repid.
alv_variant-variant = pa_vari.
alv_variant-report = sy-repid.
alv_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = t_fieldcat[]
it_sort = gt_sort[]
i_default = 'X'
i_save = 'A'
is_variant = alv_variant
it_events = gt_events[]
is_print = tp_print
TABLES
t_outtab = it_extract2
EXCEPTIONS
program_error = 1
OTHERS = 2.
write :/ 'TOTAL NO OF ENTRIES', SY-VLINE, 32 L_COUNT.
IF sy-subrc NE 0.
MESSAGE w000 WITH text-004 ' ' ' ' ' '.
ENDIF.
ENDFORM. " CALL_ALV
*& Form alv_eventtab_build
* Pass list of events to be triggered by the ALV function module
FORM alv_eventtab_build USING u_name TYPE slis_alv_event-name
u_form TYPE slis_alv_event-form
alv_lt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event. " structure for event handling
ls_event-name = u_name.
ls_event-form = u_form.
APPEND ls_event TO alv_lt_events.
ENDFORM. " alv_eventtab_build
* FORM TOP_OF_PAGE *
FORM top_of_page.
*gs_list_top_of_page-type = 'H'.
GS_LIST_TOP_OF_PAGE-INFO = L_COUNT.
APPEND GS_LIST_TOP_OF_PAGE TO GT_LIST_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'NEWALTA_LOGO'
it_list_commentary = gt_list_top_of_page.
ENDFORM. " TOP_OF_PAGE
*& Form user_command
* Process the user command.
* -->R_UCOMM User command
* -->RS_SELFIELD Field selected
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: ltp_vbeln TYPE vbeln. " Sales document number.
CASE r_ucomm.
WHEN '&IC1'.
IF ( rs_selfield-fieldname = 'VBELN'
OR rs_selfield-fieldname = 'BILL_VBELN' )
AND rs_selfield-value IS NOT INITIAL. " Display sales document.
ltp_vbeln = rs_selfield-value.
zcl_sales_doc=>display( ltp_vbeln ).
ENDIF.
ENDCASE.
ENDFORM. "user_command
*& Form alv_v-ariant_f4
* Get the display variant.
* <--CTP_VARI Variant name
FORM alv_variant_f4 CHANGING ctp_vari TYPE slis_vari.
alv_variant-report = sy-repid. " Report ID
alv_variant-username = sy-uname. " User ID
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = alv_variant
i_save = 'A'
IMPORTING
es_variant = alv_variant
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
ctp_vari = alv_variant-variant.
ENDIF.
ENDFORM. " alv_variant_f4 -
To add/delete the rows in ALV report outpout
Hi,
Is there any way by which we can add/delete the rows in ALV report output.
Thanks
AnkulHi,
Try out this way:
data: i_modified TYPE STANDARD TABLE OF mara,"For getting modified rows
w_modified TYPE mara.
CASE e_ucomm.
WHEN 'EDIT'.
perform save_database.
CALL METHOD ref_GRID->REFRESH_TABLE_DISPLAY.
ENDCASE.
FORM SAVE_DATABASE .
data: i_selected_rows TYPE lvc_t_row, "Selected Rows
w_selected_rows TYPE lvc_s_row.
* Getting the selected rows index
CALL METHOD ref_grid->get_selected_rows
IMPORTING et_index_rows = i_selected_rows.
* Through the index capturing the values of selected rows
LOOP AT i_selected_rows INTO w_selected_rows.
READ TABLE it_tab INTO wa_it_tab INDEX w_selected_rows-index.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING wa_it_tab TO w_modified.
APPEND w_modified TO i_modified.
ENDIF.
ENDLOOP.
MODIFY mara FROM TABLE i_modified.
Thanks,
Krishna -
How to add the dril down functionality in alv report.
Hi All,
I have a ALV report and now i want to add drill down functionality in this ALV report.
See my code below:
FORM f0002_build_field_catalog.
Build the field catalog
CLEAR ws_layout.
ws_layout-colwidth_optimize = 'X'.
ws_layout-edit = ' '.
ws_field_catalog-col_pos = '1'.
ws_field_catalog-fieldname = 'BUKRS'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Company Code'.
ws_field_catalog-seltext_m = 'CCode'.
ws_field_catalog-seltext_s = 'CCode'.
ws_field_catalog-fix_column = 'X'.
ws_field_catalog = 'X'.
ws_fieldcat-ref_tabname = 'VBKPF'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '2'.
ws_field_catalog-fieldname = 'BELNR'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Document no.'.
ws_field_catalog-hotspot = 'V'.
ws_field_catalog-seltext_m = 'Doc.no.'.
ws_field_catalog-seltext_s = 'Doc.no.'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '3'.
ws_field_catalog-fieldname = 'GJAHR'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Year'.
ws_field_catalog-seltext_m = 'Year'.
ws_field_catalog-seltext_s = 'Year'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '4'.
ws_field_catalog-fieldname = 'BSTAT'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Status'.
ws_field_catalog-seltext_m = 'Status'.
ws_field_catalog-seltext_s = 'Status'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '5'.
ws_field_catalog-fieldname = 'FLAG'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Open/Cleared'.
ws_field_catalog-seltext_m = 'Open/Cleared'.
ws_field_catalog-seltext_s = 'Open/Cleared'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '6'.
ws_field_catalog-fieldname = 'BLART'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Doc.Type.'.
ws_field_catalog-seltext_m = 'Doc.Type'.
ws_field_catalog-seltext_s = 'Doc.Type'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '7'.
ws_field_catalog-fieldname = 'WRBTR'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Total Amount'.
ws_field_catalog-seltext_m = 'Total Amount'.
ws_field_catalog-seltext_s = 'Total Amount'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '8'.
ws_field_catalog-fieldname = 'WAERS'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Currency.'.
ws_field_catalog-seltext_m = 'Currency'.
ws_field_catalog-seltext_s = 'Currency'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '9'.
ws_field_catalog-fieldname = 'LIFNR'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Vendor'.
ws_field_catalog-seltext_m = 'Vendor'.
ws_field_catalog-seltext_s = 'Vendor'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '10'.
ws_field_catalog-fieldname = 'NAME1'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Vendor Name'.
ws_field_catalog-seltext_m = 'Name 1'.
ws_field_catalog-seltext_s = 'Name 1'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '11'.
ws_field_catalog-fieldname = 'UZAWE'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Payment Method Supplement'.
ws_field_catalog-seltext_m = 'PmtMthSuppl'.
ws_field_catalog-seltext_s = 'PmtMthSuppl'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '12'.
ws_field_catalog-fieldname = 'XBLNR'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Reference'.
ws_field_catalog-seltext_m = 'Ref. No.'.
ws_field_catalog-seltext_s = 'Ref. No.'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
g_variant-report = sy-repid.
CLEAR struct_extab.
MOVE '&XPA' TO struct_extab-fcode.
APPEND struct_extab TO i_extab.
MOVE '&OMP' TO struct_extab-fcode.
APPEND struct_extab TO i_extab.
Display the list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
i_callback_user_command = 'HANDLE_USER_COMMAND'
is_layout = ws_layout
it_fieldcat = lt_fieldcat[]
it_excluding = i_extab[]
i_default = 'X'
i_save = 'U' "For user variants
is_variant = g_variant
TABLES
t_outtab = i_output.
ENDFORM. "f0002_build_field_catalog
*& Form f0038_pf_status
text
-->I_EXTAB text
FORM f0038_pf_status USING i_extab TYPE slis_t_extab. "#EC CALLED
CLEAR struct_extab.
MOVE '&XPA' TO struct_extab-fcode.
APPEND struct_extab TO i_extab.
MOVE '&OMP' TO struct_extab-fcode.
APPEND struct_extab TO i_extab.
SET PF-STATUS 'Z_PFSTATUS2' EXCLUDING i_extab.
ENDFORM. "f0038_pf_status
Pls tell me how i use this below dril down ability functionality in my code.
See the requirement below.
The Document Number, aka Accounting Document Number (BELNR) of each row will take the user to the appropriate document to edit as follows:
For Parked documents:-
If VBKPF-AWTYP (Reference Procedure) = RMRP, then the drilldown functionality should be to MIR4 using the Object ID in VBKPF- AWKEY. In this scenario the Object ID represents a Invoice Document Number, not an Accounting Document Number. Not the Object ID is a combination of Invoice Document Number and Fiscal Year
If VBKPF-AWTYP = Any other value, then the drilldown functionality should be to FBV2 using the Object ID in VBKPF-AWKEY. In this scenario the Object ID represents a true Accounting Document Number. Note the Object ID is a combination of Company Code (VBKPF-BUKRS), Accounting Document Number (VBKPF-BELNR) and Fiscal Year (VBKPF-GJAHR)
For Posted, not Cleared documents:-
Drilldown ability should be to FB02. The combination of Company Code (BSIK-BUKRS), Accounting Document Number (BSIK-BELNR) and Fiscal Year (BSIK-GJAHR) will be used to open/drilldown to the correct document in FB02.
For Cleared documents:-
Drilldown ability should be to FB03. The combination of Company Code (BSIK-BUKRS), Accounting Document Number (BSIK-BELNR) and Fiscal Year (BSIK-GJAHR) will be used to open/drilldown to the correct document in FB03.
Its very urgent, pls help on this.
Thanks!
VipinPls refer :
https://wiki.sdn.sap.com/wiki/display/Snippets/ABAPInteractiveALVwithCallTransaction%28usingParameterID%29
https://wiki.sdn.sap.com/wiki/display/Snippets/ABAPInteractiveALV+Program
Regards,
Anish Thomas
Pls reward all useful answers -
How can i choose row to edit in alv report
hello ,
i done alv report with one coloumne that can be edit ,
in this coloumne i want to choose which rows can be edit
and which will be close according to event .
i saw example program "BCALV_EDIT_02" that show this case
but stile , i don't understand what is the action that
do it .
this is the part
IF p_mode EQ 'RW'.
*§2a.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_ENABLED to set a cell
to status "editable".
l_mode = cl_gui_alv_grid=>mc_style_enabled.
ELSE. "p_mode eq 'RO'
*§2b.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_DISABLED to set a cell
to status "non-editable".
l_mode = cl_gui_alv_grid=>mc_style_disabled.
ENDIF.
so what is the part that will close the row for edit ?
when i add this part in my report all the row is deleted.
thanks.Dakota,
You can change the settings at runtime.
What you need to do is to have another column as part of the internal table, that has the data. This column, say, STYLE will refer to LVC_T_STYL. So, this becomes a nested internal table.
Set the editable flga switched off at Fieldcat and layout level.
Now, while filling the data in the table, or looping it separately, fill the Styles table for each row accordingly depending on the conditions. So, if you want the entire row to be enabled for editing, there will so many rows as the no. of columns in the inner internal table which is a column of that row.
col1 col2 Col3 Style
1 1 2 Col1 -- Style_Disabled
___________________Col2 -- Style_Disabled
___________________Col3 -- Style_Disabled
This should solve your problem.
Regards,
Ravi
note : Please reward the posts that help you.
Message was edited by: Ravikumar Allampallam -
Set select one of the cell in subtotal row in ALV report
Dear all,
I have a ALV report that has subtotal amount by Vendor ID.
I want to set the selection at vendor ID column (same row with subtotal).
I tried both set_selected_cell() and set_current_cell() methods, the cell selected is incorrect. It doesnt seem to be able to select any cell at the same row of SUBTOTAL.
lr_selections = ref_table->get_selections( ).
lt_current_cell = lr_selections->get_current_cell( ).
lt_current_cell-row = lt_current_cell-row.
lt_current_cell-columnname = 'LIFNR'.
lr_selections->set_current_cell( lt_current_cell ).
Please help. Thanks.HP should provide tested recovery DVD every note book user. along with note book.
That is solution
fws1 wrote:
I neglected to add that the system is configured exactly as from the factory, save a few added programs and user files. No hardware changes or OS up or downgrade. The hard drive was corrupted by some type of root virus and had to be fully reformatted. I did the format manually as well as let the HP Recovery disks. Same result either way. The recovery program, after the failure, prompts user to insert a flash drive and creates some file, but HP has no info on the file creation or what to do with said file!
fws1 wrote:
I neglected to add that the system is configured exactly as from the factory, save a few added programs and user files. No hardware changes or OS up or downgrade. The hard drive was corrupted by some type of root virus and had to be fully reformatted. I did the format manually as well as let the HP Recovery disks. Same result either way. The recovery program, after the failure, prompts user to insert a flash drive and creates some file, but HP has no info on the file creation or what to do with said file! -
How to split a single column row in alv report
Hi All,
I need to split a row of the particular coolumn in alv report.
for example row size is 10 that should be split into 5 & 5.
Thanks
RamHi Ram,
You can add one more column for that..
while processing your internal table you can split the value for that column using offset..
DATA : FIELD_STR(10) TYPE C.
VAR1 = FIELD_STR+0(5) .
VAR2 = FIELD_STR+5(5) .
Now you can print this both VAR1 and VAR2 in seperate column.
Please search on SCN before posting any question..
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
ilesh Nandaniya -
Add a count to an ALV grid of the total number of lines
Hi There
I have a really long ALV report which prints lots of records. How can I add a total number of records count to appear in the header?
I use the Grid display function to call the ALV grid.
Any help appreciatedHi,
You can do as below :
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
* Form TOP-OF-PAGE *
* ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
* Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
* Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
* Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
endform.
Thanks,
Sriram Ponna. -
Adding new rows after displaying subtotals in an ALV report by using OOABAP
Dear All,
I am creating an ALV report, displaying subtotals and total by using Classes. I have used classes CL_SALV_AGGREGATIONS (Method : add_aggregation) and CL_SALV_AGGREGATIONS (Method : add_sort) for sorting and doing subtotals.
Output of my report as follows :- (I have used * for displaying spaces between fields)
Materia*******Quantity**SerialNo*Equipment**Value***WBS Element
ISM-DBSVR****1********12363****31872565***2165***Q-0040358945.001010
ISM-DBSVR****1********12364****31872566***2165***Q-0040358945.001010
**************************************Subtotal***********4330
-> If the value of "Quantity" is greater than 1 then the value of subtotal for the field "Value" is to be divided by the Quantity for that line item and needs to be displayed Quantity, SerialNo, Value details information after subtotal .
-> Basically I need to add few more rows for displaying above additional information in the ALV grid after displaying subtotal .
Q: Do we have any methods for change the layout for the above requirement.
I Appreciate your early response.
Thank you.
RajaSekhar.Hi,
For such type of requirement you need to use ALV hierchical table.
You can have your main table in master table.
For quantity greater than 1 you need to move the data into a seperate internal table....this internal table will have material as the key between the main table and the second table.
*... §2 create an ALV hierseq table
try.
cl_salv_hierseq_table=>factory(
exporting
t_binding_level1_level2 = lt_binding
importing
r_hierseq = gr_hierseq
changing
t_table_level1 = gt_master
t_table_level2 = gt_slave ).
catch cx_salv_data_error cx_salv_not_found.
endtry.
you can display both the tables together with the subtotals also.
please refer to program SALV_DEMO_HIERSEQ_SIMPLE to see how to display the hierarchical display.
Plr reward points if found helpful.
Regards,
Mayank -
Count of Sales documenst in a ALV report
Hi Gurus!
I have an ALv report that gives me a list of sales document number with other data associated with it like the material number , status , date , iem ect ect. Each docum,ent can have several line items associated with it and it shows on teh report . I have used a count column in my report which gives me the count of line items in the report . Now what I want is the count of documnet numbers in the report rather than the count of line items , which will enable to know how many sales document are ther in the report for therie r report purpose. Is ot possible to get a count of teh document numbers in the ALV report output apart from teh count of the line items . Will I ahve to make changes in my report or it can be acheived in the layout itself. Kindly advice please.
ThanksI ahve done as said
report zztest message-id zsd no standard page heading.
* For ALV usage
type-pools: slis.
data: gs_layout type slis_layout_alv,
tp_print type slis_print_alv,
gt_sort type slis_t_sortinfo_alv,
gt_events type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv with header line,
repid type syrepid, " ABAP Program.
gt_list_top_of_page type slis_t_listheader, " Top of page text.
alv_variant type disvariant. " Customize Disp. Variant
data: w_field type slis_fieldcat_alv.
data: gs_list_top_of_page type slis_listheader.
data: l_count type I.
data: l_vbeln type I.
tables: vbak, vbap, vbpa, knvv.
*DATA : v_count type N.
DATA : count1 type N.
* Definition of selection screen *
* By plant, storage location, sold-to customers, material and *
* posting date of the sales orders *
selection-screen begin of block one with frame title text-001.
parameters: p_vkorg type vkorg obligatory memory id vko,"DEVK906677
p_vtweg type vtweg obligatory default '01',
p_spart type spart obligatory default '01'.
select-options: s_vkbur for vbak-vkbur, " Sales Office "DEVK906677
s_kunnr for vbak-kunnr. " Sold-to customer number.
select-options: s_shipto for vbap-oid_ship, " Ship-to customer number.
s_billto for vbpa-kunnr, " bill-to from S.O. header.
s_load for vbpa-kunnr, " Load confirmation contact.
s_truck for vbap-oid_extbol. " Trucking ticket number.
select-options: s_werks for vbap-werks obligatory no intervals. " Plant.
select-options: s_lgort for vbap-lgort. " Storage location.
select-options: s_matnr for vbap-matnr. " Material number.
select-options: s_konda for knvv-konda. " price group
selection-screen skip 1.
select-options: s_vdatu for vbak-vdatu default sy-datum.
selection-screen end of block one.
* ALV display layout
selection-screen begin of block layout with frame title text-003.
parameters: pa_vari type slis_vari default ' '. " Display variant.
selection-screen end of block layout.
selection-screen begin of block two with frame title text-028.
selection-screen comment: /1(79) text-029.
selection-screen comment: /1(79) text-030.
selection-screen comment: /1(79) text-031.
selection-screen comment: /1(79) text-032.
selection-screen comment: /1(79) text-033.
selection-screen comment: /1(79) text-034.
selection-screen comment: /1(79) text-035.
selection-screen comment: /1(79) text-036.
selection-screen end of block two.
* Data Definitions *
* Storing Extracted Info.
types: begin of t_extract,
vbeln type vbeln_va, " Sales order number.
augru type augru, " order reason
vdatu type edatu_vbak, " Requested delivery date.
kunnr type kunag, " Sold-to customer number.
posnr type posnr_va, " Item number.
matnr type matnr, " Material number.
vrkme type vrkme, " Sales UoM.
mseh3 type mseh3, " UoM text.
netwr type netwr_ap, " Net value of the order item.
kwmeng type p length 13 decimals 1, " Quantity.
werks type werks_d, " Plant.
lgort type lgort_d, " Storage location.
oid_extbol type oid_extbol, " External BOL or truck ticker header.
maktx type maktx, " Material description.
soldto_name type name1_gp, " Sold-to name.
oid_ship type kunwe, " Ship-to customer number.
shipto_name type name1_gp, " Ship-to name.
billto type kunre, " Bill-to customer number.
billto_name type name1_gp, " Bill-to name.
load_contact type kunnr, " Load confirmation contact.
load_name type name1_gp, " Load confirmation contact name.
truck type kunnr, " Truck company number.
truck_name type name1_gp, " Truck company name.
bstkd type bstkd, " PO number.
ihrez type ihrez, " AFE number per the contract/sales order.
delivery type vbeln_vl, " Delivery number.
posnr_vl type posnr_vl, " Delivery item number.
bill_vbeln type vbeln_vf, " Invoice number.
bill_posnr type posnr_vf, " Invoice item number.
bill_netwr type netwr_fp, " Invoice net value.
statu type stats, " Document status.
auart type auart, " order type
vkorg type vkorg, " sales org.
vtweg type vtweg, " distrbtn channel
spart type spart, " division
vkbur like vbak-vkbur, " Sales Office DEVK906677
konda type konda, " price group
tdline type tdline, " text for customer account reference
count type I ,
end of t_extract.
data :
it_extract type table of t_extract with header line,
it_extract2 type table of t_extract with header line.
data: it_text type table of tline with header line.
data: w_index type sy-index,
w_tdname type tdobname.
constants: c_minus1 type netwr_ap value '1.00-'.
*RANGES: r_auart FOR vbak-auart.
data: r_auart type range of t_extract-auart,
r_auart_line like line of r_auart.
* initialization
initialization.
gs_layout-colwidth_optimize = 'X'.
tp_print-no_print_listinfos = 'X'.
tp_print-no_coverpage = 'X'.
perform set_fieldcat.
perform alv_eventtab_build using:
** Event name Form to execute Event internal table
'TOP_OF_PAGE' 'TOP_OF_PAGE' gt_events[].
* changed to exclude following order types
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZEQ'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* credit memo
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZPRC'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* debit memo
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZPRD'.
clear r_auart_line-high.
append r_auart_line to r_auart.
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZDR'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* Industry sales order correction
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZSOC'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* oilfield FF correction
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZOCF'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* oilfield WP correction
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZOCW'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* Dropdown list for all created ALV layouts, global or user-specific
at selection-screen on value-request for pa_vari.
perform alv_variant_f4 changing pa_vari.
* Main BODY of processing logic
start-of-selection.
perform extract_data.
end-of-selection.
if not it_extract[] is initial.
* Build headings for report.
perform build_top_of_page using gt_list_top_of_page[].
perform call_alv.
endif.
*& Form EXTRACT_KEY_DATA
* Retreive the data for the report.
form extract_data.
clear: it_extract. refresh: it_extract.
* orders
select vbak~vbeln vbak~auart vbak~augru vbak~vkorg vbak~vtweg
vbak~spart vbak~vdatu vbak~kunnr vbak~vkbur
vbap~posnr vbap~matnr vbap~vrkme vbap~netwr vbap~kwmeng
vbap~werks vbap~lgort vbap~oid_extbol vbap~oid_ship
into corresponding fields of table it_extract
from vbak inner join vbap
on vbak~mandt = vbap~mandt
and vbak~vbeln = vbap~vbeln where
vbak~auart not in r_auart and
vbak~vkorg eq p_vkorg and
vbak~vtweg eq p_vtweg and
vbak~spart eq p_spart and
vbak~vkbur in s_vkbur and "DEVK906677
vbak~vdatu in s_vdatu and
vbak~kunnr in s_kunnr and
vbap~matnr in s_matnr and
vbap~werks in s_werks and
vbap~lgort in s_lgort and
vbap~oid_extbol in s_truck and
vbap~oid_ship in s_shipto.
if sy-subrc <> 0.
message i000 with text-002 ' ' ' ' ' '.
endif.
sort it_extract by vbeln.
check sy-subrc = 0.
loop at it_extract.
at new vbeln.
count1 = count1 + 1.
endat.
* Retrieve and select by load confirmation contacts from header
select single kunnr from vbpa into it_extract-load_contact
where vbeln = it_extract-vbeln
and posnr = '000000'
and parvw = 'ZB'.
if it_extract-load_contact in s_load.
it_extract-load_name = zcl_kna1=>get_name1( it_extract-load_contact ).
else.
delete it_extract.
continue.
endif.
* Retrieve and select by sales order bill-to on header level
* as well as lookup bill-to customer name/description
select single kunnr from vbpa into it_extract-billto
where vbeln = it_extract-vbeln
and posnr = '000000'
and parvw = 'RE'.
if sy-subrc = 0.
if s_billto is initial.
it_extract-billto_name = zcl_kna1=>get_name1( it_extract-billto ).
else.
if it_extract-billto in s_billto.
it_extract-billto_name = zcl_kna1=>get_name1( it_extract-billto ).
else.
delete it_extract.
continue.
endif.
endif.
else.
* Newalta - always has bill-to, following will not occur but included
* as good programming practice.
it_extract-billto_name = it_extract-billto.
endif.
* Retrieve and select by price group of sold-to
select single konda from knvv into it_extract-konda
where kunnr = it_extract-kunnr
and vkorg = it_extract-vkorg
and vtweg = it_extract-vtweg
and spart = it_extract-spart.
if sy-subrc = 0.
if not ( it_extract-konda in s_konda ).
delete it_extract.
continue.
endif.
endif.
* Retrieve trucking company customer
select single kunnr from vbpa into it_extract-truck where
vbeln = it_extract-vbeln and
posnr = '000000' and
parvw = 'ZT'.
if sy-subrc = 0.
it_extract-truck_name = zcl_kna1=>get_name1( it_extract-truck ).
endif.
* Retrieve sold-to name
it_extract-soldto_name = zcl_kna1=>get_name1( it_extract-kunnr ).
* Retrieve ship-to name
it_extract-shipto_name = zcl_kna1=>get_name1( it_extract-oid_ship ).
* lookup P.O.
select single bstkd ihrez from vbkd into (it_extract-bstkd, it_extract-ihrez)
where vbeln = it_extract-vbeln
and posnr = '000000'.
* Retreive the material description.
it_extract-maktx = zcl_material=>get_maktx( it_extract-matnr ).
* cosmetic change of material number, donot display leading zeros.
shift it_extract-matnr left deleting leading '0'.
* translate unit of measure
it_extract-mseh3 = it_extract-vrkme.
select single mseh3 from t006a into it_extract-mseh3
where spras = sy-langu
and msehi = it_extract-vrkme.
w_tdname = it_extract-vbeln.
* read customer account reference which is under 'text'
call function 'READ_TEXT'
exporting
client = sy-mandt
id = 'Z010'
language = sy-langu
name = w_tdname
object = 'VBBK'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
tables
lines = it_text
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.
if sy-subrc = 0.
read table it_text index 1.
if sy-subrc = 0.
it_extract-tdline = it_text-tdline.
else.
clear it_extract-tdline.
endif.
else.
clear it_extract-tdline.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
* Get the delivery item.
call method zcl_vbap=>get_delivery
EXPORTING
itp_vbeln = it_extract-vbeln
itp_posnr = it_extract-posnr
IMPORTING
etp_vbeln = it_extract-delivery
etp_posnr = it_extract-posnr_vl.
if it_extract-delivery is not initial.
perform process_deliveries.
else.
perform invoice_process.
endif.
it_extract-count = 1.
move-corresponding it_extract to it_extract2.
append it_extract2.
endloop.
describe table it_extract2 lines count1.
endform. " EXTRACT_DATA
*& Form SET_FIELDCAT
* Create the field catalogue.
form set_fieldcat .
clear w_field.
clear t_fieldcat. refresh t_fieldcat.
w_field-col_pos = 1.
w_field-fieldname = 'VBELN'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Document.Nbr'.
w_field-emphasize = 'X'.
w_field-hotspot = 'X'.
append w_field to t_fieldcat.
clear w_field.
w_field-col_pos = 2 .
w_field-fieldname = 'POSNR'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Item'(023).
append w_field to t_fieldcat.
clear w_field.
w_field-col_pos = 3 .
w_field-fieldname = 'VDATU'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Req. Del. Date'(005).
append w_field to t_fieldcat.
w_field-col_pos = 4 .
w_field-fieldname = 'SOLDTO_NAME'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Sold-to'(006).
append w_field to t_fieldcat.
w_field-col_pos = 5 .
w_field-fieldname = 'MATNR'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Material'(007).
append w_field to t_fieldcat.
w_field-col_pos = 6 .
w_field-fieldname = 'KWMENG'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Quantity'(008).
append w_field to t_fieldcat.
w_field-col_pos = 7.
w_field-fieldname = 'MSEH3'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'UOM'(009).
append w_field to t_fieldcat.
w_field-col_pos = 8 .
w_field-fieldname = 'BILL_VBELN'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Invoice #'(010).
w_field-emphasize = 'X'.
w_field-hotspot = 'X'.
append w_field to t_fieldcat.
clear w_field.
w_field-col_pos = 9 .
w_field-fieldname = 'BILL_NETWR'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Values'(011).
append w_field to t_fieldcat.
w_field-col_pos = 10.
w_field-fieldname = 'WERKS'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Plant'(012).
append w_field to t_fieldcat.
w_field-col_pos = 11.
w_field-fieldname = 'LGORT'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Storage Loc'(013).
append w_field to t_fieldcat.
w_field-col_pos = 12 .
w_field-fieldname = 'MAKTX'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Description'(014).
append w_field to t_fieldcat.
w_field-col_pos = 13 .
w_field-fieldname = 'SHIPTO_NAME'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Ship-to'(015).
append w_field to t_fieldcat.
w_field-col_pos = 14 .
w_field-fieldname = 'BILLTO_NAME'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Bill-to'(016).
append w_field to t_fieldcat.
w_field-col_pos = 15 .
w_field-fieldname = 'LOAD_NAME'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Load Contact'(017).
append w_field to t_fieldcat.
w_field-col_pos = 16 .
w_field-fieldname = 'TRUCK_NAME'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Truck Comp.'(018).
append w_field to t_fieldcat.
w_field-col_pos = 17 .
w_field-fieldname = 'BSTKD'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'P.O.'(019).
append w_field to t_fieldcat.
w_field-col_pos = 18 .
w_field-fieldname = 'IHREZ'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'AFE Nbr'(020).
append w_field to t_fieldcat.
w_field-col_pos = 19 .
w_field-fieldname = 'OID_EXTBOL'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Truck Ticket'(021).
append w_field to t_fieldcat.
w_field-col_pos = 20.
w_field-fieldname = 'STATU'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Status'(022).
append w_field to t_fieldcat.
w_field-col_pos = 21.
w_field-fieldname = 'AUGRU'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Ord.Reason'(024).
append w_field to t_fieldcat.
w_field-col_pos = 22.
w_field-fieldname = 'TDLINE'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'cstmr.acct.ref.'(027).
append w_field to t_fieldcat.
w_field-col_pos = 23 . "DEVK906678
w_field-fieldname = 'VKBUR'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Sales Office'(037).
append w_field to t_fieldcat.
w_field-col_pos = 24.
w_field-fieldname = 'KUNNR'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Sold-to Customer'(038).
append w_field to t_fieldcat.
w_field-col_pos = 25.
w_field-fieldname = 'OID_SHIP'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Ship-to Customer'(039).
append w_field to t_fieldcat.
w_field-col_pos = 26.
w_field-fieldname = 'BILLTO'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Bill-to Customer'(040).
append w_field to t_fieldcat.
w_field-col_pos = 27.
w_field-fieldname = 'COUNT'.
w_field-tabname = IT_EXTRACT2.
w_field-seltext_l = 'Count'(041).
w_field-do_sum = 'X'.
append w_field to t_fieldcat.
endform. " SET_FIELDCAT
*& Form CALL_ALV
* Call the ALV Grid function.
form call_alv .
sort it_extract by lgort vbeln.
* repid is necessary since the ALV F.M. does not work properly with
* sy-repid.
repid = sy-repid.
alv_variant-variant = pa_vari.
alv_variant-report = sy-repid.
alv_variant-username = sy-uname.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = t_fieldcat[]
it_sort = gt_sort[]
i_default = 'X'
i_save = 'A'
is_variant = alv_variant
it_events = gt_events[]
is_print = tp_print
TABLES
t_outtab = IT_EXTRACT2
EXCEPTIONS
program_error = 1
others = 2.
if sy-subrc ne 0.
message w000 with text-004 ' ' ' ' ' '.
endif.
endform. " CALL_ALV
*& Form build_top_of_page
* Build heading for report. *
* -->P_GT_LIST_TOP_OF_PAGE[] Header stuff for report
form build_top_of_page using e04_lt_top_of_page type slis_t_listheader.
data: ls_line type slis_listheader. "Header table for top of page
* construct 'top of page' info. to display. In this case, one line.
data: w_selections(40) type c,
w_date_from(10) type c,
w_date_to(10) type c.
write: s_vdatu-low to w_date_from dd/mm/yyyy.
if s_vdatu-high is not initial.
write: s_vdatu-high to w_date_to dd/mm/yyyy.
clear w_selections.
concatenate 'Del.Req.Date: ' w_date_from 'To' w_date_to
into w_selections separated by space.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = w_selections.
append ls_line to e04_lt_top_of_page.
gs_list_top_of_page-typ = 'S'.
gs_list_top_of_page-info = ' Total number of Sales Documents'.
append gs_list_top_of_page to gt_list_top_of_page.
gs_list_top_of_page-typ = 'S'.
gs_list_top_of_page-info = count1.
append gs_list_top_of_page to gt_list_top_of_page.
else.
clear w_date_to.
concatenate 'Del.Req.Date: ' w_date_from
into w_selections separated by space.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = w_selections.
append ls_line to e04_lt_top_of_page.
endif.
endform. " build_top_of_page
*& Form alv_eventtab_build
* Pass list of events to be triggered by the ALV function module
form alv_eventtab_build using u_name type slis_alv_event-name
u_form type slis_alv_event-form
alv_lt_events type slis_t_event.
data: ls_event type slis_alv_event. " structure for event handling
ls_event-name = u_name.
ls_event-form = u_form.
append ls_event to alv_lt_events.
endform. " alv_eventtab_build
* FORM TOP_OF_PAGE *
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'LOGO'
it_list_commentary = gt_list_top_of_page.
endform. " TOP_OF_PAGE
*& Form process_deliveries
* Process the delivery related records.
form process_deliveries .
data:
ltp_date type wadat_ist, " Goods movement date.
ltp_vbtyp type vbtyp_n,
ltp_mtart type mtart, " Material type.
w_lfimg type lfimg, " Actual quantity delivered (in sales units).
w_vrkme type vrkme. " Sales unit of measure.
* Read delivery quantity and uom.
select single lfimg vrkme into (w_lfimg, w_vrkme)
from lips where
vbeln = it_extract-delivery and
posnr = it_extract-posnr_vl.
* these fields have values from vbap. override with lips values
if sy-subrc = 0.
it_extract-kwmeng = w_lfimg.
it_extract-vrkme = w_vrkme.
* translate unit of measure
it_extract-mseh3 = it_extract-vrkme.
select single mseh3 from t006a into it_extract-mseh3
where spras = sy-langu
and msehi = it_extract-vrkme.
endif.
* Determine STATUS by reading 'service confirmation', R (goods movemt)
* it is possible to have multiple 'service confirmation' records for
* one item. ie. delivery 80010390 in PRD.
* As long as there is at least one 'service confirmation' record,
* status is considered 'complete'.
* Validate the created on date of the goods movement or service confirmation.
ltp_mtart = zcl_material=>get_mtart( it_extract-matnr ).
* ltp_date = zcl_lips=>get_goods_movement_date( itp_vbeln = it_extract-delivery
* itp_posnr = it_extract-posnr_vl itp_mtart = ltp_mtart ).
call method zcl_lips=>get_goods_mvt_info
EXPORTING
itp_vbeln = it_extract-delivery
itp_posnr = it_extract-posnr_vl
itp_mtart = ltp_mtart
IMPORTING
rtp_date = ltp_date
rtp_vbtyp = ltp_vbtyp.
* 'h' is cancel goods issue
if ltp_vbtyp = 'h'.
it_extract-statu = 'Incomplete'(025).
else.
if ltp_date is not initial.
it_extract-statu = 'COMPLETE'(026).
endif.
endif.
* Retrieve the invoice/billing document item.
call method zcl_lips=>get_invoice
EXPORTING
itp_vbeln = it_extract-delivery
itp_posnr = it_extract-posnr_vl
IMPORTING
rtp_vbeln = it_extract-bill_vbeln
rtp_posnr = it_extract-bill_posnr.
if it_extract-bill_vbeln is not initial.
* retrieve net value from the invoice.
clear it_extract-bill_netwr.
select single netwr into it_extract-bill_netwr from vbrp
where vbeln = it_extract-bill_vbeln
and posnr = it_extract-bill_posnr.
else.
it_extract-bill_netwr = it_extract-netwr. " Use order net value.
endif.
endform. " process_deliveries
*& Form user_command
* Process the user command.
* -->R_UCOMM User command
* -->RS_SELFIELD Field selected
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
data: ltp_vbeln type vbeln. " Sales document number.
case r_ucomm.
when '&IC1'.
if ( rs_selfield-fieldname = 'VBELN'
or rs_selfield-fieldname = 'BILL_VBELN' )
and rs_selfield-value is not initial. " Display sales document.
ltp_vbeln = rs_selfield-value.
zcl_sales_doc=>display( ltp_vbeln ).
endif.
endcase.
endform. "user_command
*& Form invoice_process
* Process for orders without deliveries. *
form invoice_process .
* Translate unit of measure.
select single mseh3 from t006a into it_extract-mseh3
where spras = sy-langu
and msehi = it_extract-vrkme.
* Retrieve the invoice/billing document item.
call method zcl_vbap=>get_invoice
EXPORTING
itp_vbeln = it_extract-vbeln
itp_posnr = it_extract-posnr
IMPORTING
rtp_vbeln = it_extract-bill_vbeln
rtp_posnr = it_extract-bill_posnr.
if it_extract-bill_vbeln is not initial.
* retrieve net value from the invoice.
clear it_extract-bill_netwr.
select single netwr into it_extract-bill_netwr from vbrp
where vbeln = it_extract-bill_vbeln
and posnr = it_extract-bill_posnr.
else. " If no Invoice, then status becomes 'incomplete'.
it_extract-bill_netwr = it_extract-netwr. " Use order net value.
it_extract-statu = 'Incomplete'(025).
endif.
endform. " invoice_process
*& Form alv_variant_f4
* Get the display variant.
* <--CTP_VARI Variant name
form alv_variant_f4 changing ctp_vari type slis_vari.
alv_variant-report = sy-repid. " Report ID
alv_variant-username = sy-uname. " User ID
call function 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = alv_variant
i_save = 'A'
IMPORTING
es_variant = alv_variant
EXCEPTIONS
others = 1.
if sy-subrc = 0.
ctp_vari = alv_variant-variant.
endif.
endform. " alv_variant_f4 -
Hi experts...
I want single row in alv report.
I have use loop for fatch data into internal table using loop when i am passing data in alv report then the data comes according loop. i want onlu one data in alv row.
how can i do such, plz help me.decleare two internal table.
read table itab into wa index 1.
append wa to itab2.
pass itab2 only one record display. -
How to add A single row at the middle of the table in a Webi report
Hi,
I created a Webi report using Universe(Created universe using bex query).Now i have a requirement to display a row at the middle of a report. Can you please tell me ,how to add a sigle row at the middle of a Webi report.
Thanks in advance
Regards
MonikaHi Monika,
It is not really possible to add a row (I assume you mean of unrelated data) to the middle of a table in a report. You can add a new table with a single row between two tables. For instance you could add a new one row table, or even single cells which are positioned relatively between two tables. Possibly a block on top of another. But this gets tricky.
Can you explain in more detail what you are trying to do?
Thanks
Maybe you are looking for
-
How do I sort my phone numbers inside a contact? (using custom labels)
Alright, since I've converted to iCloud, I'm now adding new contacts in there. However... before I was adding phone numbers through Address Book on my Macbook (that ended up creating a conflict with iCloud so I'm now using iCloud). What I want to kno
-
Windows File Attributes in ZIP file
Is there a way to transfer the file and folder attributes when zipping them using the Add to ZIP function in LabVIEW? I have a directory with some hidden and some read only files, but it looks like the zip function in LabVIEW ignores these. I can s
-
I've created my photo stream group of pictures and selected the contacts with whom to share them and I've posted them. What is the next step? How are the contacts notified?
-
Importing legacy clips - ends getting trimmed
We are working on a project that involves importing some older Quicktime movies into FCP 7 to update certain segments. The old movies were made with Adobe Premiere years ago (late 1990's) and apparently saved using a variable frame rate, they also co
-
I have a table with the following... Date id version_num total 01/01/2009 09:00:00 101 0 99 01/01/2009 09:00:00 101 1 100 02/01/2009 09:00:00 101 1 201 03/01/2009 09:00:00 101 1 150 04/01/2009 09:00:00 101 1 99 05/01/2009 09:00:00 101 0 103 05/01/200