Sorting name1 RFZALI20
Hello,
I would like to sort the payment list by name of the vendor(lfa1-name1) and not with the number of lifnr (lfa1-lifnr).
Actually the list is sort by lfa1-lifnr. I dont' would like to change the display just the sorting.
Can you help me ?
best regards
Hi Fany,
I believe it can help you.
http://help.sap.com/saphelp_45b/helpdata/en/35/b0ec5787a62488e10000009b38f9b7/content.htm
Regards,
Fernando Evangelista
Similar Messages
-
FBL5N Customer Namewise Sorting Needed
Dear Friends,
In FBL5n , now Customer Codewise Sorting is coming. My Requirment is Customer Namewise Sorting.
both Customer Number and Name are in Header Level.HEllo!
Please, read my explanation below:
The field NAME1 is not included in the tables BSEG and BSID/BSAD or in
the structures RFPOS and RFPOSX. Therefore, you will not be able to add
NAME1 to the line item display in FBL5N as a standard field or as a
special field (note 215798).
But, there is a workaround for this.
If you need NAME1 to be shown in the Line Item Display then you need to
add the field to the structures RFPOS and RFPOSX.
When the structure has been extended with the field then you need to
run the reports RFPOSXEXTEND and BALVBUFDEL (in the same way as seen in
the solution part in note 215798).
After that you need to use the Open FI Exit 1650 to fill the fields. You
will find a function group FI_ITEMS from transaction SE80. In this func-
tion group you will find a function module FI_ITEMS_DISPLAY where the
form ITEMS_DISPLAY_INIT includes the exits 1610 to 1650. The important
one for your problem is 1650 (OPEN_FI_PERFORM_00001650_E).
This exit is used if you want to display fields in e.g. FBL5N which
does not exist in the tables BSID/BSAD and also not in the customer
line item in BSEG.
Through this user exit it should be possible to get the value from the
relevant tables e.g. from other customer tables into structure RFPOSXEXT
if there is a relation between the relevant tables e.g. KNA1 to RFPOSX/
BSID.
Please also have a look at notes 112312 and 217189.
I hope this information clarifies your query ;D !
Regards,
REnan -
Hi all
I create matrix report( in version 9i)
I want sort columns of report
when i use order by it sort rows but i want sort columns
my query is like this:
SELECT
Code,
name,
DECODE(cons_code, '1', 'A',
'2', 'B',
'3','C',
'4', 'D',
'5', 'E') Activity,
SUM(amnt) amount
From Mytable
Where ....
group by
Code,
DECODE(cons_code, '1', 'A',
'2', 'B',
'3','C',
'4', 'D',
'5', 'E')
my group base on code
my columns base on Activity
and cells are Amount
my report result is:
........ B E D A C
name1 1 1 1 1 2
name2 3 4 8 6 1
I want this :
........ A B C D E
name1 1 1 1 1 2
name2 3 4 8 6 1
....Hello,
How about this?
SELECT Code, name,
DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D','5', 'E') Activity, SUM(amnt) amount
From Mytable
WHERE ....
GROUP BY Code, name, DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D', '5', 'E')
ORDER BY code, DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D', '5', 'E') -
Print or download ALV report with sort options
Dear friends,
How i can download into excel or print ALV report with sort options, like customer name column with similar values should not repeat in the print out or download file.
Regards,
Praveen LoboHi Praveen,
Use this code, its working:-
*FOR SORTING DATA
DATA : it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
* SORT W.R.T. CUSTOMER NAME
wa_sort-spos = 1.
wa_sort-fieldname = 'NAME1'. "field customer name
wa_sort-tabname = 'IT_KNA1'. "internal table with records
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
"this will sort the ALV o/p for customer with same name
"now the name will not be repeated
"records with same name will be grouped
* DISPLAY RECORDS IN ALV GRID
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid "report id
it_fieldcat = it_field "field catalog
it_sort = it_sort "sort info
TABLES
t_outtab = it_kna1 "internal table
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
Edited by: Tarun Gambhir on Dec 31, 2008 1:13 PM -
To hide some headings in top of page during sorting of fields...
dear experts,
I have a report in which i am fetching multiple company codes in report and in o/p they are displayed according to company codes, but during sorting of any field in list i want to hide some of the headings in top of page...for any of the radio buttons the headings which i want to hide are...
1) company code
2) opening balance and
3) closing balance
please help...my code is as follows...
TYPE-POOLS:slis.
TABLES:bkpf,bseg,kna1,bsid.
TYPES:BEGIN OF ty_bsad,
bukrs TYPE bsad-bukrs,
gjahr TYPE bsad-gjahr,
kunnr TYPE bsad-kunnr,
belnr TYPE bsad-belnr,
budat TYPE bsad-budat,
xblnr TYPE bsad-xblnr,
bldat TYPE bsad-bldat,
augdt TYPE bsad-augdt,
dmbtr type bsad-dmbtr,
END OF ty_bsad.
TYPES:BEGIN OF ty_kna1,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
city TYPE kna1-ort01,
END OF ty_kna1.
TYPES:BEGIN OF ty_knb1,
kunnr TYPE knb1-kunnr,
bukrs TYPE knb1-bukrs,
vzskz TYPE knb1-vzskz,
END OF ty_knb1.
TYPES:BEGIN OF ty_bkpf,
bukrs TYPE bkpf-bukrs,
gjahr TYPE bkpf-gjahr,
hwaer TYPE bkpf-hwaer,
kursf TYPE bkpf-kursf,
bktxt TYPE bkpf-bktxt,
belnr TYPE bkpf-belnr,
budat TYPE bkpf-budat,
xblnr TYPE bkpf-xblnr,
bldat TYPE bkpf-bldat,
waers TYPE bkpf-waers,
END OF ty_bkpf.
TYPES:BEGIN OF ty_bsid,
bukrs TYPE bsid-bukrs,
gjahr TYPE bsid-gjahr,
kunnr TYPE bsid-kunnr,
belnr TYPE bsid-belnr,
budat TYPE bsid-budat,
xblnr TYPE bsid-xblnr,
bldat TYPE bsid-bldat,
augdt TYPE bsid-augdt,
dmbtr type bsid-dmbtr,
END OF ty_bsid.
TYPES:BEGIN OF ty_bseg,
bukrs TYPE bseg-bukrs,
gjahr TYPE bseg-gjahr,
belnr TYPE bseg-belnr,
kunnr TYPE bseg-kunnr,
werks TYPE bseg-werks,
umskz TYPE bseg-umskz,
zuonr TYPE bseg-zuonr,
dmbtr TYPE bseg-dmbtr,
zbd1t TYPE bseg-zbd1t,
sgtxt TYPE bseg-sgtxt,
shkzg TYPE bseg-shkzg,
zterm TYPE bseg-zterm,
zfbdt TYPE bseg-zfbdt,
END OF ty_bseg.
TYPES:BEGIN OF ty_open,
bukrs TYPE bsid-bukrs,
shkzg TYPE bsid-shkzg,
dmbtr TYPE bsid-dmbtr,
umskz TYPE bsid-umskz,
END OF ty_open.
**Main internal Table
**For both open & cleared Customer
DATA:BEGIN OF it_main_all OCCURS 0,
bukrs TYPE bsad-bukrs,
gjahr TYPE bsad-gjahr,
kunnr TYPE bsad-kunnr,
belnr TYPE bsad-belnr,
budat TYPE bsad-budat,
xblnr TYPE bsad-xblnr,
bldat TYPE bsad-bldat,
augdt TYPE bsad-augdt,
dmbtr type bsad-dmbtr,
hwaer TYPE bkpf-hwaer,
kursf TYPE bkpf-kursf,
bktxt TYPE bkpf-bktxt,
name TYPE kna1-name1,
city TYPE kna1-ort01,
vzskz TYPE knb1-vzskz,
lights TYPE c,
END OF it_main_all.
**For Opening balance
DATA:BEGIN OF it_main_open1 OCCURS 0,
bukrs TYPE bsid-bukrs,
opening TYPE p DECIMALS 2,
END OF it_main_open1.
**Internal tables
DATA : t_bsad TYPE STANDARD TABLE OF ty_bsad,
w_bsad TYPE ty_bsad,
t_bkpf TYPE STANDARD TABLE OF ty_bkpf,
w_bkpf TYPE ty_bkpf,
t_kna1 TYPE STANDARD TABLE OF ty_kna1,
w_kna1 TYPE ty_kna1,
t_knb1 TYPE STANDARD TABLE OF ty_knb1,
w_knb1 TYPE ty_knb1,
t_bsid TYPE STANDARD TABLE OF ty_bsid,
w_bsid TYPE ty_bsid,
t_bseg TYPE STANDARD TABLE OF ty_bseg,
w_bseg TYPE ty_bseg,
t_open TYPE STANDARD TABLE OF ty_open,
w_open TYPE ty_open.
**ALV display variables
DATA:fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_layout TYPE slis_layout_alv,
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
heading TYPE slis_t_listheader,
g_save(1) TYPE c,
g_exit(1) TYPE c,
g_variant TYPE disvariant,
gx_variant TYPE disvariant,
it_sort TYPE slis_t_sortinfo_alv,
x_sort TYPE slis_sortinfo_alv.
**Selection Screens
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_bukrs FOR bkpf-bukrs OBLIGATORY,
s_gjahr FOR bkpf-gjahr OBLIGATORY NO-EXTENSION NO INTERVALS,
s_kunnr FOR bseg-kunnr OBLIGATORY NO-EXTENSION NO INTERVALS,
s_name1 FOR kna1-name1 NO-EXTENSION NO INTERVALS,
s_date FOR bkpf-budat OBLIGATORY,
s_umskz FOR bsid-umskz.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS:xnorm AS CHECKBOX DEFAULT 'X',
xshbv AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b3.
DATA:golive TYPE d VALUE '20080401',
date TYPE d,
date1 TYPE d,
closing TYPE p DECIMALS 2 VALUE 0,
opening TYPE p DECIMALS 2 VALUE 0.
**Start Of Selection
START-OF-SELECTION.
PERFORM get_data.
PERFORM events.
PERFORM f_layout.
PERFORM display.
FORM get_data .
**Open Customers master data
SELECT
bukrs gjahr kunnr belnr budat xblnr bldat augdt dmbtr
FROM bsid
INTO TABLE t_bsid
WHERE bukrs IN s_bukrs
AND gjahr IN s_gjahr
AND kunnr IN s_kunnr
AND budat IN s_date
AND umskz IN s_umskz.
**Clear Customers master data
SELECT
bukrs gjahr kunnr belnr budat xblnr bldat augdt dmbtr
FROM bsad
INTO TABLE t_bsad
WHERE bukrs IN s_bukrs
AND gjahr IN s_gjahr
AND kunnr IN s_kunnr
AND budat IN s_date
AND umskz IN s_umskz.
****Open Customers data
IF NOT t_bsid[] IS INITIAL.
SORT t_bsid BY bukrs bldat.
SELECT
bukrs gjahr hwaer kursf bktxt belnr
FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE t_bkpf
FOR ALL ENTRIES IN t_bsid
WHERE bukrs = t_bsid-bukrs
AND gjahr = t_bsid-gjahr
AND belnr = t_bsid-belnr.
SORT t_bkpf.
SELECT
kunnr name1 ort01
FROM kna1
INTO TABLE t_kna1
FOR ALL ENTRIES IN t_bsid
WHERE kunnr = t_bsid-kunnr
AND name1 IN s_name1.
SORT t_kna1.
SELECT
kunnr bukrs vzskz
FROM knb1
INTO TABLE t_knb1
FOR ALL ENTRIES IN t_bsid
WHERE kunnr = t_bsid-kunnr
AND bukrs = t_bsid-bukrs.
SORT t_knb1.
LOOP AT t_bsid INTO w_bsid.
it_main_all-bukrs = w_bsid-bukrs.
it_main_all-kunnr = w_bsid-kunnr.
it_main_all-gjahr = w_bsid-gjahr.
it_main_all-belnr = w_bsid-belnr.
it_main_all-budat = w_bsid-budat.
it_main_all-xblnr = w_bsid-xblnr.
it_main_all-bldat = w_bsid-bldat.
READ TABLE t_bkpf INTO w_bkpf WITH KEY bukrs = w_bsid-bukrs gjahr = w_bsid-gjahr belnr = w_bsid-belnr BINARY SEARCH.
IF sy-subrc EQ 0.
it_main_all-hwaer = w_bkpf-hwaer.
it_main_all-kursf = w_bkpf-kursf.
it_main_all-bktxt = w_bkpf-bktxt.
ENDIF.
READ TABLE t_kna1 INTO w_kna1 WITH KEY kunnr = w_bsid-kunnr BINARY SEARCH.
IF sy-subrc EQ 0.
it_main_all-name = w_kna1-name1.
it_main_all-city = w_kna1-city.
ENDIF.
READ TABLE t_knb1 INTO w_knb1 WITH KEY kunnr = w_bsid-kunnr BINARY SEARCH.
IF sy-subrc EQ 0.
it_main_all-vzskz = w_knb1-vzskz.
ENDIF.
it_main_all-lights = '1'.
APPEND it_main_all.
CLEAR it_main_all.
CLEAR : w_bsid, w_bkpf, w_kna1, w_knb1.
ENDLOOP .
ENDIF.
**Clear customers data
IF NOT t_bsad[] IS INITIAL.
SORT t_bsad BY bukrs bldat.
SELECT
bukrs gjahr hwaer kursf bktxt belnr
FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE t_bkpf
FOR ALL ENTRIES IN t_bsad
WHERE bukrs = t_bsad-bukrs
AND gjahr = t_bsad-gjahr
AND belnr = t_bsad-belnr.
SORT t_bkpf.
SELECT
kunnr name1 ort01
FROM kna1
INTO TABLE t_kna1
FOR ALL ENTRIES IN t_bsad
WHERE kunnr = t_bsad-kunnr
AND name1 IN s_name1.
SORT t_kna1.
SELECT
kunnr bukrs vzskz
FROM knb1
INTO TABLE t_knb1
FOR ALL ENTRIES IN t_bsad
WHERE kunnr = t_bsad-kunnr
AND bukrs = t_bsad-bukrs.
SORT t_knb1.
LOOP AT t_bsad INTO w_bsad.
it_main_all-bukrs = w_bsad-bukrs.
it_main_all-gjahr = w_bsad-gjahr.
it_main_all-kunnr = w_bsad-kunnr.
it_main_all-belnr = w_bsad-belnr.
it_main_all-budat = w_bsad-budat.
it_main_all-xblnr = w_bsad-xblnr.
it_main_all-bldat = w_bsad-bldat.
READ TABLE t_bkpf INTO w_bkpf WITH KEY bukrs = w_bsad-bukrs gjahr = w_bsad-gjahr belnr = w_bsad-belnr BINARY SEARCH.
IF sy-subrc EQ 0.
it_main_all-hwaer = w_bkpf-hwaer.
it_main_all-kursf = w_bkpf-kursf.
it_main_all-bktxt = w_bkpf-bktxt.
ENDIF.
READ TABLE t_kna1 INTO w_kna1 WITH KEY kunnr = w_bsad-kunnr BINARY SEARCH.
IF sy-subrc EQ 0.
it_main_all-name = w_kna1-name1.
it_main_all-city = w_kna1-city.
ENDIF.
READ TABLE t_knb1 INTO w_knb1 WITH KEY kunnr = w_bsad-kunnr BINARY SEARCH.
IF sy-subrc EQ 0.
it_main_all-vzskz = w_knb1-vzskz.
ENDIF.
it_main_all-lights = '3'.
APPEND it_main_all.
CLEAR : w_bsad, w_bkpf, w_kna1, w_knb1.
ENDLOOP .
ENDIF.
ENDFORM. " get_data
*& Form events
FORM events .
DATA : l_i_event TYPE slis_alv_event.
l_i_event-name = 'TOP_OF_PAGE' .
l_i_event-form = 'TOP2' .
APPEND l_i_event TO gt_events .
CLEAR l_i_event .
ENDFORM. " events
*& Form f_layout
FORM f_layout .
CLEAR gd_layout.
gd_layout-detail_popup = 'X'.
gd_layout-zebra = 'X'.
gd_layout-no_vline = ' '.
gd_layout-lights_fieldname = 'LIGHTS'.
gd_layout-colwidth_optimize = 'X'.
ENDFORM. " f_layout
*& Form display
FORM display .
fieldcatalog-fieldname = 'BUKRS'.
fieldcatalog-tabname = 'IT_MAIN_ALL'.
fieldcatalog-seltext_m = 'Company Code'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'GJAHR'.
fieldcatalog-tabname = 'IT_MAIN_ALL'.
fieldcatalog-seltext_m = 'Fiscal year'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'BELNR'.
fieldcatalog-tabname = 'IT_MAIN_ALL'.
fieldcatalog-seltext_m = 'Doc No.'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'BLDAT'.
fieldcatalog-tabname = 'IT_MAIN_ALL'.
fieldcatalog-seltext_m = 'Doc Date'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'BUDAT'.
fieldcatalog-tabname = 'IT_MAIN_ALL'.
fieldcatalog-seltext_m = 'Posting date'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'DMBTR'.
fieldcatalog-tabname = 'IT_MAIN_ALL'.
fieldcatalog-seltext_m = 'Amt in local cur.'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-just = 'R'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
**For Subtotal of fields
x_sort-fieldname = 'BUKRS' .
x_sort-group = '*'.
x_sort-subtot = 'X'.
APPEND x_sort TO it_sort.
CLEAR x_sort .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_sort = it_sort
i_default = 'X'
it_events = gt_events[]
TABLES
t_outtab = it_main_all
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.
*& Form top_of_page
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'RUCHI_LOGO'
it_list_commentary = heading[].
ENDFORM.
*& Form opening
FORM opening USING p_bukrs TYPE bsid-bukrs.
DATA : opdate TYPE d.
IF s_date-low < golive.
opening = 0.
ELSE.
opdate = s_date-low - 1.
SELECT
bukrs shkzg dmbtr umskz
FROM bsid
INTO TABLE t_open
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND gjahr IN s_gjahr
AND budat <= opdate.
LOOP AT t_open INTO w_open.
IF w_open-shkzg = 'S'.
opening = opening + w_open-dmbtr.
ELSEIF w_open-shkzg = 'H'.
w_open-dmbtr = w_open-dmbtr * ( -1 ).
opening = opening + w_open-dmbtr .
ENDIF.
CLEAR : w_open.
ENDLOOP.
SELECT
bukrs shkzg dmbtr umskz
FROM bsad
INTO TABLE t_open
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND gjahr IN s_gjahr
AND budat <= opdate.
LOOP AT t_open INTO w_open.
IF w_open-shkzg = 'S'.
opening = opening + w_open-dmbtr.
ELSEIF w_open-shkzg = 'H'.
w_open-dmbtr = w_open-dmbtr * ( -1 ).
opening = opening + w_open-dmbtr.
ENDIF.
CLEAR w_open.
ENDLOOP.
ENDIF.
ENDFORM.
*& Form top2
FORM top2 .
date = s_date-low.
date1 = s_date-high.
WRITE : / 'CUSTOMER LEDGER FOR ALL ITEMS' COLOR 7.
WRITE : / 'Customer Code:', it_main_all-kunnr.
WRITE : / 'Customer Name:', it_main_all-name.
WRITE : / 'Customer City:', it_main_all-city.
ON CHANGE OF it_main_all-bukrs.
WRITE : / 'Company Code:' COLOR 3 , it_main_all-bukrs COLOR 3.
PERFORM opening USING it_main_all-bukrs.
PERFORM closing USING it_main_all-bukrs.
WRITE : / 'Opening Balance : Rs.' , opening .
WRITE : / 'Closing Balance : Rs.' , closing .
ENDON.
CLEAR : closing, opening.
IF date1 IS INITIAL.
WRITE : / 'Date:', date DD/MM/YYYY.
ELSE.
WRITE : / 'Date:' , date DD/MM/YYYY, ' to ', date1 DD/MM/YYYY.
ENDIF.
ENDFORM.
*&Form closing
FORM closing USING c_bukrs TYPE bsid-bukrs.
LOOP AT it_main_all WHERE bukrs = c_bukrs.
closing = closing + it_main_all-dmbtr.
ENDLOOP .
closing = closing + opening .
ENDFORM.
Edited by: Vishu on Apr 20, 2009 9:32 AMit can be done with the help of a system code 'sy-xcode'. it is initialised the time list is sorted so just keeping a check point, we can solve this problem.
Vishu Khandelwal -
How to use SELECT statement to extract KNA1-NAME1 and KNB1-ZSABE
In building table I_KNA1 in form f_extract_data, an additional select statement is needed to select and append datafrom (KNA1 and KNB1) to existing I_KNA1
In form f_extract_data table i_kna1 is populated with data from zd_kna101.(where ZD_KNA101 is a view of KNA1, KNB1 and KNBK. It's a joint of these three tables.) This will take care of all customers with KNBK-BANKL and KNBK-BANLN populated. But this does not include new customers created in SAP CRM (no KNBK records). Therefore a separate SELECT statement is needed to extract KNA1-NAME1 and KNB1-ZSABE for customers created in SAP CRM(the customers who do do not have BANKL and BANKN). These selected records are then need to be appended to I_KNA1. It's possible that new selection statement might extract records that are already in existing I_KNA1 table. IF this is the case, right after the append, sort I_KNA1 and remove duplicate records.
form f_extract_data.
select kunnr " Customer Number
name1 " Name
zsabe " Business Unit
bankl " Legacy Bank Key
bankn " Legacy Bank Account
from zd_kna101 " View of KNA1, KNB1, and KNBK
into table i_kna1
for all entries in i_doc_by_ref
where kunnr = i_doc_by_ref-kunnr
and zsabe in s_zsabe.
if sy-subrc <> 0.
message a116 with 'customer'. " Customer Table is empty. HALT!!!
else.
sort i_kna1 by kunnr.
endif.
will I have to use the join statement(for KNA1-NAME1 and KNB1-ZSABE using the key as KUNNR) here or give two seperate select statements for extracting data from KNA1 and KNB1 using the key as KUNNR.
THANKS FOR THE HELP.I would suggest using the join on KUNNR. Maybe something like this.
data: begin of itab occurs 0,
kunnr type kna1-kunnr,
name1 type kna1-name1,
ZSABE type knb1-ZSABE,
end of itab.
select kna1~kunnr kna1~name1 knb1~zsabe
into table itab
from kna1
inner join knb1
on kna1~kunnr = knb1~kunnr
where ........
Regards,
Rich Heilman -
Sort the Nodes and remove duplicate nodes
Hello Experts,
I have a requirement to sort the nodes based on a key value.
e.g.
<Node>
<Key>2<Key>
<Value1>name1<Value1>
<Value2>email1<Value2>
</Node>
<Node>
<Key>1<Key>
<Value1>name2<Value1>
<Value2>email2<Value2>
</Node>
<Node>
<Key>2<Key>
<Value1>name3<Value1>
<Value2>email3<Value2>
</Node>
and the Output should be
<TNode>
<Key>1<Key>
<Value1>name2<Value1>
<Value2>email2<Value2>
</TNode>
<TNode>
<Key>2<Key>
<Value1>name3<Value1>
<Value2>email3<Value2>
</TNode>
I tried using SortByKey function for Node i.e.
Key --> SortByKey , Node --> TNode
But I dont get sorted value for Value1 and Value2.
Can anybody give solution for this?
I have around 25000 records as input and there are around 25 values in structure.
Please help.
Thanks in advance,
Beena.Beena,
Here you go. If it doesn't helps then let me know.
Mapping.
http://www.flickr.com/photo_zoom.gne?id=2185600055&size=o
http://www.flickr.com/photo_zoom.gne?id=2185600049&size=o
http://www.flickr.com/photo_zoom.gne?id=2185600063&size=o
http://www.flickr.com/photo_zoom.gne?id=2185600067&size=o
Results
http://www.flickr.com/photo_zoom.gne?id=2185600075&size=o -
How to sort web dynpro table wich data bind to CAF Entity Service
Hi
I created UI Table based on Model Node (CAF Entity).
When I try to sort this Table with using TableSorter, I get following in the trace log:
The error is: com.sap.caf.rt.exception.CAFBaseRuntimeException: Aspect does not support changing rows via its list interface
Have I met CAF limitation, or do I do something wrong?Hi Nikolai,
if you use the implementation
<code>
IServiceFacade serviceFacade = CAFServiceFactory.getServiceFacade(ts2Definition.class);
</code>
it means you use the typed access.
Possible in this sneak the
<code>
IServiceFacade serviceFacade = CAFServiceFactory.getServiceFacade();
</code>
does not work.
Try the following way - it must work.
<code>
private IServiceFacade getServiceFacade() {
final String method = "getServiceFacade()";
entering(method);
if (m_serviceFacade==null) {
try {
CoolConnectionProperties properties = new CoolConnectionProperties()
public String getCoolHost()
return "caf";
m_serviceFacade = CoolUtils.getServiceFacade(properties);
} catch (CoolConnectionPropertiesException e) {
wdComponentAPI.getMessageManager().reportException(e.getMessage(),false);
CAFUIPublicLogger.traceThrowable(Severity.ERROR, method, e) ;
} catch (CoolUtilsException e) {
wdComponentAPI.getMessageManager().reportException(e.getMessage(),false);
CAFUIPublicLogger.traceThrowable(Severity.ERROR, method, e) ;
exiting(method) ;
return m_serviceFacade;
</code>
Also do not sort in query. Sort the model node after you aspect binded. Use the method
node.sort(your_comparator) ;
the comparator like this:
<code>
public class YourComparator implements Comparator
public int compare(Object o1, Object o2)
IWDNodeElement nodeElement1 = (IWDNodeElement) o1 ;
IWDNodeElement nodeElement2 = (IWDNodeElement) o2 ;
String name1 = nodeElement1.getAttributeAsText(_attrName) ;
String name2 = nodeElement2.getAttributeAsText(_attrName) ;
if (name1 == null)
return -1 ;
if (name2 == null)
return 1 ;
if (_direction == "up")
return name1.compareToIgnoreCase(name2) ;
else if (_direction == "down")
return -name1.compareToIgnoreCase(name2) ;
return 0 ;
public void initilize(String attrName, String direction)
_attrName = attrName ;
_direction = direction ;
private String _attrName ;
private String _direction ;
</code>
Best regards,
Aliaksei. -
Hi all,
I would like to sort my cheque proposal by vendor name. I have gone into FBZP>payment methods by company code>form data> and created and new variant with the field Name1.
When I went to do a new proposal it did not work, it still sorted by vendor number. I have read most of the earlier posts is there something I am missing? It seems like it should be a pretty straight forward fix.The sort variant in (Correspondence or line items) under payment method by company code (Form data) controls how payment advice lines are sorted. Correspondence sorts the payment advice notes (or check) and line items sorts lines in a payment advice. This is payment media sorting.
The default proposal is sorted by vendor number. For proposal lines sorting, try this: Financial accounting (new) -- AR/AP -- Business Transactions -- outgoing payments -- automatic outgoing payments -- payment proposal processing -- make settings for displaying line items -- select sort fields for line item display.
But I doubt if Name1 can be added as a field to sort proposal. It has a list of standard fields to choose from.
Thanks.
Rahul
Edited by: Rahul Goyal on Jul 14, 2010 10:42 PM -
I am facing the following problem:
I have an ALV list in the following format:
fld1 fld2 fld3
bb1 bb2 comp1
<blank> <blank> comp2
<blank> <blank> comp3
aa1 aa2 comp4
<blank> <blank> comp5
<blank> <blank> comp6
<blank> <blank> comp7
<blank> - spaces are displayed
where:
comp1 ; comp2 ; comp3 -> belong to bb1 (fld1) field and
comp4 ; comp5 ; comp6 ; comp7 -> belong to aa1 (fld1) field
Now, when the user is sorting the ALV report by field: "Fld1" (by clicking on the ascending or descending sort buttons on ALV), the ALV list is displayed in the following format:
fld1 fld2 fld3
<blank> <blank> comp2
<blank> <blank> comp3
<blank> <blank> comp5
<blank> <blank> comp6
<blank> <blank> comp7
aa1 aa2 comp4
bb1 bb2 comp1
where as, I was expecting the output to be in this format:
fld1 fld2 fld3
aa1 aa2 comp4
<blank> <blank> comp5
<blank> <blank> comp6
<blank> <blank> comp7
bb1 bb2 comp1
<blank> <blank> comp2
<blank> <blank> comp3
Problem: The "<blanks>" in the ALV are also sorted and fld3 is not attached with fld1 and fld2.
Is there any way by which I can avoid this problem??
I am using "set_table_for_first_display" method to display the ALV report.
I have already tried grouping fld3 (comp's) by fld1 and fld2 using nested internal table (both statically and using pointers) and passing it to ALV via. "r_alv_grid->set_table_for_first_display" method. However, this didnt work.
Please help.REPORT ZBLOCK_ALV.
CONSTANTS :
c_x VALUE 'X'.
Macro definition
DEFINE m_fieldcat.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
ls_fieldcat-tabname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-fieldname = &1.
ls_sort-up = c_x.
append ls_sort to lt_sort.
END-OF-DEFINITION.
TYPE-POOLS: slis. " ALV Global types
TYPES:
1st Table
BEGIN OF ty_kna1,
kunnr TYPE kna1-kunnr, " Customer number
ernam TYPE kna1-ernam, " Name of Person who Created
erdat TYPE kna1-erdat, " Creation date
name1 TYPE kna1-name1, " Name 1 .
END OF ty_kna1,
2nd Table
BEGIN OF ty_mara,
matnr TYPE mara-matnr, " Material number
ernam TYPE mara-ernam, " Name of Person who Created
ersda TYPE mara-ersda, " Creation date
mtart TYPE mara-mtart, " Material type
matkl TYPE mara-matkl, " Material group
END OF ty_mara,
3rd Table
BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln, " Sales document
vkorg TYPE vbak-vkorg, " Sales organization
vtweg TYPE vbak-vtweg, " Distribution channel
kunnr TYPE vbak-kunnr, " Sold-to party
erdat TYPE vbak-erdat, " Creation date
END OF ty_vbak.
DATA:
gs_layout TYPE slis_layout_alv,
gt_kna1 TYPE TABLE OF ty_kna1,
gt_mara TYPE TABLE OF ty_mara,
gt_vbak TYPE TABLE OF ty_vbak.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '02' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
Read data
SELECT kunnr ernam erdat name1
FROM kna1
UP TO p_max ROWS
INTO TABLE gt_kna1.
SELECT matnr ernam ersda mtart matkl
FROM mara
UP TO p_max ROWS
INTO TABLE gt_mara.
SELECT vbeln vkorg vtweg kunnr erdat
FROM vbak
UP TO p_max ROWS
INTO TABLE gt_vbak.
END-OF-SELECTION.
PERFORM f_display_data.
FORM USER_COMMAND *
FORM user_command USING u_ucomm TYPE sy-ucomm
us_selfield TYPE slis_selfield. "#EC CALLED
DATA:
ls_vbak TYPE ty_vbak.
CASE u_ucomm.
WHEN '&IC1'. " Pick
CASE us_selfield-tabname.
WHEN 'GT_MARA'.
WHEN 'GT_KNA1'.
WHEN 'GT_VBAK'.
READ TABLE gt_vbak INDEX us_selfield-tabindex INTO ls_vbak.
IF sy-subrc EQ 0.
SET PARAMETER ID 'AUN' FIELD ls_vbak-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. " USER_COMMAND
Form f_display_data
FORM f_display_data.
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv, " Sort table
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event.
gs_layout-group_change_edit = c_x.
gs_layout-colwidth_optimize = c_x.
gs_layout-zebra = c_x.
gs_layout-detail_popup = c_x.
gs_layout-get_selinfos = c_x.
Build field catalog and sort table
m_fieldcat 'KUNNR' 'KNA1' 'GT_KNA1'.
m_fieldcat 'ERNAM' 'KNA1' 'GT_KNA1'.
m_fieldcat 'ERDAT' 'KNA1' 'GT_KNA1'.
m_fieldcat 'NAME1' 'KNA1' 'GT_KNA1'.
m_sort 'KUNNR'.
Build Event Table
MOVE 'TOP_OF_PAGE' TO ls_event-name.
MOVE 'TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO lt_events.
MOVE 'END_OF_LIST' TO ls_event-name.
MOVE 'END_OF_LIST' TO ls_event-form.
APPEND ls_event TO lt_events.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = lt_fieldcat
is_layout = gs_layout
it_events = lt_events
it_sort = lt_sort
i_save = 'A'
TABLES
t_outtab = gt_kna1.
ENDFORM. " F_DISPLAY_DATA
FORM top_of_page *
FORM top_of_page. "#EC CALLED
ULINE.
WRITE : sy-uname, sy-title(56) CENTERED, sy-datum.
ULINE.
ENDFORM. " TOP_OF_PAGE
FORM End_of_list *
FORM end_of_list. "#EC CALLED
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv, " Sort table
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event.
Build field catalog and sort table
m_fieldcat 'MATNR' 'MARA' 'GT_MARA'.
m_fieldcat 'ERNAM' 'MARA' 'GT_MARA'.
m_fieldcat 'ERSDA' 'MARA' 'GT_MARA'.
m_fieldcat 'MTART' 'MARA' 'GT_MARA'.
m_fieldcat 'MATKL' 'MARA' 'GT_MARA'.
m_sort 'MATNR'.
Build Event Table
MOVE 'END_OF_LIST' TO ls_event-name.
MOVE 'END_OF_LIST_2' TO ls_event-form.
APPEND ls_event TO lt_events.
gs_layout-list_append = c_x.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
it_fieldcat = lt_fieldcat
is_layout = gs_layout
it_sort = lt_sort
it_events = lt_events
i_save = 'A'
TABLES
t_outtab = gt_mara.
ENDFORM. " END_OF_LIST
FORM End_of_list_2 *
FORM end_of_list_2. "#EC CALLED
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv, " Sort table
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event.
Build field catalog and sort table
m_fieldcat 'VBELN' 'VBAK' 'GT_VBAK'.
m_fieldcat 'VKORG' 'VBAK' 'GT_VBAK'.
m_fieldcat 'VTWEG' 'VBAK' 'GT_VBAK'.
m_fieldcat 'KUNNR' 'VBAK' 'GT_VBAK'.
m_fieldcat 'ERDAT' 'VBAK' 'GT_VBAK'.
m_sort 'VBELN'.
Build Event Table
MOVE 'TOP_OF_PAGE' TO ls_event-name.
MOVE 'TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO lt_events.
gs_layout-list_append = c_x.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
it_fieldcat = lt_fieldcat
is_layout = gs_layout
it_sort = lt_sort
it_events = lt_events
i_save = 'A'
TABLES
t_outtab = gt_vbak.
ENDFORM. " END_OF_LIST_2 -
Hi all
How do I do automatic payment run sorted by vendor names instead of the vendor numbers?
Thanks for all your time...OK in the edit proposal.
There is an icon, the second from the right called select layout. There is a small button to the right of that, which will provide you a list, that includes change layout.
Select that.
Make sure Name is there.
Then once you have the name, select that and hit F7, you should then be able to select the name field.
If it is not there in the drop down list, you can add name1 via o7fb.
Hope this sorts your problem out.
Please award points if this is useful. -
DATA_PACKAGE: SORT & ( INSERT or APPEND ) ?
Hello Folks,
<u>Problemdescription:</u>
I need two compare to consecutiv records in a DataPackage
to a give sort order
and upon the result of the comparison
I need to insert an new record.
<u>Question:</u>
Can I <b>SORT</b> a DATA_PACKAGE with a given sort order
( like in SQL ...ORDER BY .... ) and how ?
Can I <b>APPEND</b> or<b> INSERT</b> a new userdefined Dataset (=Record) to a DATA_PACKAGE and how ?
Thank You !
Martin SautterHi Martin,
in your start routine, you can sort a data_package with
sort data_package by <component name1>.... <component name n>.
Additionally you can append new records to it with
append <specified workarea> to data_package.
Please check out the F1-help for the statements additionally. You get a lot more information about the use of the statements.
kind regards
Siggi -
Hi friends,
I am working with a Stasndard FI Report RFKOPR00,Right now In this report,data is not getting diplayed profitcenter wise.hence user wants me add profit center in selection-screen and sort the output, it is a simple classical report,by priftcenter by proving a Sort button in application tool bar.
Could you please let me know, How I can provide this option,and the proccedure.
Kindly, provide me sample code if available.
Follwoing is the code that Prints output data.
loop at it_item into wa_item.
format color col_normal.
write:/ sy-vline.
write : 2 wa_item-lifnr,
12 wa_item-name1,
30 wa_item-prctr,
41 wa_item-bukrs,
50 wa_item-belnr,
60 wa_item-buzei,
70 wa_item-netdt,
80 wa_item-zfbdt,
90 wa_item-budat,
100 wa_item-bldat,
110 wa_item-bschl,
115 wa_item-zlsch,
120 wa_item-WAERS,
150 wa_item-wrshb.
WRITE : 170 SY-VLINE.
format color off.
endloop.
Regards,
Xavier.P.Hi,
There is an enhancement point in the subroutine : FORM raster_ausgabe_alv_grid
Just sort the output table before the ALV list display in the standard program,
SORT <tablename> by <profitcenter>
For addition of new field on selection screen its not possible as there is no enhancement point to add your custom code..
Hope you need to copy the report into a Z report and make changes
Regards
Shiva -
Sort/order contexts in universe List View Mode
Is there a way to sort or order contexts in universe List View Mode?
ThanksHi,
There is no way to order the contexts in universe list view mode.
If you want to have a specific order I suggest that you prefix all contexts by a number such as "1 - context name1", "2 - context name2", etc.
Didier -
I have code that allows a user to sort columns in a listview. I use it in many forms around my windows project. It works nicely on all pages and searching through the listview works nicely except for one page the searching is slowed down enormously when
the column sorting is enabled but sorting works fine. Below is the code for that page.
I allow the users to search in the search box on top (not showing but it was a textbox the user can type in and it searches in the listview) and then it reloads the listview on bottom based on the search criteria.
Also the user can click on the column header in the listview and it will sort the columns….
SEARCH
private void ProductSearch_TextChanged(object sender,
EventArgs e)
ProductsSearch(btnAdvancedSearch.Text);
private void ProductsSearch(string filterOption)
StringBuilder sb = new
StringBuilder();
string ID = txtItemID.Text.EscapeLikeValue();
string Name1 = txtItemName1.Text.EscapeLikeValue();
string Name2 = txtItemName2.Text.EscapeLikeValue();
string Name3 = txtItemName3.Text.EscapeLikeValue();
if (ID.Length > 0)
sb.Append("ITEMSTRING like '" + ID +
if (Name1.Length > 0)
if (sb.Length > 0)
sb.Append(" and ");
switch (filterOption)
case "Basic Search":
sb.Append("' ' + Description
like '%" + Name1 + "%'");
break;
case "Advanced Search":
sb.Append("Description like
'" + Name1 + "%'");
break;
if (Name2.Length > 0)
if (sb.Length > 0)
sb.Append(" and ");
switch (filterOption)
case "Basic Search":
sb.Append("' ' + Description
like '% " + Name2 + "%'");
break;
case "Advanced Search":
sb.Append("Description like
'% " + Name2 + "%'");
break;
if (Name3.Length > 0)
if (sb.Length > 0)
sb.Append(" and ");
switch (filterOption)
case "Basic Search":
sb.Append("' ' + Description
like '% " + Name3 + "%'");
break;
case "Advanced Search":
sb.Append("Description like
'% " + Name3 + "%'");
break;
lsvItems.Items.Clear();
dtProducts.DefaultView.RowFilter = sb.ToString();
foreach (DataRow row
in dtProducts.Select(sb.ToString()))
ListViewItem lvi = new
ListViewItem(row["Item"].ToString());
lvi.SubItems.Add(row["Description"].ToString());
lvi.SubItems.Add(row["Cost"].ToString());
lvi.SubItems.Add(row["Price"].ToString());
lsvItems.Items.Add(lvi);
if (dtProducts.DefaultView.Count <= 0)
Validation.ShowMessage(Main.lblStatus,
"No items match your search.");
SORTING
public Form1()
InitializeComponent();
lsvColumnSorter =
new ListViewColumnSorter(0);
this.lsvItems.ListViewItemSorter = lsvColumnSorter;
private ListViewColumnSorter lsvColumnSorter;
private void lsvItems_ColumnClick(object sender,
ColumnClickEventArgs e)
((ListView)sender).ColumnSort(e, lsvColumnSorter);
public static
void ColumnSort(this
ListView lsv, ColumnClickEventArgs e,
ListViewColumnSorter lsvColumnSorter)
// Determine if clicked column is already the column that is being sorted.
if (e.Column == lsvColumnSorter.SortColumn)
// Reverse the current sort direction for this column.
if (lsvColumnSorter.Order == System.Windows.Forms.SortOrder.Ascending)
lsvColumnSorter.Order = System.Windows.Forms.SortOrder.Descending;
else
lsvColumnSorter.Order = System.Windows.Forms.SortOrder.Ascending;
else
// Set the column number that is to be sorted; default to ascending.
lsvColumnSorter.SortColumn = e.Column;
lsvColumnSorter.Order = System.Windows.Forms.SortOrder.Ascending;
// Perform the sort with these new sort options.
lsv.Sort();
In this specific page the column sorting code is effecting the searching code.
What could the problem be?
Debra has a questionHi Debra,
I suggest you could use the listview to search.
you could refer to this post:
http://stackoverflow.com/questions/16549823/filtering-items-in-a-listview
Use the listView item, not to reload the listViewitem.
And then i see you using the ListViewColumnSorter class, what is this class? Is it customized?
If you could share the more details, I could help you better.
Best regards,
Youjun Tang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Maybe you are looking for
-
Receiving an ics calendar file from Outlook
I have two calendar databases. At work, my PC is attached to the corporate Exchange server. No other email client or system is permitted. At home, I'm using Mail that is part of Mac OSX / iOS5 / iCloud as well as a cpi[;e pf other providers such a
-
Problems with eBusiness Suite Lookups
In eBusiness Suite UM Connector, I have been provided with these default Lookup Definitions: Lookup.EBS.Application Lookup.EBS.Responsibility I have a process child form (UD_EBS_USER), which has the following fields: 1. Application Name 2. Responsibi
-
Possible to use JavaScript to Import Data from XML file to pre-fill fields?
Hi, I have a dynamic fill-in PDF that I want to "pre-fill" internally in my company before sending out to users who will change any pre-filled fields necessary and answer questions we did not already answer. We do not have LiveCycle Reader Extensions
-
When I go to the Java test page (http://java.com/en/download/testjava.jsp), it says the Plugin is disabled. The Manage Add-Ons page said it was Disabled after a reboot, but is enabled now. Chrome and IE both agree that I have Java 7 Update 9 installe
-
Save Exit or BADI @ ML81N Service Entry
Hi All, This is an Urgent requirrement on Service Entry creation. I am working on one interface where I need to code at the Time of saving or Acceptance of Service entry. Request you to help me in providing me the right User exit or BADI name at the