Align ALV Output Display to fit window resolution using cl_gui_custom_conta
hi,
my ALV Display is not fitting to the window screen for different resolutions.
big monitor the screen display is too small and small monitor its fitting.
I want to have DYNAMIC screen fit using cl_gui_custom_container...
is it possible??
ags.
Thanks Pawan,
the link you provided had my exact solution.
this is a very rare feature to know i believe since most of the people havnt faced it i guess.
I will have to say the same thing as you said in the
"Thanks Pawan, that explains everything.. sometime I just overlook the things..Thnaks again!!"
ags.
Similar Messages
-
Strange behaviour in alv output display for a date column!
hi friends,
my alv output list display contains a column for budat (posting date), if this field has no value, then it displays a blank cell (space) in the output in my user login...but when the same report is run in another user login, even though the value of the column is null, it displays 00000000 (8 zeroes) rather than displaying a blank cell...i have set the field catalog property NO_ZERO = 'X'; is this property has anything to do with authorization to achieve its funcionality? am not sure...this is strange, as it is the same report, same field catalog that is being used..need some inputs on this
thanks in advance
SathishThere are 2 solutions for an adhoc solution you can change the field to a char10 field, this will solve your immediate problem of the 0 display. For a permanent solution you can check the user profile setting for the date for you as well as the concerned user.
Hope That Helps
Anirban M. -
To Display Calender in F4 help in ALV Output Display.
Hello Experts.
I have one requirement. I have an ALV output. In this one date field is editable. Here User wants F4 Help. I have provided the F4 help, F4 help is coming but for F4 help i want the Factory Calendar type display. Currently the F4 help is coming like a normal F4 help.
Thanks.
Swati.hi Swati,
I hope you have checked standard program 'bcalv_edit_08'.
in this program, if the type of field we are taking in that perticuler column is 'DATS' then it should display the calender.
Regards,
Ani -
hi
i'm doing an ALV Report. In the output i'm double clicking on the Document field using user-command
it is taking me to a particular Transaction and my requirement is if i change any field for ex : Description
in that transaction and come back again to the output display the Changed Description should appear
when i refresh the Output.how to get it?
Regards1. create one icon on allication toolbar which is REFRESH icon, and give some function for it.
2. write the code like:
CASE SY_UCOMM.
when 'FCODE'.
refresh itab.
perform get_data.
perform_displaydata.
it is nothing but u need to put the same code which u used earlier to show the data in output gaian after clicking on function code.
Regards,
Rajesh. -
Hello,
I have one query witl regards to ALV output. After entering data in the selection screnn my ALV output gets displayed and there is no issue with it. The ALV is in display mode and if i click on the change button the ALV becomes editable. So fat it is fine.
The area of concern is the initial ALV output even though it is in display mode looks as if it is editable ALV. On click of the change button, then the ALV is shown in display mode and it is easily identifiable.
The user feels the initial ALV output is confusing and that he is not able to recognize whether it is display/editbale ALV. How can we fix it so that client can identify it?
Also, how do we get all the standard ALV buttons that we get in SE38 output in webdynpro? Please help.
Regards,
VaishnaviHi,
init your ALV settings with:
DATA lr_alv_cfg TYPE ref to cl_salv_wd_config_table.
lo_INTERFACECONTROLLER = wd_this->wd_cpifc_alv_table( ).
lr_alv_cfg = lo_interfacecontroller->get_model( ).
lr_alv_cfg->IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY( abap_true ).
If you click change button do this:
is_read_only = lr_alv_cfg->IF_SALV_WD_TABLE_SETTINGS~GET_READ_ONLY( ).
if lv_is_read_only = abap_true.
lr_alv_cfg->IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY( abap_false ).
else.
lr_alv_cfg->IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY( abap_true ).
endif. -
Hi,
I have a report with ALV .In the output success or error message gets displayed in a column based on certain conditions.The errors can be manually corrected.I
f the errors are corrected and 'Refresh' button is pressed in my output,the error message displayed in the output should disappear.
As of now,this happens if the report is run again but i want this to happen just by clicking of refresh button.i.e. the entire report should be run again with the existing inputs entered in selection screen.
If i try to call the same program using 'submit' spool gets created,but i want the output in the same page.
Can you please tell me how this can be achieved.
Regards,
S.SubasreeHi Subasree,
The following method call is used to refresh the data displayed within an ALV object grid:
CALL method gd_tree->REFRESH_TABLE_DISPLAY.
CALL METHOD gd_tree->set_table_for_first_display
EXPORTING
is_layout = gd_layout
CHANGING
it_fieldcatalog = gd_fieldcat
it_sort = it_sortcat
it_outtab = it_report.
CALL method gd_tree->REFRESH_TABLE_DISPLAY.
CALL METHOD cl_gui_cfw=>flush.
Hope this helps.
Reward if helpful.
Regards,
Sipra -
Error message was displaying when comes back from the final output display
Hi Experts,
I have developed one program and it works fine. But when i press F3 or BACK button from the final display one Error wa coming in a pop-up saying "Selection criterion "Posting Date" contains several selection lines".
I cant understand where the problem was. Can any one suggest where would be the problem. I am sending the code.
REPORT zfir0011_o2c_tax_gl_summary.
TYPE-POOLS slis.
TABLES: faglflexa.
Types Declaration.
TYPES: BEGIN OF x_faglflexa,
ryear TYPE gjahr,
bukrs TYPE bukrs,
belnr TYPE belnr_d, "Document Number
poper TYPE poper, "Posting Period
budat TYPE budat, "Posting Date
buzei TYPE buzei, "Document line item
racct TYPE racct, "G/L Account no.
END OF x_faglflexa,
ty_t_faglflexa TYPE STANDARD TABLE OF x_faglflexa.
TYPES: BEGIN OF x_bset,
belnr TYPE belnr_d,
buzei TYPE buzei,
mwskz TYPE mwskz, "Tax code
hkont TYPE hkont,
shkzg TYPE shkzg, "Debit/Credit Indicator
txjcd TYPE txjcd, "Tax Jurisdiction
h2ste TYPE h2ste, "Tax Amount
h2bas TYPE h2bas_bses, "Tax Amount
END OF x_bset,
ty_t_bset TYPE STANDARD TABLE OF x_bset.
TYPES: BEGIN OF x_skat,
spras TYPE spras,
ktopl TYPE ktopl,
saknr TYPE saknr,
text TYPE txt20_skat,
END OF x_skat,
ty_t_skat TYPE STANDARD TABLE OF x_skat.
TYPES: BEGIN OF x_custom,
geo_state TYPE char2,
geo_county TYPE char3,
country TYPE char2,
description TYPE char40,
END OF x_custom,
ty_t_custom TYPE STANDARD TABLE OF x_custom.
TYPES: BEGIN OF x_budat,
sign TYPE char_01,
option TYPE char2,
low TYPE budat,
high TYPE budat,
END OF x_budat,
ty_t_budat TYPE STANDARD TABLE OF x_budat.
TYPES: BEGIN OF x_txjcd,
geo_state TYPE char2,
geo_county TYPE char3,
END OF x_txjcd,
ty_t_txjcd TYPE STANDARD TABLE OF x_txjcd.
TYPES: BEGIN OF x_inter,
ryear TYPE gjahr,
bukrs TYPE bukrs,
txjcd TYPE txjcd, "Tax Jurisdiction
racct TYPE racct, "G/L Account no.
h2ste TYPE h2ste, "Tax Amount
poper TYPE poper, "Posting Period
belnr TYPE belnr_d, "Document Number
shkzg TYPE shkzg, "Debit/Credit Indicator
END OF x_inter,
ty_t_inter TYPE STANDARD TABLE OF x_inter.
TYPES: BEGIN OF x_final,
txjcd TYPE bset-txjcd, "Tax Jurisdiction
state TYPE char40, "State
curr_bal TYPE bset-h2ste, "Current Balance
per_chng TYPE bset-h2ste, "Period Change
pri_bala TYPE bset-h2ste, "Prior Balance
END OF x_final,
ty_t_final TYPE STANDARD TABLE OF x_final.
Column positions to pass to field catalog
CONSTANTS : c_pos_1 TYPE sy-cucol VALUE '1', " position of the columns
c_pos_2 TYPE sy-cucol VALUE '2',
c_pos_3 TYPE sy-cucol VALUE '3',
c_pos_4 TYPE sy-cucol VALUE '4',
c_pos_5 TYPE sy-cucol VALUE '5'.
*Field names for Field Catalog
CONSTANTS : c_h TYPE c VALUE 'H', "Header
c_s TYPE c VALUE 'S', "Sub heading
c_slash TYPE c VALUE '/', "Slash
c_colon TYPE c VALUE ':', "Column
c_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',"#EC NEEDED "Top-of-page
c_top_of_page_split TYPE slis_formname VALUE 'TOP_OF_PAGE_SPLIT', "Top-of-page centered
c_txjcd TYPE slis_fieldname VALUE 'TXJCD', "Tax Jurisdiction
c_region TYPE slis_fieldname VALUE 'STATE', "State
c_currb TYPE slis_fieldname VALUE 'CURR_BAL', "Current Balance
c_perch TYPE slis_fieldname VALUE 'PER_CHNG', "Period Change
c_prbal TYPE slis_fieldname VALUE 'PRI_BALA'. "Prior Balance
CONSTANTS : c_table_name TYPE slis_tabname VALUE 'IT_FINAL', "For Field Catalog
c_spras TYPE spras VALUE 'E', "Language
c_buzei TYPE c VALUE '1', "Line item in BSET
c_one(2) TYPE c VALUE '01',
c_zp TYPE bset-mwskz VALUE 'ZP', "Sales Tax Code
c_zr TYPE bset-mwskz VALUE 'ZR'. "Sales Tax Code
Variables Declaration.
DATA : v_current_year TYPE i, "Current year
v_poper TYPE poper, "Posting period
v_saknr TYPE saknr, "Account no. "#EC NEEDED
v_ktopl TYPE ktopl, "Chart of Accounts
v_konts TYPE saknr, "G/L Account Number
v_bukrs TYPE bukrs, "Company Code
v_sum_val TYPE h2ste, "#EC NEEDED "Tax Amount
v_sum_val1 TYPE h2ste, "Tax Amount
v_sum_val2 TYPE h2ste, "Tax Amount
v_sum_debit TYPE h2ste,
v_sum_credit TYPE h2ste,
v_sum_debit1 TYPE h2ste,
v_sum_credit1 TYPE h2ste,
v_h2ste TYPE string, "#EC NEEDED
v_desc TYPE char40, "G/L Acct. Description
v_title TYPE char40. "Title
Internal Tables Declaration.
DATA : it_faglflexa TYPE ty_t_faglflexa, "Internal table for G/L Line Items.
it_bset TYPE ty_t_bset, "Internal table for Tax Data Document Segment.
it_skat TYPE ty_t_skat, "Internal table for Chart of Accounts: Desc.
it_custom TYPE ty_t_custom, "Custom table for storing STATE Description.
it_txjcd TYPE ty_t_txjcd, "For storing Tax Jurisdiction codes.
it_inter TYPE ty_t_inter. "Intermediate table for storing data & Performing Calculations.
DATA : it_final TYPE ty_t_final. "#EC NEEDED
*Fieldcatalogue Internal Table Declaration
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_alv_top_of_page TYPE slis_t_listheader,
wa_line TYPE slis_listheader.
*Field-symbols and Work Area Declarations
FIELD-SYMBOLS : <fs_faglflexa> TYPE x_faglflexa,
<fs_bset> TYPE x_bset.
DATA : wa_faglflexa TYPE x_faglflexa, "#EC NEEDED
wa_bset TYPE x_bset,
wa_skat TYPE x_skat,
wa_custom TYPE x_custom,
wa_txjcd TYPE x_txjcd,
wa_inter TYPE x_inter,
wa_final TYPE x_final. " #EC NEEDED
SELECTION-SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_bukrs TYPE faglflexa-rbukrs OBLIGATORY, " Company Code
p_gjahr TYPE faglflexa-gjahr OBLIGATORY. " Fiscal Year
SELECT-OPTIONS: s_budat FOR faglflexa-budat OBLIGATORY " Posting Date
NO-EXTENSION
NO INTERVALS.
PARAMETERS: p_racct TYPE faglflexa-racct OBLIGATORY. " G/L Accounts
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN VALIDATIONS.
*Company Code Validation.
AT SELECTION-SCREEN ON p_bukrs.
SELECT SINGLE bukrs INTO v_bukrs
FROM t001
WHERE bukrs = p_bukrs.
IF sy-subrc NE 0.
MESSAGE e071(zfinprjt).
ENDIF.
Fiscal Year Validation. It should not be more than Current.
AT SELECTION-SCREEN ON p_gjahr.
v_current_year = sy-datum+0(4).
IF p_gjahr > v_current_year.
MESSAGE e072(zfinprjt).
ENDIF.
*G/L Account Validation.
AT SELECTION-SCREEN ON p_racct.
SELECT SINGLE saknr INTO v_saknr
FROM skb1
WHERE saknr EQ p_racct
AND bukrs EQ p_bukrs.
IF sy-subrc EQ 0.
*Check the Chart of Accounts for that Company Code.
SELECT SINGLE ktopl FROM t001
INTO v_ktopl
WHERE bukrs = p_bukrs.
*Check that it is a Tax G/L Account for that Company Code and G/L Account.
SELECT SINGLE konts FROM t030k "#EC *
INTO v_konts
WHERE ktopl = v_ktopl
AND konts = v_saknr.
IF sy-subrc NE 0.
MESSAGE e073(zfinprjt).
ENDIF.
ELSE.
MESSAGE e073(zfinprjt).
ENDIF.
AT SELECTION-SCREEN ON s_budat.
DATA : v_year(4) TYPE c,
v_month(2) TYPE c,
v_date(2) TYPE c. "#EC NEEDED
*if date ne 01 converting date to '01'
READ TABLE s_budat.
IF s_budat-low+6(2) NE c_one.
v_year = s_budat-low.
v_month = s_budat-low+4(2).
v_date = s_budat-low+6(2).
s_budat-high = s_budat-low.
CLEAR s_budat-low.
CONCATENATE v_year c_one c_one INTO s_budat-low.
s_budat-sign = 'I'.
s_budat-option = 'BT'.
APPEND s_budat.
ENDIF.
START-OF-SELECTION.
PERFORM get_data USING p_bukrs "#EC *
p_gjahr "#EC *
s_budat[] "#EC *
p_racct CHANGING it_final. "#EC *
*Display report in ALV grid
IF it_final IS NOT INITIAL.
*Build Top of the page table.
PERFORM comment_build USING it_skat CHANGING it_alv_top_of_page.
*Build Field catalog table for ALV
PERFORM build_field_catalog CHANGING it_fieldcat.
*Display report
PERFORM display_alv USING it_final.
ELSE.
*No data found for the selection criteria/period.
MESSAGE i022(zfinprjt).
exit.
ENDIF.
*& Form GET_DATA
Retrieve data from Database tables
-->P_P_BUKRS text
-->P_P_GJAHR text
-->P_P_BUDAT text
-->P_P_RACCT text
<--P_IT_FINAL text
FORM get_data USING fp_bukrs TYPE bukrs "#EC *
fp_gjahr TYPE gjahr "#EC *
fp_budat TYPE ty_t_budat "#EC *
fp_racct TYPE racct "#EC *
CHANGING fp_it_final TYPE ty_t_final.
*selecting the Required data from FAGLFLEXA
SELECT ryear "Fiscal Year
rbukrs "Company Code
belnr "Document Number
poper "Posting Period
budat "Posting Date
buzei "Document line item
racct "G/L Account no.
INTO TABLE it_faglflexa
FROM faglflexa
WHERE rbukrs EQ p_bukrs "#EC *
AND gjahr EQ p_gjahr "#EC *
AND budat LE s_budat "#EC *
AND budat IN s_budat "#EC *
AND racct EQ p_racct. "#EC *
IF sy-subrc EQ 0.
SORT it_faglflexa.
ENDIF.
*selecting the Tax Jurisdiction, Tax amount from BSET
IF it_faglflexa IS NOT INITIAL.
SELECT belnr
buzei
mwskz
"hkont
shkzg "Debit/Credit Indicator
txjcd "Tax Jurisdicaiton
h2ste "Tax Amount
h2bas "Tax Amount1
INTO TABLE it_bset
FROM bset
FOR ALL ENTRIES IN it_faglflexa
WHERE belnr EQ it_faglflexa-belnr
AND gjahr EQ p_gjahr "it_faglflexa-ryear
AND buzei EQ c_buzei. "Line item
ENDIF.
IF sy-subrc EQ 0.
SORT it_bset BY txjcd ASCENDING.
SORT it_bset BY belnr ASCENDING.
ENDIF.
*Selecting the G/L Account Long Text from SKAT
IF it_faglflexa IS NOT INITIAL.
SELECT spras " Language key
ktopl " Chart of Accounts
saknr " G/L Account Number
txt20 " G/L Account Long Text
INTO TABLE it_skat
FROM skat
FOR ALL ENTRIES IN it_faglflexa
WHERE spras = c_spras
AND saknr = it_faglflexa-racct.
ENDIF.
IF sy-subrc EQ 0.
SORT it_skat.
ENDIF.
LOOP AT it_bset ASSIGNING <fs_bset>.
wa_txjcd-geo_state = <fs_bset>-txjcd+0(2).
wa_txjcd-geo_county = <fs_bset>-txjcd+2(3).
APPEND wa_txjcd TO it_txjcd.
CLEAR wa_txjcd.
ENDLOOP.
IF sy-subrc EQ 0.
SORT it_txjcd BY geo_state.
DELETE ADJACENT DUPLICATES FROM it_txjcd COMPARING geo_state geo_county.
ENDIF.
*Selecting the Description from Custom table
IF it_txjcd IS NOT INITIAL.
SELECT geo_state
geo_county
country
description
INTO TABLE it_custom
FROM ztfi_tgl_summary
FOR ALL ENTRIES IN it_txjcd
WHERE geo_state = it_txjcd-geo_state
AND geo_county = it_txjcd-geo_county.
ENDIF.
IF sy-subrc EQ 0.
SORT it_custom.
ENDIF.
LOOP AT it_faglflexa ASSIGNING <fs_faglflexa>.
MOVE-CORRESPONDING <fs_faglflexa> TO wa_inter. "#EC ENHOK
*Read Tax Jurisdiction and Tax Amount from BSET Table.
READ TABLE it_bset INTO wa_bset WITH KEY belnr = <fs_faglflexa>-belnr
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_inter-shkzg = wa_bset-shkzg.
wa_inter-txjcd = wa_bset-txjcd.
ENDIF.
*If BSET-MWSKZ = ZP or ZR then pick H2BAS as Tax Amount.
IF wa_bset-mwskz = c_zp.
wa_inter-h2ste = wa_bset-h2bas.
ELSEIF wa_bset-mwskz = c_zr.
wa_inter-h2ste = wa_bset-h2bas.
ELSE.
wa_inter-h2ste = wa_bset-h2ste.
ENDIF.
*Check it is credit entry or debit entry ('H' or 'S').
IF wa_inter-shkzg EQ 'H'.
wa_inter-h2ste = wa_inter-h2ste * -1.
ENDIF.
APPEND wa_inter TO it_inter.
CLEAR: wa_inter, wa_bset.
ENDLOOP.
IF sy-subrc EQ 0.
SORT it_inter BY bukrs ryear txjcd ASCENDING.
DELETE it_inter WHERE txjcd EQ space.
DELETE ADJACENT DUPLICATES FROM it_inter COMPARING belnr.
ENDIF.
v_poper = s_budat-high+4(2).
LOOP AT it_inter INTO wa_inter.
*Read the Text maintained in the custom table based on the GEO_STATE = First two digits of TXJCD
*and GEO_COUNTY = Next three digits of TXJCD. If this is blank pick based on First two digits of TXJCD.
READ TABLE it_custom INTO wa_custom WITH KEY geo_state = wa_inter-txjcd+0(2)
geo_county = wa_inter-txjcd+2(3)
BINARY SEARCH.
IF sy-subrc NE 0.
READ TABLE it_custom INTO wa_custom WITH KEY geo_state = wa_bset-txjcd+0(2)
BINARY SEARCH.
ENDIF.
IF sy-subrc = 0.
wa_final-state = wa_custom-description.
ENDIF.
AT NEW txjcd.
CLEAR: v_sum_val, v_sum_val1, v_sum_val2.
ENDAT.
Period Change, if v_poper equal to present period(v_poper).
IF wa_inter-poper EQ v_poper.
IF wa_inter-shkzg EQ 'H'.
v_sum_debit = v_sum_debit + wa_inter-h2ste.
ELSE.
v_sum_credit = v_sum_credit + wa_inter-h2ste.
ENDIF.
Prior Balance, if v_poper is less than present period(v_poper).
ELSEIF wa_inter-poper LT v_poper.
IF wa_inter-shkzg EQ 'H'.
v_sum_debit1 = v_sum_debit1 + wa_inter-h2ste.
ELSE.
v_sum_credit1 = v_sum_credit1 + wa_inter-h2ste.
ENDIF.
ENDIF.
AT END OF txjcd.
wa_final-txjcd = wa_inter-txjcd.
IF sy-subrc EQ 0.
v_sum_val1 = v_sum_credit - v_sum_debit. "Temp Commented
ENDIF.
wa_final-per_chng = v_sum_val1. "Period change
IF sy-subrc EQ 0.
v_sum_val2 = v_sum_credit1 - v_sum_debit1. "Temp commented
ENDIF.
wa_final-pri_bala = v_sum_val2. "Prior Balance
wa_final-curr_bal = v_sum_val1 + v_sum_val2. "Current Balance
APPEND wa_final TO it_final. "#EC *
CLEAR: wa_inter,
wa_final,
v_sum_credit,
v_sum_credit1,
v_sum_debit,
v_sum_debit1.
ENDAT.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form COMMENT_BUILD
ALV Top of Page
-->P_IT_SKAT text
<--P_IT_ALV_TOP_OF_PAGE text
FORM comment_build USING fp_it_skat TYPE ty_t_skat"#EC NEEDED
CHANGING fp_it_alv_top_of_page TYPE slis_t_listheader.
DATA: v_budat_low TYPE c LENGTH 10, "#EC NEEDED
v_budat_high TYPE c LENGTH 10, "#EC NEEDED
v_butxt TYPE butxt.
CLEAR wa_line.
*Report Title
CONCATENATE text-005 p_bukrs INTO v_title SEPARATED BY space.
wa_line-typ = c_h.
wa_line-key = ' '.
wa_line-info = v_title.
APPEND wa_line TO fp_it_alv_top_of_page.
CLEAR wa_line.
*Account Number
wa_line-typ = c_s.
wa_line-key = text-006.
wa_line-info = p_racct.
APPEND wa_line TO fp_it_alv_top_of_page.
CLEAR wa_line.
*G/L Account Description
READ TABLE it_skat INTO wa_skat WITH KEY ktopl = v_ktopl BINARY SEARCH."#EC *
IF sy-subrc EQ 0.
v_desc = wa_skat-text.
ENDIF.
wa_line-typ = c_s.
wa_line-key = text-007.
wa_line-info = v_desc.
APPEND wa_line TO fp_it_alv_top_of_page.
CLEAR wa_line.
*Fiscal Year from selection
IF NOT p_gjahr IS INITIAL.
wa_line-info = p_gjahr.
wa_line-typ = c_s.
wa_line-key = text-008. "Fiscal Year
APPEND wa_line TO fp_it_alv_top_of_page.
CLEAR wa_line.
ENDIF.
*Posting Date
CONCATENATE s_budat-high4(2) s_budat-high6(2) s_budat-high+0(4) INTO wa_line-info SEPARATED BY c_slash.
wa_line-typ = c_s.
wa_line-key = text-009. "Posting Date
APPEND wa_line TO fp_it_alv_top_of_page.
CLEAR wa_line.
*Company Code Description from selection
IF NOT p_bukrs IS INITIAL.
SELECT SINGLE butxt FROM t001
INTO v_butxt WHERE bukrs EQ p_bukrs.
IF sy-subrc EQ 0.
wa_line-info = v_butxt.
wa_line-typ = c_s.
wa_line-key = text-010. "Company Code Description
APPEND wa_line TO fp_it_alv_top_of_page.
CLEAR wa_line.
ENDIF.
ENDIF.
Printed Date
wa_line-typ = c_s.
wa_line-key = text-011. "Printed Date
CONCATENATE sy-datum+4(2)
sy-datum+6(2)
sy-datum(4) INTO wa_line-info SEPARATED BY c_slash. "todays date
APPEND wa_line TO fp_it_alv_top_of_page.
CLEAR: wa_line.
Printing Time
wa_line-typ = c_s.
wa_line-key = text-012. "Printing Time
wa_line-info = sy-uzeit.
CONCATENATE sy-uzeit(2)
sy-uzeit+2(2)
sy-uzeit+4(2) INTO wa_line-info SEPARATED BY c_colon. "current time
APPEND wa_line TO fp_it_alv_top_of_page.
CLEAR: wa_line.
ENDFORM. " COMMENT_BUILD
*& Form BUILD_FIELD_CATALOG
Fieldcatalogue
<--P_IT_FIELDCAT text
FORM build_field_catalog CHANGING fp_it_fieldcat TYPE slis_t_fieldcat_alv.
TAX JURISDICTION
wa_fieldcat-col_pos = c_pos_1.
wa_fieldcat-reptext_ddic = text-013. "TAX JURISDICTION
wa_fieldcat-fieldname = c_txjcd.
wa_fieldcat-tabname = c_table_name.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO fp_it_fieldcat.
CLEAR : wa_fieldcat.
STATE
wa_fieldcat-col_pos = c_pos_2.
wa_fieldcat-reptext_ddic = text-014. "STATE
wa_fieldcat-fieldname = c_region.
wa_fieldcat-tabname = c_table_name.
wa_fieldcat-outputlen = '40'.
APPEND wa_fieldcat TO fp_it_fieldcat.
CLEAR : wa_fieldcat.
CURRENT BALANCE
wa_fieldcat-col_pos = c_pos_3.
wa_fieldcat-reptext_ddic = text-015. "CURRENT BALANCE
wa_fieldcat-fieldname = c_currb.
wa_fieldcat-tabname = c_table_name.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-outputlen = '17'.
APPEND wa_fieldcat TO fp_it_fieldcat.
CLEAR : wa_fieldcat.
PERIOD CHANGE
wa_fieldcat-col_pos = c_pos_4.
wa_fieldcat-reptext_ddic = text-016. "PERIOD CHANGE
wa_fieldcat-fieldname = c_perch.
wa_fieldcat-tabname = c_table_name.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-outputlen = '17'.
APPEND wa_fieldcat TO fp_it_fieldcat.
CLEAR : wa_fieldcat.
PRIOR BALANCE
wa_fieldcat-col_pos = c_pos_5.
wa_fieldcat-reptext_ddic = text-017. "PRIOR BALANCE
wa_fieldcat-fieldname = c_prbal.
wa_fieldcat-tabname = c_table_name.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-outputlen = '17'.
APPEND wa_fieldcat TO fp_it_fieldcat.
CLEAR : wa_fieldcat.
ENDFORM. " BUILD_FIELD_CATALOG
*& Form DISPLAY_ALV
ALV Grid Display
-->P_IT_FINAL text
FORM display_alv USING fp_it_final TYPE ty_t_final.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = c_top_of_page
i_callback_html_top_of_page = c_top_of_page_split
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
i_save = 'A'
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = fp_it_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc EQ 0. "#EC *
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV
*& Form top_of_page_split
Top of page for displaying the Text in Center
FORM top_of_page_split USING fp_top TYPE REF TO cl_dd_document."#EC *
TYPES: BEGIN OF ty_text,
text TYPE sdydo_text_element,
END OF ty_text.
TYPES: BEGIN OF ty_text1, "AAAAAAAA
text1 TYPE sdydo_text_element,
END OF ty_text1.
DATA: v_tab TYPE sdydo_text_table,
v_area TYPE REF TO cl_dd_area,
v_text TYPE sdydo_text_element,
v_text1 TYPE sdydo_text_element, "#EC NEEDED
v_tab1 TYPE sdydo_text_table.
DATA: it_text TYPE TABLE OF ty_text,
wa_text TYPE ty_text,
it_text1 TYPE TABLE OF ty_text1,
wa_text1 TYPE ty_text1.
DATA: v_title TYPE string,
v_accts_desc TYPE string,
v_year TYPE string,
v_comp_code TYPE string,
v_desc TYPE char40,
v_budat TYPE char10,
v_budat1 TYPE char10,
v_butxt TYPE butxt,
v_time TYPE char10,
v_comma TYPE c VALUE ','.
CALL METHOD fp_top->initialize_document.
CHECK sy-subrc EQ 0.
CALL METHOD fp_top->vertical_split
EXPORTING
split_area = fp_top
split_width = '31%'
IMPORTING
right_area = v_area.
IF sy-subrc EQ 0. "#EC NEEDED
*MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*G/L Account Description
READ TABLE it_skat INTO wa_skat WITH KEY ktopl = v_ktopl BINARY SEARCH.
IF sy-subrc EQ 0.
v_desc = wa_skat-text.
ENDIF.
*Company code Description
IF NOT p_bukrs IS INITIAL.
SELECT SINGLE butxt FROM t001
INTO v_butxt WHERE bukrs EQ p_bukrs.
ENDIF.
CONCATENATE text-005 p_bukrs INTO v_title SEPARATED BY space.
wa_text1-text1 = v_title.
APPEND wa_text1 TO it_text1.
v_tab1 = it_text1.
CALL METHOD v_area->add_text
EXPORTING
text_table = v_tab1
fix_lines = 'X'
sap_fontsize = cl_dd_document=>large
sap_emphasis = cl_dd_document=>strong. "AAAAAA
CHECK sy-subrc EQ 0.
CONCATENATE text-006 p_racct v_comma text-007 v_desc INTO v_accts_desc SEPARATED BY space.
CONCATENATE s_budat-high4(2) s_budat-high6(2) s_budat-high+0(4) INTO v_budat SEPARATED BY c_slash.
CONCATENATE text-008 p_gjahr v_comma text-009 v_budat INTO v_year SEPARATED BY space.
CONCATENATE text-010 v_butxt INTO v_comp_code SEPARATED BY space.
wa_text-text = v_title.
APPEND wa_text TO it_text.
wa_text-text = v_accts_desc.
APPEND wa_text TO it_text.
wa_text-text = v_year.
APPEND wa_text TO it_text.
wa_text-text = v_comp_code.
APPEND wa_text TO it_text.
v_tab = it_text.
CALL METHOD v_area->add_text
EXPORTING
text_table = v_tab
fix_lines = 'X'
sap_fontsize = cl_dd_document=>medium
sap_emphasis = cl_dd_document=>medium.
CHECK sy-subrc EQ 0.
CALL METHOD fp_top->new_line.
CHECK sy-subrc EQ 0.
CALL METHOD fp_top->new_line.
CHECK sy-subrc EQ 0.
CALL METHOD fp_top->new_line.
CHECK sy-subrc EQ 0.
CALL METHOD fp_top->add_gap
EXPORTING
width = 0.
CHECK sy-subrc EQ 0.
CONCATENATE sy-datum4(2) sy-datum6(2) sy-datum+0(4) INTO v_budat1 SEPARATED BY c_slash.
CALL METHOD fp_top->add_text
EXPORTING
text = text-011
sap_emphasis = 'STRONG'.
CHECK sy-subrc EQ 0.
CALL METHOD fp_top->add_gap
EXPORTING
width = 1.
CHECK sy-subrc EQ 0.
v_text = v_budat1.
CALL METHOD fp_top->add_text
EXPORTING
text = v_text.
sap_style = 'KEY'.
CHECK sy-subrc EQ 0.
CALL METHOD fp_top->new_line.
CHECK sy-subrc EQ 0.
CALL METHOD fp_top->add_text
EXPORTING
text = text-012
sap_emphasis = 'STRONG'.
CHECK sy-subrc EQ 0.
CALL METHOD fp_top->add_gap
EXPORTING
width = 1.
CHECK sy-subrc EQ 0.
CONCATENATE sy-uzeit(2)
sy-uzeit+2(2)
sy-uzeit+4(2) INTO v_time SEPARATED BY c_colon. "current time
v_text = v_time.
CALL METHOD fp_top->add_text
EXPORTING
text = v_text.
sap_style = 'KEY'.
CHECK sy-subrc EQ 0.
ENDFORM. "top_of_page_split
Thanks in Advance.
Regards,
RamanaProblem is with ur selection screen definition for s_budat
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_bukrs TYPE faglflexa-rbukrs OBLIGATORY, " Company Code
p_gjahr TYPE faglflexa-gjahr OBLIGATORY. " Fiscal Year
SELECT-OPTIONS: s_budat FOR faglflexa-budat OBLIGATORY " Posting Date
NO-EXTENSION
NO INTERVALS.
PARAMETERS: p_racct TYPE faglflexa-racct OBLIGATORY. " G/L Accounts
SELECTION-SCREEN END OF BLOCK b1.
Here u r defining s_budat like parameter with NO-EXTENSION
NO INTERVALS. additions.
So that means it should contain only one record in it. As s_budat is nothing but a range table with headerline so this entry should be contained in the body as well as in the header.
But in AT SELECTION-SCREEN ON s_budat. u r again entering a 2nd record if date is not 01.
AT SELECTION-SCREEN ON s_budat.
DATA : v_year(4) TYPE c,
v_month(2) TYPE c,
v_date(2) TYPE c. "#EC NEEDED
*if date ne 01 converting date to '01'
READ TABLE s_budat.
IF s_budat-low+6(2) NE c_one. << Here u r checking the header not the body
v_year = s_budat-low.
v_month = s_budat-low+4(2).
v_date = s_budat-low+6(2).
s_budat-high = s_budat-low.
CLEAR s_budat-low.
CONCATENATE v_year c_one c_one INTO s_budat-low.
s_budat-sign = 'I'.
s_budat-option = 'BT'.
APPEND s_budat.
ENDIF.
Due to these 2 records it is giving u error. So to avoid the problem u should read the body of the table and then modify the record.
Read table s_budat index 1.
IF s_budat-low+6(2) NE c_one.* << Here u r checking the header not the body
v_year = s_budat-low.
v_month = s_budat-low+4(2).
v_date = s_budat-low+6(2).
s_budat-high = s_budat-low.
CLEAR s_budat-low.
CONCATENATE v_year c_one c_one INTO s_budat-low.
s_budat-sign = 'I'.
s_budat-option = 'BT'.
modify s_budat index sy-tabix.
Regards,
Joy. -
ALV Hierarchy display: How to get rid of the bullets ?
Hi All,
I am using Web dypro ALV to display my data, and I use ALV display type hierarchy. When I expand the parent node in my hierarchy column, I get bullets in my lower level rows in the hierarchy column( this is the standard hierarchical ALV display). Is it possible to override these bullets ? I want to have a link to action element instead of the bullets in that column(for the lower level rows). If this is not possible, then atleast I would like to have an empty column with no text instead of the bullets. Could any one of you please help me ?
Thanks and Best Regards,
Viqar Ali.Hi jagruti,
It is very simple to display a Hierarchical ALV. Just do the following:
lr_column = l_value->if_salv_wd_column_settings~get_column( 'COLUMN_NAME' ).
For hierarchical column display: Set column as hierarchy column
lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
Use display type hierarchical for the table.
l_value->if_salv_wd_table_settings~set_display_type( if_salv_wd_c_table_settings=>display_type_hierarchy ).
This is sufficient coding to display the ALV as a hierarchy.
However, my problem is that when I display the ALV as a hierarchy, I get bullets in the hierarchy column in my lower level rows on expanding the parent node. I wanted to know if it is possible to get rid of the bullets.
Thanks and Best Regards,
Viqar Ali. -
How to change the Grid ALV output resolution according to screen
Hi All,
I have a requirement in which I have to adjust the Grid ALV Output Screen resolution according to user screen. I mean if the user has any type of screen (17'' , 15'', 12.1'' ), the output should be completely fit to his screen.
Helpful solution will definitely be rewared.
Amit VarlaniHi!
I doesn't depends on the screen size only the desktop resolution.
If the desktop resolution is set to 1024*768 on every computer, then it will be the same all the time.
You can set the desktop resolution in your windows (right click on desktop - properties - settings).
Regards
Tamá -
How get window between selection screen and alv output
Hi Friends,
I am displaying ALV report now i want to display small window with one button and it should show list of fields before displaying alv output.
means i want a window showing list of fields of internal table coming from program.and when i will click on yes button it should show ALV output.
how can i achive this .
Pls. help
thanks in advance.Hi,
Try to use the following command:
<b><i>WINDOW STARTING AT <some-value> <some-value> ENDING AT <some-value> <some-value>.
</i></b>
notice that there is a space between <> <>.
This statement should be used inside the AT USER-COMMAND event.
i.e.,
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'XXX'.
<b> <i> WINDOW STARTING AT <> <> ENDING AT <> <>.</i></b>
..............statements....................
ENDCASE.
This should help you some what.
Bye -
ALV Grid display in the middle of window
Hi all,
When I m refering to the past queries in the forum I read that specifying these values
I_SCREEN_START_COLUMN
I_SCREEN_START_LINE
I_SCREEN_END_COLUMN
I_SCREEN_END_LINE in the FM reuse_alv_grid_display
we can display the output of alv in the middle of the window. But when I specify these values a new window is popped up in which the o/p of ALV is displayed. Actually what is the significance of thses values ? If I want to display in the middle of the window but not in a new window, so what should I do for this.
Regards,
Vijay.Hi Neil,
REPORT Z_ALV_CHANGEHEADER.
type-pools slis.
data : begin of itab occurs 0 ,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
end of itab.
select carrid connid fldate from sflight into corresponding fields
of table itab.
data : i_fieldcat type slis_t_fieldcat_alv.
data : wa_fieldcat type slis_fieldcat_alv.
wa_fieldcat-row_pos = 0.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'CARRID'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-SELTEXT_L = 'Carrier Id'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-row_pos = 0.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'CONNID'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-SELTEXT_L = 'Connection Id'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-row_pos = 0.
wa_fieldcat-col_pos = 3.
wa_fieldcat-fieldname = 'FLDATE'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-SELTEXT_L = 'Flight Date'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'Z_ALV_CHANGEHEADER'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 30
I_SCREEN_START_LINE = 10
I_SCREEN_END_COLUMN = 90
I_SCREEN_END_LINE = 70
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I have posted my code . Please check and tell me where I have gone wrong.
Regards,
Vijay. -
Total is not getting displayed in the ALV output.
Hi,
Total is not getting displayed in the ALV output.
I m using :REUSE_ALV_BLOCK_LIST_APPEND & REUSE_ALV_BLOCK_LIST_DISPLAY
Are there any issues with it as the same settings are working fine with REUSE_ALV_LIST_DISPLAY
source code:
DATA: layout TYPE slis_layout_alv,
IT_eventS TYPE slis_t_event,
fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
rec_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
TYPES: BEGIN OF ty_tab,
belnr TYPE dberchz-belnr,
belzart TYPE dberchz-belzart,
net TYPE dberchz-nettobtr,
END OF ty_tab.
DATA: lt_tab TYPE STANDARD TABLE OF ty_tab.
SELECT belnr belzart nettobtr
FROM dberchz
INTO TABLE lt_tab[]
WHERE belnr eq '000000000001'.
if sy-subrc ne 0.
ENDIF.
* defining layout
layout-colwidth_optimize = 'X'.
layout-def_status = 'X'.
*defning event
*event
*defining field catalog
fcat-col_pos = 1.
fcat-fieldname = 'BELNR'.
fcat-tabname = 'LT_TAB'.
APPEND fcat.
fcat-col_pos = 2.
fcat-fieldname = 'BELZART'.
fcat-tabname = 'LT_TAB'.
APPEND fcat.
fcat-col_pos = 3.
fcat-fieldname = 'NET'.
fcat-tabname = 'LT_TAB'.
fcat-do_sum = 'X'.
APPEND fcat.
*calling alv
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = 'YZ_PLR'
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IT_EXCLUDING =
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = layout
it_fieldcat = fcat[]
i_tabname = 'LT_TAB'
it_events = IT_EVENTS[]
* IT_SORT =
* I_TEXT = ' '
tables
t_outtab = lt_tab[]
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
Thanks,
GauravHi
No I don't think, this is my code (based on your code) and it works fine:
TYPE-POOLS SLIS.
DATA: BEGIN OF LT_TAB OCCURS 0,
BELNR LIKE BSEG-BELNR,
GJAHR LIKE BSEG-GJAHR,
WRBTR LIKE BSEG-WRBTR,
WAERS LIKE BKPF-WAERS,
END OF LT_TAB.
DATA: LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_EVENTS TYPE SLIS_T_EVENT,
FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
REC_FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
START-OF-SELECTION.
FCAT-COL_POS = 1.
FCAT-FIELDNAME = 'BELNR'.
FCAT-TABNAME = 'LT_TAB'.
FCAT-REF_FIELDNAME = 'BELNR'.
FCAT-REF_TABNAME = 'BSEG'.
APPEND FCAT.
FCAT-COL_POS = 2.
FCAT-FIELDNAME = 'GJAHR'.
FCAT-TABNAME = 'LT_TAB'.
FCAT-REF_FIELDNAME = 'GJAHR'.
FCAT-REF_TABNAME = 'BSEG'.
APPEND FCAT.
FCAT-COL_POS = 3.
FCAT-FIELDNAME = 'WRBTR'.
FCAT-TABNAME = 'LT_TAB'.
FCAT-CFIELDNAME = 'WAERS'.
FCAT-REF_FIELDNAME = 'WRBTR'.
FCAT-REF_TABNAME = 'BSEG'.
FCAT-DO_SUM = 'X'.
APPEND FCAT.
FCAT-COL_POS = 4.
FCAT-FIELDNAME = 'WAERS'.
FCAT-TABNAME = 'LT_TAB'.
FCAT-REF_FIELDNAME = 'WAERS'.
FCAT-REF_TABNAME = 'BKPF'.
FCAT-DO_SUM = SPACE.
APPEND FCAT.
SELECT * FROM BSEG INTO CORRESPONDING FIELDS OF TABLE LT_TAB
WHERE BUKRS = 'MAAB'
AND BELNR = '0000000001'.
LT_TAB-WAERS = 'EUR'.
MODIFY LT_TAB FROM LT_TAB TRANSPORTING WAERS WHERE WAERS = SPACE.
*CALLING ALV
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = 'ZPROVAMAX5'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FCAT[]
I_TABNAME = 'LT_TAB'
IT_EVENTS = IT_EVENTS[]
TABLES
T_OUTTAB = LT_TAB[].
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
I've also inserted a currency field
Max -
Newly added field not getting displayed in ALV output
Hi All,
I'm adding one more field/column to be displayed in an old existing program that uses REUSE_ALV_FIELDCATALOG_MERGE to generate the ALV fieldcat.
DATA: BEGIN OF it_salary OCCURS 0,
pernr LIKE pa0000-pernr,
ename LIKE pa0001-ename,
rtext like lv_rtext, -
added field
waers LIKE pa0008-waers
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = driver
i_internal_tabname = 'IT_SALARY'
i_client_never_display = 'X'
i_inclname = driver
CHANGING
ct_fieldcat = lv_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = driver
it_fieldcat = lv_fieldcat[]
i_default = 'X'
i_save = 'A'
is_variant = lv_tmplt
is_layout = lv_ls_layout
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = it_salary
EXCEPTIONS
program_error = 1
OTHERS = 2.
The newly added field is not getting populated in the lv_fieldcat table. Tried running programs BALVBUFDEL,
BCALV_BUFFER_DEL_SHARED then logging off and logging in but of no help.
Please provide suggestion for this issue.
Regards,
Sridevi SHi,
Fieldcat is buffered - so use
I_BYPASSING_BUFFER = 'X'
Since a while CL_GUI_ALV_GRID is available which does NOT need any fieldcat (is determined internally using RTTI). It is worth playing around whith this class if you have some time. This class is recommended for ALV Output by SAP (but no edit is possible - was never supported officially).
A simple use would be:
data: gt_output type standard table of (adjust!).
*simple ALV output
data go_alv type ref to cl_salv_table.
data go_functions type ref to cl_salv_functions_list.
data go_columns type ref to cl_salv_columns_table.
data go_column type ref to cl_salv_column_table.
*Exceprion handlig
data: go_exception type ref to cx_root,
gv_errortext type string.
** fill table gt_output ...
** ALV output
if not gt_output is initial.
try.
call method cl_salv_table=>factory
importing
r_salv_table = go_alv
changing
t_table = gt_output.
catch cx_salv_msg into go_exception.
gv_errortext = go_exception->get_text( ).
message gv_errortext type 'A'.
endtry.
* enable all standard ALV functions
go_functions = go_alv->get_functions( ).
go_functions->set_all( ).
* hide MANDT
go_columns = go_alv->get_columns( ).
go_column ?= go_columns->get_column( columnname = 'MANDT' ).
go_column->set_technical( ).
go_alv->display( ).
Kind regards,
Holger -
Hi,
I need to create a column that will have an icon ICON_DOCUMENT displayed in the column. Now, when i clik on this icon it should check for the existance of any links existing for a material , if so, then display those links . Basically this icon should dispaly the link to material drawings . How do i include the icon in the output column in ALV?
Thanks,
Sindhu.hi,
Sample code is ::
report zalvexer2 message-id zz .
*& TABLES DECLARATION *
tables: vbak.
*& TYPE POOLS DECLARATION *
type-pools: slis.
*& INTERNAL TABLE DECLARATION *
data: begin of itab occurs 0,
icon type icon-id,
vbeln like vbak-vbeln,
audat like vbak-audat,
vbtyp like vbak-vbtyp,
auart like vbak-auart,
augru like vbak-augru,
netwr like vbak-netwr,
waerk like vbak-waerk,
end of itab.
*INTERNAL TABLE FOR FIELD CATALOG
data: wa_fieldcat type slis_fieldcat_alv,
it_fieldcat type slis_t_fieldcat_alv.
IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
WITH HEADER LINE,
*INTERNAL TABLE FOR EVENTS
data: it_event type slis_t_event,
wa_event type slis_alv_event,
*INTERNAL TABLE FOR SORTING
it_sort type slis_t_sortinfo_alv,
wa_sort type slis_sortinfo_alv,
*INTERNAL TABLE FOR LAYOUT
wa_layout type slis_layout_alv.
*& VARIABLE DECLARATION *
data : v_repid type sy-repid,
v_pagno(4) type n,
v_date(8) type c.
*& CONSTANTS *
constants: c_x type c value 'X'.
*& SELECTION SCREEN *
selection-screen: begin of block b1 with frame title text-001.
select-options: s_vbeln for vbak-vbeln,
s_vbtyp for vbak-vbtyp default 'C'.
selection-screen: end of block b1.
selection-screen: begin of block b2 with frame title text-002.
selection-screen : begin of line.
selection-screen comment 1(20) text-003.
parameters: p_list radiobutton group rad1 default 'X'.
selection-screen : end of line.
selection-screen : begin of line.
selection-screen comment 1(20) text-004.
parameters: p_grid radiobutton group rad1.
selection-screen : end of line.
selection-screen: end of block b2.
at selection-screen.
perform validate_screen.
*& START OF SELECTION *
start-of-selection.
clear: itab, itab[].
V_REPID = SY-REPID.
perform get_data.
perform display_data.
*& END OF SELECTION *
end-of-selection.
*--DO ALV Process
v_repid = sy-repid.
*--Sort the Output Fields
perform sort_fields.
*--Build Field catalog for the Output fields
PERFORM BUILD_FIELDCAT.
*--Set the Layout for ALV
perform set_layout.
*& Form GET_DATA
text
TO GET THE DATA FROM TABLES INTO ITAB
form get_data .
select vbeln
audat
vbtyp
auart
augru
netwr
waerk
into corresponding fields of table itab
from vbak
where vbeln in s_vbeln and
audat > '04.04.2005'
and netwr > 0.
<b>loop at itab.
if itab-netwr < 10000.
itab-icon = '@08@'.
elseif itab-netwr > 10000 and itab-netwr < 100000.
itab-icon = '@09@'.
elseif itab-netwr > 100000.
itab-icon = '@0A@'.
endif.
modify itab index sy-tabix.
endloop.</b>
endform. " GET_DATA
*& Form sort_fields
form sort_fields .
clear wa_sort.
wa_sort-fieldname = 'VBTYP'.
wa_sort-spos = '1'.
wa_sort-up = 'X'.
append wa_sort to it_sort.
clear wa_sort.
wa_sort-fieldname = 'NETWR'.
wa_sort-spos = '2'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
append wa_sort to it_sort.
endform. " sort_fields
*& Form set_layout
form set_layout .
if p_list = c_x .
wa_layout-window_titlebar = 'LIST DISPLAY'(016).
wa_layout-zebra = 'X'.
*-- ALV LIST DISPLAY
perform list_display tables itab.
*-- ALV GRID DISPLAY
elseif p_grid = c_x.
wa_layout-window_titlebar = 'GRID DISPLAY'(017).
wa_layout-zebra = 'X'.
perform grid_display tables itab.
endif.
endform. " set_layout
*& Form list_display
form list_display tables p_itab .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = v_repid
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_sort = it_sort[]
i_save = 'U'
tables
t_outtab = itab
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " list_display
*& Form GRID_DISPLAY
form grid_display tables p_itab .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_repid
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_sort = it_sort[]
it_events = it_event
tables
t_outtab = itab
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " GRID_DISPLAY
*& Form VALIDATE_SCREEN
text
--> p1 text
<-- p2 text
form validate_screen .
data: lv_vbeln like vbak-vbeln.
if not s_vbeln is initial.
select vbeln
into lv_vbeln
up to 1 rows
from vbak
where vbeln in s_vbeln.
endselect.
if sy-subrc <> 0.
message e000 with 'INVALID SALES DOC'.
endif.
endif.
endform. " VALIDATE_SCREEN
*& Form display_data
text
--> p1 text
<-- p2 text
form display_data .
define m_fieldcat.
add 1 to wa_fieldcat-col_pos.
wa_fieldcat-fieldname = &1.
wa_fieldcat-ref_tabname = 'VBAK'.
wa_fieldcat-do_sum = &2.
wa_fieldcat-cfieldname = &3.
append wa_fieldcat to it_fieldcat.
end-of-definition.
data:
ls_fieldcat type slis_fieldcat_alv,
lt_fieldcat type slis_t_fieldcat_alv.
m_fieldcat 'ICON' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'AUDAT' '' ''.
m_fieldcat 'VBTYP' '' ''.
m_fieldcat 'AUART' '' ''.
m_fieldcat 'AUGRU' '' ''.
m_fieldcat 'NETWR' 'C' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
endform. " display_data[/code]
Message was edited by: Ashok Parupalli
Message was edited by: Ashok Parupalli -
ALV list display in a Background job - Spool output
Hi,
We are currently working on a report scheduled to be run in the background job, and the ALV list is displayed in the spool output.
ALV list in the spool does not look the same as front run job, the column headers are all crowded together, and there is no grid in-between different columns or rows. It's hard to read.
Is there a way to add grid for this kind of output?
Thanks!Hi Deepak:
I expanded your report into two rows display, and the grid in the spool display simply gone!
report zzscratch line-size 120 no standard page heading.
type-pools slis.
tables pa0001.
data : li_field type standard table of slis_fieldcat_alv,
gi_events type standard table of slis_alv_event,
gr_layout_bck type slis_layout_alv,
gr_save like disvariant,
gr_events type slis_alv_event.
types : begin of gtt_emp,
pernr type persno,
ename like pa0001-ename,
uname like pa0001-UNAME,
end of gtt_emp.
data : lr_field type slis_fieldcat_alv.
data : lc_rep like syst-repid.
data : li_emp type standard table of gtt_emp,
lr_emp type gtt_emp.
data : gv_ref_table type lvc_rtname.
gv_ref_table = 'CATSDB'.
lr_field-fieldname = 'PERNR'.
lr_field-ref_tabname = gv_ref_table.
lr_field-inttype = 'N'.
lr_field-outputlen = 8.
lr_field-seltext_l = 'EMPLOYEE Number'.
append lr_field to li_field.
lr_field-fieldname = 'ENAME'.
lr_field-ref_tabname = 'PA0001'.
lr_field-inttype = 'C'.
lr_field-outputlen = 40.
lr_field-seltext_l = 'EMPLOYEE Name'.
append lr_field to li_field.
lr_field-fieldname = 'UNAME'.
lr_field-ref_tabname = 'PA0001'.
lr_field-inttype = 'C'.
lr_field-outputlen = 12.
lr_field-seltext_l = 'User Name'.
lr_field-row_pos = 2.
lr_field-col_pos = 1.
append lr_field to li_field.
lc_rep = sy-repid.
gr_layout_bck-edit_mode = 'D'.
gr_save-report = sy-repid.
lr_emp-pernr = '00000001'.
lr_emp-ename = 'abc'.
lr_emp-uname = 'testus'.
append lr_emp to li_emp.
lr_emp-pernr = '00000002'.
lr_emp-ename = 'def'.
append lr_emp to li_emp.
lr_emp-pernr = '00000003'.
append lr_emp to li_emp.
lr_emp-pernr = '00000004'.
append lr_emp to li_emp.
lr_emp-pernr = '00000005'.
append lr_emp to li_emp.
lr_emp-pernr = '00000006'.
append lr_emp to li_emp.
lr_emp-pernr = '00000007'.
append lr_emp to li_emp.
lr_emp-pernr = '00000008'.
append lr_emp to li_emp.
end-of-selection.
Function module for ALV grid display
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = lc_rep
is_layout = gr_layout_bck
it_fieldcat = li_field
i_save = 'A'
is_variant = gr_save
it_events = gi_events
TABLES
t_outtab = li_emp[]
EXCEPTIONS
program_error = 1
others = 2.
if sy-subrc <> 0.
clear gr_messages.
message e023 into gr_messages.
append gr_messages to gi_messages.
endif.
Maybe you are looking for
-
HT1338 my new mac book air can't mirror but my ipad can
my new mac book air can't mirror with apple tv but my ipad can. How do I fix this?
-
For some reason I need to double tap everything to access apps, menu etc. Also, I cannot scroll down past what is appearing on the screen. Any suggestions for help? Please.
-
I can't debug the xml_xslt_content EJB sample in the examplesWebApp !! start the Example Server http://localhost:7001/console among the deployed EJB ,the xml_xslt_content EJB how to run Is the related jsp page in \bea\wlserver6.0\samples\examples\xml
-
Fingerprint Required EVERY TIME you unlock iPhone 5S
So this isn't so much a question as a comment on a discovery. If you have the the fingerprint enabled to unlock the iPhone 5S, it automatically disables the options to require the passcode (or fingerprint), after 1, 5, 15 minutes, etc. If you would l
-
FWproblems MuVo2 5gb (not
Hi. I got a MuVo2 .5 Gb mp3 player at christmas. It broke so i sent it in. They sent back a 5 gb MuVo2, witch was realy nice. Now is the problem that it shows firmware error when i turn it on, and no firmware is to be found. Can creative please add M