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: 

How can I call a custom function module from LSMW (similar to BAPI)

oppenheim_jm
Participant
0 Kudos
1,539

Hi experts
How can I call a custom function module from LSMW?

We have written a custom function module to perform some complex calculations for an interface, but now need to execute the same function module multiple times in a large batch directly in SAP.

My thoughts are to use LSMW but not sure how to specify my FM.

How can I call a custom function module from LSMW?

5 REPLIES 5

RaymondGiuseppi
Active Contributor
0 Kudos
1,522

Convert your FM to a BAPI (look at transaction BAPI) or build a small transaction that execute your FM and record a BDC...

0 Kudos
1,514

Thank you @RaymondGiuseppi ! Let me take a look

 

0 Kudos
1,512

I don't think that is the right approach. OP needs to call the function module to execute some calculations i.e. during mapping stage, not to import the data. 

Your answer would be correct, if the function was to import the data.

DominikTylczyn
SAP Champion
SAP Champion
0 Kudos
1,505

Hello @oppenheim_jm 

Have a look at LSMW Processing Times documentation. Here you can insert your own code and call the function module from there. I think you should put a call to your function in  __BEGIN_OF_RECORD__ or __END_OF_RECORD__ processing time.

Best regards

Dominik Tylczynski

RaymondGiuseppi
Active Contributor
1,468

Can you elaborate on 'custom function module to perform some complex calculations for an interface'

Does your FM update some data form input or just format this input to send them in another interface, is the FM the only step?

  • In first case use my previous answer
  • In second case, use the FM in the 'Convert Data' step