FIELD VALUE IN ALV HEADER
Hi friends,
I make one header alv ok I want and take one variable count in my program so I want to display its value in ALV HEADER
Total Target Qty:
Total EMP. Efficiency
Total Machine Effi.
I take may header like this and pass thre text here.ok Now I want to display value of this three.
Total Trget Qty: 2.23 like that.
CLEAR st_line.
st_line-typ = 'S'.
CONCATENATE 'Total Target Qty: ' count ' ' INTO st_line-info.
APPEND st_line TO t_list_top_of_page.
So I took like this in header count is my variable in which I take value.
So how can we pass the value in ALV Header please tell me.
its urgent so.
Thnaks in Advance.
Prashant.
HI DHWANI,
*& Report ZPP_RE_EMP_DETAILS
*& This Report is used to check the Employee Performance And Used Machine Quantity
*& Rqueirement By Santhosh
*& Developed By Prashant On Date 01.02.2008
*& Created By: Prashant Brahmbhatt
*& Creation Date: 20080201
*& Module: PP (Production & Plannig)
*& Changed By Changed Date Reason
REPORT zpp_re_emp_details.
TABLES:zpplan.
TYPE-POOLS:slis.
DATA:BEGIN OF itab OCCURS 0,
zdate LIKE zpplan-zdate,
werks LIKE zpplan-werks,
mname LIKE zpplan-mname,
shftin LIKE zpplan-shftin,
iserh LIKE zpplan-iserh,
quaty LIKE zpplan-quaty,
plan_qty LIKE zpplan-plan_qty,
act_prod LIKE zpplan-act_prod,
temp TYPE c,
tar_qty(10) TYPE c,
ach_qty(10) TYPE c,
mch_eff(10) TYPE c,
a(10) TYPE c,
END OF itab.
DATA:BEGIN OF temp OCCURS 0,
zdate LIKE zpplan-zdate,
werks LIKE zpplan-werks,
mname LIKE zpplan-mname,
shftin LIKE zpplan-shftin,
iserh LIKE zpplan-iserh,
quaty LIKE zpplan-quaty,
plan_qty LIKE zpplan-plan_qty,
act_prod LIKE zpplan-act_prod,
temp TYPE c,
tar_qty(10) TYPE c,
ach_qty(10) TYPE c,
mch_eff(10) TYPE c,
a(10) TYPE c,
END OF temp.
DATA:BEGIN OF itab_t OCCURS 0,
zdate LIKE zpplan-zdate,
werks LIKE zpplan-werks,
mname LIKE zpplan-mname,
shftin LIKE zpplan-shftin,
iserh LIKE zpplan-iserh,
quaty LIKE zpplan-quaty,
plan_qty LIKE zpplan-plan_qty,
act_prod LIKE zpplan-act_prod,
temp TYPE c,
tar_qty(10) TYPE c,
ach_qty(10) TYPE c,
mch_eff(10) TYPE c,
a(10) TYPE c,
END OF itab_t.
DATA:BEGIN OF itab1 OCCURS 0,
zdate LIKE zpplan-zdate,
werks LIKE zpplan-werks,
mname LIKE zpplan-mname,
shftin LIKE zpplan-shftin,
act_prod LIKE zpplan-act_prod,
quaty LIKE zpplan-quaty,
planned LIKE zpplan-planned,
iserh LIKE zpplan-iserh,
temp TYPE c,
tar_qty TYPE p DECIMALS 2,
ach_qty TYPE p DECIMALS 2,
mch_eff TYPE p DECIMALS 2,
END OF itab1.
DATA: wa LIKE itab1.
DATA:BEGIN OF itab2 OCCURS 0,
zdate LIKE zpplan-zdate,
werks LIKE zpplan-werks,
mname LIKE zpplan-mname,
shftin LIKE zpplan-shftin,
act_prod LIKE zpplan-act_prod,
quaty LIKE zpplan-quaty,
planned LIKE zpplan-planned,
iserh LIKE zpplan-iserh,
temp TYPE c,
tar_qty(10) TYPE p DECIMALS 2,
ach_qty(10) TYPE p DECIMALS 2,
mch_eff(10) TYPE p DECIMALS 2,
count(10) TYPE c,
END OF itab2.
DATA: a(10) TYPE c,
b(10) TYPE c,
count(10) TYPE c,
count1(10) TYPE c.
c(2) TYPE p DECIMALS 2.
DATA:t_fcat TYPE slis_t_fieldcat_alv,
t_events TYPE slis_t_event,
t_list_top_of_page TYPE slis_t_listheader,
t_list_end_of_page TYPE slis_t_listheader.
CONSTANTS:c_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
CONSTANTS:c_formname_end_of_page TYPE slis_formname VALUE 'END_OF_PAGE'.
DATA: st_line TYPE slis_listheader.
SELECTION-SCREEN
SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
*PARAMETERS:shftin LIKE zpplan-shftin.
SELECT-OPTIONS:date FOR zpplan-zdate,
shftin FOR zpplan-shftin,
werks FOR zpplan-werks.
SELECTION-SCREEN:END OF BLOCK blk1.
ALV CALL
INITIALIZATION.
PERFORM build_fieldcatalog USING t_fcat .
PERFORM event_call.
PERFORM head_built USING t_events.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM display_alv.
*& Form build_fieldcatalog
text
-->P_T_FCAT text
FORM build_fieldcatalog USING temp_fcat TYPE slis_t_fieldcat_alv.
DATA:w_fcat TYPE slis_fieldcat_alv.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'MNAME'.
w_fcat-seltext_m = 'Machine Name'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'SHFTIN'.
w_fcat-seltext_m = 'Emp No'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'ZDATE'.
w_fcat-seltext_m = 'Pos Date'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'QUATY'.
w_fcat-seltext_m = 'Quantity'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'ACT_PROD'.
w_fcat-seltext_m = 'Actual Quantity'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'ISERH'.
w_fcat-seltext_m = 'Down Time'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'TAR_QTY'.
w_fcat-seltext_m = 'Target Qty.'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'ACH_QTY'.
w_fcat-seltext_m = 'EMP Effec.'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'MCH_EFF'.
w_fcat-seltext_m = 'Machine Effec.'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
w_fcat-tabname = 'ITAB2'.
w_fcat-fieldname = 'COUNT'.
w_fcat-seltext_m = 'Machine Effec.'.
APPEND w_fcat TO temp_fcat.
CLEAR w_fcat.
ENDFORM. " build_fieldcatalog
*& Form event_call
text
--> p1 text
<-- p2 text
FORM event_call .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_events
EXCEPTIONS
LIST_TYPE_WRONG = 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. " event_call
*& Form data_retrieval
text
--> p1 text
<-- p2 text
FORM data_retrieval .
IF shftin <> ''.
SELECT zdate werks mname shftin INTO CORRESPONDING FIELDS OF TABLE
temp FROM zpplan
WHERE shftin IN shftin
AND zdate IN date
AND werks IN werks.
ELSE.
SELECT zdate werks mname INTO CORRESPONDING FIELDS OF TABLE
temp FROM zpplan
WHERE zdate IN date
AND werks IN werks.
ENDIF.
SORT temp BY mname zdate shftin.
DELETE ADJACENT DUPLICATES FROM temp.
SORT temp BY mname shftin zdate.
DELETE ADJACENT DUPLICATES FROM temp.
APPEND temp.
LOOP AT temp.
SELECT zdate werks mname shftin act_prod quaty iserh FROM zpplan INTO CORRESPONDING FIELDS OF TABLE itab_t
WHERE mname = temp-mname
AND zdate = temp-zdate
AND werks = temp-werks.
LOOP AT itab_t.
MOVE-CORRESPONDING itab_t TO itab.
APPEND itab.
ENDLOOP.
ENDLOOP.
*******************************************8
SELECT zdate werks mname shftin act_prod quaty iserh FROM zpplan INTO CORRESPONDING FIELDS OF TABLE itab
FOR ALL ENTRIES IN temp
WHERE zdate = temp-zdate AND
werks = temp-werks
AND mname = temp-mname.
SELECT zdate werks mname shftin act_prod quaty iserh FROM zpplan INTO CORRESPONDING FIELDS OF TABLE itab
WHERE zdate IN date AND
werks IN werks AND
shftin = shftin.
SORT itab BY mname zdate.
DELETE ADJACENT DUPLICATES FROM itab.
LOOP AT itab.
MOVE-CORRESPONDING itab TO itab1.
COLLECT itab1.
ENDLOOP.
LOOP AT itab1.
itab1-tar_qty = itab1-tar_qty + ( itab1-quaty / 3 ).
IF ( itab1-tar_qty NE 0 ).
itab1-ach_qty = ( itab1-ach_qty + itab1-act_prod / itab1-tar_qty ) * 100.
ELSE.
itab1-ach_qty = 0 * 100.
ENDIF.
itab1-mch_eff = ( ( 8 - itab1-iserh ) / 8 ) * 100.
MODIFY itab1 TRANSPORTING tar_qty ach_qty mch_eff.
ENDLOOP.
LOOP AT itab1.
READ TABLE itab1 INDEX 1 INTO wa.
IF itab1-mname = wa-mname.
itab1-zdate = wa-zdate.
itab2-shftin = itab1-shftin.
itab2-mname = itab1-mname.
itab2-zdate = itab1-zdate.
itab2-quaty = itab2-quaty + itab1-quaty.
itab2-act_prod = itab2-act_prod + itab1-act_prod.
itab2-iserh = itab2-iserh + itab1-iserh.
itab2-tar_qty = itab2-tar_qty + itab1-tar_qty.
itab2-ach_qty = itab2-ach_qty + itab1-ach_qty.
itab2-mch_eff = itab2-mch_eff + itab1-mch_eff.
ELSE.
APPEND itab2.
CLEAR itab2.
MOVE-CORRESPONDING itab1 TO wa.
itab2-shftin = itab1-shftin.
itab2-mname = itab1-mname.
itab2-zdate = itab1-zdate.
itab2-quaty = itab2-quaty + itab1-quaty.
itab2-act_prod = itab2-act_prod + itab1-act_prod.
itab2-iserh = itab2-iserh + itab1-iserh.
itab2-tar_qty = itab2-tar_qty + itab1-tar_qty.
itab2-ach_qty = itab2-ach_qty + itab1-ach_qty.
itab2-mch_eff = itab2-mch_eff + itab1-mch_eff.
ENDIF.
ENDLOOP.
APPEND itab2.
LOOP AT itab2.
IF ( itab2-tar_qty NE 0 ).
itab2-ach_qty = ( itab2-ach_qty + itab2-act_prod / itab2-tar_qty(10) ) * 100.
ELSE.
itab2-ach_qty = 0 * 100.
ENDIF.
itab2-mch_eff = ( ( 8 - itab2-iserh ) / 8 ) * 100.
MODIFY itab2 TRANSPORTING tar_qty ach_qty mch_eff.
ENDLOOP.
APPEND itab2.
LOOP AT itab2.
count = sy-tfill.
a = a + itab2-tar_qty.
b = b + itab2-ach_qty.
ENDLOOP.
CLEAR itab2.
itab2-tar_qty = a.
itab2-ach_qty = b.
APPEND itab2.
CLEAR itab2.
count = a / sy-tfill.
count1 = b / sy-tfill.
itab2-tar_qty = count.
itab2-ach_qty = count1.
itab2-tar_qty = count.
APPEND itab2.
ENDFORM. " data_retrieval
*& Form head_built
text
-->P_T_EVE text
FORM head_built USING p_t_eve TYPE slis_t_event.
count = a / sy-tfill.
DATA: ls_event TYPE slis_alv_event.
REFRESH t_list_top_of_page.
READ TABLE p_t_eve WITH KEY name = slis_ev_top_of_page INTO ls_event.
IF sy-subrc = 0.
MOVE c_formname_top_of_page TO ls_event-form.
MODIFY p_t_eve FROM ls_event INDEX sy-tabix.
ENDIF.
CLEAR st_line.
st_line-typ = 'S'.
st_line-key = 'Total Target Qty: '.
st_line-info = count.
APPEND st_line TO t_list_top_of_page.
CLEAR st_line.
st_line-typ = 'S'.
st_line-info = count.
CONCATENATE 'Avg Target Qty.' count ' ' INTO st_line-info.
APPEND st_line TO t_list_top_of_page.
CLEAR st_line.
st_line-typ = 'S'.
st_line-key = 'Avg.EMP Efficiency: '.
st_line-info = count1.
APPEND st_line TO t_list_top_of_page.
CLEAR st_line.
st_line-typ = 'S'.
st_line-key = 'Avg. Machine Efficincy: '.
st_line-info = count.
APPEND st_line TO t_list_top_of_page.
REFRESH t_list_end_of_page.
READ TABLE p_t_eve WITH KEY name = slis_ev_end_of_list INTO ls_event.
IF sy-subrc = 0.
MOVE c_formname_end_of_page TO ls_event-form.
MODIFY p_t_eve FROM ls_event INDEX sy-tabix.
ENDIF.
CLEAR st_line.
st_line-typ = 'S'.
CONCATENATE 'END OF PAGE' ' ' INTO st_line-info.
APPEND st_line TO t_list_end_of_page.
ENDFORM. " head_built
*& Form top-of-page
text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_list_top_of_page
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "top-of-page
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = 'ZPP_RE_EMP_DETAILS'
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 = 'ALV_BACKGROUND'
i_grid_title = 'EMP Information'
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = t_fcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = t_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 = itab2
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
Similar Messages
-
Problem with aligning values in ALV header???????
I am supposed to show some values in ALV header some thing like this
PGMID: xxxxx
Material: p_Matnr-low to p_Matnr high
Plant: p_werks-low to p_werks-high
ALV Reoport
For this i wrote code something like this.
Fieldcatalog-status='s'.
Fieldcatalog-key = 'PGMID:'.
FieldCatalog-info = 'xxxxxxxx'
append field catlalog.
Fieldcatalog-status='s'.
Fieldcatalog-key = 'Material:'.
Concatenate p_Matnr-low
'to'
p_Matnr-high into FieldCatalog-info.
append field catlalog.
etc................
Now output shown is like this
PGMID: xxxxx
Material: p_Matnr-low to p_Matnr high
Plant: p_werks-low to p_werks-high
I am not able to give a good gap in between the 'to' as shown initially. Any idea on this??
RakeshHi,
Please find attached below code :
IF NOT so_bukrs-low IS INITIAL AND NOT so_bukrs-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Company Code'(015).
CONCATENATE so_bukrs-low 'to' so_bukrs-high INTO gs_line-info
SEPARATED BY space.
APPEND gs_line TO lt_top_of_page.
ELSEIF so_bukrs-low IS INITIAL AND so_bukrs-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Company Code'(015).
gs_line-info = 'ALL Values'(012).
APPEND gs_line TO lt_top_of_page.
ELSEIF so_bukrs-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Company Code'(015).
gs_line-info = so_bukrs-low.
APPEND gs_line TO lt_top_of_page.
ENDIF.
*Fiscal Year
CLEAR gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Year'(014).
MOVE sp_gjahr TO gs_line-info.
APPEND gs_line TO lt_top_of_page.
*Period
CLEAR gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Period'(013).
MOVE sp_monat TO gs_line-info.
APPEND gs_line TO lt_top_of_page.
*Currency Key
IF NOT so_waers-low IS INITIAL AND NOT so_waers-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Currency'(011).
CONCATENATE so_waers-low 'to' so_waers-high INTO gs_line-info
SEPARATED BY space.
APPEND gs_line TO lt_top_of_page.
ELSEIF so_waers-low IS INITIAL AND so_waers-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Currency'(011).
gs_line-info = 'ALL Values'(012).
APPEND gs_line TO lt_top_of_page.
ELSEIF so_waers-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Currency'(011).
gs_line-info = so_waers-low.
APPEND gs_line TO lt_top_of_page.
ENDIF.
*Clearing Doc
IF NOT so_augbl-low IS INITIAL AND NOT so_augbl-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Clearing Doc'(020).
CONCATENATE so_augbl-low 'to' so_augbl-high INTO gs_line-info
SEPARATED BY space.
APPEND gs_line TO lt_top_of_page.
ELSEIF so_augbl-low IS INITIAL AND so_augbl-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Clearing Doc'(020).
gs_line-info = 'ALL Values'(012).
APPEND gs_line TO lt_top_of_page.
ELSEIF so_augbl-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'Clearing Doc'(020).
gs_line-info = so_augbl-low.
APPEND gs_line TO lt_top_of_page.
ENDIF.
*User ID
IF NOT so_usrid-low IS INITIAL AND NOT so_usrid-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'User ID'(021).
CONCATENATE so_usrid-low 'to' so_usrid-high INTO gs_line-info
SEPARATED BY space.
APPEND gs_line TO lt_top_of_page.
ELSEIF so_usrid-low IS INITIAL AND so_usrid-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'User ID'(021).
gs_line-info = 'ALL Values'(012).
APPEND gs_line TO lt_top_of_page.
ELSEIF so_usrid-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'User ID'(021).
gs_line-info = so_usrid-low.
APPEND gs_line TO lt_top_of_page.
ENDIF.
*GL Account
IF NOT so_hkont-low IS INITIAL AND NOT so_hkont-high IS INITIAL.
SHIFT so_hkont-low LEFT DELETING LEADING '0'.
SHIFT so_hkont-high LEFT DELETING LEADING '0'.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'GL Account'(004).
CONCATENATE so_hkont-low 'to' so_hkont-high INTO gs_line-info
SEPARATED BY space.
APPEND gs_line TO lt_top_of_page.
ELSEIF so_hkont-low IS INITIAL AND so_hkont-high IS INITIAL.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'GL Account'(004).
gs_line-info = 'ALL Values'(012).
APPEND gs_line TO lt_top_of_page.
ELSEIF so_hkont-high IS INITIAL.
SHIFT so_hkont-low LEFT DELETING LEADING '0'.
CLEAR: gs_line.
gs_line-typ = gc_s.
gs_line-key = 'GL Account'(004).
gs_line-info = so_hkont-low.
APPEND gs_line TO lt_top_of_page.
ENDIF.
Thanks,
Sriram Ponna. -
Tool Tip Text for field values in ALV report
Hi,
How to get the tool tip text for the field values in ALV report.
Thanks & Regards,
Pallavi.Hi,
In fieldcatalog specify the TOOLTIP.
<b>
LVC_S_FCAT-TOOLTIP
</b>
In this speicfyteh tooltip you want.
Then append this to the fieldcatalog.
Hope this solves ur problem. -
Hello
Is there a way to use the field label in the header of a ALV grid?
I am currently using a hard coded solution, and i know it's not good.
form buildfieldcat .
clear wa_fcat.
refresh it_fcat.
wa_fcat-col_pos = '1'.
wa_fcat-tabname = 'KNA1'.
wa_fcat-fieldname = 'KUNNR'. " I want to use the field label of this field in the header...
wa_fcat-seltext_l = 'Customer Number'. " ...To not use this line.
wa_fcat-outputlen = 15.
wa_fcat-key = 'X'.
wa_fcat-no_zero = 'X'.
I hope my query was clear. Thanks a lot!Hi,
If you want header columns from Dictionary field labels, instead of hardcoding, you can follow what fellow SDNs mentioned.
Here is the solution.
<li>define internal table like this.
TYPES:
BEGIN OF t_mard,
werks TYPE mard-werks,
lgort TYPE mard-lgort,
matnr TYPE mard-matnr,
insme TYPE mard-insme,
einme TYPE mard-einme,
speme TYPE mard-speme,
END OF t_mard.
DATA:
w_mard TYPE t_mard.
DATA:
i_mard TYPE STANDARD TABLE OF t_mard.
<li>Buidl fieldcatalog internal table like below . It works
PERFORM build_fcat USING:
"Field Int Tab ref field ref table
'WERKS' 'I_MARD' 'WERKS' 'MARD',
'LGORT' 'I_MARD' 'LGORT' 'MARD',
'MATNR' 'I_MARD' 'MATNR' 'MARD',
'INSME' 'I_MARD' 'INSME' 'MARD',
'EINME' 'I_MARD' 'EINME' 'MARD',
'SPEME' 'I_MARD' 'SPEME' 'MARD'.
*& Form BUILD_FCAT
FORM build_fcat USING l_field l_tab ref_field ref_tab.
w_fieldcat-fieldname = l_field.
w_fieldcat-tabname = l_tab.
w_fieldcat-ref_fieldname = ref_field.
w_fieldcat-ref_tabname = ref_tab.
* w_fieldcat-seltext_m = l_text.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " BUILD_FCAT
<li> You can check program [here|http://hr-abap-freeeducation.blogspot.com/2008/04/alv-list-display_17.html]
I hope that it solves your problem.
Thanks
Venkat.O -
Hello experts,
I have created an simple ALV Grid report, in that I have implemented double click event n I want to create a new ALV grid with new data to be displayed. So I want to access field value ie using SLIS_SELFIELD or anything. Could anyone please guide me how can I access a field value using slis though SLIS_SELFIELD has methods like SEL_TAB_FIELD... I wan to access something like SEL_FIELD_VALUE but its not available in the class.
Thanks in advance...
Regards,
Viral PatelHi Viral,
SLIS_SELFIELD has an attribute named VALUE which holds the value you selected row & TBAINDEX holds the row number.
Refer below code snippet :-
FORM user_command
USING s_ucomm LIKE sy-ucomm
s_selfield TYPE slis_selfield. "#EC CALLED
CASE s_ucomm.
WHEN '&IC1'.
CLEAR wa_podat2.
READ TABLE itab_podat2 INTO wa_podat2 INDEX s_selfield-tabindex.
CHECK sy-subrc = 0.
IF wa_podat2-ebeln = s_selfield-value.
SET PARAMETER ID 'BES' FIELD wa_podat2-ebeln.
IF wa_podat2-ebeln IS NOT INITIAL.
CALL TRANSACTION c_tcode.
ENDIF.
For above event to happen, you have to use parameter I_CALLBACK_USER_COMMAND of REUSE_ALV_GRID_DISPLAY as below :-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = itab_fieldcat
it_events = itab_events
TABLES
t_outtab = itab_podat2[].
Regards
Abhii
Edited by: Abhii on Nov 30, 2009 11:25 AM -
Referencing Field Values in Region Heading
Is there a simple way to refer to more than one field value in a region heading? I have added the '&P1_YEAR.' to the end of a region name and it will display the contents of that field in the heading.
How can you display more than one filed in the heading. For example if you wanted to add 'Year' and 'Model' to the heading 'Vehicle' so that it displayed
'Vehicle Ford 2008'
Kind Regards,
Steve WelchSteve:
You can simply concatenate the fields whose values you want displayed
&P1_YEAR. &P1_MODEL.
varad -
Concatenate text to field value in report header
I'm trying to concatenate text to field value in a textbox in the report header but am getting an error. Here's how I'm doing it:
=First(Fields!Pp_Name.Value, "dsProspect") & "Prospect"
and the error says the report definition is invalid. An unexpected error occurred while compiling expressions. Native compiler return value '[BC30179] class 'Textbox.....
any idea why this wont compile?
Thank you.Hi moondaddy,
Generally, the error message always occurred when there are two distinct text boxes with the same name that only differ in their name by casing in report. When Reporting Services generates VB code for these textboxes during report publishing, the compilation
fails because VB class names are considered case-insensitive.
So this issue is not related to the expression (the format is correct) you post, it related to the Textbox name that the error message said. In order to fix this issue, please rename one of the textboxes.
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
If you have any feedback on our support, please click here.
Katherine Xiong
TechNet Community Support -
Arrow mark with kunnr field values in alv output.
Hi ,
I need to increase the column field length. I am using Function Module REUSE_ALV_LIST_DISPLAY because alv_grid display fm is not available in 4.0b version. I have used column optimization in layout. The column kunnr is coming with a small arrow though there is no data loss. Is there any way I can remove the arrow mark with kunnr field values.Hi,
You can increase your column lenght in fieldcat by using Fcat-columnwidth = "SIZE OF KUNNR ".
Set the size of kunnr field in fieldcat and get the appropiate output.
Regards
Abdul -
How to show fixed values instead of field values in ALV cell.
Hi colleagues,
I have a ALV object of type CL_GUI_ALV_GRID.
I have associted a table with it which has a field called refresh type which is of type char1.
My program works fine.
But the problem is,
The refresh_type field has fixed values in its value range.
On display of ALV i want to show the associated fixed value instead of actual value in table content.
I donno the way to do it.
Please help me.
-TruptiAnother way to do this would be to define a conversion exit function for use in the report.
You can copy a SAP-provided function group like ALFA as a template, but you may need untyped importing/exporting parameters. Name the new functions as CONVERSION_EXIT_Zxxx_OUTPUT and CONVERSION_EXIT_Zxxx_INPUT where Zxxx is some string you choose.
In this case the input to the ...OUTPUT function will be the code value from the database and the output value will be the corresponding text. So the code of the function CONVERSION_EXIT_Zxxx_OUTPUT will do the conversion suggested in steps 2 & 3 of Marcin's response above.
Here is an example based on the SFLIGHT model to enhance example report BCALV_GRID_DEMO.
First the conversion function: (I used 'zalv' as my identifying string for the conversion.)
function conversion_exit_zalv_output.
*"*"Local Interface:
*" IMPORTING
*" VALUE(INPUT)
*" EXPORTING
*" VALUE(OUTPUT)
field-symbols:
<output> type c,
<carrid> type c.
assign input to <carrid> casting.
assign output to <output> casting.
select single carrname from scarr into <output> " convert code to text
where carrid = <carrid>.
endfunction.
In a copy of program BCALV_GRID_DEMO, make changes in the module pbo.
module pbo output.
set pf-status 'MAIN100'.
if g_custom_container is initial.
create object g_custom_container
exporting
container_name = g_container.
create object grid1
exporting
i_parent = g_custom_container.
* " changes start here
data: gs_fcat type lvc_s_fcat,
gt_fcat type lvc_t_fcat.
tables: dd03l.
select * from dd03l where tabname = 'SFLIGHT'. " fill field catalog
if dd03l-fieldname = 'CARRID'.
gs_fcat-inttype = dd03l-inttype.
gs_fcat-outputlen = 20.
gs_fcat-coltext = 'Carrier'.
gs_fcat-seltext = 'Carrier'.
gs_fcat-edit_mask = '==ZALV'. " == with the string you used to name the functions
else.
clear gs_fcat.
gs_fcat-ref_table = dd03l-tabname.
endif.
gs_fcat-fieldname = dd03l-fieldname.
append gs_fcat to gt_fcat.
endselect.
* " changes end here
call method grid1->set_table_for_first_display
exporting
i_structure_name = 'SFLIGHT'
changing
it_fieldcatalog = gt_fcat
it_outtab = gt_sflight.
endif.
endmodule. "PBO OUTPUT
If you run this amended program, you see appropriate carrier texts in the ALV grid, where the original program had the IATA codes.
This approach makes sense if, for example, the same translation is also required elsewhere, as the function can easily be reused.
best wishes
Ed -
In BO 4.0,how to convert field values into column heading.
Currently Product Codes are represented in "Code" and "Value" fields.
Please retain the code and value fields, so that if the user adds another code and immediately needs to report on them they can through this functionality.
Current:
Fund Code
Code
Value
ABC1
Embassy Series
XYZ123
ABC1
FMI
19837
ABC1
Gladis Short Name
FUJHAT
Required:
Fund Code
Embassy Series
FMI
Gladis Short Name
ABC1
XYZ123
19837
FUJHATHi Archana,
I think you need to use a Cross Tab on your report but also you will need to apply Sections on the Fund Code dimension.
ie
Section 1 - ABC1
Crosstab
Section 2 - ABC2
Crosstab
Section 3 - ABC3
Crosstab
With regards
Gill -
How to get field values in ALV based on user provided input
Hi,
In my ALV grid, I have 2 fields:
1. Material ID
2. Material Description
When user provides input to Material ID field, the material Description field should get populated immediately.
Note: Curretly I am able to do it based on the sy-ucomm = 'Enter', i.e. when the user presses "Enter" outside the ALV grid, I retrieve Description from Mat Table and populate this in Mat_Desc in ALV grid.
I want to do the same operation whenever tab is pressed (not when user presses enter outside the ALV grid).
Please provide your inputs for this.
Thanks & regards,
RavishHi Ravish,
Check <b>BCALV_TEST_GRID_F4_HELP</b> program for F4 help on ALV Grid.
Thanks
Venkat.O -
Subtotal in alv report based on the particular field value
Hi,
As per my requirement, i need to do subtotal of quntity field based on the material number field value in alv report.
Ex: if material number falls 1 to 10 then i need to be calculate and display subtotal qty amount with text " total of the mat1" and if material number falls 11 to 20 then again i need to be claculate and display subtotal qty amount with text "total of the mat2". similarily i need to display the details.
<removed_by_moderator>
Regards
NagendraHi,
Ex: if material number falls 1 to 10 then i need to be calculate and display subtotal qty amount with text " total of the mat1" and if material number falls 11 to 20 then again i need to be claculate and display subtotal qty amount with text "total of the mat2". similarily i need to display the details.
What you can do is in your output table, you will have to create an auxilary field, lets call it as material group (groupid). Now you can do a subtotal on the material group. However the logic to determine what materials belong to which group should be coded. I guess you might be having some logic for that.
So lets say that material 1 to 10 as G1 ( group 1 ) and material 11 to 20 as G2 ( group 2 )
The output of the internal table would be
Groupid matnr ...
1 1
1 2
1 3.....and so on
2 11
2 12
2 13....upto 20.
Now in the fieldcatalog assign an 'X' to the 'dosum' parameter to the field Groupid
In the sort info do the following :
gs_sort-fieldname = 'GROUPID'.
gs_sort-spos = 1.
gs_sort-up = 'X'.
gs_sort-subtot = 'X'. ***CRUCIAL STATEMENT****
append gs_sort to gt_sort.
Now pass all this data to the alv grid function. And you are done.
regards,
Advait -
Content Conversion without key field value
Hi all,
I want to do a content conversion which includes a record structure Header,1,Detail,*
I dont have any key field value in the header nor in the detail. Can this be achived using FCC or should i go for Java.
Rgds
AdityaHi Aditya,
I think if u having multiple records then one shud hav key fields,
pls check 4th point in this guide
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/troubleshooting%2bthe%2bfile%2badapter
Also check this discussion::File Content Conversion(SenderFileadapter) fields parameters
Thanks, -
Field value is not coming in my customize ALV report
Hi All,
Good day.
I have added two fields in a customized ALV report. But the customized report was not developed by me. Therefore I am unable to understand the whole report. As per my requirement I have added 2 fields more like* quantity* & unit field in that ALV. But not understanding why values are not coming in my report though values are there in DB. Plz help me regarding this. The portion of the code is given below.
SORT t_ekbe by belnr.
loop at t_ekbe INTO w_ekbe where vgabe = '1'.
on CHANGE OF w_ekbe-belnr.
SELECT MBLNR
BWART
SMBLN
ERFMG " This is the new added field
erfme " This is the new added field
INTO CORRESPONDING FIELDS OF TABLE t_mseg
from mseg
where mblnr = t_ekbe-belnr
AND bwart = '101'.
endon.
ENDLOOP.
Thanks,
Tripod.hi ,
Do according to this
SORT t_ekbe by belnr.
if t_ekbe[] is not initial .
SELECT MBLNR
BWART
SMBLN
ERFMG " This is the new added field
erfme " This is the new added field
INTO CORRESPONDING FIELDS OF TABLE t_mseg
for all entries in t_ekbe
from mseg
where mblnr = t_ekbe-belnr
AND bwart = '101'.
endif.
after this
loop at t_ekbe .
loop at t_mseg where mblnr = t_ekbe-belnr .
t_ekbe-ERFMG = t_mseg-ERFMG .
t_ekbe-erfme = t_mseg-erfme .
modify t_ekbe transporting ERFMG erfme .
clear t_mseg .
endloop.
clear t_ekbe .
endloop.
Regards
Deepak . -
How to show header value in each page same as Page field value.
Hi there
It would be very helpful if anyone could tell us how to set header value based on the page field.
To make it more clear.. i have a field in my Rtf (which is basically a group by) so in each page it'll differ.. My Header should reflect the same as field value.
what my understanding is header wont change for each page. but ,my requirement is something like i have to show the header which is same as one of my filed value..
for eg:
HEADER: ABC page-1
Field - ABC
HEADER:XYZ page-2
Field - XYZ
Regards - Vijay
Edited by: Vijay Santhanam on 23-Oct-2008 3:51 PMHi Haiye ,
The Pointer you gave would keep Header ABC through out all the pages in report right, actually i had tried this and got same header for all pages,
but what i need is my first page Header should be based on one of the field of Page 1, second pge Header again based on the same field, but the value may differ... (coz the page field is group by ).
Would appreciate your help on this issue!!
Regards - Vijay
Maybe you are looking for
-
My stock Mac Pro 2006 just started showing the Kernel Panic screen at start-up. First saw the Kernel Panic this afternoon after leaving the system for less than an hour with a game running (EV Nova in a Pause screen). A reboot brought the system back
-
How much does it cost to get a Skype number? Monthly/yearly fee? Is this included in subscription fees? Solved! Go to Solution.
-
What is the use of setup tables in LO extraction
Hi Friends, What is the use of setup tables in LO extraction, what is the functionality of setup tables Thanks in advance
-
This might be a newbie question . I am trying to create JTable with URLs/links as cells . Is it possible to do it with JLabel or JEditorPane or both of them? Can i have JLabel or JEditorPane as the cell contents?? if yes then how it is done .Is there
-
Score Editor: double bar
Hi, I need to divide a measure in the middle of a song (in a 2/4 time signature) with a double bar: | quarter note || quarter note | half note | half note | etc. |: bar ||: double bar Is it possible to do this? Thanks.