2007 Dec 19 2:52 PM
Hi I am uploading a file through gui_upload,
my flat file contains matnr,vkorg,vtweg.
Suppose I am entering a wrong value in place of vkorg it should throw an error message that sales org doesn't exist.
And this is for sales data in material master.
I am writing the code as below but the entries are not coming to the WA_MVK.
Please suggest me some idea.
REFRESH t_mvke.
CLEAR t_mvke.
select matnr vkorg vtweg from mvke into table t_mvke.
If sy-subrc eq 0.
loop at t_file into wa_file.
READ table t_mvke into wa_mvk with key matnr = wa_file-matnr BINARY SEARCH.
if sy-subrc = 0.
IF wa_file-matnr <> wa_mvk-matnr.
MESSAGE e999 with text-004.
endif.
IF wa_file-vkorg <> wa_mvk-vkorg.
MESSAGE e999 with text-005 wa_file-vkorg text-006.
endif.
IF wa_file-vtweg <> wa_mvk-vtweg.
MESSAGE e999 with text-007 wa_file-vtweg text-006.
ENDIF.
endif.
endloop.
endif.
Reply asap.Reward will be given.
Thanks in advance
What is not working. The read statement. Sort if first by MATNR.
If not, then which part is not working.
2007 Dec 19 2:54 PM
What is not working. The read statement. Sort if first by MATNR.
If not, then which part is not working.
2007 Dec 19 2:58 PM
Hi,
I gave the SORT with t_mvke and I have 8222 data in this but while reading the data is not coming to the wa_mvk.
For this only the sy-subrc is 4 and i am not able to give the error messages..
please suggest me asap.
2007 Dec 19 3:01 PM
2007 Dec 19 3:03 PM
2007 Dec 19 2:55 PM
IF wa_file-vkorg wa_mvk-vkorg.
select single vkorg from check table of VKORG
into lv_vkorg
where vkorg = wa_file-vkorg.
if sy-subrc eq 0.
MESSAGE e999 with text-005 wa_file-vkorg text-006.
endif.
endif.
hi guest.. I remeber I said some one to sort and gave the above format to full fill his req... binary search works well when its sorted with all the primary keys..
Edited by: jackandjay on Dec 19, 2007 9:56 AM
2007 Dec 19 3:54 PM
Hi,
you have all material numbers in your internal table 't_file', then why you are selecting all entries from 'MVKE', after getting data from flat file to T_FILE, add the below code.
declare your T_FILE-MATNR by reffering MARA-MATNR.
then loop through T_FILE.
CALL FUNCTION 'CONVERSION_EXIT_MATN2_INPUT'
EXPORTING
input = T_FILE-MATNR
IMPORTING
OUTPUT = T_FILE-MATNR
EXCEPTIONS
NUMBER_NOT_FOUND = 1
LENGTH_ERROR = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
MODIFY T_FILE.
ENDLOOP.
this has to be done before select statement, then
select matnr vkorg vtweg from mvke into table t_mvke for all entries in T_FILE where matnr = T_FILE-MATNR.
sort T_MVKE by matnr.
now prceed with your code.
Reward if useful.
Regards,
Sreeram.
Edited by: Sreeram Prasad on Dec 19, 2007 4:55 PM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |