Call BAPI in Web Dynpro

I want to call a BAPI using web Dynpro.
In my case, the BAPI without input parameter, it only give out a out table after execute.
So that I include this Bapi in the model and directly call it in wdDoInit like this :
        wdContext.nodeZbapi_Outvendor_Input().currentZbapi_Outvendor_InputElement().modelObject().execute();
wdContext.nodeZbapi_Outvendor_Input().invalidate();
However, no any result can see. Anybody could tell me what is the correct way to call BAPI in WD?
Thanks!

Hi,
Don't invalidate the zbapi node...
If your output can be recieved from the node say.., output from the bapi side and you mapped it to controller to node say OutVend...
Then use this code
wdContext.nodeOutVend().bind(wdContext.nodeZbapi_Outvendor_Input().currentZbapi_Outvendor_InputElement().modelObject().getOutput());
Any queries revert back.
If this is not working post your context structure in your reply and tell where you are expect the output
Best Wishes,
Idhaya R

Similar Messages

  • Looking for a beginner guide - Adaptive RFC  call BAPI  in Web Dynpro Java

    Hi,
    im new in SAP Developeing. I developed some basic web Dynpro applications (after some tutorials) and they are all working.
    Now i want to build an Web Dynpro application with an adaptive RFC Model.
    I already imported the adaptive RFC Modell with a function Model (BAPI Z_...) from the R3 System successfully.
    But if i deploy the application i will get following error:
    com.sap.tc.webdynpro.services.exceptions.TypeNotFoundException: type extern:mypackages.com.types.BapiModel:mypackages.com.types.Zmbs_Bapi_Dispo_Orderdata could not be loaded: com.sap.dictionary.runtime.DdException: TypeBroker failed to access SLD: Error while obtaining JCO connection.
         at com.sap.tc.webdynpro.services.datatypes.core.DataTypeBroker.getStructure(DataTypeBroker.java:305)
         at com.sap.tc.webdynpro.progmodel.context.DataNodeInfo.doInit(DataNodeInfo.java:234)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:671)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:674)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:674)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:674)
         at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:40)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:199)
         at com.sap.tc.webdynpro.progmodel.controller.Component.getCustomControllerInternal(Component.java:449)
         at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:387)
         at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:416)
         at com.sap.tc.webdynpro.progmodel.context.MappingInfo.getDataNode(MappingInfo.java:83)
         at com.sap.tc.webdynpro.progmodel.context.MappingInfo.initMapping(MappingInfo.java:125)
         at com.sap.tc.webdynpro.progmodel.context.MappingInfo.init(MappingInfo.java:121)
         at com.sap.tc.webdynpro.progmodel.context.MappedNodeInfo.doInit(MappedNodeInfo.java:215)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:671)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:674)
         at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:40)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:199)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:709)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:579)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:155)
         at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.doOpen(WebDynproWindow.java:295)
         at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.show(ApplicationWindow.java:183)
         at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.open(ApplicationWindow.java:178)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:364)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.initApplication(ApplicationSession.java:754)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:289)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:666)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:46)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    Caused by: com.sap.dictionary.runtime.DdException: TypeBroker failed to access SLD: Error while obtaining JCO connection.
         at com.sap.tc.webdynpro.services.datatypes.core.DataTypeBroker$1.fillSldConnection(DataTypeBroker.java:90)
         at com.sap.dictionary.runtime.ProviderFactory.internalResolveLogicalNameToJCODestination(ProviderFactory.java:377)
         at com.sap.dictionary.runtime.ProviderFactory.resolveLogicalNameToJCODestination(ProviderFactory.java:322)
         at com.sap.dictionary.runtime.ProviderFactory.internalGetProvider(ProviderFactory.java:181)
         at com.sap.dictionary.runtime.ProviderFactory.getProvider(ProviderFactory.java:146)
         at com.sap.dictionary.runtime.DdDictionaryPool.getProvider(DdDictionaryPool.java:97)
         at com.sap.dictionary.runtime.DdDictionaryPool.getDictionary(DdDictionaryPool.java:79)
         at com.sap.dictionary.runtime.DdDictionaryPool.getDictionary(DdDictionaryPool.java:48)
         at com.sap.dictionary.runtime.DdBroker.getDataType(DdBroker.java:149)
         at com.sap.dictionary.runtime.DdBroker.getStructure(DdBroker.java:180)
         at com.sap.tc.webdynpro.services.datatypes.core.DataTypeBroker.getStructure(DataTypeBroker.java:303)
         ... 49 more
    Caused by: com.sap.tc.webdynpro.services.sal.sl.api.WDSystemLandscapeException: Error while obtaining JCO connection.
         at com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory.getJCOClientConnection(SystemLandscapeFactory.java:152)
         at com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory.getJCOClientConnectionUnMapped(SystemLandscapeFactory.java:178)
         at com.sap.tc.webdynpro.services.sal.sl.core.SystemLandscapeInternal.getJCOClientConnectionUnMapped(SystemLandscapeInternal.java:62)
         at com.sap.tc.webdynpro.services.datatypes.core.DataTypeBroker$1.fillSldConnection(DataTypeBroker.java:77)
         ... 59 more
    Caused by: com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to load client to connect to SLD. Please check your SLD connection settings using the Visual Admin.
         at com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory$1.run(SystemLandscapeFactory.java:754)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory.getClient(SystemLandscapeFactory.java:747)
         at com.sap.tc.webdynpro.serverimpl.wdc.sl.JCOClientConnection.readJCODestinationFromSLD(JCOClientConnection.java:511)
         at com.sap.tc.webdynpro.serverimpl.wdc.sl.JCOClientConnection.resolveConnectionParameter(JCOClientConnection.java:439)
         at com.sap.tc.webdynpro.serverimpl.core.sl.AbstractJCOClientConnection.init(AbstractJCOClientConnection.java:233)
         at com.sap.tc.webdynpro.serverimpl.core.sl.AbstractJCOClientConnection.<init>(AbstractJCOClientConnection.java:218)
         at com.sap.tc.webdynpro.serverimpl.wdc.sl.JCOClientConnection.<init>(JCOClientConnection.java:129)
         at com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory.getJCOClientConnection(SystemLandscapeFactory.java:150)
         ... 62 more
    Caused by: com.sap.sldserv.exception.SldServiceRuntimeException: Failed to create CIM client. Check via 'Visual Administrator' tool if the secure store is operational.
         at com.sap.sldserv.SldApplicationService.getCimClient(SldApplicationService.java:117)
         at com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory$1.run(SystemLandscapeFactory.java:751)
         ... 70 more
    Caused by: com.sap.lcr.api.cimclient.CIMClientException: java.net.MalformedURLException: URL must have a host part
         at com.sap.lcr.api.cimclient.ClientFactory.createConnection(ClientFactory.java:466)
         at com.sap.lcr.api.cimclient.ClientFactory.createClientImpl(ClientFactory.java:413)
         at com.sap.lcr.api.cimclient.ClientFactory.createClient(ClientFactory.java:363)
         at com.sap.sldserv.SldApplicationService.getCimClient(SldApplicationService.java:113)
         ... 71 more
    ........Looks like a have a Problem with JCO.
    Is there a good guide, which explains the Basic steps in developeing Web dynpro applications and BAPI ?!

    thank you guys for all the answers.I have to read all the documentations.
    to my szenario:
    I installed on my notebook the Trial Versions of:
    SAP NetWeaver Application Server 7.00/Java AS 7.00
    SAP NetWeaver Developer Studio Version: 7.0.14
    All my basic Web Dynpro Applications in Java are running (even with Adobe Interactive Forms) on the local NetWeaver Trail- Web AS Trail perfectly.
    Now i want to connect per RFC to another SAPERP Server, which is in the intranet.
    I did the whole RFC tutorial with the flights -
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/76b45d9688e04abe1a1070410ddc1e/content.htm (also with the JCO codeing etc)
    so my web dynpro application should work.
    I think I have to configure - like ramesh said something on the NetWeaver Trail.
    So what do i need and configure excactly on my Netweaver Trial to work with RFC - to call the BAPIS in the other System?
    - SLD ? JCO ?
    If i over Web Dynpro - Content Administrator - >
    it says "Connection to System Landscape Directory (SLD) could not be opended successfully." and all the buttons
    create Jco destinations etc. are greyed out.
    I didn´t configured the SLD and JCO in the Netweaver yet.

  • Error when calling BAPI from web dynpro

    Hi,
    I have a program that calls a BAPI to retrieve data. The problem is that i have the following error message:
    com.sap.dictionary.runtime.DdException: 'WD_RFC_LOADBL_META' not properly defined! Unable to create Metadata connection for Dictionary Provider. Either the logical System Name 'WD_RFC_LOADBL_META' has not been properly defined in the System Landscape Directory, or you are not using a MsgServerDestination (AppServerDestinations are not permitted for Metadata connections)
    I have created a JCOP connector and tested it, everything works fine, but the application is not working.
    Any helpfull ideas ??
    Thanks a lot.
    Thibault Schalck

    I have checked again the parameters, have updated the logon group to PUBLIC and now I have this error message:
    com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to message server host failed Connect_PM TYPE=B MSHOST=sapdevnova GROUP=PUBLIC R3NAME=NO1 MSSERV=sapmsNO1 PCS=1 LOCATION CPIC (TCP/IP) on local host with Unicode ERROR service 'sapmsNO1' unknown TIME Fri Feb 06 16:23:15 2009 RELEASE 700 COMPONENT NI (network interface) VERSION 38 RC -3 MODULE ninti.c LINE 530 DETAIL NiPGetServByName2: service 'sapmsNO1' not found SYSTEM CALL getservbyname_r COUNTER 1
    I have no idea what this means...

  • Call a ABAP Web-Dynpro-application via a BSP-Application

    We have a BSP-Framework, that call several applications among other things other BSP-Applications, ITS-Application and other systems. Now I want to integrate a ABAP Web Dynpro-Application.
    For the moment I can call the ABAP Web Dynpro-Application from our application.
    This application runs in the same session as the Framework (verify in transaction sm04).
    When I want to call another application in the Framework, the session will be killed (no more sessions in sm04). This happens also, when I want to call the ABAP Web Dynpro-Application a second time.
    I guess, that the ABAP-Framework thinks I want to go outside the system (for example www.google.de) and close the session. I found out, that this wouldn't happen, if the application were suspended. But I found no way to tell the application via a url-parameter to suspend.
    Can someone help me?

    Thx for the tip,
    but I can't firea suspend plug. Because I'm in BSP. I understand the docu so, that you have the option to call a other apllication like BSP from a ABAP Web Dynpro.
    I want to call the ABAP Web Dynpro form BSP like this way.
    1. Start BSP-Framework
    2. Call ABAP Web-Dynpro-Application from BSP
    3. Call another Application from BSP without automatically logout by unload ABAP Web Dynpro. (I have a chance to call the ABAP Web Dynpro again via url to suspend before I call the other app.)
    Regards Stefanie

  • How to call method in web dynpro for ABAP

    Hi All,
    I created a z class and two methods to get the data.
    I created a WE4A application. Now i want to call these methods from my Z calss in the web dynpro ,but i am getting  amessage saying 'type zclass is unknown".
    when i am trying to declare
    data: cl_class type ref to zclass . i am getting above message.
    can anyone explain how to call zcalss methods in my application.

    Hi,
    You can call any global class method in WDA via. Wizard.
    Even more you can make your class as assistance class and call their methods by wd_assist.
    Thanks
    Pradeep

  • Call Transaction in Web dynpro

    Hi friends ,
    how to call the sap transaction in web dynpro abap.
    I am using the function module
      CALL FUNCTION 'ABAP4_CALL_TRANSACTION '
        EXPORTING
          tcode                         =  'VA01'
    in web dynpro abap
    but i am getting error like  fill all the required filed
    please give suggestion.
    Regards ,
    krishnan R.

    Hi Krishnan,
    You cannot call a transaction from WebDynpro ABAP. You can instead create an transactional iView in the portal. Go through this link for further information.
    [http://help.sap.com/SAPHELP_NW04S/helpdata/EN/18/f96f4132f15c58e10000000a1550b0/frameset.htm|http://help.sap.com/SAPHELP_NW04S/helpdata/EN/18/f96f4132f15c58e10000000a1550b0/frameset.htm]
    There are already many similar threads over the issue of calling a transaction from WebDynpro ABAP. Please try run a search in the previous forum threads. Below are a few such threads:
    [https://forums.sdn.sap.com/click.jspa?searchID=18250003&messageID=5345700|https://forums.sdn.sap.com/click.jspa?searchID=18250003&messageID=5345700]
    [call Transaction thru WB4A.|call Transaction thru WB4A.]
    Regards,
    Uday

  • How to call call transaction in web dynpro abap

    hello experts,
    i need to call one RFC in web dynpro.In RFC we maintained the BDC program. but while calling the same RFC in web dynpro through service call function, it is not working.Kindly suggest any way out.this is very urgent.
    Regards

    Hi Rajat,
    Please use the below mentioned link.May be it will help you:
    The webdynpro/ABAP (WDA) calling RFC enabled FM of other ECC systems
    Thanks and Regards,
    Neha

  • How to Call Transaction iView that calls RRMXP from Web Dynpro for ABAP

    Dear Experts,,
    I'm developing an application in Web Dynpro for ABAP wherein I'm supposed to give a link that should open an SAP Transaction iView that calls  tcode = 'RRMXP' and I pass the application parameter as QUERY/WBID = <BI query/Workbook ID>.
    I tried calling com.sap.portal.appintegrator.sap.bwc.Transaction iView, but it asks for system/application and GUI type parameters. How to pass through the URL?
    Any help would be highly appreciated
    Regds,
    Srini

    Hi Wolfgang,,
    My problem was that I was supposed to call the BeX Web Analyser ( a BI excel based tool - client installation) on click of a button in my WD-ABAP application. I solved it as follows :
    In the portal pcd, I cam across a folder content provided by SAP. Here, you'll find standard template iViews that can be used to call applications ( for which you make iViews). I had to call an SAP TCode : RRMXP so as to call a BI Workbook/Query.
    So, I called the standard iView template for sap_transaction_iView as follows :
    irj/servlet/prt/portal/prtmode/preview/prtroot/'
               'pcd!3aportal_content!2fcom.sap.pct!2ftemplates'
               '!2fiviews!2fcom.sap.portal.sap_transaction_iview?'
               'sap-config-mode=true&System=BWR3System&TCode=RRMXP'
               '&GuiType=WinGui&OkCode=y&ApplicationParameter='  <appnm>  into url.
          l_popup =
             l_window_manager->create_external_window( url = url
                                          has_menubar = ' '
                                         has_statusbar = ' '
                                          has_toolbar = ' '
                                          has_location = ' ').
          l_popup->open( ).
    And , it worked.
    Any more help pls feel free to revert.
    Regds,
    Srini

  • How to call jsp from web dynpro app.

    Hi Frndz,
    How can I call a JSP from my web dynpro(and here i don't want to redirect to JSP ),I want to call a JSP which can show a message window as alert on top  of WDP view.
    Here am using CE 7.2 SP1, and my requirement is to call the model(back end) for every minute interval and need to give alert that how many new records r added.With WDP java i haven't find any option to give alert r notifications about new records added, so am thinking to call JSP where I will pass the parameter which can show a alert r notification(like FACEBOOK n outlook notifications).
    Please share any ideas ti achieve this,
    Thanks in advance.
    Regrads
    Rajesh

    Hi,
    If your application should open in a new url, then you can use link to url action to open jsp.
    You can also use EPCF navigation api to call any pcd page as well external links
    i.e
      WDPortalNavigation
          .navigateAbsolute("link",[parameters]);
    Since your passing parameters, you build url in both the cases.
    Ram

  • Calling Page in Web dynpro

    Hii,
    I created one application in web dynpro.In the start page i have create button,export,refresh button and table.
    I created button by name """ Create """"...And also in Action tab i given """"create"""..............
    My requirement is.............
    When i press Create button,,,,it has to go to next page.
    when i press ""Save """""" it has to save the data...
    Same for Cancel,Delete,Export,Refresh also........
    For that what i have to do in the application.Is there any need to write the code.If thats the case,,,please provide the code for me.
    Thanks in advance.
    Regards
    Sushma

    Hi sushma ,
    1. For the "create"  button , to navigate to a new view what you have to do is to create outbound plug(createout)  in the current view and an inbound plug(newin) to the view which you want to navigate ,
    in the onAction property of the "create" button reate an action say onClick and in the implementations tab , add the following code to navigate to next view,
    wdThis.wdFirePlugCreateout();
    2. For the "save" button , if you want to save data from the view , you can create an RFC model for any functional module that does the required job of storing the data into the table.
    Similarly for Delete , eport and all.
    Regards
    Sam Charles J

  • How to Use BAPI in Web dynpro?

    Hi SDN,
    I am trying to use BAPI_FLIGHT_GETLIST in my web dypro application but my result table doesn't showing any data.
    can you please tell me the reason behind this?
    Regards,
    Rahul

    hi rahul.........
             steps to be followed:
                Right click on your component and click create->service call.
                give the bapi name you want to access.
                give the rfc destination name..
                if you have all the rights, then whatever name you give, an rfc destination will be created automatically.
                 otherwise you have to specify an already existing rfc destination name.
                 in your view you create input fields for binding the importing parameters.
                 bind the changing parameters to your table.
                 <b>make sure you call the method which will calls the bapi</b> either when you initialize your window or have a button and call the method, inside its action.
                 <b>embed your view to the window</b>.
    note:
             the method and the respective codings would be automatically generated when you created your service call.
    ---regards,
       alex b justin.

  • Call Function in Web Dynpro

    Hi all, does anyone know how to call function 'RH_GET_DATE_DAYNAME' in WDDOINIT?
    Regards,
    YC

    Hi YC,
    see.. for example you have some FM or BAPI or Class method already there, now that you want to use in webdynpro,
    so by using SERVICE CALL option you can use this.
    Generally, WD is MVC pattern, so bussiness logic statements like SELECT, MODIFY, INSERT like commands directly
    not use in webdynpro methods, for this we create any FM or Class method and use those FM in webdynpro using
    SERVICE CALLS.
    Check this example for your understand..
    http://wiki.sdn.sap.com/wiki/display/WDABAP/WebdynproApplicationtocalltwoBAPIsfordisplayingtheFlightdetailsusingtab+strips
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9cb5d345-0801-0010-6a8e-fc57c23fd600?quicklink=index&overridelayout=true
    And read this..
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/a189b0ee583b8be10000000a421937/frameset.htm
    ->using CALL FUNCTION you can call any FM in webdynpro abap.. same works with pattern too.
    Cheers,
    Kris.
    Edited by: kissnas on Mar 9, 2011 7:00 AM

  • Creating a sales document using BAPI in web dynpro by uploading a file

    Hi ALL,
    Can some one help me how to create a sales document using  BAPI by uploading a file as input...Can someone  provide me a sample program....
    Thanks n Regards,
    Praveenn.
    Edited by: praveenn on Aug 23, 2011 12:42 PM

    Hi Sri,
    Thx for the response...
    Here is the code that i followed for creating a BAPI_SALESORDER_CREATE1 by uploading a text file as input.
    Just create a Attribute  in the VIEW CONTEXT of type String.
    method ONACTIONCREATE_SO .
    types : Begin of ty_data,
             sales_org  type vkorg,
             doc_type   type AUART,
             DISTR_CHAN type VTWEG,
             DIVISION   type spart,
             material   type matnr,
             partn_role type PARVW,
             PARTN_NUMB type kunnr,
           end of ty_data.
      DATA  :it_table TYPE  TABLE OF ty_data,
             i_data   TYPE  TABLE OF string,
             l_string TYPE string,
             wa_table TYPE ty_Data,
             l_xstring TYPE xstring,
             fields TYPE string_table,
             lv_field TYPE string.
    DATA: wa_order_header_in TYPE BAPISDHD1,
          it_order_items_in  TYPE TABLE OF BAPISDITM,
          wa_order_items_in  TYPE BAPISDITM,
          it_order_partners  TYPE TABLE OF BAPIPARNR,
          wa_order_partners  TYPE BAPIPARNR,
          it_return TYPE TABLE OF BAPIRET2,
          wa_return TYPE BAPIRET2.
    DATA : sales_doc type bapivbeln-vbeln.
    DATA:
       node_zfinal_node  TYPE REF TO if_wd_context_node,
       elem_zfinal_node  TYPE REF TO if_wd_context_element,
       stru_zfinal_node  TYPE if_main_view=>element_zfinal_node .
    get single attribute
      wd_context->get_attribute(
      EXPORTING
      name =  'DATASOURCE'
      IMPORTING
      value = l_xstring ).
      CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
        EXPORTING
          in_xstring = l_xstring
        IMPORTING
          out_string = l_string.
    SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE i_data.
      LOOP AT i_data INTO l_string.
       SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
        READ TABLE fields INTO lv_field INDEX 1.
        wa_table-sales_org = lv_field.
        READ TABLE fields INTO lv_field INDEX 2.
        wa_table-doc_type = lv_field.
        READ TABLE fields INTO lv_field INDEX 3.
        wa_table-DISTR_CHAN = lv_field.
        READ TABLE fields INTO lv_field INDEX 4.
        wa_table-DIVISION = lv_field.
        READ TABLE fields INTO lv_field INDEX 5.
        wa_table-material  = lv_field.
        READ TABLE fields INTO lv_field INDEX 6.
        wa_table-partn_role  = lv_field.
        READ TABLE fields INTO lv_field INDEX 7.
        wa_table-partn_numb  = lv_field.
    APPEND wa_table TO it_table.
      ENDLOOP.
    loop at it_table into wa_table.
    clear : wa_order_header_in.
    wa_order_header_in-sales_org   = wa_table-sales_org.
    wa_order_header_in-doc_type    = wa_table-doc_type.
    wa_order_header_in-distr_chan  = wa_table-distr_chan.
    wa_order_header_in-division    = wa_table-division.
    clear : wa_order_items_in.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = wa_table-material
    IMPORTING
       OUTPUT        = wa_order_items_in-material.
    *wa_order_items_in-req_qty  = wa_table-req_qty.
    append wa_order_items_in to it_order_items_in.
    clear : wa_order_partners.
    wa_order_partners-partn_role = wa_table-partn_role.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = wa_table-partn_numb
    IMPORTING
       OUTPUT        = wa_order_partners-partn_numb
    *wa_order_partners-partn_numb = wa_table-partn_numb.
    append wa_order_partners to it_order_partners.
    endloop.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
      SALESDOCUMENTIN               =
        order_header_in               = wa_order_header_in
      ORDER_HEADER_INX              =
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
    IMPORTING
       SALESDOCUMENT                 = sales_doc
      tables
       RETURN                        = it_return
       ORDER_ITEMS_IN                = it_order_items_in
      ORDER_ITEMS_INX               =
        order_partners                = it_order_partners.
      ORDER_SCHEDULES_IN            =
    get message manager
    DATA: l_current_controller TYPE REF TO if_wd_controller,
           l_message_manager    TYPE REF TO if_wd_message_manager.
           l_current_controller ?= wd_this->wd_get_api( ).
    DATA:  v_message_text TYPE string.
    When Sales Order is created commit the data
    IF NOT sales_doc IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       EXPORTING wait = 'X'.
      CONCATENATE 'Sales Document' sales_doc 'has been created.' INTO v_message_text SEPARATED BY space.
    Report Success message
      CALL METHOD l_message_manager->report_success
      EXPORTING
      message_text = v_message_text.
      ELSE.
      v_message_text = 'Error Creating Sales Order'.
    Report Error message
    CALL METHOD l_message_manager->report_error_message
    EXPORTING
    message_text = v_message_text.
    ENDIF.
    endmethod.
    Edited by: praveenn on Aug 30, 2011 2:41 PM

  • Call smartform in web dynpro abap

    hi guys,
          I am tring to create PDF from smartform but am getting sy-subrc = 1 error after call function LV_FNAM.
    I am attaching the code below. Am not using InteractiveForm UI Elemnt .
    data: lv_fnam type rs38l_fnam,
          ls_ssfctrlop type ssfctrlop,
          ls_ssfcompop type ssfcompop,
          ls_book type ppftbook,
          ls_job_output_info type ssfcrescl,
          ls_job_output_options type ssfcresop,
          lv_bytecount type i,
          lt_lines type table of tline,
          ls_line type tline,
          lv_string type string,
          lv_buffer type xstring,
          l_xline type xstring,
          l_pdfstring type xstring,
          it_add_rel type table of zprint_add_rel.
    *      p_pdf type xstring.
    data : wa_board type mara-matnr,
           plant type marc-werks.
    wa_board =  'SYPJ764'.
    plant = '2001'.
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSSF_ADD_REL'
    importing
    fm_name = lv_fnam.
    ls_ssfctrlop-no_dialog = 'X'.
    ls_ssfctrlop-getotf  = 'X'.
    ls_ssfctrlop-preview = 'X'.
    ls_ssfcompop-tdnoprev = 'X'.
    ls_ssfcompop-tdtitle = 'X'.
    ls_ssfcompop-tdnewid = 'X'.
    call function lv_fnam
    exporting
    control_parameters = ls_ssfctrlop
    output_options = ls_ssfcompop
    *is_book = ls_book
    board = wa_board " 'SYPJ764'
    plant = plant " '2001'
    importing
    job_output_info = ls_job_output_info
    job_output_options = ls_job_output_options
    tables
    it_add_rel_i = it_add_rel
    exceptions
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    other = 5.
    if sy-subrc <> 0.
    endif.
    *convert to pdf
    call function 'CONVERT_OTF'
    exporting
    format = 'PDF'
    importing
    bin_filesize = lv_bytecount
    tables
    otf = ls_job_output_info-otfdata
    lines = lt_lines
    exceptions
    err_conv_not_possible = 1
    err_bad_otf = 2.
    loop at lt_lines into ls_line.
    lv_string = ls_line.
    export mydata = lv_string to data buffer lv_buffer.
    import mydata to l_xline from data buffer lv_buffer in char-to-hex mode.
    concatenate l_pdfstring l_xline into l_pdfstring in byte mode.
    endloop.
    p_pdf = l_pdfstring.
    Please help me out with this error.
    Regards,
    Santosh

    Hi Santhosh,
    Please find the below code:
    FUNCTION ZP3088_NEW_JOINEE_ACT.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(PERNR) TYPE  PERSNO
    *"  EXPORTING
    *"     REFERENCE(L_DISPLAY_PDF) TYPE  NUM1
    *"     REFERENCE(L_DATA) TYPE  XSTRING
    *"  EXCEPTIONS
    *"      TRAINEE_PERNR
    * Tables declaration
      TABLES: NAST,PA0041.
    *   Type pools declaration
      TYPE-POOLS: SZADR.
    *   Internal table declaration
      DATA: L_PDF_LEN TYPE I,
            IT_PDF_LINES TYPE TABLE OF TLINE,
            JOB_OUTPUT_INFO TYPE  SSFCRESCL.
    *   Variables declaration
      DATA: G_RETCODE LIKE SY-SUBRC,
            G_FMNAME TYPE RS38L_FNAM.
      DATA: L_HIRE_DATE TYPE DATS,
            L_INCLUDE_DATE TYPE DATS,
            L_WEEK_DAYS TYPE P,
            IT_P0041 LIKE PA0041.
      DATA: DAR TYPE PA0041-DAR01,
            DAT TYPE PA0041-DAT01.
      DATA: L_DEVICE(30) TYPE C,
            LA_CTRL_FORM TYPE SSFCTRLOP,
            LA_OUTPUT_OPT TYPE SSFCOMPOP.
      data: l_persg type PA0001-persg. 
    * Start of Actual Code
      SELECT SINGLE persg
        from PA0001
        INTO l_persg
       where pernr eq pernr
         and endda eq '99991231'.
        if l_persg eq 'T' or
           l_persg eq 'W' or
           l_persg eq 'X'.
          raise trainee_pernr.
        endif.
      L_DISPLAY_PDF = 0.
      SELECT SINGLE * FROM PA0041 INTO IT_P0041
             WHERE PERNR EQ PERNR.
      IF SY-SUBRC = 0.
        DO 12 TIMES VARYING DAR FROM IT_P0041-DAR01
                                  NEXT IT_P0041-DAR02
                      VARYING DAT FROM IT_P0041-DAT01
                                  NEXT IT_P0041-DAT02.
          CASE DAR .
    *        WHEN '09'.          "Hiring Date
            WHEN '51'.          "Hiring Date
              L_HIRE_DATE = DAT.
              EXIT.
            WHEN ''.
              EXIT.
          ENDCASE.
        ENDDO.
      ENDIF.
    *To get the no. of weekdays between the hire date and current date excluding sat and sun
      IF NOT L_HIRE_DATE IS INITIAL.
        WHILE L_HIRE_DATE LE SY-DATUM.
          CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
            EXPORTING
              DATE_IN  = L_HIRE_DATE
            IMPORTING
              DATE_OUT = L_INCLUDE_DATE.
          DO 5 TIMES.
            " Making sure that it starts from the from date till to_date calculate before
            IF L_INCLUDE_DATE GE L_HIRE_DATE AND L_INCLUDE_DATE LE SY-DATUM.
              L_WEEK_DAYS = L_WEEK_DAYS + 1.
            ENDIF.
            L_INCLUDE_DATE = L_INCLUDE_DATE + 1.
          ENDDO.
          L_HIRE_DATE = L_INCLUDE_DATE + 2.
        ENDWHILE.
    IF L_WEEK_DAYS LE 30.
          L_DISPLAY_PDF = 1.         "Display the PDF document
        ELSE.
          L_DISPLAY_PDF = 0.         "Do Not Display the PDF document
        ENDIF.
      ENDIF.
      IF L_DISPLAY_PDF = 1.
    * Clear local variables
        CLEAR:   L_DEVICE,
                 LA_CTRL_FORM,
                 LA_OUTPUT_OPT.
    ** Spool Parameters
        LA_OUTPUT_OPT-TDIMMED = 'X'.
        LA_OUTPUT_OPT-TDDELETE = 'X'.
        LA_OUTPUT_OPT-TDLIFETIME = 'X'.
        LA_OUTPUT_OPT-TDDEST = 'LOCL'.
    * Get Smartform function module name
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            FORMNAME           = 'ZP3088_NEW_JOINEE_ACT_PDF'
          IMPORTING
            FM_NAME            = G_FMNAME
          EXCEPTIONS
            NO_FORM            = 1
            NO_FUNCTION_MODULE = 2
            OTHERS             = 3.
        IF SY-SUBRC <> 0.
          G_RETCODE = SY-SUBRC.
          SYST-MSGTY = 'E'.
        ELSE.
    * Parameters passes to get the output in PDF format
          LA_CTRL_FORM-NO_DIALOG = 'X'.
          LA_CTRL_FORM-PREVIEW = SPACE.
          LA_CTRL_FORM-GETOTF = 'X'.
          LA_CTRL_FORM-LANGU = NAST-SPRAS.
          LA_CTRL_FORM-DEVICE = 'PRINTER'.
    Edited by: wahid hussain syed on Nov 4, 2010 3:41 AM
    Edited by: wahid hussain syed on Nov 4, 2010 3:41 AM
    Edited by: Neil Gardiner on Nov 4, 2010 2:04 PM

  • Calling BADIs in Web-Dynpro Application

    Hi All,
    Is it possible to call BADIs in WebDynpro  java ?  If yes can anybody please send some document regarding this to me.
    Thanks & Regards,
    Amit Kade

    Hi,
    These links can be of some help
    <a href="http://searchsap.techtarget.com/tip/1,289483,sid21_gci900872,00.html">Link1</a>
    <a href="http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci1154531,00.html">Link 2</a>
    Regards,
    Ashwani

Maybe you are looking for