Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error record

Former Member
0 Likes
710

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

6 REPLIES 6
Read only

Former Member
0 Likes
683

What is not working. The read statement. Sort if first by MATNR.

If not, then which part is not working.

Read only

0 Likes
683

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.

Read only

0 Likes
683

check ur declerations of the ur wa and the tables

Read only

0 Likes
683

Hi

How have you defined wa_file-matnr?

Read only

former_member156446
Active Contributor
0 Likes
683

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

Read only

Former Member
0 Likes
683

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