S.screen and abap oo--alv report
i see all the example here but there is not s.screen before whyyy???
there is an example with s.screen
Hi,
this is example for S.Screen. in OO alv.
below is the Code.
and I am specifying variants on s.screen
Material ............ 100-100 to 100-200
Plant................ 1000 to 2000
BOM Usage............ 1 to 1
BOM status........... 01 to 01
BOM category........ D to P
* T Y P E S *
TYPES:
* Material Data
BEGIN OF type_mast,
matnr LIKE mast-matnr, " Material Number
werks LIKE mast-werks, " Plant
stlan LIKE mast-stlan, " BOM Usage
stlnr LIKE mast-stlnr, " Bill of material
stlal LIKE mast-stlal, " Alternative BOM
END OF type_mast,
* Material Description Data
BEGIN OF type_makt,
matnr LIKE makt-matnr, " Material Number
maktx LIKE makt-maktx, " Material Description
END OF type_makt,
* BOM Header Data
BEGIN OF type_stko,
stlty LIKE stko-stlty, " BOM category
stlnr LIKE stko-stlnr, " Bill of material
stlal LIKE stko-stlal, " Alternative BOM
datuv LIKE stko-datuv, " Valid-From Date
bmeng LIKE stko-bmeng, " Base Quantity
stktx LIKE stko-stktx, " Alternative BOM Text
stlst LIKE stko-stlst, " BOM status
END OF type_stko,
* BOM Text Data
BEGIN OF type_stzu,
stlty LIKE stzu-stlty, " BOM category
stlnr LIKE stzu-stlnr, " Bill of material
ztext LIKE stzu-ztext, " BOM text
END OF type_stzu,
* BOM Item Data
BEGIN OF type_stpo,
stlty LIKE stpo-stlty, " BOM category
stlnr LIKE stpo-stlnr, " Bill of material
idnrk LIKE stpo-idnrk, " BOM component
postp LIKE stpo-postp, " Item Category(BOM)
posnr LIKE stpo-posnr, " BOM Item Number
menge LIKE stpo-menge, " Component quantity
END OF type_stpo,
* Output Data
BEGIN OF type_output,
werks LIKE mast-werks, " Plant
matnr LIKE mast-matnr, " Material Number
maktx LIKE makt-maktx, " Material Description
stlnr LIKE mast-stlnr, " Bill of material
stlan LIKE mast-stlan, " BOM Usage
stlal LIKE mast-stlal, " Alternative BOM
stlty LIKE stko-stlty, " BOM category
datuv LIKE stko-datuv, " Valid-From Date
bmeng LIKE stko-bmeng, " Base Quantity
stktx LIKE stko-stktx, " Alternative BOM Text
stlst LIKE stko-stlst, " BOM status
idnrk LIKE stpo-idnrk, " BOM component
postp LIKE stpo-postp, " Item Category(BOM)
posnr LIKE stpo-posnr, " BOM Item Number
menge LIKE stpo-menge, " Component quantity
ztext LIKE stzu-ztext, " BOM text
END OF type_output.
* D A T A *
DATA:
w_matnr TYPE mara-matnr, " Material Number
w_werks TYPE mast-werks, " Plant
w_stlan TYPE mast-stlan, " BOM Usage
w_stlst TYPE stko-stlst, " BOM status
w_stlty TYPE stko-stlty, " BOM category
w_container TYPE REF TO cl_gui_custom_container,
w_alv_grid TYPE REF TO cl_gui_alv_grid,
ok_code LIKE sy-ucomm.
* I N T E R N A L T A B L E S *
DATA:
* Material Data
i_mast TYPE STANDARD TABLE OF type_mast,
wa_mast TYPE type_mast,
* Material Description Data
i_makt TYPE STANDARD TABLE OF type_makt,
wa_makt TYPE type_makt,
* BOM Header Data
i_stko TYPE STANDARD TABLE OF type_stko,
wa_stko TYPE type_stko,
* BOM Text Data
i_stzu TYPE STANDARD TABLE OF type_stzu,
wa_stzu TYPE type_stzu,
* BOM Item Data
i_stpo TYPE STANDARD TABLE OF type_stpo,
wa_stpo TYPE type_stpo,
* Output table
i_output TYPE STANDARD TABLE OF type_output,
wa_output TYPE type_output,
* Field Catalog table
it_fcat TYPE lvc_t_fcat, " Internal table for field catal
wa_fcat TYPE lvc_s_fcat. " Work area for field catalog
* S E L E C T I O N S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-ss1.
SELECT-OPTIONS:
s_matnr FOR w_matnr, " Material Number
s_werks FOR w_werks OBLIGATORY," Plant
s_stlan FOR w_stlan, " BOM Usage
s_stlst FOR w_stlst, " BOM status
s_stlty FOR w_stlty. " BOM category
SELECTION-SCREEN END OF BLOCK b1.
* A T S E L E C T I O N S C R E E N *
AT SELECTION-SCREEN.
PERFORM f010_validate_material.
PERFORM f020_validate_plant.
PERFORM f030_validate_bom_usage.
PERFORM f040_validate_bom_status.
PERFORM f050_validate_bom_category.
* S T A R T O F S E L E C T I O N *
START-OF-SELECTION .
PERFORM f210_fetch_bom_link_data.
PERFORM f220_fetch_material_des_data.
PERFORM f230_fetch_bom_header_data.
PERFORM f240_fetch_bom_text.
PERFORM f250_fetch_bom_item_data.
* E N D O F S E L E C T I O N *
END-OF-SELECTION.
PERFORM f600_populate_data.
PERFORM f650_field_catlog.
CALL SCREEN 100.
*& Form f010_validate_material *
* --Validate Material *
FORM f010_validate_material .
* Validate Material
IF s_matnr IS NOT INITIAL.
SELECT matnr
INTO w_matnr
FROM mara
UP TO 1 ROWS
WHERE matnr IN s_matnr.
ENDSELECT.
CHECK sy-subrc NE 0.
SET CURSOR FIELD 'S_MATNR'.
MESSAGE e210. " Invalid Material
ENDIF. " IF s_matnr IS NOT INITIAL.
ENDFORM. " f010_validate_material
*& Form f020_validate_plant *
* - Validate Plant *
FORM f020_validate_plant .
* Validate Plant
SELECT werks
INTO w_werks
FROM t001w
UP TO 1 ROWS
WHERE werks IN s_werks.
ENDSELECT.
CHECK sy-subrc NE 0.
SET CURSOR FIELD 'S_WERKS'.
MESSAGE e220. " Invalid Plant
ENDFORM. " f020_validate_plant
*& Form f030_validate_BOM_usage *
* -Validate BOM Usage *
FORM f030_validate_bom_usage .
* Validate BOM Usage
IF s_stlan IS NOT INITIAL.
SELECT stlan
INTO w_stlan
FROM t416
UP TO 1 ROWS
WHERE stlan IN s_stlan.
ENDSELECT.
CHECK sy-subrc NE 0.
SET CURSOR FIELD 'S_STLAN'.
MESSAGE e230. " Invalid BOM Usage
ENDIF. " IF s_stlan IS NOT INITIAL.
ENDFORM. " f030_validate_BOM_usage
*& Form f040_validate_BOM_status
* - Validate BOM Status
FORM f040_validate_bom_status .
* Validate BOM Status
IF s_stlst IS NOT INITIAL.
SELECT stlst
INTO w_stlst
FROM t415s
UP TO 1 ROWS
WHERE stlst IN s_stlst.
ENDSELECT.
CHECK sy-subrc NE 0.
SET CURSOR FIELD 'S_STLST'.
MESSAGE e240. " Invalid BOM Status
ENDIF. " IF s_stlst IS NOT INITIAL
ENDFORM. " f040_validate_BOM_status
*& Form f050_validate_BOM_category *
* -Validate BOM Category *
FORM f050_validate_bom_category .
* Validate BOM Category
IF s_stlty IS NOT INITIAL.
SELECT stlty
INTO w_stlty
FROM stko
UP TO 1 ROWS
WHERE stlty IN s_stlty.
ENDSELECT.
CHECK sy-subrc NE 0.
SET CURSOR FIELD 'S_STLTY'.
MESSAGE e250. " Invalid BOM Category
ENDIF. " IF s_stlty IS NOT INITIAL.
ENDFORM. " f050_validate_BOM_category
*& Form f210_fetch_bom_link_data *
* - Fetch Material BOM Link data *
FORM f210_fetch_bom_link_data .
* Fetch Material BOM Link data
SELECT matnr " Material Number
werks " Plant
stlan " BOM Usage
stlnr " Bill of material
stlal " Alternative BOM
INTO TABLE i_mast
FROM mast
WHERE matnr IN s_matnr
AND werks IN s_werks.
IF sy-subrc NE 0.
MESSAGE s200. " No Data Found
ENDIF. " IF sy-subrc NE 0.
SORT i_mast BY matnr werks.
ENDFORM. " f200_fetch_bom_link_data
*& Form f220_fetch_material_des_data *
* -Fetch Material Description data *
FORM f220_fetch_material_des_data .
SELECT matnr
maktx
INTO TABLE i_makt
FROM makt
FOR ALL ENTRIES IN i_mast
WHERE matnr EQ i_mast-matnr.
IF sy-subrc NE 0.
MESSAGE s200. " No Data Found
ENDIF. " IF sy-subrc NE 0.
SORT i_makt BY matnr.
ENDFORM. " f200_fetch_material_des_data
*& Form f230_fetch_bom_header_data *
* - Fetch BOM Header data *
FORM f230_fetch_bom_header_data .
* Fetch BOM Header data
SELECT stlty " BOM category
stlnr " Bill of material
stlal " Alternative BOM
datuv " Valid-From Date
bmeng " Base Quantity
stktx " Alternative BOM Text
stlst " BOM status
INTO TABLE i_stko
FROM stko
FOR ALL ENTRIES IN i_mast
WHERE stlnr EQ i_mast-stlnr
AND stlty IN s_stlty
AND stlst IN s_stlst.
IF sy-subrc NE 0.
MESSAGE s200. " No Data Found
ENDIF. " IF sy-subrc NE 0.
SORT i_stko BY stlty stlst.
ENDFORM. " f200_fetch_bom_header_data
*& Form f240_fetch_bom_text *
* - Fetch BOM text Data *
FORM f240_fetch_bom_text .
* DATA:
* i_stko_temp LIKE TABLE OF wa_stko.
* i_stko_temp = i_stko.
* SORT i_stko_temp BY stlty stlnr.
* DELETE ADJACENT DUPLICATES FROM i_stko_temp
* COMPARING stlty stlnr.
* SELECT stlty " BOM category
* stlnr " Bill of material
* ztext " BOM text
* INTO TABLE i_stzu
* FROM stzu
* FOR ALL ENTRIES IN i_stko_temp
* WHERE stlty EQ i_stko_temp-stlty
* AND stlnr EQ i_stko_temp-stlnr.
* DATA:
* i_stzu_temp LIKE TABLE OF wa_stzu.
SELECT stlty " BOM category
stlnr " Bill of material
ztext " BOM text
INTO TABLE i_stzu
FROM stzu
FOR ALL ENTRIES IN i_stko
WHERE stlty EQ i_stko-stlty
AND stlnr EQ i_stko-stlnr.
IF sy-subrc NE 0.
MESSAGE s200. " No Data Found
ENDIF. " IF sy-subrc NE 0.
ENDFORM. " f200_fetch_bom_text
*& Form f250_fetch_bom_item_data *
* - Fetch BOM Item data *
FORM f250_fetch_bom_item_data .
* Fetch BOM Header data
SELECT stlty " BOM category
stlnr " Bill of material
idnrk " BOM component
postp " Item Category(BOM)
posnr " BOM Item Number
menge " Component quantity
INTO TABLE i_stpo
FROM stpo
FOR ALL ENTRIES IN i_stko
WHERE stlty EQ i_stko-stlty
AND stlnr EQ i_stko-stlnr.
IF sy-subrc NE 0.
MESSAGE s200. " No Data Found
ENDIF. " IF sy-subrc NE 0.
ENDFORM. " f200_fetch_bom_item_data
*& Form f600_populate_data *
* - Displaying the data *
FORM f600_populate_data .
* SORT i_stko.
* SORT i_mast.
* DELETE ADJACENT DUPLICATES FROM i_mast.
LOOP AT i_stpo INTO wa_stpo.
CLEAR wa_output.
READ TABLE i_stko INTO wa_stko WITH KEY stlnr = wa_stpo-stlnr
stlty = wa_stpo-stlty
BINARY SEARCH.
* CHECK sy-subrc eq 0.
READ TABLE i_stzu INTO wa_stzu WITH KEY stlnr = wa_stko-stlnr
stlty = wa_stko-stlty
BINARY SEARCH.
* CHECK sy-subrc Eq 0.
READ TABLE i_mast INTO wa_mast WITH KEY stlnr = wa_stko-stlnr
BINARY SEARCH.
* CHECK sy-subrc Eq 0.
READ TABLE i_makt INTO wa_makt WITH KEY matnr = wa_mast-matnr
BINARY SEARCH.
* CHECK sy-subrc Eq 0.
MOVE:
wa_stpo-idnrk TO wa_output-idnrk,
wa_stpo-postp TO wa_output-postp,
wa_stpo-posnr TO wa_output-posnr,
wa_stpo-menge TO wa_output-menge,
wa_stko-stlty TO wa_output-stlty,
wa_stko-datuv TO wa_output-datuv,
wa_stko-bmeng TO wa_output-bmeng,
wa_stko-stktx TO wa_output-stktx,
wa_stko-stlst TO wa_output-stlst,
wa_stzu-ztext TO wa_output-ztext,
wa_mast-werks TO wa_output-werks,
wa_mast-matnr TO wa_output-matnr,
wa_makt-maktx TO wa_output-maktx,
wa_mast-stlnr TO wa_output-stlnr,
wa_mast-stlan TO wa_output-stlan,
wa_mast-stlal TO wa_output-stlal.
APPEND wa_output TO i_output.
ENDLOOP. " LOOP AT i_stpo
ENDFORM. " f600_display_data
*& Form f650_field_catlog *
* -Fill Field Catalog *
FORM f650_field_catlog .
wa_fcat-fieldname = 'WERKS'.
wa_fcat-ref_table = 'MAST'.
wa_fcat-ref_field = 'WERKS'.
wa_fcat-col_pos = 1.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-ref_table = 'MAST'.
wa_fcat-ref_field = 'MATNR'.
wa_fcat-col_pos = 2.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'MAKTX'.
wa_fcat-ref_table = 'MAKT'.
wa_fcat-ref_field = 'MAKTX'.
wa_fcat-col_pos = 3.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'STLTY'.
wa_fcat-ref_table = 'STKO'.
wa_fcat-ref_field = 'STLTY'.
wa_fcat-col_pos = 4.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'STLAN'.
wa_fcat-ref_table = 'MAST'.
wa_fcat-ref_field = 'STLAN'.
wa_fcat-col_pos = 5.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'STLNR'.
wa_fcat-ref_table = 'MAST'.
wa_fcat-ref_field = 'STLNR'.
wa_fcat-col_pos = 6.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'STLAL'.
wa_fcat-ref_table = 'MAST'.
wa_fcat-ref_field = 'STLAL'.
wa_fcat-col_pos = 7.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'STKTX'.
wa_fcat-ref_table = 'STKO'.
wa_fcat-ref_field = 'STKTX'.
wa_fcat-col_pos = 8.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'DATUV'.
wa_fcat-ref_table = 'STKO'.
wa_fcat-ref_field = 'DATUV'.
wa_fcat-col_pos = 9.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'BMENG'.
wa_fcat-ref_table = 'STKO'.
wa_fcat-ref_field = 'BMENG'.
wa_fcat-col_pos = 10.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'STLST'.
wa_fcat-ref_table = 'STKO'.
wa_fcat-ref_field = 'STLST'.
wa_fcat-col_pos = 11.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'IDNRK'.
wa_fcat-ref_table = 'STPO'.
wa_fcat-ref_field = 'IDNRK'.
wa_fcat-col_pos = 12.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'POSTP'.
wa_fcat-ref_table = 'STPO'.
wa_fcat-ref_field = 'POSTP'.
wa_fcat-col_pos = 13.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'POSNR'.
wa_fcat-ref_table = 'STPO'.
wa_fcat-ref_field = 'POSNR'.
wa_fcat-col_pos = 14.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'MENGE'.
wa_fcat-ref_table = 'STPO'.
wa_fcat-ref_field = 'MENGE'.
wa_fcat-col_pos = 15.
APPEND wa_fcat TO it_fcat.
wa_fcat-fieldname = 'ZTEXT'.
wa_fcat-ref_table = 'STZU'.
wa_fcat-ref_field = 'ZTEXT'.
wa_fcat-col_pos = 16.
APPEND wa_fcat TO it_fcat.
ENDFORM. " f650_field_catlog
*& Module STATUS_0100 OUTPUT *
* -Calling Function Module *
MODULE status_0100 OUTPUT.
SET PF-STATUS 'BACK'.
* SET TITLEBAR 'xxx'.
IF w_container IS INITIAL.
* IF cl_gui_alv_grid=>offline( ) IS INITIAL.
CREATE OBJECT w_container
EXPORTING
* PARENT =
container_name = 'CUSTOM'
* STYLE =
* LIFETIME = lifetime_default
* REPID =
* DYNNR =
* NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF sy-subrc <> 0.
ENDIF.
CREATE OBJECT w_alv_grid
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
i_parent = w_container
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF sy-subrc <> 0.
* ENDIF.
CALL METHOD w_alv_grid->set_table_for_first_display
* EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* i_structure_name = 'WA_OUTPUT'
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
* IS_LAYOUT =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
CHANGING
it_outtab = i_output
it_fieldcatalog = it_fcat
* 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. " IF sy-subrc <> 0.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT *
* - Leave Program *
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE. " CASE ok_code
CLEAR ok_code.
ENDMODULE. " USER_COMMAND_0100 INPUT
thanks,
Reward if helpful,
Brijesh
Similar Messages
-
Drill down to all screens of XK03 in ALV report from CALL TRANSACTION
HI!
I have created a vendor master report which calls the XK03 transaction when the vendor is clicked on on the ALV output. It takes me to the XK03 address screen and when I try clicking to go to the next screen it says the last screen is reached , 'Do you wnat to cancell processing'. I want to enable the program to goto the next screens as well like the controll screen and the accounting screen ect in my drill down on call transaction.
following si my code section which does it.
CASE rs_selfield-fieldname.
WHEN 'LIFNR'.
* Set parameter ID for transaction screen field
CHECK NOT wa_vend-lifnr IS INITIAL.
SET PARAMETER ID 'LIF' FIELD wa_vend-lifnr.
SET PARAMETER ID 'BUK' FIELD wa_vend-bukrs.
SET PARAMETER ID 'EKO' FIELD wa_vend-ekorg.
SET PARAMETER ID 'KDY' FIELD kdy_val.
CALL TRANSACTION 'XK03' AND SKIP FIRST SCREEN. "EC needed
ENDCASE.
ENDCASE.
Thanks and regards,
AaravHi,
Your code seems to be right.
Try writing the code as the below format.
CASE SY-UCOMM.
* CHECK FUNCTION CODE
WHEN '&IC1'.
* CHECK FIELD CLICKED ON WITHIN ALVGRID REPORT
IF SELFIELD-FIELDNAME = 'LIFNR'.
* READ DATA TABLE, USING INDEX ROW USER CLICKED ON
READ TABLE IT_FINAL INTO WA_FINAL INDEX SELFIELD-TABINDEX.
* SET PARAMETER ID FOR TRANSACTION SCREEN FIELD
SET PARAMETER ID 'BES' FIELD WA_FINAL-LIFNR.
* EXECUTE TRANSACTION 'XK03',AND SKIP INITIAL DATA ENTRY SCREEN.
CALL TRANSACTION 'XK03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
Thanks
Arbind -
Blank screen when Back on ALV report
Hello All,
I have written an ALV report and when I click BACK on the output list, instead of taking me back to selection screen it is giving a blank screen, and again clicking BACK is giving me selection screen.
ALV output -->> BACK --> Blank screen --> BACK --> Selection screen
I am unable to trace out why this is happenning. I want behavour as it dies for other alv report.
ALV output --> BACK --> Selection Screen.
Any suggestions are highly appreciated.
Thanks-I am using a FM, its a straight forward ALV report,
Getting data from different tables in to final output internal table, calling a function module to display ALV.
h_repid = sy-repid.
h_variant-report = h_repid.
t_slis_layout_alv-zebra = 'X'.
t_slis_layout_alv-colwidth_optimize = 'X'.
PERFORM get_fieldcat_summary.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = h_repid
is_layout = t_slis_layout_alv
it_fieldcat = t_fieldcat1[]
i_save = 'A'
is_variant = h_variant
TABLES
t_outtab = it_main[]
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.
Thanks- -
Subtotals and Totals In ALV Report
Hi Experts,
I have a problem in my current scenario,
I have 3 fields,
KUNNR, WAERS, DMBTR.
000001 USD 100.00
000001 USD 200.00
000002 USD 100.00
000002 USD 400.00
000002 EUR 300.00
000002 EUR 100.00
The above mentioned is the data I have in my internal table & in my ALV report as well, Which is fine...!
Now I need Subtotals for each customer,
Means for customer 000001 The subtotal is 300 (USD)
Means for customer 000002 The subtotal is 500 (USD)
Means for customer 000002 The subtotal is 400 (EUR)
At the end I need grand totals.
USD 800
EUR 400.
Currently My field catalog is given below.
FIELDCATALOG-COL_POS = COL_POS.
FIELDCATALOG-FIELDNAME = 'DMBTR'.
FIELDCATALOG-SELTEXT_M = TEXT-106.
FIELDCATALOG-DO_SUM = 'X'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
what else I need to do for getting individual subtotals by currency and customers.
Thanks & regards,
Dileep .CHi Deelip,
FOR TOTAL:
there is a property of fieldcatalog, that is do_sum.
USE COED LIKE:
PERFORM fieldcat USING:
'1' 'KUNNR' 'I_MARD' 'CUSTOMER NO' ,
'2' 'DMBTR' 'I_MARD' 'CURRENCY' ,
FORM fieldcat USING value(p_0029)
value(p_0030)
value(p_0031)
value(p_0032)
wa_fieldcat-col_pos = p_0029.
wa_fieldcat-fieldname = p_0030.
wa_fieldcat-tabname = p_0031.
wa_fieldcat-reptext = p_0032.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " FIELDCAT
in final output you will get the total of currency field.
FOR SUB TOTAL:
decleare: i_sort type standard table of slis_sortinfo_alv,
wa_sort type slis_t_sortinfo_alv.
wa_sort-spos = '1'.
wa_sort-fieldname = 'KUNNR'.
wa_sort-tablename = 'i_final'
wa_sort-up = 'x'
wa_sort-subtot = 'X'.
wa_sort-spos = '2'.
wa_sort-fieldname = 'WAERS'.
wa_sort-tablename = 'i_final'
wa_sort-up = 'x'
wa_sort-subtot = 'X'.
append wa_tab to i_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
it_sort = i_sort
Hope this can solve your pbs.
Regards,
Tutun -
Screens and ABAP Objects - R/3 4.6c
Greetings fellow SAP developers.
Looking for some input here. What's the best way to manage dialog screens with ABAP OO?
Do you encapsulate the screen in an object? So that there is just one method or two methods? As in:
Screen->Init
Or do you break it down into chunks? As in:
Screen->Set_Fields
Screen->Validate
Screen->Handle_Action
Or do you avoid using objects to encapsulate screens? That is, just use objects to encapsulate business processes? As in:
SCREEN_FIELD_1 = BusinessObject->Get_Value_1()
SCREEN_FIELD_2 = BusinessObject->Get_Value_2()
Thanks in advance for your input.
BrettSure you can handle PBO and PAI of screen using objects, take a look at transaction MIGO, its full of it. The only thing is is that you can not use the "CALL SCREEN" statement inside your objects.
Regards,
Rich Heilman -
Subtotal and total in alv report
hi,
i have an ALV REPORT,displaying the fields such as po item(ekpo-menge).but i am unable to perform total and sub total,it gives me a information message 'total cannot b performed'.
can any one help me, how to total and subtotal.Hi,
Please go through the following links. I am sure it will help you.
<a href="http://www.sapfans.com/forums/viewtopic.php?t=20386">http://www.sapfans.com/forums/viewtopic.php?t=20386</a>
<a href="http://www.sapfans.com/forums/viewtopic.php?t=85191">http://www.sapfans.com/forums/viewtopic.php?t=85191</a>
<a href="http://www.sapfans.com/forums/viewtopic.php?t=88401">http://www.sapfans.com/forums/viewtopic.php?t=88401</a>
Please reward helpful answer.
Regards,
Amit Mishra -
Editing rows and columns in alv reports in webdynpro abap
how edit row and columns in webdynpro abap ?
can i add colors to salv repotrs for below and above range of values how ?
if possible send source code for it.............hi
check out this link for editing the columns of ALV
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0155eb5-b6ce-2b10-3195-d9704982d69b
check out for this thread as well for coloring ALV
Coloring of selected table cells: Ideas wanted
regards,
amit -
Preview and Download in ALV report blank
Dear All,
I have a problem. When user preview and download to local save (txt, xls, etc) from report in ALV format, user get blank preview and blank file.
I use 2 FM.
1st i use FM REUSE_ALV_LIST_LAYOUT_INFO_GET to get fieldcat because user want to download after customize the layout (example default there are 5 field then user hide 2 field so only 3 field are displayed and downloaded).
2nd I use FM REUSE_ALV_GRID_DISPLAY to display as ALV format. and user can download via download button default in ALV format.
so, anyone.. could u help me ??
ThanksHi,
ok I generaeted the fieldcatalog for the above and try to execute as this as I described above
i am giving the code just check it.
type-pools SLIS.
data : lv_vbeln type vbak-vbeln.
select-options : so_vbeln for lv_vbeln.
initialization.
so_vbeln-low = '4970'.
so_vbeln-high = '4975'.
append so_vbeln.
data : lt_fcat type SLIS_T_FIELDCAT_ALV,
ls_fcat like line of lt_fcat.
types : begin of ty_vbak,
vbeln type vbak-vbeln,
erdat type vbak-erdat,
erzet type vbak-erzet,
ernam type vbak-ernam,
end of ty_vbak.
data : lt_vbak type standard table of ty_vbak,
ls_vbak type ty_vbak.
data : ls_variant like DISVARIANT.
data : ls_layo type SLIS_LAYOUT_ALV.
start-of-selection.
perform getvbak.
if sy-subrc eq 0.
perform displayvbak.
endif.
FORM GETVBAK .
select vbeln erdat erzet ernam from vbak
into table lt_vbak
where vbeln in so_vbeln.
ENDFORM. " GETVBAK
FORM DISPLAYVBAK .
clear ls_fcat.
ls_fact-fieldname = 'VBELN'.
ls_fcat-colpos = 1.
ls_fcat-seltext_m = 'Sales No'.
ls_fcat-outputlen = 10.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fact-fieldname = 'ERDAT'.
ls_fcat-colpos = '2'.
ls_fcat-seltext_m = 'Date'.
ls_fcat-outputlen = 10.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fact-fieldname = 'ERZET'.
ls_fcat-colpos = '3'.
ls_fcat-seltext_m = 'Time'.
ls_fcat-outputlen = 10.
append ls_fcat to lt_fcat.
clear ls_fcat.
ls_fact-fieldname = 'ERNAM'.
ls_fcat-colpos = '4'.
ls_fcat-seltext_m = 'Created By'.
ls_fcat-outputlen = 10.
append ls_fcat to lt_fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IS_LAYOUT = ls_layo
IT_FIELDCAT = lt_fcat[]
I_SAVE = 'X'
IS_VARIANT = ls_variant
TABLES
T_OUTTAB = lt_vbak[].
ENDFORM. " DISPLAYVBAK
Thanks & Regards,
Raghunadh K -
Layout change and save for ALV report
Hi,
I ahve created R3 report in which report has been displayed using ALV grid, I am able to change the layout as I can see the layout -> change option in settings menu, but save and choose option is disabled.
Please advise how to enable layoutr save and choose option for ALV grid.
Thanks,
PiyushHi,
According to sap help you need authorization to save Layout
[ALV -Layout|http://help.sap.com/saphelp_sm32/helpdata/en/82/839d37664e4d45e10000009b38f8cf/content.htm]
To save layouts for all users, you need the authorization S_ALV_LAYO with activity 23 as of Release 4.6C. You can only go to the layout administration if you have this authorization.
You must maintain the authorization object S_ALV_LAYO using the user administration.
If you would like to use or save the Excel view in your layout, you also require the additional authorization S_BDS_DS with activity 01,02,03,06,30; CLASSNAME ALVLAYOUTTEMPLATES and CLASSTYPE OT.
Furthermore, there are applications that have their own authorization checks installed.
In some ALV lists, you can only save user-specific layouts. In these cases, the indicator "user-specific" is active , on a grey background and unable to be changed. This is related to the parameter I_SAVE. This controls which options you have to save the layout.
To be able to define default layouts, the parameter I_DEFAULT must have the value 'X'.
Notes 409190 and 601803 also provide further information on authorizations. -
Distinct and sum in alv report
i have 6 row of 1 matnr
and i have to display only 1 with the sum of each field
example:
300032 3 4 1
300032 3 3 3
300032 2 2 2
i want
<b>300032 8 9 7</b>
how?
thanks.Hi
Use Collect statament to append the record to output table.
DATA: BEGIN OF ITAB OCCURS 0,
KEY
FIELD1 TYPE I,
FIELD2 TYPE I,
FIELD3 TYPE I,
END OF ITAB.
ITAB-KEY = '300032'.
ITAB-FIELD1 = 3.
ITAB-FIELD2 = 4.
ITAB-FIELD3 = 1.
COLLECT ITAB.
ITAB-KEY = '300032'.
ITAB-FIELD1 = 2.
ITAB-FIELD2 = 2.
ITAB-FIELD3 = 2.
COLLECT ITAB.
ITAB-KEY = '300032'.
ITAB-FIELD1 = 3.
ITAB-FIELD2 = 3.
ITAB-FIELD3 = 3.
COLLECT ITAB.
Max
Message was edited by: max bianchi
Message was edited by: max bianchi -
Writing Subtotal and Grandtotal in ALV Report
Dear All,
I have a requirement that instead of * and ** in Subtotal and Grandtotal, I will require to write text "Subtotal" and "Grandtotal" written. Can you please help me out?
Thanks and regards,
AtanuHI
http://help.sap.com/saphelp_sm32/helpdata/en/ee/b99d37e188a049e10000009b38f8cf/content.htm
Use "Subtotal_text" in events table.
here GTOTAL is field in itab on which we sortindf data, and use your own field on which field u want to sort...
refresh gt_event.
clear gw_event.
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_event.
Subtotal
read table gt_event with key name = slis_ev_subtotal_text into gw_event.
if sy-subrc = 0.
move 'SUBTOTAL_TEXT' to gw_event-form.
append gw_event to gt_event.
endif.
form subtotal_text using uw_subtot_line type ty_main
uv_subtottxt type slis_subtot_text. "#EC CALLED
if uv_subtottxt-criteria = 'GTOTAL'.
uv_subtottxt-display_text_for_subtotal = 'TOTAL'.
endif.
*FORM build_sort .
refresh gt_sort.
gw_sort-spos = 1.
gw_sort-fieldname = 'GTOTAL'.
gw_sort-tabname = 'GT_MAIN'.
gw_sort-up = 'X'.
gw_sort-subtot = 'X'.
APPEND gw_sort TO gt_sort.
CLEAR gw_sort. -
ALV report - run in background and output to screen
I wish to run a report in background and then output the report to screen as a standard ALV report with all the associated functionality. Can anyone tell me how to do this?
Thanks.Hi,
In background i dont think so its possible.
Regards,
Prashant -
What are events in ALV report and explain how sorting is done alv report
events in alv report and sorting in alv report
Moderator Message: Search before posting.
Edited by: kishan P on Dec 21, 2011 11:13 AMHi Raja,
<<content and links removed by moderator>>
PavanKumar.G
Edited by: kishan P on Dec 21, 2011 11:12 AM -
*New to ABAP: what is Report*
Hi Gurus,
i am new to ABAP.If any body can explain about what is report and how many types are there to create internal tables.
points will be reward.
Thanks,
Balakrishna.hi naidu,
When you are working in the SAP System, you may want to access information from the database. To do this, you use reports.
In this documentation, report refers to the report program, and list refers to the output u2013 that is, the results of the report.
Some reports display information; others allow you to perform analyses.
A report must be started, or executed. In many cases, the SAP System automatically executes a report. Sometimes, however, you will want to execute a report yourself.
In addition to report programs, the SAP System provides numerous reporting tools, each of which has its own set of procedures for executing report programs.
This documentation describes report programs only. For an introduction to the SAP reporting tools, refer to the Reporting Made Easy guidebooks (Release 4.0B). You can find these guidebooks at: www.saplabs.com/rme
In ABAP, there are a total of 7 types of reports. They are:
Classical
Interactive
Logical Database
ABAP query
ALV Reports (ALV stands for ABAP List Viewer)
Report Writer/Report Painter Views (There are different types of views also)
[Edit section] Classical Reports
These are the most simple reports. Programmers learn this one first. It is just an output of data using the Write statement inside a loop.
Classical reports are normal reports. These reports are not having any sub reports. IT IS HAVING ONLY ONE SCREEN/LIST FOR OUTPUT.
Events In Classical Reports.
INTIALIZATION: This event triggers before selection screen display.
AT-SELECTION-SCREEN: This event triggers after proccesing user input still selection screen is in active mode.
START OF SELECTION: Start of selection screen triggers after proceesing selection screen.
END-OF-SELECTION : It is for Logical Database Reporting.
[Edit section] Interactive Reports
As the name suggests, the user can Interact with the report. We can have a drill down into the report data. For example, Column one of the report displays the material numbers, and the user feels that he needs some more specific data about the vendor for that material, he can HIDE that data under those material numbers.
And when the user clicks the material number, another report (actually sub report/secondary list) which displays the vendor details will be displayed.
We can have a basic list (number starts from 0) and 20 secondary lists (1 to 21).
Events associated with Interactive Reports are:
AT LINE-SELECTION
AT USER-COMMAND
AT PF<key>
TOP-OF-PAGE DURING LINE-SELECTION.
HIDE statement holds the data to be displayed in the secondary list.
sy-lisel : contains data of the selected line.
sy-lsind : contains the level of report (from 0 to 21)
Interactive Report Events:
AT LINE-SELECTION : This Event triggers when we double click a line on the list, when the event is triggered a new sublist is going to be generated. Under this event what ever the statements that are been return will be displayed on newly generated sublist.
AT PFn: For predefined function keys...
AT USER-COMMAND : It provides user functions keys.
TOP-OF-PAGE DURING LINE-SELECTION :top of page event for secondary list.
[Edit section] Logical Database Reports
Logical database is another tool for ABAP reports. Using LDB we can provide extra features for ABAP reports.
While using LDB there is no need for us to declare Parameters.
Selection-screen as they will be generated automatically.
We have to use the statement NODES in ABAP report.
If there are many tables the Performance will be slow as all the table data will be read from top node to bottom node .
[Edit section] ABAP Query Reports
ABAP query is another tool for ABAP. It provides efficency for ABAP reports. These reports are very accurate.
Transaction Code : SQ01
The advantage with ABAP QUERY is logic required for classic & interactive reports system design automatically 80%.
For ABAP QUERY handle these
SQ01 ; QUERY
SQ02 : INFOSET OR FUNCTIONAL AREA
SQ03: USER GROUP.
[Edit section] Report Writer
Key Concept :
Super users and end users can use Report Painter/Report Writer tools to write their own reports.
Giving them the ability to report on additional fields at their discretion shifts the report maintenance burden to them, saving SAP support groups time and effort normally spent creating and maintaining the reports.
Instead of using ABAP code to write a report in FI and CO, many users build a Report Painter/ Report Writer library using transaction MC27.
However, this workaround has some drawbacks. Little known transaction GRCT solves these problems in most cases, and eliminates the need to use transaction MC27.
ABAP Report Types
ABAP report types are those ones available in some report's attributes screen, i.e. :
Executable program
Function group (containing function modules)
Include
Interface pool
Class pool
Module pool
Subroutine pool
Also 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.
hope its clear to you,
Reward points if usefull,
Thanks,
Kalyan. -
How to get GUI Status(Push Buttons) in ALV Report
Hi Friends
I have a requirement in a way that:
Once selection-screen was processed,an ALV report has to come and above the ALV List,I need a custom GUI Status(4 Push Button) with Push Buttons Logic.
Once I had clicks on thesse push button,I need to display one more ALV List and above this List,again I need a custom GUI Status(2 Push Buttons) with Push Buttons Logic.
Can anyone throw some light how we can achieve this.
Thanks for your cooperation!
Regards,
Madisettydata: rt_extab type slis_t_extab,
g_ucomm like sy-ucomm ,
g_selfield type slis_selfield.
form alv_display .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = g_repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMM'
it_fieldcat = it_fldcat
tables
t_outtab = it_final1
perform pf_status using rt_extab.
perform user_comm using g_ucomm g_selfield .
endform.
form pf_status using p_rt_extab.
set pf-status 'PF_STATUS' excluding p_rt_extab.
endform.
form user_comm using p_ucomm like sy-ucomm
p_selfield type slis_selfield.
data: l_row type i.
case p_ucomm.
when 'DISPLAY_PO'.
loop at it_final1 into wa_final1.
if wa_final1-sel eq 'X' .
l_row = l_row + 1.
endif.
if l_row gt 1.
message e004.
endif.
clear wa_final1.
endloop.
p_selfield-fieldname = 'SEL'.
read table it_final1 into wa_final1 index p_selfield-tabindex .
set parameter id 'BES' field wa_final1-ebeln.
call transaction 'ME23N'.
endcase.
endform.
*create user interface for gui status by double clicking on 'PF_STATUS'.
*Check the above sample code .
Maybe you are looking for
-
CHarged for games purchases I didn't purchase
My itunes account charged me about $250 for game apps I didn't purchase, I tried using the report problem page, but it just wouldn't work for me... Help!! WHo should i contact about this problem and what cna i do to undo this??!!?!?
-
Getting an error message when running any cs5 application
Hello everyone. I'm getting desperate. Here is ym problem. I downloaded a trial version of Adobe Master Suite and installed it but whenever I start any of CS5 applications i get the following error: I've tried uninstalling it completely, cleaning my
-
Dear Experts If anybody knows step by step config of DIP Profile, please share? Regards Deepu Pillai
-
Newbie help with java :(
Hey guys bare with me as this is my first assignment for my Java class. Here is the assignement and my class must be named payroll1. Any help on correcting or pointing out what is wrong with my code would be great. Create a non-GUI based Java applica
-
Nikon D3100 pics won't work in iPhoto
I've seen similar discussion regarding Nikon pics and iPhoto, but none with my exact issue. At first my Nikon D3100 photos wouldn't even transfer in iPhoto, but per other discussions, I figured out how to transfer them, but when I try to view them in