Calling a function from a DLL, exectution in background mode.

Dear Experts,
We have created an ABAP report the calls a function from a DLL file. If the report is executed in on-line mode the program calls and executes the function from the DLL, but if the ABAP programa is executed in background mode it doesnt calls the DLL function.
Do you know a way to solve the problem when executing in background mode?
Best regards.
Antonio

Hi Gabriel,
Let me explain in details about my DLL function.
We are importing the business partners from legacy system into the SAP CRM system, so at the moment we created the BP master data via BAPI, I get the name of the BP and this moment I call the function in the DLL file. I export the parameter name and I receive back a simplified string with the name reduced to a code. This code I get back from the dll it is insert in a Z table, so there is no interaction in the screen, all must be executed in background mode, because there are a lot of business partners to be converted in SAP system.
I am sending my code for your considerations.
Instancia a DLL
  CREATE OBJECT dll 'MTCODE.CPFONET'.
  IF sy-subrc NE 0.
    RAISE without_dll.
  ENDIF.
Move para a tabela interna IT_NAME os valores recebidos na TI_NAME
  it_name[] = ti_name[].
Para cada registro importado
  LOOP AT it_name.
    CLEAR v_string_ret.
    wa_matchcode-zregid     = it_name-zregid.
    wa_matchcode-name1_text = it_name-name1_text.
    v_string = it_name-name1_text.
    CONDENSE  v_string.
    TRANSLATE v_string TO UPPER CASE.
    CALL METHOD  OF dll 'SetNome' EXPORTING #1 = v_string.
    CALL METHOD  OF dll 'ExecMatch'.
    CALL METHOD  OF DLL 'GetMCData' = v_string_ret.
    FREE OBJECT dll.
  Preenche os campos do match-code de acordo com o retorno da DLL
    SPLIT v_string_ret
    AT '|'
    INTO wa_matchcode-zparmcln
         wa_matchcode-zparmcfn
         v_empty
         wa_matchcode-name_first
         wa_matchcode-name_last
         wa_matchcode-namemiddle.
  Adiciona o registro com o match-code correspondente na TE_MATCHCODE
    APPEND wa_matchcode TO te_matchcode.
  ENDLOOP.

Similar Messages

  • Calling a function from a dll written by using visual studio c++

    Hi, how can i call a function from a dll which is written by visual studio c++ in test stand?  Although the functions in dll are exported and i've chosen c/c++ adapter, i saw no function in test stand. Is there a different step while i'm calling a function from a dll written by c++ than calling a function from a dll written by cvi?

    Hey Sadik,
    Selecting the C/C++ DLL Adapter Module should be sufficient for this. When you drag an action step for this onto the Main Step and navigate to the location of the DLL, the function list should populate and you should be able to select the function you want to use. If this is not the case, would you be able to post this DLL so that we can test this on our end?
    Regards,
    Jackie
    DAQ Product Marketing Engineer
    National Instruments

  • Can I call a function from a dll in LabVIEW that returns:double*string and int.?

    I have a function from a dll that return a double* string and an integer. How can I call this function from LabVIEW? There is a possibility to work in LabVIEW with a double* string?

    pcbv wrote:
    > Hello all,<br><br>The header of the function is:
    >
    > "HRESULT WRAPIEnumerateDevices(WRAPI_NDIS_DEVICE **ppDeviceList, long *plItems);"
    >
    > where WRAPI_NDIS_DEVICE have this form:
    >
    > typedef struct WRAPI_NDIS_DEVICE<br>{<br>
    > WCHAR *pDeviceName;<br>
    > WCHAR *pDeviceDescription;<br><br>}
    > WRAPI_NDIS_DEVICE;<br><br>
    >
    > The function is from WRAPI.dll, used for communication with wireless card.
    > For my application I need to call in LabVIEW this function.
    Two difficulties I can see with this.
    First the application seems to allocate the array of references
    internally and return a pointer to that array. In that case there must
    be another function which then deallocates that array again.
    Then you would need to setup the function call to have a pointer to an
    int32 number for the deviceList parameter and another pointer to int32
    one for the plItems parameter.
    Then create another function in your DLL similar to this:
    HRESULT WRAPIEnumExtractDevice(WRAPI_NDIS_DEVICE *lpDeviceList, long i,
    CHAR lpszDeviceName, LONG lenDeviceName,
    CHAR lpszDeviceDesc, LONG lenDeviceDesc)
    if (!lpDeviceList)
    return ERROR_INV_PARAMETER;
    if (lpDeviceList[i].pDeviceName)
    WideCharToMultiByte(CP_ACP, 0,
    pDeviceList[i].pDeviceName, -1,
    lpszDeviceName, lenDeviceName,
    NULL, NULL);
    if (lpDeviceList[i].pDeviceName)
    WideCharToMultiByte(CP_ACP, 0,
    pDeviceList[i].pDeviceDescription, -1,
    lpszDeviceDesc, lenDeviceDesc,
    NULL, NULL);
    return NO_ERROR;
    Pass the int32 you got from the first parameter of the previous call as
    a simple int32 passed by value to this function (and make sure you don't
    call this function with a higher index than (plItems - 1) returned from
    the first function.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Call multiple functions from same dll with call library function

    hi,
    i am working on a project in wich we need to make a UI to read out a sensor network.
    the UI should be usable in any project, but every node needs a different piece of code depending on the type of sensor with wich it is equipt.
    so i need to be able to call different pieces of code when i need them, and still be able to use the UI in future projects with possibly new types of node we now don't have.
    so someone told me to use DLL's, cause then i would be able to call the code i need the moment i need it.
    but i have never worked with DLL's (just learned about this option 3 day's ago) so i have a question.
    i know i can dynamicly change the DLL i call with the call library function, but can i dynamicly change the function i call from that DLL ?
    or do i have to put a new call library function for each function i want to call, even if its from the same DLL ?
    kind regards,
    stijn

    nazarim wrote:
    ok so there is no (easy and ubderstandable) way for me to dynamicly change wich function i want to call from a certain DLL.
    but now i started wondering, the path on the call library function is not ment to dynamicly change a DLL
    but it does work so, if i am carefull, can i use it for that purpose or will labview give me a series of problems once i start using it in larger programs ?
    Thepath on the Call Library Node can be used to load a different DLL. Obviously since you can't change the function name your other DLL would have to export exactly the same function name and of course with the same parameters. This is seldom the case so it is not the main use of the path input to the Call Library Node. It's main use is as indicated to load DLLs at runtime rather than at load time of a VI. So that an application can run even when the DLL is missing, until the moment the functionality from that DLL is needed.
    If you can make sure that all your DLLs export the same function name with the same parameter you can use the Call Library Node to call into different DLLs through the path input. If however you would need to call different function names you would have to resolve to some DLL which does do the dispatching and invocation using LoadLibrary() and GetProcAddress(). But unless you need to go with DLLs for some reason using the Call By Reference Node can give you an even more flexible approach. 
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Application with a vi calling a function from kernel32.dll

    I have a Labview application which runs very well.
    I had add a vi using the functio GetSystemTime from the dll kernel32.dll. The vi calling the API function runs well. Then I tried to buil the application and it does'nt run anymore . A dialog box is opened : "access to a forbidden space memory. I don't understand.
    Does anyone have an idea?
    Thank you for your response.

    I have made at test with this function but it runs on my system.
    I have used LV 6.0.2 to LV 7.0 on a Win XP Prof. You can compare your solution with mine.
    The VI will run once when the application is called. You will see current time.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions
    Attachments:
    GetSystemTime.zip ‏23 KB

  • Calling a function from a dll given by a third party

    Hi everyone,
    I was given a dll that exposes several COM functions.
    I want to call one of them (using java code) that is called LoginGUI() that returns a string.
    How could I do that?
    Thanks for your feedback.
    I am working on a windows environement.

    Use JNA.

  • Calling a native function from a dll

    Hi all,
    I want to call an api function exported from a dll using java. For example l like to call a function from kernel.dll (Windows). How can i do this. Do i have to create another dll for this?

    hi,
    you need to use JNI
    you have to create de DLL , and call kernel32.dll in.
    like that:
    java_class.class ==> first_dll.dll ==> kernel32.dll

  • How to call a function of a dll

    Hello,
    I have to call a function from a dll. I have a description how to do that in Visual Basic but I don't find those command in Diadem 9.1.
    Here is the command in Visual Basic:
    Declare Sub oLIC Lib "LICENSE.DLL" (ByVal PrgNam As String, ByVal VerString As String)
    PrgNam = "DiademScript"
    VerString = "1.0.0"
    Call oLIC(PrgNam,VerString)
    Is such a call possible in Diadem?
    Regards
    Patrick

    Hello Patrick!
    This is not possible! This is one of the differences between VB/VBA and VBS. You have to wrap the DLL with a COM server or a DIAdem GPI DLL.
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • Calling C Functions in existing DLL's from Java

    Hi Guys ,
    The tutorial in this site talks about creating ur own DLL's and then calling them from Java . I need to call C functions in existing DLL's from Java . How do I go about doing this ? . Any help on this would be much appreciated.
    regards
    murali

    What you are interested in can be done with what's called "shared stubs", from the JNI book (http://java.sun.com/products/jdk/faq/jnifaq.html), although you don't need the book to do it (I didn't).
    The example code will call functions with any number and kind of parameters, but doing that requires some assembly language. They supply working examples for Win32 (Intel architecture) and Solaris (Sparc).
    If you can limit yourself to functions to a single function signature (number and types of parameters), or at least a small set that you know you'll call at compile time, you can modify the example so that the assembly language part isn't needed, just straight C code.
    Then you'll have one C library that you compile and a set of Java classes and you can load arbitrary functions out of arbitrary dynamic libraries. In my case you don't even have to know what the libraries and functions are ahead of time, the user can set that up in a config file.
    You mentioned doing this with Delphi. One thing to watch out for is C versus Pascal (Win32) function calling convention. A good rule of thumb; if it crashes hard, you probably picked the wrong one, try the other. :-)

  • Can LabVIEW call a function from a .sys file or is LabVIEW limited to dll access?

    My vendor has sent me a .sys file with functions accessing their hardware.  Can i call these function from labview directly or do I have to wrapper the .sys with a dll?

    Well a sys file is a kernel device driver. LabVIEW does not have any direct way of accessing such a driver. The way kernel drivers are accessed is usually through a DLL which makes calls to WinAPI functions such as CreateFile(), ReadFile(), WriteFile(), CloseHandle() and DeviceIORequest(). Since these WinAPI calls are basically just DLL calls too, you could theoretically use the Call Library Node to call them and access the kernel device driver in such a way.
    However for any kernel device driver with more than one or two device driver calls, it will certainly be easier in terms of development, debugging and maintenance of the code, to write actually a dedicated DLL in C/C++ for this device driver and access that DLL from LabVIEW, especially if you consider the LabVIEW datatype limitations when designing the DLL interface (Basically this same DLL can then be called from any other Windows development environment, be it Visual Basic (similar datatype limitation as LabVIEW), Delphi, (Visual) C, LabVIEW or also various scripting environments like Python and Lua.
    Some of the necessary WindAPI calls are rather involved and pose quite a bit of trouble to get the parameter data right in LabVIEw.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How do I call Vee functions from TestStand ?

    I wish to call Vee functions from TestStand steps.
    I am using Vee 6.01 and TestStand 2.0.

    Hi Gerry,
    Sorry about that. Below is a sequence file created in 2.0.1f1. Please copy the contents of the zip file (previous attachment) into the folder \Examples\VEE\Using ActiveX (VEE 6.0). Please create this directory if it does not exist. The next thing you will need to do, is register the TestStand VEE server located in \Examples\VEE\Using ActiveX (VEE 6.0)\VEE_StepType.dll. To do this:
    1) Select Start>>Run.
    2) Type regsvr32 "C:\TestStand\Examples\VEE\Using ActiveX (VEE 6.0)\VEE_StepType.dll"
    You should get a message saying that the registration was successful. You should now be able to run the example. Please let me know if you encounter any further problems. Thanks!
    Attachments:
    Computer.seq ‏66 KB

  • Can Any one tell me what is the step in calling a function from a *.lib file in Labview application

    Hi, I am working on Labview 8.0.
    I am trying to  communicate to a thrid party HW using the driver file he has provided to me.
    The drive file is a *.lib file.
    I am unable to call the function from the lib file.
    I could get only from a DLL.
    Pls help .
    Regards
    -Patil

    patil wrote:
    When it is possible in Lab Windows, why calling a function from a static library is prohibited?
    I was trying to use Function node, but found that it is only for functions from a DLL file.
    Will CIN be useful.? 
    LabWindows is not the same as LabVIEW. LabVIEW cannot call .lib files. LIB files are intermediary products and you need to use a wrapper DLL that's compatible with the object format of the .lib file. It's as simple as that. LabWindows creates C application and from that perspective is no different than a regular C
    compiler. That's why you can call .lib files because that's how .lib
    files are used.
    A CIN, as pointed out, is something completely different and will not help you.  

  • Using PostLVUserEvent function from Labview.dll

    I am trying to use the PostLVuserEvent function from the labview.dll and corresponding extcode.h file.  I have made my own dll using CVI that uses this function.  I then use Labview to call my dll.  My dll compiles fine.  No issues, no errors.  LabView can call my dll function containing the PostLVUserEvent function with no errors.  However, the event number LabView passes my dll is not the same event number I receive so no LabView event is triggered. 
    Has anyone had this issue? 
    We are trying to solve it from the LabView side and the CVI side but cannot seem to get it to work.  The examplesI have found here were compiled using C++ and those seem to work.  I do not know why when I compile my program in C, it creates the dll but does not work.   If I had to guess, i think it's an issue with pointers vs non-pointers.  When the LAbview program selects my function from the dll, it shows the argument PostLVUserEvent as a pointer when in my dll, it is not a pointer PostLVUserEvent....
    Any ideas?
    Thanks in advance. 

    Hello Blue
    Take a look to this one, it was created on C, I think the .c and the .h files will give a good idea, how the function should be implemented. It is important when calling the dll on LabVIEW, to use the std calling convention and run it on the UI thread.
    Regards
    Mart G
    Attachments:
    LabView EventTest.zip ‏1041 KB

  • Is their a possibility to call SDK functions from TestStand directly?

    Hello!
    I want to call a function from the Windows SDK.
    Is this possible?
    Regards,
    Brosig
    Using TestStand 3.5 and Windows XP

    Brosig,
    sadly i dont know what the error with the pdb-file could be. but as far
    as i see from the description to the function found here, there should
    be no such dependency.
    please take a look into the "requirements"-section of the link. it
    seems that kernel32.dll is sufficient for usage of the function. and
    for myself, i never had such problems when using the kernel32.dll.....
    one problem could be the type of the parameter you are using. i know
    that there are sometimes odd issues on SDK when the parameters do not
    fit exactly the needed type.  so make sure that all strings are
    null-terminated and the buffers you pass are preallocated!
    Norbert B.
    Edit: forgot the link.....
    Message Edited by Norbert B on 12-22-2005 09:31 AM
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How can I call a function from a procedure

    I have a function named: f_calc_value which return the variable v_result. This function is part of a package.
    How can I call this function from a new procedure I am creating?
    Thanks

    or refer this theread....calling function from procedure

Maybe you are looking for