Document number generated from function module K_COSTS_PLAN_INTERFACE_TOTAL

Dear friends,
  I am using function module K_COSTS_PLAN_INTERFACE_TOTAL to upload the Planning costs, After this function module call I need the document number generated for that item, but there is no return parameter from this function module which would give me the document number generated. Please let me know how to get the document number after this function module call.

Hi...
Try this function module..
CALL FUNCTION 'BAPI_DOCUMENT_GETLATEST2' "
  EXPORTING
    documenttype =              " bapi_doc_aux-doctype  Document type
    documentnumber =            " bapi_doc_aux-docnumber  Document number
    documentpart =              " bapi_doc_aux-docpart  Documentation - text lines
    documentversion =           " bapi_doc_aux-docversion  Document version
    multilevelexplosion = 'X'   " bapi_doc_aux-flag  Document management indicator
*   docbomchangenumber = SPACE  " bapi_doc_draw2-ecnumber  Change number
*   docbomvalidfrom = SY-DATUM  " bapi_doc_draw2-validfromdate  Valid-From Date
*   docbomrevisionlevel = SPACE  " bapi_doc_draw2-revlevel  Revision level
*   loadlatest = 'X'            " bapi_doc_aux-flag  Document management indicator
*   loadlatestreleased = 'X'    " bapi_doc_aux-flag  Document management indicator
*   search_new_maindoc = SPACE  " bapi_doc_aux-flag  Document management indicator
*   getdocdata = SPACE          " bapi_doc_aux-flag  Document management indicator
*   getobjectlinks = SPACE      " bapi_doc_aux-flag  Document management indicator
*   getdocdescriptions = SPACE  " bapi_doc_aux-flag  Document management indicator
*   getlongtexts = SPACE        " bapi_doc_aux-flag  Document management indicator
*   getstatuslog = SPACE        " bapi_doc_aux-flag  Document management indicator
*   getdocfiles = SPACE         " bapi_doc_aux-flag  Document management indicator
*   getcomponents = SPACE       " bapi_doc_aux-flag  Document management indicator
*   getclassification =         " bapi_doc_aux-flag  Document Management Indicator
*   getstructures =             " bapi_doc_aux-flag  Document Management Indicator
*   getwhereused =              " bapi_doc_aux-flag  Document Management Indicator
*   sortf_exclude = SPACE       " stpox-sortf   Sort string
*   sortf_stop_expl = SPACE     " stpox-sortf   Sort string
*   expl_docs_only_once = 'X'   " bapi_doc_aux-flag  Document management indicator
*   stop_on_first_error = SPACE  " bapi_doc_aux-flag  Document Management Indicator
  IMPORTING
    return =                    " bapiret2      Return parameter
    newversion =                " bapi_doc_aux-docversion  Document version
  TABLES
    docstructure =              " stpox         BOM Items (Extended for List Displays)
*   changedversions =           " tchg_vers     Table for Transferring Changed Document Versions
*   statuslist =                " tstate_order  Sequence of Status Check
*   documentdata =              " bapi_doc_draw2  BAPIS DMS: document data
*   objectlinks =               " bapi_doc_drad_keys  BAPIS DMS: document data
*   documentdescriptions =      " bapi_doc_drat_keys  BAPIS DMS: document data
*   longtexts =                 " bapi_doc_text_keys  BAPIS DMS: document data
*   statuslog =                 " bapi_doc_drap_keys  BAPIS DMS: document data
*   documentfiles =             " bapi_doc_files2_keys  BAPIS DMS: document data
*   components =                " bapi_doc_comp_keys  BAPIS DMS: document data
*   all_returns =               " bapiret2      Return Parameters
*   characteristicvalues =      " bapi_char_values_keys  BAPI Structure for Characteristic Value Assignment (Docs)
*   classallocations =          " bapi_class_allocation_keys  BAPI Structure for the Assignment of Classes to Several Objects
*   documentstructures =        " bapi_doc_structure_keys  BAPIs DMS: Structure Data for Several Documents
*   whereusedlists =            " bapi_doc_structure_keys  BAPIs DMS: Structure Data for Several Documents
    .  "  BAPI_DOCUMENT_GETLATEST2
And also check this link..
Send original document from DMS as mail attachment
Hope this will help you..
Regards,
Jhings

Similar Messages

  • I generated web service from function module.Where can I find .wsdl file ?

    Hi,
    I generated web service from function module.
    Where can I find .wsdl file ?
    I want to use .wsdl file in .Net application.
    Thanks.

    Hii Cemil Bozlagan,
      All Remote enabled Function Modules in Web AS 6.20 and Above are available as Webservices and the WSDL documents are available in the web service repository at
    [http://<host>:<port>/sap/bc/bsp/sap/webservicebrowser/search.html]
    Find the respective BAPI.
    Click on the WSDL link in the browser and download the WSDL document and use it as per the requirement
    Regards,
    Varun

  • Provide Asynchornous Webservice from Function Module

    Hi!
    I need to create a webservice to provide master data. My scenario do not use Process Integration, so I create the webservice from function module (Remote-Enable Module) through SE80.
    When service is created I can see in the configuration tag that is not possible to change to asynchronous mode.
    I want to create asynchronous webservice because I need to return master data. Selecting this data consume a lot of time, so in order to avoid timeouts I think is better to create asynchronous webservice.
    May be I am wrong but I think is not possible to create async webservice without PI.
    All documents I have read until now show async comunication through PI and using proxy clients but I have not found the case I am talking.
    Thanks
    Reagards
    Edited by: jordis on Mar 17, 2011 4:45 PM

    Thanks Raja,
    I think I'm confusing about synchronous / asynchronous concept in webservices. I need an example or an explanation where I can understand it. Taking account that I do not have PI, where scenario I'm moving in?
    I mean, is it possible that an external client calls my webservice created through FM in async mode? Maybe is the client who has to create the corresponding call to the webservice in async mode and I have to do anything.
    Another question related, what does it means the propierty sync/async in a proxy?
    I do not understand your sugestion since I think that proxy creaton is relevant in case of the connecting SAP with an external system (I tried it and I have to inform an URL o WSDL).
    All documents I have readed have been in the context of PI and I think my case is more simply.
    Any more suggestions, links or ideas?
    Thanks
    Regards
    Edited by: jordis on Mar 18, 2011 12:41 PM

  • How to create webservice from function module

    Hello,
    I'm trying to create webservice from function module from. I choose Utilities/More Utilities/Create Webservice/..From function Module. What data should I enter in section "Enter Package/Request" ?
    When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign namespaces"
    Is there any doc about this procedure (web service creation) with description of all sections ?
    thanks for any reply,
    Lukasz Ferenc

    Hi,
    Which SAP product of wich release of which SP are you using ?
    The procedure is documented in help.sap.com and in blogs and SDN forum messages.
    It means that the use of the SEARCH button should give plenty of answers...
    >When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign >namespaces"
    As usual, begin your choosen name with an "Z".
    Regards,
    Olivier

  • Calling a report from function module

    Hi Friends,
    I have requirement for Function Module i.e. we will add the button to the standard T-code and ( Function added in config ) then
    Function to be called from Customizing
    Program A called from customizing function
    CalculationPDFFunction  is called from program A.
    So can any one help me the logic for "calling a report from function module  ".
    Thanks in Advance.
    Regards,
    OSReddy.
    Edited by: OSReddy on Sep 23, 2011 7:31 AM

    Hi Jaya,
    Yes. It is possible to call ur custom program using SUBMIT statement.
    1. If u have data to pass then build table type RSPARAMS and use below statement.
    data:
          rspar_tab  TYPE TABLE OF rsparams,
          rspar_line LIKE LINE OF rspar_tab,
    SUBMIT report1 WITH SELECTION-TABLE rspar_tab
                   AND RETURN.
    1. If u want to create variant to the program and use that. use the below statement .
    SUBMIT report1 USING SELECTION-SET 'VAR1' "variant
                   AND RETURN.
    Regards,
    Venkat.O

  • Request number of a function module.

    Hi Experts,
    Can anybody plz send me the table where the request number of a function module get stored.
    (Function groups are stored in E071,But i need the request number for function module.)
    If any function module for the same plz send it
    Regards,
    Anoop Chandran

    Hi Martin,
    My scenario  is ;
    i have 2 fn modules
    Fn mod1 and Fn mod2 in fn group A
    and i transported this to another server.
    now i changed fn mod1 and transported.
    so the request number of fn mod 1 get changed.
    So my req is to not based on fn group.
    And it depends on fn modules.
    Can u plz gv me some idea to get the request number (tables or fn mods) of fn module??
    Regards,
    Anoop Chandran

  • How to create a generic datasource from function module?

    Dear experts,
    I have created a generic datasource from function module. For this extrator, I created a function module and a structure.
    I have now some difficulties to continue:
    In this function module, i get data from different transparent tables. Then i put these data into an internal table.
    I just don't know what is the relatioin between the structure i defined and this internal table.
    I should make "iTab structure AA" in the source code?
    Thanks

    Hi..
    check this
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    1. Create s structure with the fields that you need from the 4 tables . Activate.
    2. Goto SE 80 Select The Function Group , Copy , Select the Function module
    " RSAX_BIW_GET_DATA_SIMPLE " and Give a New name starting With
    Y or Z .
    3. SE37 ->Your Function module name -> Change , In table tab give your structure
    name by deleting the associated type given in " XXXX " .
    4. Now select source code and Do the coding . Give Data source name in Coding .
    In your case you have to take data from more that 1 table .
    5. Activate the Function Group .
    6. In RSO2 Create the Data source , Give the Function Module Name , And Save.
    7. RSA3 -> Give data source name and Check for the Records .
    Creation of custom datasource. (Using function module)
    .Create a function group .
    . Structure ZTXXXX
    Create function module (i.e. ZTESTXXX) .
    . Create the data source using transaction (RSO2).
    . If structure exists for the table parameter of your function module then ok else create a structure for the table parameter ‘        ’.
    Test the datasource in R/3 using transaction RSA3.
    Transfer the data source to BW –System and replicate it in the BW-System.
    Message was edited by:
            shiv

  • Urgent: Web Service from Function Module

    Hi guys, I am new to this area so please help to achieve following:
    I want to show a demo to load data from a web service to BI. I have performed the following steps and don’t know how to process further. Please help me in the sense where do I put the logic to show fields on the web service and ….
    1. I have created a web service data source in BI with four fields (Cal dat, material, amount and currency)
    2. This created a Web Service /RFC FM automatically.
    3. From this FM I created a web service (Utilities – create web service – from function module)
    4. I followed the web service creation wizard.
    Thanks,
    sam

    releasing and related steps are fine,
    what i want to know is, BW/BI datasource will create a FM, from this FM inturn I will create a webservice.
    Lets say BW/BI datasource has 4 fields account, company, amount & currency.
    I want to enter these 4 values from the webservice which will bring these values to BW delta queue and eventually get loaded in BW.
    For this process do I need to code anything in the FM or any other part of the system

  • Can we change WSDL file created from Function Module wizard??

    Hi everybody!
    I have created a web service from function module using SAP wizard.
    Now the consumer side want me to change <wsp:UsingPolicy wsdl:required="true"/>
    Is this possible???
    If so how?????
    Thank u in advance!!

    Hi Muhammad!
    As soon as you open WSDL for selected binding in the URL are of you explorer change the ws_policy with "standard" . Then simply save the wsdl and send it to the other party.
    Hope this helps!

  • Creating Spool from function module

    Hi friends,
    I want to create a spool from my function module. I dont knw it is possible or not. Currently I am creating spool by submitting another report from my function module and exporting the values calculated in memory ID and importing in report which is not  a good practise, kindly suggest some other way.
    Thanks,
    Brijesh

    No. Spool is not possible from Function Module. You have to use that FM from one report/program.
    Thanks
    Subhankar

  • Calling Web Service from Function Module

    dear all
    i am new to SAP.
    i have a web Service developed with .net and C#.
    i want to call this web Service from inside a function module.
    how can i do this ?
    thanks,

    Hi Ramzy,
    Please browse through chrome or sdn , there is a lot of documents and discussions, any how find the below URL, which might be helpful.
    Create an SAP Web Service Consumer (calling External Web Service from ABAP)
    Create a Function Module and full the below Code :
    Sample code :
    DATA: http_client TYPE REF TO if_http_client,
          host_str TYPE string VALUE 'www.myservice.in',
          service_str TYPE string,
          path TYPE string VALUE  'my path',
          errortext TYPE string. "used for error handling
    DATA  : wf_string1 TYPE string,
             lw_inputs TYPE string,
             error_text type string,
             subrc TYPE SY-SUBRC,
             lw_outputs TYPE  string.
    CALL METHOD cl_http_client=>create_by_url
      EXPORTING
        url                = 'myurl'
      IMPORTING
        client             = http_client
      EXCEPTIONS
        argument_not_found = 1
        plugin_not_active  = 2
        internal_error     = 3
        OTHERS             = 4.
      IF sy-subrc <> 0.
    *  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = '~request_method'
        value = 'POST'.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = '~server_protocol'
        value = 'HTTP/1.1'.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = '~request_uri'
        value = 'mypath'.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = 'Content-Type'
        value = 'application/soap+xml; charset=utf-8'."'text/xml; charset=utf-8'.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = 'Content-Length'
        value = '19000'."txlen.
    CALL METHOD http_client->request->set_header_field
      EXPORTING
        name  = 'SOAPAction'
        value = 'myURL'.
    concatenate 'data u need sned' into wf_string
    CALL METHOD http_client->request->set_cdata
      EXPORTING
        data   = wf_string1
        offset = 0
        length = '19000'.
    Regards,
    Lokeswar.

  • How to createWebservice from Functional Module inECC system and how to test

    Hi all
    i have one functional module in backend system i.e BAPI_GL_ACC_GETLIST. now i want to create a Webservice from the above functional module. once the webservice is ready in ECC system then how do we access in webdynpro thru model. i want to test the same webservice in ECC system itself, what is the procedure??
    can any body send the clear steps on starting from create of webservice and till to access the same in webdynpro.
    if we want to access from webdynpro thru model for the  same webservice which did in ECC system, is it require to deploy on J2ee engine by creating the same webservice or we can access that directly in Webdynpro??
    can you please tell me clear steps on the same rather than documents??
    Regards
    Suresh babu

    Hi Suresh,
    refer This ppt link will  help you.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/244e7923-0a01-0010-5887-fe0b0c6dbb8d
    Supraja

  • How to download Temp tables from Function Module

    Hi Gurus,
    I have a function Module which is getting data from various DSOs and putting in another DSO.
    For data validation purposes I need to download data which is in temp tables.
    I know I need to go to SE37 and set breakpoint and then go to rsa3 and run the extractor/ FM in DEBUG mode. After that I have to execute the FM. I performed all these steps but still could not  downlaod temp tables.
    Anybody has any suggestions if I am missing any steps in here.
    Regards

    if you have a temp table - say itab - then you can have an open dataset command to dump the table into a flat file in your app server and then do the reconsiliation with that data.  This is because extraction is done using a background job and you can only store the data as a flat file onto the app server.
    The flat file can be generated using the open dataset command.

  • Pushing data in packets from Function Module to BW

    Hi All,
    I have been struggling with a problem for about a week and a half and I find myself at an in-pass. I firstly created a function module to pull data from SAP and join multiple tables so I could use it to report in Crystal. The problem was that it was so much data that I received errors due to processing time.
    Thus to solve this problem I now use the function module to push data into a datasource so that it executes in the background.
    The main problem I am experiencing is how to code a function module so that it will retrieve the data in segments then commit then retrieve next segment. At the moment the program works but if the data increases like it should I will run into the no more space in the internal table error.
    Example of my code below. (much simplified to just demonstrate functionality). Sorry that it is still long but didn't  want to leave out parts that might be important.
    So how would one get the data to retrieve from the SAP tables and commit to BW in segments instead of like I do to retrieve all the data then pump into BW in segments.
    FUNCTION ZBOBJ_COMMISSION.
    *"  IMPORTING
    *"     VALUE(I_REQUNR) TYPE  SRSC_S_IF_SIMPLE-REQUNR
    *"     VALUE(I_DSOURCE) TYPE  SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
    *"     VALUE(I_MAXSIZE) TYPE  SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
    *"     VALUE(I_INITFLAG) TYPE  SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
    *"     VALUE(I_READ_ONLY) TYPE  SRSC_S_IF_SIMPLE-READONLY OPTIONAL
    *"     VALUE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
    *"  TABLES
    *"      I_T_SELECT TYPE  SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
    *"      I_T_FIELDS TYPE  SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
    *"      E_T_DATA STRUCTURE  ZDGB_COMMISION_REPORT OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
      STATICS : counter type i.
    ** Example: DataSource for table SFLIGHT
      TABLES: ZDGB_COMMISION_REPORT.
    ** Auxiliary Selection criteria structure
      DATA: L_S_SELECT TYPE SRSC_S_SELECT.
    ** Maximum number of lines for DB table
      STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
    ** counter
              S_COUNTER_DATAPAKID LIKE SY-TABIX,
    ** cursor
              S_CURSOR TYPE CURSOR.
    ** Initialization mode (first call by SAPI) or data transfer mode
    ** (following calls) ?
      IF I_INITFLAG = SBIWA_C_FLAG_ON.
    ** Check DataSource validity
        CASE I_DSOURCE.
          WHEN 'ZBOBJ_COMMISSION'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE E009(R3). ENDIF.
    ** this is a typical log call. Please write every error message like this
            LOG_WRITE 'E'                  "message type
                      'R3'                 "message class
                      '009'                "message number
                      I_DSOURCE   "message variable 1
                      ' '.                 "message variable 2
            RAISE ERROR_PASSED_TO_MESS_HANDLER.
        ENDCASE.
        APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT.
    * Fill parameter buffer for data extraction calls
        S_S_IF-REQUNR    = I_REQUNR.
        S_S_IF-DSOURCE = I_DSOURCE.
        S_S_IF-MAXSIZE   = I_MAXSIZE.
        APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
      ELSE.                 "Initialization mode or data extraction ?
        STATICS: st_itab TYPE ZDGB_COMMISION_REPORT OCCURS 0 WITH HEADER LINE.
        IF S_COUNTER_DATAPAKID = 0.
    ORIGINAL - DIRECT CUSTOMER**********************************************************
          Select
                 VBPA~KUNNR
                VBRK~VBTYP
                INTO CORRESPONDING FIELDS OF TABLE itab1
                  FROM
                    VBRK
                    INNER JOIN VBRP ON VBRK~VBELN = VBRP~VBELN
                    INNER JOIN MARA ON VBRP~MATNR = MARA~MATNR
                    INNER JOIN ZCUWE ON ZCUWE~BOT_MAN = MARA~ZZBOTTMANU
                    INNER JOIN VBPA ON VBPA~VBELN = VBRP~AUBEL
                  WHERE              VBPA~PARVW in s_parvw.
          SORT ITAB1 BY KUNNR.     
          LOOP AT itab2.
            st_itab-BUKRS = itab2-BUKRS.
          ENDLOOP.
        endif.
        INSERT LINES OF st_itab TO S_S_IF-MAXSIZE INTO TABLE e_t_data.
        DELETE st_itab TO S_S_IF-MAXSIZE.
          IF lines( st_itab ) IS INITIAL.
            counter = counter + 1.
            if counter = 2.
              RAISE NO_MORE_DATA.
            endif.
          ENDIF.
              S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
      ENDIF.       
    ENDFUNCTION.

    I'm not sure, but I think there's something wrong with your select instruction
          Select
                 VBPA~KUNNR
                VBRK~VBTYP
                INTO CORRESPONDING FIELDS OF TABLE itab1
                  FROM
                    VBRK
                    INNER JOIN VBRP ON VBRKVBELN = VBRPVBELN
                    INNER JOIN MARA ON VBRPMATNR = MARAMATNR
                    INNER JOIN ZCUWE ON ZCUWEBOT_MAN = MARAZZBOTTMANU
                    INNER JOIN VBPA ON VBPAVBELN = VBRPAUBEL
                  WHERE              VBPA~PARVW in s_parvw.
    You're making a join within vbrk vbrp mara zcuwe and vbpa using a non-key field such vbpa-parvw. Are you sure we're talking about an over-size problem?
    You should separate INNER JOIN, using FOR ALL ENTRIES instruction, with range datas.

  • Get vendor number BAPI or functional module

    Hi,
    I recently found one standard functional module(or BAPI) to get vendor number if i pass user ID and i forgotten to make a note of it.
    I couldn't able find this functional module(or BAPI) again SRM system. can anyone help in finding this functional module(or BAPI).
    any help is appreciated.
    Thanks,
    Murali.

    Hi
    What's your detailed requirement ? Which SRM and R/3 versions are you using ?
    <u>Incase you want SRM local Vendor details use the Function module BBP_PARTNER_GETDETAIL</u>
    <b>Otherwise, go for META function modules to fetch R/3 data from SRM System.</b>
    <u>Meta functions (similar to BAPIs) are generic call to external system. Depending on system kind and release, the function to call is different. The bapi that the Meta will effectly call in a backend is defined in table bbp_function_map.</u>
    <b>Other related links -></b>
    Function Module to send Vendor Master Data from SRM to ECC
    Partner GUID and partner function
    Changing vendor number in BE PO
    Re: BAPI before sending PO to R3 and Vendor
    Hope this will definitely help.
    Regards
    - Atul

Maybe you are looking for