Application Development 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: 

Loading EXCEL file through SM35

Former Member
0 Kudos
315

Hi All

I have a program that reads an excel file and posts financial documents using transactions FB01L or FBS1. The problem is, when loading an excel file, if there is an error, the program stops loading the file until the user fixes the error then starts loading again.

We try to see if we can load the file with the errors first then fix them after loading because its so stressful going one by one to fix errors when there is a large file, but this seems to be unsuccessful.

What i want to know is if it is possible for the user to run the program and it gets processed in SM35 and load all the data then the user can then go to proccess the data and fix the problem online sm35.

How can this be dones.

Thanks guys.

6 REPLIES 6

Former Member
0 Kudos
109

If you run it in the background in SM35, it will load the entries that do not have errors and you can then evaluate the just ones that are rejected due to errors all at once instead of doing it piecemeal as in an interactive load

In addition, you can filter out many of the obvious errors in the program that creates the session, and correct them at that point before you even get to SM35. That is what we usually do.

Good luck

Brian

0 Kudos
109

thank Brian for your reply. But I think i didn't explain the situation well.

The thing is that they already have a program writing to load this file. It is writing using Call Transaction. But like i said, the problem is when it comes to an error, it stops, they have to go back to the excel file to correct the problem and then run it again. Now usually, they normally have a huge record, so it is very stressful to back like 50 times or more to correct this errors.

So they now want a way to load this file including the errors without stop but should be able to log the errors and then they can now review the errors and go to back to the excel file at once to correct the error then load it again instead of doing it one by one like the way it is now with Call Transaction.

thanks

0 Kudos
109

Instead of using CALL TRANSACTION use the following

CALL FUNCTION 'BDC_INSERT'

EXPORTING

tcode = <your tcode here>

dynprotab = bdcdata.

This builds a session that you can process using SM35, instead of doing it immediately using CALL TRANSACTION.

You can create an edit list for any errors, and even segregate the entries that have errors into a separate table that you can download.

You could choose to do the BDC_INSERT only for those entries that pass the edits.

The basic idea is as follows:

Upload file to itab

loop thru itab

check for errors

if no errors

call BDC_INSERT

else

print error message(s)

save to error itab

endif

endloop

download error itab to error file

-


When I do this, I usually have a selection option that indicates if this is a test run or an update run.

If it is a test run, it does not create a session or do the BDC_INSERT, it just checks for errors and builds the error list and error file.

-


You can then review the edit list and update the entries in the error table all at once. Then rerun the process with the corrected entries, and see if anythings still kicks out.

If it is an update run, you can call SM35 and process the session for any good entries that were loaded using BDC_INSERT.

Good luck

Brian

0 Kudos
109

Hello Basil,

There should be some reason to use call transaction .. I guess they are using mode 'E' within call transaction. if any error records then it will stop that point.

so make it as MODE 'N' and now run your program,

See the syntax :

call transaction TCODE using BDCDATA

<b>mode 'N'</b>

messages into bdcmsgcoll.

Let me say one example :

I have 10 records in file (2nd record is error record),if i use that file ,if i run my program ,it creates the data 1 ,3,4,5,6,7,8,9,10 and it will not create for 2nd record since i am running on mode 'N'.

No need to change into session method.

for identifying error log ,you need to use bdcmsgcoll structure.

if you need sample code ,then do the recording for any transaction using SHDB,creates the program for that recording,system will create error log logic.

Hope you got it.

Thanks

Seshu

0 Kudos
109

Hi Seshu,

I checked the program and they used mode 'N' and 'E'. Brian's suggestion to use Session Method is good but before i do, i just want to be sure its the best method because its going to be slower.

thanks.

Former Member
0 Kudos
109

The ticket was closed. Thanks all