on 10-17-2005 10:57 AM
Hello Gurus !!!
I would like to SORT my list with the field
WA_ITAB-VVVPR (PRICE).
WHEN i USE
Sort wa_itab-vvvpr the error syntax error shows <b>'WA_ITAB is not an Internal table'</b>
well its the Work area...
and when I mention Sort itab by VPRSV <b>it shows itab has no header line..</b> I am working with 4.7c and We must use work area not header line while defining ITAB:
PLS HELP...
DATA: i_mbew TYPE TABLE OF mbew,
wa_mbew TYPE mbew.
SELECT * FROM mbew INTO TABLE i_mbew where
BWKEY Between '4010''4020' and '4030' .
LOOP AT itab INTO wa_itab.
READ TABLE i_mbew INTO wa_mbew WITH KEY
matnr = wa_itab-artnr.
IF wa_mbew-vprsv = 'V'.
wa_itab-vvvpr = wa_mbew-verpr.
ELSE.
wa_itab-vvvpr = wa_mbew-stprs.
ENDIF.
MODIFY itab FROM wa_itab.
WRITE:/4 wa_itab-artnr,
15 wa_itab-vvvpr,
41 wa_mbew-vprsv,
53 wa_mbew-bwkey,
71 wa_mbew-peinh.
ENDLOOP.
Message was edited by: Preetham
Hi,
You should specify the type of table in the declaration.You cannot sort the workarea wa_itab,since it's already having one record.You should only sort internal table.Check the below sample code and reward points by clicking the star on the left of reply,if it helps.
DATA: i_mbew TYPE <b>standard</b> TABLE OF mbew,
wa_mbew TYPE mbew.
SELECT * FROM mbew INTO TABLE i_mbew where
BWKEY Between '4010''4020' and '4030' .
<b>sort itab by VPRSV.</b>
LOOP AT itab INTO wa_itab.
READ TABLE i_mbew INTO wa_mbew WITH KEY
<b>matnr = wa_itab-matnr</b>.
IF wa_mbew-vprsv = 'V'.
wa_itab-vvvpr = wa_mbew-verpr.
ELSE.
wa_itab-vvvpr = wa_mbew-stprs.
ENDIF.
MODIFY itab FROM wa_itab.
WRITE:/4 wa_itab-artnr,
15 wa_itab-vvvpr,
41 wa_mbew-vprsv,
53 wa_mbew-bwkey,
71 wa_mbew-peinh.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi gurus.. Thanx ... But check the following CODE this is my FULL CODE...
and I need to sort the PRICE which is in the Structure...
wa_itab-vvvpr
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILENAME =
FILE_FILTER =
INITIAL_DIRECTORY =
MULTISELECTION =
CHANGING
file_table = file
rc = rc
USER_ACTION =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
.
IF sy-subrc <> 0.
ENDIF.
READ TABLE file INTO file_name INDEX 1.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = file_name
CHANGING
data_tab = itab
.
IF sy-subrc <> 0.
ENDIF.
DATA: i_mbew TYPE standard TABLE OF mbew,
wa_mbew TYPE mbew.
SELECT * FROM mbew INTO TABLE i_mbew WHERE
bwkey BETWEEN '4010''4020' and '4030' .
LOOP AT itab INTO wa_itab.
READ TABLE i_mbew INTO wa_mbew WITH KEY
matnr = wa_itab-artnr.
IF wa_mbew-vprsv = 'V'.
wa_itab-vvvpr = wa_mbew-verpr.
ELSE.
wa_itab-vvvpr = wa_mbew-stprs.
ENDIF.
MODIFY itab FROM wa_itab.
WRITE:/4 wa_itab-artnr,
15 wa_itab-vvvpr,
41 wa_mbew-vprsv,
53 wa_mbew-bwkey,
71 wa_mbew-peinh.
ENDLOOP.
TOP-OF-PAGE.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE: /50 'Report Für Material Preis Östereich',
108 'Records', syst-dbcnt,
130 'page', syst-pagno,
235 ''.
SKIP 1.
WRITE : /2 'Material Number',
24 'Preis',
39 'Preis Typ',
53 'BWKEY',
69 'Preis Einheit'.
Hi,
Wa_itab will have only one record inside the loop.Each time in the loop,it will have the previous record overwritten.
So you cannot sort a single record.
Normally we will sort the table records for the read operation.
Wa_itab is not an internal table.It is a workarea.
Work area will have only one record at a time.
So we can sort only internal table which is having more than one record.
Hope this answers your question.If so,kindly reward points.
SELECT * FROM mbew INTO TABLE i_mbew WHERE
bwkey BETWEEN '4010''4020' and '4030' .
<b>
sort itab by vvvpr.</b>
LOOP AT itab INTO wa_itab.
READ TABLE i_mbew INTO wa_mbew WITH KEY
matnr = wa_itab-artnr.
IF wa_mbew-vprsv = 'V'.
wa_itab-vvvpr = wa_mbew-verpr.
ELSE.
wa_itab-vvvpr = wa_mbew-stprs.
ENDIF.
MODIFY itab FROM wa_itab.
WRITE:/4 wa_itab-artnr,
15 wa_itab-vvvpr,
41 wa_mbew-vprsv,
53 wa_mbew-bwkey,
71 wa_mbew-peinh.
ENDLOOP.
Hello Preetham,
There's no version called 4.7C. We only have 4.6C. Furthermore, starting from SAP release 4.7, it is better to specify the ABAP / Basis release that you're working on, like 620, 640 etc.,
Your code snippet doesn't have any SORT statement. and nor do you have a declaration for "itab" and "wa_itab". So it's difficult to say the reason for the syntax error.
Regards,
Anand Mandalika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
just add
sort i_mbew by vvvpr above the loop
cheers,
sasi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Preetam,
it seems you defined wa as work_area not inernal table, thats why yu get the error.
do the following to sort by vvvpr.
sort itab by vvvpr.
you can use addition ASCENDING or decending DESCENDING also.
sort itab by vvvpr ASCENDING. or
sort itab by vvvpr DESCENDING.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use as
DATA: i_mbew TYPE <b>STANDARD</b> TABLE OF mbew,
wa_mbew TYPE mbew.
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I'm using working on 4.7C, but your statament works fine:
DATA: i_mbew TYPE TABLE OF mbew.
Sort i_mbew by VPRSV.
Only error is occured was there isn't VRPSV, but VPRSV.
Max
Message was edited by: max bianchi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
check this it may help you...
data : begin of wa.
include structure mbew.
data end of wa.
data : itab like table of wa with header line.
SELECT * FROM mbew INTO corresponding field of wa where
BWKEY Between '4010''4020' and '4030' .
loop at itab into wa.
endloop.
hope this helps you...
regards,
venu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.