Negative sign for DMBTR field in ALV output
Hi Experts,
Before posting I have searched for more than 3 hours in the forums to get a solution for this.
I did not get any solution so I am posting this problem which I need to resolve.
I have to display the DMBTR field in ALV output for which a grand total will have to be displayed.
Here for all the values in DMBTR which are negative are getting displayed as '- 6673.56','- 289956.23' as I am using the edit mask 'V_____________.__'.
I have to get the value shown as '-6673.56', '-289956.23'.
I tried to use convert this DMBTR to String and have successfully displayed the negative sign correctly in front of the value but I am not getting the totals which I need to have
PLease check and suggest for a solution.
Regards
Kishore
Hi,
If this is the case, then you can use character field to display the sign on the left. Sum up the total and use the event end of list to display the same. Remember to set the TECH and NO_OUT in the field catalog.
Hope this helps.
Regards,
Siva
Similar Messages
-
How to pass custom search help(F4 help) for a field in ALV output?
Hi,
I want to activate the F4 help in ALV output for a field for which we do not have search help assigned at table ,data element and domain level.
In field catalog i have enabled it by below line.
ls_fcat-F4AVAILABL = 'X'.
but because there are no standard input help available it is giving message as "No input help is available".
so how to pass our custom search help (g_search) for any field in ALV output.
I am using object oriented ALV grid display.
Thanks!!!
Rajesh Gupta.hi,
check this out:
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b3d5e890-0201-0010-c0ac-bba85ec2ae8d
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/acdefb13-0701-0010-f1a2-8eeefa7d3780
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b3d5e890-0201-0010-c0ac-bba85ec2ae8d?quicklink=index&overridelayout=true -
Co41 enhancement for add field in ALV output
I must add a custom filed to ALV output of transaction CO41 and i trying to use all the 25 enhancements provided (that i find in other post CO41- Enhancement ), but i haven't found any way to get the desired results.
Can any body help me?
Thanks in advance.Hi,
I had the same requirement to add a custom field to ALV output of transaction CO41.
1. I first added the custom field to an new append-structure to the structure SFC_POCO.
2. Then i added this field to the Dynpro-Screen 200 in the function-group COUP (by choosing the table control, pressing F6 and then adding the custom field of SFC_POCO).
3. At last i added an Enhancement to the function CO_UP_PLANNED_ORDERS_SELECT and filled my custom field with data there.
Please reward if useful.
Regards,
Henry -
Color for a Field in alv output
Hi All,
I use a field in the ALV grid output which needs to display color (red or green) depending on certain validations. Please tell me how to display color for this field. The program uses oops.
Thanks.Hi
1. add one more field to ur final internal table say COLOR(4)
2. in layout wa_layout-style_fname = 'COLOR'. " if its grid
wa_layout-style_fieldname = 'COLOR'. "if its list
3. read table itab index 3.
itab-color = 'C410'.
modify itab index 3
4. see program SHOWCOLO for all color codes
1. Add a field of data type CHAR(3) to the internal output table.
2. Enter the color code in the appropriate field of the row to be colored in the internal
output table:
Code: 'Cxy'
C = Color (all codes begin with 'C')
x = color number ('1' - '9')
y = highlight ('0' = off, '1' = on)
3. Assign the internal output table color code field name to the IS_LAYOUT importing
structure IS_LAYOUT-INFO_FIELDNAME field and pass this structure in the ALV call
interface.
To enable row coloring, you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row. So, lets modify declaration of our list data table gt_list.
you should fill the color code to this field. Its format will be the same as explained before at section C.6.3. But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by passing the name of the field containing color codes to the field INFO_FNAME of the layout structure.
e.g.
ps_layout-info_fname = <field_name_containing_color_codes>. e.g. ROWCOLOR
You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.
You can color an entire row as described in the next section. However, this method is less time consuming.
Coloring Individual Cells
This is the last point about coloring procedures for the ALV Grid. The procedure is similar to coloring an entire row. However, since an individual cell can be addressed with two parameters we will need something more. What is meant by more is a table type structure to be included into the structure of the list data table. It seems strange, because including it will make our list data structure deep. But anyhow ALV Grid control handles this.
The structure that should be included must be of type LVC_T_SCOL. If you want to color the entire row, this inner table should contain only one row with field fname is set to space, some color value at field col, 0 or 1 at fields int (intensified) and inv (inverse).
If you want to color individual cells, then for each cell column, append a line to this inner table which also contains the column name at field fname. It is obvious that you can color an entire column by filling this inner table with a row for that column for each row in the list data table.
Reward points if useful
Regards
Anji -
Fixed length for the fields of ALV output
Hi,
How to fix a field in the ALV output to its max length..For example..if a field's max length is 10...that coloumn should not be dragged or moved to right..Its lenght shluld be fixed to 10...Could any bod suggest me how to perform this...thanks..
Shyam.Hi,
U can better optimize the width.it will be good.
data : W_LAYOUT TYPE SLIS_LAYOUT_ALV.
W_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_STRUCTURE_NAME = 'T_ALV'
IS_LAYOUT = W_LAYOUT
IT_FIELDCAT = T_FIELDCAT_ALV
I_CALLBACK_TOP_OF_PAGE = 'ALV_TOP_OF_PAGE'
TABLES
T_OUTTAB = T_ALV
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. -
Negative sign for Currency fields
Hello experts,
If a currency field containt -Ve sign (86.47-) then, i have to move it this sign to Left sinde. I have do this as follow by moving the currency field value to Charractor field
DATA: w_total1 (18).
MOVE w_total To w_total1.
IF w_total1 CA '-'.
SHIFT w_total1 RIGHT CIRCULAR.
ENDIF.
CONDENSE w_total1 NO-GAPS.
But don't want to move this to Chanddacter field for other pupepose. Now how can i **** the -Ve sign to left side for currency field, IF bsid-shkzg EQ 'H'.
Thanks.Hi sandhya ,
Try this :
DATA: w_total type string ,
w_total1 type string.
w_total = '1,4567.7-'.
MOVE w_total To w_total1.
IF w_total1 CA '-'.
SHIFT w_total1 RIGHT CIRCULAR.
ENDIF.
* CONDENSE w_total1 NO-GAPS.
write : / w_total1.
Hope all your issues are fixed now .
Regards ,
lokesh
Edited by: Lokesh Pattnayak on Oct 11, 2010 10:23 AM -
I am not getting the headings of the fields in ALV output.
I am not getting ALV out put but the headings of the fields in ALV output.
Please see my below code .
TYPES : BEGIN OF ty_zgxmit.
INCLUDE STRUCTURE zgxmit.
TYPES : END OF ty_zgxmit.
DATA : gt_zgxmit TYPE TABLE OF ty_zgxmit.
*& Form alv_display *
This subroutine is to display the out put in ALV. *
FORM alv_display .
Local data
DATA: y_x LIKE boole VALUE 'X'.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: lf_fieldcat TYPE slis_fieldcat_alv.
DATA: lh_index LIKE lf_fieldcat-col_pos.
For variant
DATA: ws_repid LIKE sy-repid,
g_save TYPE c VALUE 'A',
g_exit TYPE c,
g_variant LIKE disvariant,
gx_variant LIKE disvariant.
For 1st field.( RPT_LOC )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'RPT_LOC'.
lf_fieldcat-tabname = 'GT_ZGXMIT'.
lf_fieldcat-ref_tabname = 'RPT_LOC'.
lf_fieldcat-ref_fieldname = 'ZGXMIT'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
For 2nd field.( BAL_XMIT )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'BAL_XMIT'.
lf_fieldcat-tabname = 'GT_ZGXMIT'.
lf_fieldcat-ref_tabname = 'BAL_XMIT'.
lf_fieldcat-ref_fieldname = 'ZGXMIT'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
For 3rd field.( INC_XMIT )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'INC_XMIT'.
lf_fieldcat-tabname = 'GT_ZGXMIT'.
lf_fieldcat-ref_tabname = 'INC_XMIT'.
lf_fieldcat-ref_fieldname = 'ZGXMIT'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
For 4th field.( Z500_XMIT )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'Z500_XMIT'.
lf_fieldcat-tabname = 'GT_ZGXMIT'.
lf_fieldcat-ref_tabname = 'Z500_XMIT'.
lf_fieldcat-ref_fieldname = 'ZGXMIT'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZJV_2245'
it_fieldcat = lt_fieldcat
TABLES
t_outtab = gt_zgxmit
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. " alv_displayYou can force the headings like so.
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'RPT_LOC'.
lf_fieldcat-tabname = 'GT_ZGXMIT'.
lf_fieldcat-ref_tabname = 'RPT_LOC'.
lf_fieldcat-ref_fieldname = 'ZGXMIT'.
lf_fieldcat-reptext_ddic = 'Whatever Heading'. "<- Right here
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
Regards,
Rich Heilman -
Add List box for one field in ALV GRID
Hi All,
I need to add drop down list box for one field in ALV Grid.
If any body knows, please help.
Thanks in advance.
Regards
MangleshHi,
Here is the ex where i have used for date parameter in the sel screen
type-pools: vrm.
data: name type vrm_id,
list type vrm_values,
value like line of list.
parameters : p_date like p_date2
as listbox visible length 15.
at selection-screen output.
name = 'P_DATE'.
value-key = '1'.
value-text = 'Today'.
append value to list.
value-key = '2'.
value-text = 'Last 7 days'.
append value to list.
value-key = '3'.
value-text = 'Last 30 days'.
append value to list.
value-key = '4'.
value-text = 'Last 90 days'.
append value to list.
value-key = '5'.
value-text = 'Last year'.
append value to list.
Call the ''VRM_SET_VALUES' to display the values in Listbox
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
at selection-screen.
if sy-ucomm = 'CLI1'.
sscrfields-ucomm = 'ONLI'(001).
endif.
if p_date = '1'.
p_date11 = sy-datum .
elseif p_date = '2'.
p_date11 = ( sy-datum - 7 ).
elseif p_date = '3'.
p_date11 = ( sy-datum - 30 ).
elseif p_date = '4'.
p_date11 = ( sy-datum - 90 ).
elseif p_date = '5'.
p_date11 = ( sy-datum - 365 ).
endif.
Hope this helps u..
Please reward points if useful.
Regards,
Sreenivas -
How to add F1 help for a field on ALV grid
Hi All,
When we execute a program, the output is displayed using ALV grid.
on the ALV grid, if we press F1 on a field, it should popup the help document.
How to add F1 help for a field on ALV grid.
Thank you all in advance.fill field LVC_S_FCAT-ROLLNAME of your fieldcatalog in method SET_TABLE_FOR_FIRST_DISPLAY
A. -
How to add a search help for a field in alv?
HI!Everyone ,
i want to add a search help created by myself for one field in alv,
and i want to use this function "HELP_VALUES_GET_WITH_TABLE".
can anyone help me ?
thanks!HI,Vijay.
My code like this :
PERFORM build_fcat.
PERFORM build_objects.
PERFORM layo_build.
PERFORM set_drdn_table .
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'STU_S'
is_layout = s_layo
CHANGING
it_outtab = itab_out
it_fieldcatalog = i_fcat
."Period
IF sy-subrc <> 0.
EXIT.
ENDIF.
for example, there is a field 'UNAME' IN Structure 'STU_S',
i want to add a search help for 'UNAME'.
the 'UNAME' is not users in SAP R/3 , i want to add some data by myself or from a table . -
How to display the fields in ALV Output without using Field catalog?
How to display the fields in ALV Output without using Field catalog?
Could you pls tell me the coding?
Akshitha.Hi,
u mean without building field catalog. is it? I that case, we can use the FM REUSE_ALV_FIELDCATALOG_MERGE.
data: itab type table of mara.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = itab
CHANGING
ct_fieldcat = lt_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
*Pass that field catalog into the fillowing FM
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_grid_title = 'REPORTING'
is_layout = gt_layout
it_fieldcat = lt_fieldcat[]
tables
t_outtab = itab. -
Negative sign display for CURR field in ALV grid report
I have a field BETRG defined as CURR field of length 15, decimal places 2. The value may be negative or positive. In case of negative values I am using EDIT_MSK option in the field catalog to bring the negative sign to the left of the value as shown below.
Quote
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'LT_FINAL'
i_inclname = sy-repid
CHANGING
ct_fieldcat = fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
LOOP AT fieldcat.
CASE fieldcat-fieldname.
WHEN 'BETRG'.
fieldcat-ctabname = ' '.
fieldcat-cfieldname = ' '.
fieldcat-edit_mask = 'RRV_______________.__'.
ENDCASE.
MODIFY fieldcat.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
i_grid_title = 'ABCD'
is_layout = gs_layout
it_fieldcat = fieldcat[]
i_save = 'A'
is_variant = gs_save
it_events = gs_events
TABLES
t_outtab = lt_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
Unquote
On displaying the report using 'REUSE_ALV_GRID_DISPLAY' as shown above, when the value of BETRG is a smaller number like say 624, then the ALV output appears as '- 624.00' instead of '-624.00'.
Is there any way that I can remove the space in between the negative sign and the number before displaying the ALV output using 'REUSE_ALV_GRID_DISPLAY'?Hi Deepak,
I tried this and found that this doesn't work in case of currency field. Once you move back the char field (with negative sign to the left and condensed) to the currency field, the negative sign again moves back to the right.
I think that the only way a negative sign can be brought to the left of the currenct field is by using edit_mask of field catalog as I have shown above.
Regards,
Shayeree. -
Dynamic displaying of decimal points for currency field in ALV
Hi,
In ALV output there is a currency field and displaying data of different countries. It should display decimal point according to the country's currency. But at a time it can display data of different countries.Hi Dilip,
I think your question is about currencies with different number of digits after decimal point. If you have the currency field in the ALV row, you have to give it's name as currency reference for the value field in the field catalog.
After creating the field catalog, call a form and do something like this (change fielnames accordingly).
<pre>
*& Form alv_fieldcat_enhance
Individual Enrichment of field catalog
FORM alv_fieldcat_enhance
CHANGING pt_alv_fieldcat TYPE slis_t_fieldcat_alv.
FIELD-SYMBOLS:
<alv_fieldcat> TYPE slis_fieldcat_alv.
LOOP AT pt_alv_fieldcat ASSIGNING <alv_fieldcat>.
IF <alv_fieldcat>-fieldname(5) = 'KBETR' OR
<alv_fieldcat>-fieldname(5) = 'SKBTR' OR
<alv_fieldcat>-fieldname(5) = 'DMBTR'.
Company code currency
<alv_fieldcat>-cfieldname = 'BWAER'.
Document Currency for conditions, net value and taxes
ELSEIF <alv_fieldcat>-fieldname(5) = 'KWERT' OR
<alv_fieldcat>-fieldname = 'NETWR' OR
<alv_fieldcat>-fieldname = 'NPAX_MWST_AMNT'.
Document Currency
<alv_fieldcat>-cfieldname = 'WAERK'.
ENDIF." <alv_fieldcat>-fieldname(5) = 'KBETR' or
ENDLOOP." at pt_alv_fieldcat assigning <fieldcat_alv>.
ENDFORM. " alv_fieldcat_enhance
</pre>
Regards,
Clemens -
How can we sum for the field on alv grid
Dear Freinds,
I am having the field count .....in the ouput (iam using alv grid) .......which dispalys the id's which are identical .
i have scneario similar to the below in my ALV Output
ID count total
4000 3 100
100
200 Can i get count 3 also along with 200 in alv?
i am using the code as follows for count can any one please let me know.
my earlier question which i put was confusing.........so i am givin the qustion again
clear ls_fieldcat.
ls_fieldcat-col_pos = 1.
ls_fieldcat-fieldname = 'ORGUNIT'.
ls_fieldcat-seltext_l = text-015. "'Orgunit'.
ls_fieldcat-key = 'X'.
ls_fieldcat-key_sel = 'X'.
ls_fieldcat-no_out = 'X'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 2.
ls_fieldcat-fieldname = 'COUNT'.
ls_fieldcat-seltext_l = 'H.Count'.
ls_fieldcat-outputlen = 4.
ls_fieldcat-do_sum = 'X'.
ls_fieldcat-datatype = 'NUMC'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'TOTAL'.
ls_fieldcat-seltext_m = 'total'.
ls_fieldcat-col_pos = 3.
ls_fieldcat-outputlen = 17.
ls_fieldcat-do_sum = 'X'.
ls_fieldcat-datatype = 'CURR'.
append ls_fieldcat to fp_i_fieldcat.
Please let me know how can do if so what is the parameter i have to change for COUNT
regards
syamalHi Shamala Kiran.
My name is also kiran.I have a develop a code for u.Actually i cant understand your code.But i know ur problem .Plz check that code.In that code i develop a subtotals and grandttotal.Plz observe the FORM "FIELD CATALOG" in that observe the NETWR FIELD and observe the FORM SORTCATALOG then ur problem will be solved.
Copy the the below code and execute that code and the result.
If u r Satisfied with the answer plz give the REWARD POINTS.
CODE:
Type Pools
TYPE-POOLS:slis.
Tables
TABLES: vbak,vbap.
Global Variable
data: w_var type i.
Global Data
DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_sortcat TYPE slis_t_sortinfo_alv,
wa_sortcat LIKE LINE OF it_sortcat.
Internal Table
data: BEGIN OF it_salesorder OCCURS 0,
vbeln LIKE vbak-vbeln, " Sales Document Number
posnr like vbap-posnr, " Sales Doc Item
netwr like vbap-netwr, " Net Value
END OF it_salesorder.
SELECT OPTIONS
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln. " Sales Document Number.
SELECTION-SCREEN END OF BLOCK b1.
Initialization
INITIALIZATION.
PERFORM initialization.
*& Form initialization
text
--> p1 text
<-- p2 text
form initialization .
s_vbeln-sign = 'I'.
s_vbeln-option = 'BT'.
s_vbeln-low = '4969'.
s_vbeln-high = '5000'.
APPEND s_vbeln.
endform. " initialization
Start Of Selection
START-OF-SELECTION.
PERFORM field_catalog. "For Structure Creation
PERFORM fetch_data. "Get the Data From DB Table
PERFORM sorting USING it_sortcat.
End Of Selection
END-OF-SELECTION.
perform display_data.
*& Form field_catalog
text
--> p1 text
<-- p2 text
form field_catalog .
wa_fieldcat-col_pos = w_var. " Column Position Variable
wa_fieldcat-tabname = 'IT_SALESORDER'. " Internal Table Name
wa_fieldcat-fieldname = 'VBELN'. " Field Name
wa_fieldcat-key = 'X'. " Blue Color
wa_fieldcat-ref_tabname = 'VBAK'. " Table Name
wa_fieldcat-ref_fieldname = 'VBELN'. " Field Name
wa_fieldcat-seltext_m = 'Sales Doc No'. " Display Text In Screen
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ADD 1 TO w_var.
wa_fieldcat-col_pos = w_var. " Column Position Variable
wa_fieldcat-tabname = 'IT_SALESORDER'. " Internal Table Name
wa_fieldcat-fieldname = 'POSNR'. " Field Name
wa_fieldcat-ref_tabname = 'VBAP'. " Table Name
wa_fieldcat-ref_fieldname = 'POSNR'. " Field Name
wa_fieldcat-seltext_m = 'Sales Doc Item'. " Display Text In Screen
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ADD 1 TO w_var.
wa_fieldcat-col_pos = w_var. " Column Position Variable
wa_fieldcat-tabname = 'IT_SALESORDER'. " Internal Table Name
wa_fieldcat-fieldname = 'NETWR'. " Field Name
wa_fieldcat-ref_tabname = 'VBAP'. " Table Name
wa_fieldcat-ref_fieldname = 'NETWR'. " Field Name
wa_fieldcat-do_sum = 'X'. " Sum
wa_fieldcat-seltext_m = 'Net Value'. " Display Text In Screen
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ADD 1 TO w_var.
endform. " field_catalog
*& Form sorting
text
-->P_IT_SORTCAT text
form sorting using p_it_sortcat TYPE slis_t_sortinfo_alv.
wa_sortcat-fieldname = 'VBELN'.
wa_sortcat-up ='X'.
wa_sortcat-subtot = 'X'.
APPEND wa_sortcat TO p_it_sortcat.
endform. " sorting
*& Form display_data
text
--> p1 text
<-- p2 text
form display_data .
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 = ' '
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 = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = it_sortcat
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 = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
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 = it_salesorder
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_data
*& Form fetch_data
text
--> p1 text
<-- p2 text
form fetch_data .
select a~vbeln
posnr
b~netwr
from vbak as a
inner join vbap as b on avbeln = bvbeln
into table it_salesorder
where a~vbeln in s_vbeln.
endform. " fetch_data -
Not allowing totaling of a field in alv output
hi,
I had made a ALV in which i have to hide 1 field for getting it totaling.
i.e. if somebody try to make total of it ,it should not be allowed on dat field . is dere any solution for this problem?
plzz provide me guidelines for it.Please please it this. I made the total for every field other than RACCT and SUM_COMM.
*& Form sub_prepare_display_output
Display output
--> No Parameter
FORM sub_prepare_display_output .
Local variables
DATA: l_lead_col TYPE char25, " Lead column
l_progname TYPE sy-repid, " Program name
Local internal tables
l_oref_layout TYPE REF TO cl_salv_layout, "Layout
Local work area
l_wa_key TYPE salv_s_layout_key, "Work area for key
l_except1 TYPE REF TO cx_salv_msg,"Exception
l_text1 TYPE string. "Exception msg
If profit center is checked
IF p_prfctr = c_check.
l_lead_col = 'Profit Center'(041).
If product catagory is checked
ELSEIF p_prodc = c_check.
l_lead_col = 'Product Category'(042).
If material is checked
ELSEIF p_smatnr = c_check.
l_lead_col = 'Material No.'(043).
ENDIF.
Create ALV instance with class-method cl_salv_table=>factory
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
IMPORTING
r_salv_table = v_oref_table
CHANGING
t_table = i_final.
CATCH cx_salv_msg INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
Make header of the report
PERFORM sub_header_report USING v_oref_table.
Get the toolbar
v_oref_functions = v_oref_table->get_functions( ).
For activating application toolbar
v_oref_functions->set_all( abap_true ).
v_oref_columns = v_oref_table->get_columns( ).
It populate the key fields which are always displayed
PERFORM sub_fill_fields_of_fcatalog USING:
'SUM_COMM' l_lead_col ' ',
'RACCT' 'Account Number'(035) ' ',
'FOBAC' 'FOB Acrual'(023) 'X',
'EXCESS' 'Excess'(024) 'X',
'OBSOLE' 'Obsolescence'(025) 'X',
'PPV' 'Puchachse Price Var'(026) 'X',
'FR_VAR' 'Freight Variance'(027) 'X',
'PROD_OR_VAR' 'Produc Ord Var'(028) 'X',
'DEP_VAR' 'Dept. Variance'(029) 'X',
'OTH_PROD_VAR' 'Other Prod Var'(030) 'X',
'PR_OR_SCRP_VAR' 'Scrap Variance'(031) 'X',
'COST_OF_ACC' 'Cost of Sales Accnt'(032) 'X',
'INV_ACC' 'Inventory Account'(033) 'X'.
Optimize the columns
v_oref_columns->set_optimize( value = 'X' ).
Setting the layout
get the LAYOUT object
l_oref_layout = v_oref_table->get_layout( ).
set the layout key
l_progname = sy-repid.
l_wa_key-report = l_progname.
l_oref_layout->set_key( value = l_wa_key ).
set save restriction:
none / only user-dependent / only user-independent
l_oref_layout->set_save_restriction(
value = if_salv_c_layout=>restrict_none ).
set: setting of default layout is allowed / isnu2019t allowed
l_oref_layout->set_default( value = 'X' ).
Dispaly the output
v_oref_table->display( ).
ENDFORM. " sub_prepare_display_output
*& Form sub_header_report
Create the header of the report
-->P_v_oref_TABLE table name
FORM sub_header_report USING p_v_oref_table TYPE REF TO
cl_salv_table .
DATA : l_oref_grid TYPE REF TO cl_salv_form_layout_grid.
CREATE OBJECT l_oref_grid.
Add text items for top of page
l_oref_grid->create_text( row = 1 column = 1 text = 'Program'(022)
l_oref_grid->create_text( row = 1 column = 2 text = sy-repid ).
l_oref_grid->create_text( row = 2 column = 1
text = 'User Name'(021) ).
l_oref_grid->create_text( row = 2 column = 2 text = sy-uname ).
l_oref_grid->create_text( row = 3 column = 1 text = 'Date'(020) ).
l_oref_grid->create_text( row = 3 column = 2 text = sy-datum ).
l_oref_grid->create_text( row = 3 column = 3 text = 'Time'(019) ).
l_oref_grid->create_text( row = 3 column = 4 text = sy-uzeit ).
l_oref_grid->create_text( row = 4 column = 1 text = 'System'(018) ).
l_oref_grid->create_text( row = 4 column = 2 text = sy-sysid ).
l_oref_grid->create_text( row = 4 column = 3 text = 'Client'(017) ).
l_oref_grid->create_text( row = 4 column = 4 text = sy-mandt ).
Declare grid as header of list
p_v_oref_table->set_top_of_list( value = l_oref_grid ).
ENDFORM. " sub_header_report
*& Form sub_fill_fields_of_fcatalog
This subroutine populates the field catalog excluding
period fields
-->P_FIELDNAME Table field name
-->P_NAME Field description
-->P_DEC Decimal value flag
FORM sub_fill_fields_of_fcatalog USING p_fieldname TYPE lvc_fname
p_name TYPE c
p_dec TYPE c.
DATA: l_char_l TYPE scrtext_l, "For short text
l_char_m TYPE scrtext_m, "For medium text
l_char_s TYPE scrtext_s, "For long text
l_except1 TYPE REF TO cx_salv_not_found,"Exception
l_text1 TYPE string, "Exception msg
l_orf_aggregs TYPE REF TO cl_salv_aggregations.
Getting the text long/short/medium into variables
l_char_l = p_name.
l_char_m = p_name.
l_char_s = p_name.
Setting the long/short/medium text and fix the key fileds
TRY.
CALL METHOD v_oref_columns->get_column
EXPORTING
columnname = p_fieldname
RECEIVING
value = v_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
v_oref_column ?= v_oref_column1.
v_oref_column->set_long_text( l_char_l ).
v_oref_column->set_medium_text( l_char_m ).
v_oref_column->set_short_text( l_char_s ).
v_oref_column->set_key( value = 'X' ).
v_oref_columns->set_key_fixation( value = 'X' ).
Set the decimal length
IF p_dec = 'X'.
v_oref_column->set_decimals( value = '2' ).
ENDIF.
IF p_fieldname = 'RACCT' AND p_gl <> c_check.
v_oref_column->set_visible( value = space ).
ENDIF.
IF p_gl = c_check.
v_oref_columns->set_column_position( columnname = 'RACCT'
position = 2 ).
ENDIF.
IF p_fieldname NE 'RACCT' AND p_fieldname NE 'SUM_COMM'.
l_orf_aggregs = v_oref_table->get_aggregations( ).
l_orf_aggregs->add_aggregation( columnname = p_fieldname
aggregation = if_salv_c_aggregation=>total ).
ENDIF.
ENDFORM. " sub_fill_fields_of_fcatalog
Maybe you are looking for
-
Problems with opening Adobe Reader 9 or pdf files
Hi, Can someone please help me resolve this problem? I had no problem using Adobe Reader 8 but since removing Adobe Reader 8 and download the updated Adobe Reader 9, I cannot open any pdf files or the Adobe Reader 9 (on desktop) without receiving th
-
Javax.crypto.* is not present in JDK 1.4 plz help
Hi, Currently i am using jdk 1.4 and I am trying to compile the security applications which are using javax.crypto.* package. Hence it is giving error so can any one please help me how can I include this package into jdk 1.4 or is there any other alt
-
Is there any way to get Mini Bridge to show the color labels that are set in Bridge and/or Lightroom? I am using Cloud InDesign CS6 on Windows 7.
-
Multitrack recording in audition cs6 - input hardware question
I use audition cs6 on win 7 pro for editing and hospital radio production work. Soon to take delivery of a Sonifex S2 desk for the main studio and have a need to be able to record two seperate stereo outputs from the desk simultaneously (for example
-
I recently purchased a 2012 Volvo XC60. When attempting to control and play music through the USB connection and the iPod function on the audio system, my iPhone 4S (version 5.1) continually switches the audio output to bluetooth. That results in m