Displaying dynamic No. of blocks in alv
hi experts,
i have a blocked alv list and the blocks are displayed with respect to the department...i want to display the block alv but i dont know the number of departments so the number of blocks would be dynamic that i will get from the internal table..
i tried to use append block in loop with respect to the department but could not display it..can any one guide me..
with thanks in advance,
syed
thanks again,
My problem is not displaying the Block ALV but to Display it dynamically.. that is i will not know how many blocks i will need until runtime..so i cannot predefine my no of blocks as in the Code you provide..
for example...if i have 4 departments i need to have four blocks for 4 departments and if 5 means 5 departments
below is my code.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = SY-REPID
i_callback_user_command = 'USER_COMMAND'.
LOOP AT IPUT INTO WPUT.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE WPUT TO <OUTTAB>.
APPEND <OUTTAB> TO OUTTABLE.
ON CHANGE OF WPUT-DEPARTMENT."i need to find the no. of blocks with respect to the number of department
PERFORM APPEND_BLOCK."when there is a change in department a block has to be added..
REFRESH OUTTABLE.CLEAR OUTTABLE."here the value is getting refreshed as it should but if i call reuse alv block list alv before refreshing the the first block appeara then when i click back the 2nd block apperas twice. and 3rd and 4th as such..
ENDON.
CLEAR WPUT.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
EXCEPTIONS
program_error = 1
OTHERS = 2.
"perform append _block
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
it_fieldcat = gt_fieldcatcH[]
is_layout = t_layout
i_tabname = 'OUTTABLE'
it_events = t_event
TABLES
t_outtab = OUTTABLE
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
thanks in advance,
syed
Similar Messages
-
Displaying dynamic table in OOPS ALV
Hi,
I am creating a dynamic internal table which consists of some fields which are being filled dynamically and some fields which are being filled from a static internal table. I am facing two issues in the development:-
1. The static fields are being populated into the dynamic work area successfully but I am not able to modify the dynamic in ternal table using the work area.
PFB my code:
READ TABLE I_LEVEL1 WITH KEY KSCHL = WA_T681-KSCHL
KOTABNR = WA_T681-KOTABNR.
IF SY-SUBRC EQ 0.
<WA_DYN_TABLE1>-UDATE = I_LEVEL1-UDATE.
<WA_DYN_TABLE1>-UTIME = I_LEVEL1-UTIME.
MOVE-CORRESPONDING <WA_DYN_TABLE1> TO <WA_DYN_TABLE>.
MODIFY <I_DYN_TABLE> FROM <WA_DYN_TABLE> TRANSPORTING UDATE
UTIME.
The dynamic filds of <I_DYN_TABLE> are being populated successfully but the MODIFY statement gives an error.
The specified type has no structure and therefore no component called UDATE.
2. The other problem I am facing is that while displaying output for the same ALV, no column names are being displayed.
I am using OOPS ALV.
PFB my code for the same:
CL_SALV_TABLE=>FACTORY( IMPORTING R_SALV_TABLE = O_TABLE
CHANGING T_TABLE = <I_DYN_TABLE> ).
O_FUNCTIONS = O_TABLE->GET_FUNCTIONS( ).
O_FUNCTIONS->SET_ALL( ABAP_TRUE ).
O_COLUMNS = O_TABLE->GET_COLUMNS( ).
O_COLUMNS->SET_OPTIMIZE( 'X' ).
Please help me regarding the issues.
Thanks.
Edited by: Suhas Saha on Jan 18, 2012 3:11 PMHi Suhas,
Thank you for the reply. The modify problem has been solved.
Regarding the heading issue:
Here is the code for populating the table:-
LOOP AT I_TY_FIELD INTO WA_TY_FIELD.
WA_DYN_IT-FIELDNAME = WA_TY_FIELD-FIELDNAME.
WA_DYN_IT-TABNAME = WA_TY_FIELD-TABNAME.
WA_DYN_IT-DATATYPE = WA_TY_FIELD-DATATYPE.
WA_DYN_IT-INTTYPE = WA_TY_FIELD-INTTYPE.
WA_DYN_IT-INTLEN = WA_TY_FIELD-INTLEN.
WA_DYN_IT-SCRTEXT_M = WA_TY_FIELD-FIELDDESC.
APPEND WA_DYN_IT TO I_DYN_IT.
CLEAR: WA_DYN_IT.
ENDLOOP.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = I_DYN_IT
IMPORTING
EP_TABLE = I_DY_TABLE.
ASSIGN I_DY_TABLE->* TO <I_DYN_TABLE>.
ASSIGN <I_DYN_TABLE> TO <FS_2>.
Create dynamic work area and assign to FS
CREATE DATA I_DY_LINE LIKE LINE OF <I_DYN_TABLE>.
ASSIGN I_DY_LINE->* TO <WA_DYN_TABLE>.
I_TY_FIELD contains all static and dynamic fields.
Is there any field of I_DYN_IT i need to fill I have missed which fills up the column header data? -
Total Text Display at the end of the ALV
Hi,
I want to display the text 'TOTAL' in my ALV at the end of my report.I am pasting my code, So please any one help me in this issue.
*& Report ZFIR0011_O2C_TAX_GL_SUMMARY
REPORT zfir0011_o2c_tax_gl_summary.
TYPE-POOLS slis.
TABLES: faglflexa.
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',
c_s TYPE c VALUE 'S',
c_slash TYPE c VALUE '/',
c_colon TYPE c VALUE ':',
c_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
c_top_of_page_split TYPE slis_formname VALUE 'TOP_OF_PAGE_SPLIT',
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
c_total TYPE slis_fieldname VALUE 'TOTAL'. "Total
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',
c_zp TYPE bset-mwskz VALUE 'ZP',
c_zr TYPE bset-mwskz VALUE 'ZR'.
Types Declaration.
TYPES: BEGIN OF ty_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 ty_faglflexa,
ty_t_faglflexa TYPE STANDARD TABLE OF ty_faglflexa.
TYPES: BEGIN OF ty_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 ty_bset,
ty_t_bset TYPE STANDARD TABLE OF ty_bset.
TYPES: BEGIN OF ty_skat,
spras TYPE spras,
ktopl TYPE ktopl,
saknr TYPE saknr,
text TYPE txt20_skat,
END OF ty_skat,
ty_t_skat TYPE STANDARD TABLE OF ty_skat.
TYPES: BEGIN OF ty_custom,
geo_state TYPE char2,
geo_county TYPE char3,
country TYPE char2,
description TYPE char40,
END OF ty_custom,
ty_t_custom TYPE STANDARD TABLE OF ty_custom.
TYPES : BEGIN OF ty_budat,
sign TYPE char_01,
option TYPE char2,
low TYPE budat,
high TYPE budat,
END OF ty_budat,
ty_t_budat TYPE STANDARD TABLE OF ty_budat.
TYPES: BEGIN OF ty_txjcd,
geo_state TYPE char2,
geo_county TYPE char3,
END OF ty_txjcd,
ty_t_txjcd TYPE STANDARD TABLE OF ty_txjcd.
TYPES: BEGIN OF ty_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 ty_inter,
ty_t_inter TYPE STANDARD TABLE OF ty_inter.
TYPES: BEGIN OF ty_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 ty_final,
ty_t_final TYPE STANDARD TABLE OF ty_final.
Internal Tables Declaration.
DATA : it_faglflexa TYPE ty_t_faglflexa,
it_bset TYPE ty_t_bset,
it_skat TYPE ty_t_skat,
it_custom TYPE ty_t_custom,
it_txjcd TYPE ty_t_txjcd,
it_inter TYPE ty_t_inter. "Intermediate table for storing data
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,
gs_line TYPE slis_listheader.
*Field-symbols and Work Area Declarations
FIELD-SYMBOLS : <fs_faglflexa> TYPE ty_faglflexa,
<fs_bset> TYPE ty_bset,
<fs_inter> TYPE ty_inter.
DATA : wa_faglflexa TYPE ty_faglflexa, "#EC NEEDED
wa_bset TYPE ty_bset,
wa_skat TYPE ty_skat,
wa_custom TYPE ty_custom,
wa_txjcd TYPE ty_txjcd,
wa_inter TYPE ty_inter,
wa_final TYPE ty_final. " #EC NEEDED
Variables Declaration.
DATA : v_current_year TYPE i,
v_poper TYPE poper,
v_saknr TYPE saknr, "#EC NEEDED
v_ktopl TYPE ktopl,
v_konts TYPE saknr,
v_bukrs TYPE bukrs,
v_buzei(2) TYPE n VALUE '0',
v_sum_val TYPE h2ste,
v_sum_val1 TYPE h2ste,
v_sum_val2 TYPE h2ste,
v_h2ste TYPE string,
v_desc TYPE char40,
v_title TYPE char40,
v_start_date TYPE char10. "Temp Added
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
NO-EXTENSION
NO INTERVALS.
PARAMETERS: p_racct TYPE faglflexa-racct OBLIGATORY.
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 text-002 TYPE 'E'.
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 text-003 TYPE 'E'.
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.
SELECT SINGLE ktopl FROM t001
INTO v_ktopl
WHERE bukrs = p_bukrs.
SELECT SINGLE konts FROM t030k
INTO v_konts
WHERE ktopl = v_ktopl
AND konts = v_saknr.
IF sy-subrc NE 0.
MESSAGE text-004 TYPE 'E'.
ENDIF.
ELSE.
MESSAGE text-004 TYPE 'E'.
ENDIF.
START-OF-SELECTION.
PERFORM get_data USING p_bukrs
p_gjahr
s_budat[]
p_racct CHANGING it_final.
*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 text-018 TYPE 'I'.
ENDIF.
*& Form GET_DATA
text
-->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
fp_gjahr TYPE gjahr
fp_budat TYPE ty_t_budat
fp_racct TYPE racct
CHANGING fp_it_final TYPE ty_t_final.
DATA : v_date(2) TYPE c VALUE '01',
v_month(2) TYPE c VALUE '01',
v_start_date TYPE datum.
*concatenate p_gjahr v_month v_date into v_start_date. " separated by c_slash.
SELECT ryear
rbukrs
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
AND gjahr EQ p_gjahr
AND budat LE s_budat
AND racct EQ p_racct.
*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.
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.
*Selecting the Description from Custom table
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 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.
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.
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.
ENDIF.
v_poper = s_budat-low+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_bset-txjcd+0(2)
geo_county = wa_bset-txjcd+2(3).
IF sy-subrc NE 0.
READ TABLE it_custom INTO wa_custom WITH KEY geo_state = wa_bset-txjcd+0(2).
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 wa_inter-poper EQ v_poper.
v_sum_val1 = v_sum_val1 + wa_inter-h2ste.
ENDIF.
Prior Balance
IF wa_inter-poper LT v_poper.
v_sum_val2 = v_sum_val2 + wa_inter-h2ste.
ENDIF.
AT END OF txjcd.
wa_final-txjcd = wa_inter-txjcd.
wa_final-per_chng = v_sum_val1. "Period change
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.
CLEAR wa_final.
ENDAT.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form COMMENT_BUILD
text
-->P_IT_SKAT text
<--P_IT_ALV_TOP_OF_PAGE text
FORM comment_build USING fp_it_skat TYPE ty_t_skat
CHANGING fp_it_alv_top_of_page TYPE slis_t_listheader.
DATA: v_budat_low TYPE c LENGTH 10,
v_budat_high TYPE c LENGTH 10,
v_butxt TYPE butxt.
CLEAR gs_line.
*Report Title
CONCATENATE text-005 p_bukrs INTO v_title SEPARATED BY space.
gs_line-typ = c_h.
gs_line-key = ' '.
gs_line-info = v_title.
APPEND gs_line TO fp_it_alv_top_of_page.
CLEAR gs_line.
*Account Number
gs_line-typ = c_s.
gs_line-key = text-006.
gs_line-info = p_racct.
APPEND gs_line TO fp_it_alv_top_of_page.
CLEAR gs_line.
*G/L Account Description
READ TABLE it_skat INTO wa_skat WITH KEY ktopl = v_ktopl.
IF sy-subrc EQ 0.
v_desc = wa_skat-text.
ENDIF.
gs_line-typ = c_s.
gs_line-key = text-007.
gs_line-info = v_desc.
APPEND gs_line TO fp_it_alv_top_of_page.
CLEAR gs_line.
*Fiscal Year from selection
IF NOT p_gjahr IS INITIAL.
gs_line-info = p_gjahr.
gs_line-typ = c_s.
gs_line-key = text-008. "Fiscal Year
APPEND gs_line TO fp_it_alv_top_of_page.
CLEAR gs_line.
ENDIF.
*Posting Date
CONCATENATE s_budat-low4(2) s_budat-low6(2) s_budat-low+0(4) INTO gs_line-info SEPARATED BY c_slash.
gs_line-typ = c_s.
gs_line-key = text-009. "Posting Date
APPEND gs_line TO fp_it_alv_top_of_page.
CLEAR gs_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.
gs_line-info = v_butxt.
gs_line-typ = c_s.
gs_line-key = text-010. "Company Code Description
APPEND gs_line TO fp_it_alv_top_of_page.
CLEAR gs_line.
ENDIF.
Printed Date
gs_line-typ = c_s.
gs_line-key = text-011. "Printed Date
CONCATENATE sy-datum+4(2)
sy-datum+6(2)
sy-datum(4) INTO gs_line-info SEPARATED BY c_slash. "todays date
APPEND gs_line TO fp_it_alv_top_of_page.
CLEAR: gs_line.
Printing Time
gs_line-typ = c_s.
gs_line-key = text-012. "Printing Time
gs_line-info = sy-uzeit.
CONCATENATE sy-uzeit(2)
sy-uzeit+2(2)
sy-uzeit+4(2) INTO gs_line-info SEPARATED BY c_colon. "current time
APPEND gs_line TO fp_it_alv_top_of_page.
CLEAR: gs_line.
ENDFORM. " COMMENT_BUILD
*& Form BUILD_FIELD_CATALOG
text
<--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
text
-->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 <> 0.
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
Top of the page for ALV
FORM top_of_page. "#EC CALLED
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_alv_top_of_page
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "top_of_page
*& Form top_of_page_split
text
FORM top_of_page_split USING r_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: s_tab TYPE sdydo_text_table,
c_area TYPE REF TO cl_dd_area,
text TYPE sdydo_text_element,
c_area1 TYPE REF TO cl_dd_area, "AAAAAAA
text1 TYPE sdydo_text_element,
s_tab1 TYPE sdydo_text_table.
DATA: it_text TYPE TABLE OF ty_text,
wa_text TYPE ty_text.
DATA: 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 r_top->initialize_document.
CALL METHOD r_top->vertical_split
EXPORTING
split_area = r_top
split_width = '31%'
IMPORTING
right_area = c_area.
IF sy-subrc EQ 0.
*MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*G/L Account Description
READ TABLE it_skat INTO wa_skat WITH KEY ktopl = v_ktopl.
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.
s_tab1 = it_text1.
CALL METHOD c_area->add_text
EXPORTING
text_table = s_tab1
fix_lines = 'X'
sap_fontsize = cl_dd_document=>large
sap_emphasis = cl_dd_document=>strong. "AAAAAA
CONCATENATE text-006 p_racct v_comma text-007 v_desc INTO v_accts_desc SEPARATED BY space.
CONCATENATE s_budat-low4(2) s_budat-low6(2) s_budat-low+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.
s_tab = it_text.
CALL METHOD c_area->add_text
EXPORTING
text_table = s_tab
fix_lines = 'X'
sap_fontsize = cl_dd_document=>medium
sap_emphasis = cl_dd_document=>medium.
CALL METHOD r_top->new_line.
CALL METHOD r_top->new_line.
CALL METHOD r_top->new_line.
CALL METHOD r_top->add_gap
EXPORTING
width = 0.
CONCATENATE sy-datum4(2) sy-datum6(2) sy-datum+0(4) INTO v_budat1 SEPARATED BY c_slash.
CALL METHOD r_top->add_text
EXPORTING
text = text-011
sap_emphasis = 'STRONG'.
CALL METHOD r_top->add_gap
EXPORTING
width = 1.
text = v_budat1.
CALL METHOD r_top->add_text
EXPORTING
text = text.
sap_style = 'KEY'.
CALL METHOD r_top->new_line.
CALL METHOD r_top->add_text
EXPORTING
text = text-012
sap_emphasis = 'STRONG'.
CALL METHOD r_top->add_gap
EXPORTING
width = 1.
CONCATENATE sy-uzeit(2)
sy-uzeit+2(2)
sy-uzeit+4(2) INTO v_time SEPARATED BY c_colon. "current time
text = v_time.
CALL METHOD r_top->add_text
EXPORTING
text = text.
sap_style = 'KEY'.
ENDFORM. "top_of_page_split
Thanks & Regards,
RamanaHi,
try to declare alv layout and in that
FORM t_layout USING i_layout TYPE slis_layout_alv.
i_layout-colwidth_optimize = 'X'.
i_layout-zebra = 'X'.
p_i_layout-totals_text = 'GRAND TOTAL ='.
p_i_layout-subtotals_text = 'Sub Total'.
p_i_layout-DEF_STATUS = ' '.
p_i_layout-info_fieldname = 'LINE_COLOR'.
ENDFORM. " T_LAYOUT
hope this helps you.
Thanks & Regards,
Y.R.Prem Kumar -
HI,
I have a Requirement where i have a Block list ALV . I have 4 blocks to be Displayed in the output and the output has to be transfered to the PDF.
I am able to get the 4 blocks in the output and the Top of Page for the Report in each page.
But the Problem is when i download the output containing the top of page of output with 4 blocks into a PDF.
I want the Top of page of Report to be the Top of Page of the PDf also.
In PDF the Top of page of Report is coming in the center of the PDF also in some other places also.
How to make sure the Top of page of Report comes in the top of the PDf
Can you kinldy help me in this.
Thanks,
GokulDuplicate post.
Reported. -
Display more than 1023 Columns in alv
can we display more than 1023 columns in alv. please provide inputs on any approach that can be followed to achieve this.
Thanks.Hi,
just for the record. Here's the code to create a table with 10000 columns, in this example all of type vendor. It could be modified a little to create any dynamic table. Without any visible limits and can be displayed in SALV.
DATA:
lv_lifnr TYPE lifnr,
lv_numc7 TYPE numc7,
lt_components TYPE cl_abap_structdescr=>component_table,
lo_struc_descr TYPE REF TO cl_abap_structdescr,
lo_tdescr TYPE REF TO cl_abap_tabledescr,
lr_tab TYPE REF TO data.
FIELD-SYMBOLS:
<component> TYPE LINE OF abap_component_tab,
<range_tab> TYPE STANDARD TABLE,
<tab> TYPE table.
* build dynamic table
DO 10000 TIMES.
APPEND INITIAL LINE TO lt_components ASSIGNING <component>.
<component>-type ?= cl_abap_datadescr=>describe_by_data( lv_lifnr ).
lv_numc7 = sy-index.
CONCATENATE 'FIELD' lv_numc7 INTO <component>-name.
ENDDO.
lo_struc_descr ?= cl_abap_structdescr=>create( lt_components ).
lo_tdescr = cl_abap_tabledescr=>create( lo_struc_descr ).
CREATE DATA lr_tab TYPE HANDLE lo_tdescr.
ASSIGN lr_tab->* TO <tab>.
APPEND INITIAL LINE TO <tab>.
I discovered that it takes some time (15 seconds or more) to create, even F1 and F4 in the SALV table use considerable time to pop up, I think (SAP never imagined
But it works - and the code is so simple!
Kind regards,
Clemens -
Displaying Dynamic Time in Oracle forms6i
Hi all,
i want to display dynamic time in Oracle forms (forms 6i). this should be displayed in text item only..
i want it to run time continuously. What can i do for this.
Please help me guys
Regards
Balrajtry this as im doing to my forms 6i
/* *Trigger : _WHen-neW-Form-instaNcE* */
declare
mtimer_id timer;
begin
/*THis if you want to appear on your Window. */
SET_WINDOW_PROPERTY('WINDOW1', TITLE, 'Hospital Management Information System',TO_CHAR(SYSDATE, 'DD/MM/YYYY HH24:MI:SS')) ;
/* Create a TiMeR */
HD_TIMER := CREATE_TIMER('mtimer_id', 1000, _REPEAT) ;*
/* for the item you need to add item in a block */
*:control_blk.item_hrs := to_char(sysdate,'HH12:MI:SS am');*
/* Trigger: When-Timer-exPiRed */
declare
mexpired_timer varchar(20) := getapplication_property(timer_name); <<< this if you have more than 1 timer to check what timer is expired
begin
if mexpired_timer = 'mtimer_id' then
SET_WINDOW_PROPERTY('WINDOW1', TITLE, 'Hospital Management Information System',TO_CHAR(SYSDATE, 'DD/MM/YYYY HH24:MI:SS')) ;
*:control_blk.item_hrs := to_char(sysdate,'HH12:MI:SS am')* <<<--- This for the item...
end if;
/* DONT FORGET THIS */
Synchronize;
end;
Edited by: charles on Jan 24, 2011 10:06 AM
Edited by: charles on Jan 24, 2011 10:11 AM
Edited by: charles on Jan 24, 2011 10:12 AM
Edited by: charles on Jan 24, 2011 10:13 AM
Edited by: charles on Jan 24, 2011 10:14 AM -
Displaying text more than 256 in ALV report
Hi experts,
I have problem while displaying text field in ALV report which has more than 256 characters.
I'm using CL_SALV_TABLE for displaying alv.while concatenating my internal table holding all the text.but at the time of displying the report it's only displaying 256 characters.
Can anyone guide me how to display more than 256 characters in ALV output using CL_SALV_TABLE.Hi,
Please find the below code.
TRY.
gr_column ?= gr_columns->get_column( columnname = 'MATNR' ).
gr_column->set_output_length( '300' ).
CATCH cx_salv_not_found.
Message : Column definition problem
MESSAGE e075().
ENDTRY.
Edited by: Archana.T on Jun 16, 2010 1:24 PM -
Display Currency symbol with value in ALV Report
Hi Experts,
I need to display currency symbol with value in ALV Report like if currency type is dollar then $200.
Here I am using field catalog type slis_t_fieldcat_alv and suing field merge catalog FM: 'REUSE_ALV_FIELDCATALOG_MERGE'
I tried like this
IF <fs_fieldcat>-fieldname = 'STPRS'.
<fs_fieldcat>-seltext_s = 'Std Cost '.
<fs_fieldcat>-seltext_m = 'Std Cost'.
<fs_fieldcat>-seltext_l = 'Std Cost '
<fs_fieldcat>-tabname = 'MBEW'.
<fs_fieldcat>-ctabname = 'T001'.
<fs_fieldcat>-cfieldname ='WAERS'.
<fs_fieldcat>-datatype = 'CURR'.
ENDIF.
Please any one can suggest the solution for this.
Advance Thanks.
Regards,
Bala AchariHİ,
Check this link.
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=24379571
Take care.
Çağatay -
How to display subtotals in separate column in alv report?
hi,
I am displayed the subtotals for QUantity field BDMNG in Reuse_alv_grid_display in the same column.
but I want to display subtotal in separate column.
How to display subtotals in separate column in alv report?
thanks®ards.
samba.kHi
As far as i know you can't do this,the option you have is to create one more column (subtotal) and populate it by manual calculation at every subtotal (not alv subtotal but yours) .
Best Regards
Yossi -
How to display dynamic signature in Smartforms?
Hi,
Someone could help me in displaying dynamic signatures in SmartForms?. The signature is an attached file to the document. I already have the binary file but I don't know how to display this as an image in the Smartforms.
Thanks in advance,
Oliver
Message was edited by: Oliver Vera
Message was edited by: Oliver VeraPlease give me the reply.
I have an image content in one internal table.I want to display that image in the smartforms.
plaese please. -
How to display Cleared/open item symbol' in alv?
Hi Experts,
I am developing ALV report like faglb03,additionaly including some fields as per user requirement.here i want to display " Cleared/open item symbol' in alv.Can anyone tel me how to do this.In which and how it is stored in table?
Thanks in Advance![Formatting Column Contents|http://help.sap.com/saphelp_nw04/helpdata/en/ff/4649a6f17411d2b486006094192fe3/frameset.htm]
check the documentation for ICON , check the table ICON for more symbols
[Sample code of alv list|http://www.sap-img.com/abap/regarding-icon-display-in-alv.htm]] -
Problem displaying dynamically loaded text in Flash CS3
I created a Flash CS3 application that does not display
dynamically loaded text (from internal AS3 scripts) on 3/6 of my
client's computers. All computers run IE 6 and Flash Player 9. I
cannot replicate the problem on any computer in my department. The
problem seems to be related to Flash Player 9 or a browser
setting/IT restriction. Has anyone encountered this? If so, have
you found a solution?
If I cannot find a solution, then I will need to almost
completely redo the application.
One slightly insane idea I have considered is to, if
possible, convert dynamically loaded text to an image real-time. Is
that possible?
Btw, I have created a font in my library. Should I try
manually embedding the font from the Properties menu and selecting
all characters?
Thanks in advance.yes, even though you may be using a font from the library,
you still have to specify that each text field that uses that font
embeds the font, and you'll need to select all characters(well not
all, unless you require all the different scripts of the world -
upper-case, lower-case, numerals and punctuation usual suffices).
I bet if you checked, the computers where the font did not
appear did not have the font on their system.
Good luck
Craig -
How to display dynamic header title in the report?
I have a req to display dynamic header title in the report.
When a id is entered in the prompt text, it will display the user data based on that user_id.
so similarly....the header title should vary each time when you select different user_id.
How can we implement this?>
Zack H wrote:
> Lazaro,
>
> It depends on what you want displayed in the heading for each id.
> Please elaborate.
>
> Thanks,
> Zack H.
Zack..I have several projects listed under several project id's...
so when a user selects project id 00164 then it should display something like "Project document for Jon Doe"
again when the user selects project id as 00192 then it should display something like "project document for Zimmerman"
Did you get it?? -
Displaying dynamically generated HTML
Hi!
Is it possible to display dynamically generated HTML-page by means of ITS?
I want to write report in ABAP and generate HTML-page with report data, then display it on client side.
Is it possible?
Thanks!Hello,
As long as it has a transaction code then probably yes. Just use the webgui service.
Edgar -
Regarding Excel Download in Block list ALV
Hi Abaper's,
I am facing with one problem during downloading of the BlockList ALV.
<b>If I click on the standart toolbar 'local file button '( ctrl + shift + F9) it is downloading the ALV data into the excel file but the ALV header information starts from column 1 and ALV data information starts from the 2nd column.</b>
Please suggest me is it the expected functionality of the Block List ALV or I have written wrong code. Please suggest me.I think there is something wrong with the output...maybe you should check your fieldcatalog wheter it matches to the structure of your internal table of data you want to show.
Normally you should get an output per column with the fieldnames in the first line starting with 1st column and the data starting in 2nd line starting with 1st col.
hope that helps you off, please award if useful!
Clemens
Maybe you are looking for
-
Solaris 8.0 on SUN SPARC 5 machine.
Can i install Solaris 8.0 on SUN SPARC 5 machines ? Why can't i find it in the hardware compatibility list ?
-
Embed labview generated code with c++ gui application
Hey everyone , I am very new to labview and trying to learn it ... but before that i wanted to make sure a doubt which i have in my mind , the problem is that i have a realtime GUI application built on c++ widgets and i want to change the existing
-
Can't find waveform generator vi
Is Labview 6.0 supposed to have a waveform generator vi included with it? I am going through the activities to learn how to use it, and one of the activities is building a waveform generator, but I cannot find the waveform generator vi. The help faci
-
Error in classification (class REQ_RELEASE class type 032)
Hi Guys I have changed the release codes to 6 release strategys and maintained Charecterstics and moved them to Quality system. Now in Quality i can see those changes applied but when i click on Classification i can't open it and system is throwing a
-
Keeps capitalizing letters I want in lower case
when I'm typing something in lower case it sometimes changes to capitals. For example, for a URL i put in the letters .co.U.K. and it changes the U.K. (as it has done here) - the U.K. I have put in lower cases in all examples here and you can see the