Regarding problem in function module BAPI_PO_CREATE1

Hi Guys,
            I have created a program for the creation of Purchase Order using Bapi_PO_CREATE1 with account assignment category as 'M' and item category as 'L'.Here when i am doing it manually i was asked to give the details of the components.But I am unable to find where to include these fields in my program.
                   Please help me out.Any program template would be of great help to me.
Thanks in Advance
Srikanth.

hello muva,
this prog may help u ...check this
*& Report  ZBAPI                                                       *
REPORT  zbapi                                   .
DATA: BEGIN OF i_data OCCURS 0,
        text(255),
      END OF i_data.
DATA: i_ekko TYPE bapiekkoc.
DATA: it_ekko LIKE TABLE OF i_ekko INITIAL SIZE 0  WITH HEADER LINE.
DATA: BEGIN OF i_ekpo OCCURS 0,
        po_item(5),
        pur_mat(18),
        plant(4),
        net_price(23),
        disp_quan(13),
     END OF i_ekpo.
DATA: it_ekpo LIKE TABLE OF bapiekpoc INITIAL SIZE 0 WITH HEADER LINE .
DATA: BEGIN OF i_eket OCCURS 0,
         po_item(5),
         deliv_date(8),
         quantity(13),
      END OF i_eket.
DATA: it_eket LIKE TABLE OF bapieket INITIAL SIZE 0 WITH HEADER LINE.
DATA: v_index TYPE i.
DATA: return TYPE TABLE OF bapireturn INITIAL SIZE 0 WITH HEADER LINE.
DATA: po_num(10).
START-OF-SELECTION.
CALL FUNCTION 'UPLOAD'
EXPORTING
  CODEPAGE                      = ' '
  FILENAME                      = ' '
  FILETYPE                      = ' '
  ITEM                          = ' '
  FILEMASK_MASK                 = ' '
  FILEMASK_TEXT                 = ' '
  FILETYPE_NO_CHANGE            = ' '
  FILEMASK_ALL                  = ' '
  FILETYPE_NO_SHOW              = ' '
  LINE_EXIT                     = ' '
  USER_FORM                     = ' '
  USER_PROG                     = ' '
  SILENT                        = 'S'
IMPORTING
  FILESIZE                      =
  CANCEL                        =
  ACT_FILENAME                  =
  ACT_FILETYPE                  =
  TABLES
    data_tab                      = i_data
EXCEPTIONS
  CONVERSION_ERROR              = 1
  INVALID_TABLE_WIDTH           = 2
  INVALID_TYPE                  = 3
  NO_BATCH                      = 4
  UNKNOWN_ERROR                 = 5
  GUI_REFUSE_FILETRANSFER       = 6
  OTHERS                        = 7
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at i_data.
if i_data-text(1) = 'H'.
   shift i_data-text.
   v_index = v_index + 1.
   split i_data-text at ',' into i_ekko-doc_type
                                i_ekko-purch_org
                                i_ekko-pur_group
                                i_ekko-vendor.
  append i_ekko to it_ekko.
elseif i_data-text(1) = 'I'.
shift i_data-text.
split i_data-text at ',' into i_ekpo-po_item
                               i_ekpo-pur_mat
                               i_ekpo-plant
                               i_ekpo-net_price
                               i_ekpo-disp_quan.
append i_ekpo.
move-corresponding i_ekpo to it_ekpo.
append it_ekpo.
clear it_ekpo.
else.
shift i_data-text.
split i_data-text at ',' into i_eket-po_item
                               i_eket-deliv_date
                               i_eket-quantity.
append it_eket .
move-corresponding i_eket to it_eket.
append it_eket.
clear it_eket.
endif.
endloop.
CALL FUNCTION 'BAPI_PO_CREATE'
  EXPORTING
    po_header                        = i_ekko
  PO_HEADER_ADD_DATA               =
  HEADER_ADD_DATA_RELEVANT         =
  PO_ADDRESS                       =
  SKIP_ITEMS_WITH_ERROR            = 'X'
  ITEM_ADD_DATA_RELEVANT           =
  HEADER_TECH_FIELDS               =
IMPORTING
  PURCHASEORDER                    =
  tables
    po_items                         = it_ekpo
  PO_ITEM_ADD_DATA                 =
    po_item_schedules                = it_eket
  PO_ITEM_ACCOUNT_ASSIGNMENT       =
  PO_ITEM_TEXT                     =
   RETURN                           = return
  PO_LIMITS                        =
  PO_CONTRACT_LIMITS               =
  PO_SERVICES                      =
  PO_SRV_ACCASS_VALUES             =
  PO_SERVICES_TEXT                 =
  PO_BUSINESS_PARTNER              =
  EXTENSIONIN                      =
  POADDRDELIVERY                   =
write: po_num.
  loop at return.
  write:/ return-message,return-type.
  endloop.

Similar Messages

  • Regarding the Remote Function Module

    hi,
            Can any body can provide the brief information regarding the Remote Function Module.
    1)How to create the remote function module
    2)how it differ from the normal function module
    3)any special features about this.
    Thanks in advance

    Hi
    RFC (Remote Function Call) is similar to the general SAP fun module: except that in the attributes you click the radio button: RFC enabled;
    and you will be passing an Import parameter DESTINATION to it.
    Other code and usage will be similar to any fun module;
    Have a look at any fun module in SE37 to understand better about the different components of Fun modules;
    Refer this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/22/042518488911d189490000e829fbbd/frameset.htm
    check out the following link it might help you
    http://help.sap.com/printdocu/core/Print46c/de/data/pdf/BCFESDE2/BCFESDE2.pdf
    Function Modules;
    Check this matter.
    Function Modules are Global ABAP programs created by SAP for reusable purpose.they have IMPORT,EXPORT and TABLE parameters, and EXCEPTIONS to through when error occurs.
    You can create them from TCode SE37.
    Go through the following doc:
    Function modules are cross-program, reusable procedures that are organized into function groups, and whose functions are implemented between the statements FUNCTION and ENDFUNCTION. Function modules and their interfaces are created in the Function Builder.
    Function Module Interfaces
    The parameter interface of a function module is defined in the Function Builder. It includes the definition of interface parameters and the specification of exceptions that can be triggered by a function module. The Function Builder automatically generates comment lines below the FUNCTION statement in the source code of the function module, which represent the interface of the function module with the following syntax:
    Syntax
    ... [IMPORTING parameters]
    [EXPORTING parameters]
    [CHANGING parameters]
    [TABLES table_parameters]
    [{RAISING|EXCEPTIONS} exc1 exc2 ...]
    The syntax and semantics of IMPORTING, EXPORTING, CHANGING, RAISING, and EXCEPTIONS mainly correspond to the definition of method interfaces with [CLASS-]METHODS. The additional option of defining table parameters using TABLES is obsolete.
    Interface parameters
    The interface parameters are defined on the relevant tab pages in the Function Builder.
    IMPORTING parameters are input parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input parameter. The content of the actual parameter is passed to the input parameter when the call is made. The content of an input parameter for which 'pass by reference' is defined cannot be changed in the function module.
    EXPORTING parameters are output parameters. When the function module is called, a suitable actual parameter can be specified for every output parameter. The content of an output parameter that is defined for 'pass by value' is transferred to the actual parameter if the function module is completed without errors. An output parameter that is defined for pass by reference is not initialized when the function module is called.
    CHANGING parameters are input and output parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input or output parameter. When the function module is called, the content of the actual parameter is passed to the input/output parameter, and when the function module is completed, the content of the input/output parameter is passed to the actual parameter.
    TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
    Exceptions
    The exception of a function module are defined on the Exceptions tab page in the Function Builder. Here you can select exception classes to define whether class-based exceptions are declared or non-class-based exception are defined. Class-based exceptions are represented in the above syntax by RAISING, and non-class-based exceptions are represented by EXCEPTIONS.
    The addition RAISING is used to declare class-based exceptions that can be propagated from the function module to the caller. Exceptions in the categories CX_STATIC_CHECK and CX_DYNAMIC_CHECK must be explicitly declared, otherwise a propagation can lead to an interface violation. A violation of the interface leads to the treatable exception CX_SY_NO_HANDLER. Exceptions of the category CX_NO_CHECK are implicitly always declared. The declaration of exceptions of the category CX_STATIC_CHECK is statically checked in the syntax check. For exceptions of the category CX_DYNAMIC_CHECK, the check is not performed until runtime. In a function module in which class-based exceptions are declared with the RAISING addition, the statement CATCH SYSTEM-EXCEPTIONS cannot be used. Instead, the relevant treatable exceptions should be handled in a TRY control structure.
    The addition EXCEPTIONS is used to define a list of non-class-based exceptions that can be triggered in the function module using the statements RAISE or MESSAGE RAISING. Exceptions defined in this way - as with formal parameters - are bound to the function module and cannot be propagated. If an exception of this type is triggered in a function module, and no return value has been assigned to it with the homonymous addition EXCEPTIONS of the CALL FUNCTION statement when the call was made, this leads to a runtime error.
    Note
    For new developments after release 6.10, SAP recommends that you work with class-based exceptions that are independent of the function module.
    RFC is a technology which is used to access a functions (Modules) from
    the remote systems.
    If a function module is set as remote enabled which can be access from
    the remote system via RFC.Eg: U can access the Remote enabled function modules in ur VB,Webdynpro,Java,Visual composer program.
    A function module can be set as remote enabled by SE37->Go to ur FM->click the option Button "remote enabled".
    But Normal function modules can not accessd from the remote system.
    Good Example for RFC enabled function module is : BAPI(Business Application Programming Interface)
    Note: All BAPIs are Remote enabled but not all remote enabled function modules are BAPI.
    CALLING A FUNCTION MODULE:
    1)In U ABAP Editor --> Click "Patter" ---> Selection Option Button "Call Function"
    --> Write the Corresponding FM name --> Hit Enter
    2)The appropriate import ,export Parameters will be displayed in ur editor
    3)Pass the Values Here.
    Also check these links.
    http://www.geocities.com/victorav15/sapr3/abapfun.html
    Check this link:
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    Check this link:
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    See the following links:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Regarding Error in Function Module in Update Task

    Hi All,
    If a function module is called in Update Task and there is some error generated from it, it comes as an exit message unlike in a normal function module.
    Is there any possible way to avoid such an exit message?
    Thanks in advance.
    Regards,
    Garima

    Hi,
    The problem is I am updating Z tables in a function and also calling a function in Update task to update a different set of tables.
    Now, if for some reason there is an error in Update Function module, then my requirement is that rather than throwing an Exit message (which it is presently doing) the errors coming from the function should be captured so that the user knows what was wrong with the data he entered.
    Is there any work around to the above requirement? Either all the tables should be updated or none of them should be updated.
    Regards,
    Garima Thapar.

  • Problem using Function Module IDOC_INBOUND_ASYNCHRONOUS

    Hi friends,
    I have a critical problem load idoc ARTMAS05. I development a program for load the data with idoc but my program call the function module IDOC_INBOUND_ASYNCHRONOUS close my session of the SAP GUI and lose the load. This problem begining today because yesterday was work well. This morning when I'm load the idoc gave to me a short dump with this message "SNAP_NO_NEW_ENTRY" I have find some notes and obtained this note 17537.
    Note Solution
    Solution
    When the SNAP Table is full: Reorganize the table e.g. via Transaction ST22->Go to->Reorganize. Please also refer to Note 16083. This may lead to other errors of this kind since not all dumps e.g. from SM21 can be displayed.
    In case of database problems, the errors should no longer occur with new short dumps after correcting the database error. Here, other errors of this kind may occur in SM21 as well.
    After apply the correction begin the error that I close me the Session of SapGui and lose all my data proccessing. Please need your help.
    Thank and regards..

    Hi Sir,
    I am also facing the same issue...i need to update dependents Information  Date Of Birth n Perid(Which is stored in IT0106)...in IT 0021..
    Kindly correct my code....
    I am using the following code for this...
    data: w_return type  bapireturn1.
    data: p0021_struc TYPE p0021,
          p0106_struc TYPE p0106,
          p_pskey   TYPE pskey.
    start-of-selection.
    get pernr.
    p0021_struc = p0021.
    p0021_struc-favor = 'Gaurav'.
    p0021_struc-fgbdt = '05/10/1955'.
    Move p0021_struc-favor to p0021-favor.
      p0106_struc = p0106.
      p0106_struc-stras = '2235 BOmbay Road'.
      p0106_struc-perid = '123456789'.
      MOVE p0106_struc-stras to p0106-stras.
    Enqueue personnel number
      call function 'BAPI_EMPLOYEE_ENQUEUE'
        exporting
          number = pernr-pernr
        importing
          return = w_return.
      CALL FUNCTION 'HR_INFOTYPE_OPERATION'
        EXPORTING
          infty            = p_pskey-infty
          number           = p_pskey-pernr
          subtype          = p_pskey-subty
          objectid         = p_pskey-objps
          lockindicator    = p_pskey-sprps
          validityend      = p0021-endda         " '99991231'
          validitybegin    = p0021-begda
          record           = p0021_struc
          operation        = 'mod'
          tclas            = 'A'
          dialog_mode      = '2'
         nocommit         = p_test
          VIEW_IDENTIFIER  = '07'              "p0003-viekn
          secondary_record = p0106_struc
        IMPORTING
          return           = w_return
         key              = familykey
        EXCEPTIONS
          OTHERS           = 0.
    Enqueue personnel number
      call function 'BAPI_EMPLOYEE_DEQUEUE'
        exporting
          number = pernr-pernr
        importing
          return = w_return.

  • Reg: code problem in Function module

    Hi Friends,
    I am facing problem while developing Function module.
    i declared following things in Import.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(SOURCETABLETXT) TYPE  STRING
    *"     VALUE(SELECTTXT) TYPE  STRING
    *"     VALUE(SOURCEINFOOBJECT) TYPE  STRING
    *"     REFERENCE(ITAB_OUTTAB)
    *"     REFERENCE(ITAB_SOURCEPAK)
    In source code writen as,
    DATA DREF1 TYPE REF TO DATA.
    FIELD-SYMBOLS: <ITAB_SPACK> TYPE ANY TABLE,
                        <WA1> TYPE ANY,
    TYPES: BEGIN OF SOURCEIOJ,
            SOURCEINFOOBJECT(72) TYPE C ,
           END OF SOURCEIOJ.
    DATA: ITAB_SOURCEIOJ TYPE TABLE OF SOURCEIOJ.
    DATA: WA_SOURCEIOJ LIKE LINE OF ITAB_SOURCEIOJ.
    ASSIGN ITAB_SOURCEPAK->* TO <ITAB_SPACK>.
    CREATE DATA DREF1 LIKE LINE OF <ITAB_SPACK>.
    ASSIGN DREF1->* TO <WA1>.
    LOOP AT <ITAB_SPACK> assigning <WA1>.
    READ TABLE ITAB_SOURCEIOJ INTO WA_SOURCEIOJ WITH KEY SOURCEINFOOBJECT = <WA1>-SOURCEINFOOBJECT.
    IF SY-SUBRC <> 0.
    WA_SOURCEIOJ-SOURCEINFOOBJECT = <WA1>-SOURCEINFOOBJECT.
    INSERT WA_SOURCEIOJ INTO TABLE ITAB_SOURCEIOJ.
    ENDIF.
    ENDLOOP.
    While checking i am getting error as The data object "<WA1>" has no structure and therefore no componentcalled "SOURCEINFOOBJECT". called "SOURCEINFOOBJECT".
    SOURCEINFOOBJECT is not field in internal table which passing as reference and hence not in WA1.
    But the input field which i give to SOURCEINFOOBJECT while calling the FM, that input field is the part of the intenal table
    <ITAB_SPACK>, which ref of ITAB_SOURCEPAK passing to FM.
    Please give some idea how to handle this.
    Regards
    MRK

    Hey,
    you declared <wa> as field symbol, so it won't contain the field that you are trying to read. Go through the following; it may help you.
    Loop at <ITAB_SPACK> assigning <WA1>.
            do.
              assign component sy-index of structure <wa1> to <dyn_field>.
              if sy-subrc <> 0.
                exit.
              endif.
              if sy-index = 1.
                WA_SOURCEIOJ-SOURCEINFOOBJECT = <dyn_field>.
              else.
                WA_SOURCEIOJ-SOURCEINFOOBJECT = <dyn_field>.
              endif.
            enddo.
           endloop.
    with regards
    Mahesh

  • Urgent: problems in function module extraction

    Hi Gurus,
    I am new to BW and My requirement is to extract the notes from CRM as it is not stored in database tables i used functional module to extract it i have used standard FM RSAX_BIW_GET_DATA_SIMPLE but in that when i map E_T_DATA with my own structure with like or type keyword in tables tab(e.g. E_T_DATA LIKE/TYPE ZCRM_OREDR_STR) i am getting a warning msg "tables parameters are obsolete". Would anyone please suggest me what i need to do. I appreciate it in advance. I def. award points.
    Thanks a lot
    With Regards
    Venkat

    Hi PSG,
    Thanks a lot for quick response. when i use tables it is once again giving an error "The typing method can be 'Like', 'Type', or 'Type Ref To'" I even used all the three than also same problem. Actually it is coming in Function Builder in Tables tabstrip when i use E_T_DATA Like/tables/type/type ref to ZCRM_ORDER_STR I donot know why it is happening. Please would you suggest me what to do.
    Thanks a lot
    With Regards
    Venkat.

  • Problem in Functional Module on BW Query

    Hi,
    We are working on below requirement in BW.
    We have to fetch the data of BW Query via a functional module to web services. We have created a query and a functional module based on that query. To create the function module on query, we have followed the standard method suggested in SAP blog. (ie. Input parameters for Functional Module is Filters use in Query and output parameters will be Keyfigures and Char. Of the Query).
    We have 0PLANT in the raw section in query. We want to fetch plant text in the Function module output. But, our problem is we are getting Plant KEY value only in the output of functional module.
    0PLANT properties in query designer is set to TEXT only.
    So, in short, we want to have 0PLANT Text in the function module output.
    Please suggest.
    Regards,
    Macwan James.

    Hi,
    In your Function module, I hope the code is perfect. Please check your Infoobject maintenance whether text was maintained.
    Regards,
    Suman

  • Problem in Function Module "ALSM_EXCEL_TO_INTERNAL_TABLE"

    Dear All,
    In this function module we give the number of end rows to be picked from the excel sheet. So, please tell me what can be the maximum number, currently I have put 4000 end rows.
    Thanx&Reg,
    Nishu

    Hai Nishu
    *& Report ZK_REPORT *
    REPORT ZK_REPORT.
    internal table declarations
    DATA: BEGIN OF ITAB OCCURS 0,
    NAME(20) TYPE C,
    ADDR(20) TYPE C,
    END OF ITAB.
    DATA: ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
    DATA: K1 TYPE I VALUE 1,
    M1 TYPE I VALUE 1,
    K2 TYPE I VALUE 100,
    M2 TYPE I VALUE 9999.
    use FM for uploading data from EXCEL to internal table
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    FILENAME = 'C:\book1.xls'
    I_BEGIN_COL = K1
    I_BEGIN_ROW = M1
    I_END_COL = K2
    I_END_ROW = M2
    TABLES
    INTERN = ITAB1
    EXCEPTIONS
    INCONSISTENT_PARAMETERS = 1
    UPLOAD_OLE = 2
    OTHERS = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT ITAB1.
    WRITE:/ ITAB1.
    ENDLOOP.
    Thanks & regards
    Sreeni

  • Problem with  Function Modules

    Hi.
    can anybody tell me how can i calculate
    cost depreciation for an asset.
    I have used one function module DEPR_RECALCULATE.
    but it will allow only one date and it will calculate depreciation for total year .
    As per my
    I want to pass the two dates  and need to  calculate the  depreciation between two periods.

    Hi Nitin.
    Thank you for u r  quick reply.
    I have tried all  these function modules but as per our requirement
    They are not support.
    Issue:
    I need to calculate the cost depreciation between APRIL and MARCH
    but DEPR_RECALCULATE    Fm   will calculate  between  JAN  and  the date which is specified in the parameter field on the  selection screen .
    so how can calculate the depreciation cost between two dates( I want to pass the  select-options).
       Thanking you,
        Regards
        sateesh

  • Problem in Function Module

    Hi gurus,
      I have created a genric extractor by using function module and i took extract structure as a DB View, FM is working fine, when i am checking the extractor in RSA3 for records, it is showing 0 records.  When i am executing FM, it is showing the data.
    Thanks&Regards
    Phani

    Hey.  The best way would be to set a break point in the FM and just see what's happening.  Couple thoughts...
    1) You may not be passing the data to E_T_DATA, but that is just a guess.  If that is the case, you just need to append the records to E_T_DATA as that is what the FM needs to populate for the records to be processed further/sent to BW.
    2) Is the selection criteria the same when you are running RSA3 and testing the FM?
    Thanks

  • Regarding the RFC Function Module call from PI

    Hi All,
    I am working on one File to RFC interface, in which File adapter picks the file, this file data has to goto  2 function modules in SAP system. For this i added 2 Inbound interfaces in INTERFACE DETERMINATION and I developed 2 RECEIVER AGREEMENTS. In 2 RECEIVER AGREEMENTS i added single receiver RFC Communication Channel.
    Now i want assurance that once 1 st function module will execute completely, then only my second function module should be called. Is there any setting that i can do to make this sync?????.
    what is the use of  Send 'Confirm Transaction' in receiver RFC Communication Channel under Adavanced Mode.
    Thanks,
    Balu

    Hi,
    As per you requirement I would suggest to change your scenario as File To Proxy. It will much more easier and 100% sure to process second BAPI only after first gets successful inside the proxy.
    Pass the data from file adapter to inbound proxy and then inside proxy code you first call the first BAPI and use commit wrok. Once commit work is successful then you call the second BAPI otherwise rollback the changes.
    Example:
    Call First_BAPI
    <pass the data to it's import export parameters>
    Commit work.
    if sy-subrc =0.
    Call Second_BAPI.
    <pass the data to it's import export parameters>
    Commit work.
    endif.
    Note: If you are not very much comfortable with ABAP the discuss this with your ABAP team mate.
    Regards,
    Sarvesh

  • Regarding the obsolute function modules

    Hi All,
    below function module are obsolute in 4.6c ,what are the new function modules in ECC 6.0.
    1.GRAPH_RECEIVE
    2.GRAPH_SET_CUA_STATUS
    already i search in sdn but i didnt get exact answer................
    plz help me.....
    Regards,
    Madhu

    Hi
    Though these function modules are set to obsolete,they are still maintained and supported by SAP and can be used in your application further.  They are set as obsolete in order to avoid the usage in new development projects.       When starting new developments it is recommended to use class 'cl_gui_chart_engine' .
    Hope this is helpful.

  • Problem using Function Module

    Hi,
    I am using RH_STRUC_GET with evalPath O-O-S-P and get the or g structure. I then loop through the table obtained from RH_STRUC_GET and re-use RH_STRUC_GET with a evaluation path 'bossonly' to find out who the managers are. But it does not work. I get No ROOTS FOUND error.
    When I try the function module RH_STRUC_GET separately with the same input fields then it works!!!
    Please let me know if I am doing anything wrong. My code is shown below....
    FUNCTION Z_ORGBUILDER_CONN.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(OTYPE) LIKE  OBJEC-OTYPE
    *"     VALUE(OBJID) LIKE  OBJEC-OBJID
    *"     VALUE(PATHID) LIKE  GDSTR-WEGID
    *"     VALUE(PLVAR) LIKE  OBJEC-PLVAR
    *"  EXPORTING
    *"     VALUE(RETURN) LIKE  BAPIRET2 STRUCTURE  BAPIRET2
    *"  TABLES
    *"      L_ZCONN_TAB TYPE  ZCONN_TAB
    *"      RESULT_TAB STRUCTURE  SWHACTOR OPTIONAL
    *"      RESULT_OBJEC STRUCTURE  OBJEC OPTIONAL
    *"      RESULT_STRUC STRUCTURE  STRUC OPTIONAL
    *"      L_ZCONN_ORG TYPE  ZCONN_TAB
    *"      L_ZCONN_POS_HOLDER TYPE  ZCONN_POS_TAB
    *"      L_MANAGERS STRUCTURE  OBJEC
    DATA: z_struc type zconn_struc.
    DATA: xresult_struc like result_struc.
    DATA: yresult_struc like result_struc.
    DATA: z_struc1 type zconn_struc.
    DATA: z_struc_pos type zconn_position.
    DATA: temp_tab LIKE SWHACTOR occurs 0 with HEADER LINE.
    DATA: temp like struc-objid.
            CALL FUNCTION 'RH_STRUC_GET'
              EXPORTING
                          act_otype = otype
                          act_objid = objid
                          act_plvar = plvar
                          act_wegid = pathid
              TABLES
                          result_tab = result_tab
                          result_struc = result_struc
                          result_objec = result_objec
              EXCEPTIONS
                          no_plvar_found = 1
                          no_entry_found = 2
                          OTHERS = 3.
              IF sy-subrc <> 0.
                          RAISE no_roots_found.
              ENDIF.
    LOOP AT result_struc into xresult_struc.
          read table result_struc into yresult_struc with key seqnr =
    xresult_struc-pup.
            if sy-subrc = 0.
            z_struc-objectID = xresult_struc-OBJID.
            z_struc-objectType = xresult_struc-otype.
            z_struc-parentID = yresult_struc-objid.
            z_struc-parentType = yresult_struc-otype.
    endif.
    Append z_struc to l_zconn_tab.
    ENDLOOP.
    LOOP AT l_zconn_tab.
      if l_zconn_tab-objectType = 'O' or l_zconn_tab-objectType = 'S'.
            z_struc1-objectID = l_zconn_tab-objectID.
            z_struc1-objectType = l_zconn_tab-objectType.
            z_struc1-parentID = l_zconn_tab-parentID.
            z_struc1-parentType = l_zconn_tab-parentType.
    Append z_struc1 to l_zconn_org.
        endif.
    ENDLOOP.
    LOOP AT l_zconn_tab.
      if l_zconn_tab-objectType = 'P'.
            z_struc_pos-position = l_zconn_tab-parentID.
            z_struc_pos-pos_holder = l_zconn_tab-objectID.
    Append z_struc_pos to l_zconn_pos_holder.
        endif.
    ENDLOOP.
    loop at result_struc.
      if result_struc-otype = 'O'.
            CALL FUNCTION 'RH_STRUC_GET'
              EXPORTING
                          act_otype = 'O'
                          act_objid = result_struc-objid
                          act_plvar = '01'
                          act_wegid = 'bossonly'
              TABLES
                          result_tab = temp_tab
              EXCEPTIONS
                          no_plvar_found = 1
                          no_entry_found = 2
                          OTHERS = 3.
              IF sy-subrc <> 0.
                          RAISE no_roots_found.
              ENDIF.
              APPEND LINES OF temp_tab to L_managers.
          endif.
    endloop.
    ENDFUNCTION.

    data: begin of itab occurs 0,
          orgunit(10) type c,
          mananger(30) type c,
          end of itab.
    * This will add a record to your itab
    loop at result.
      itab-orgunit = result-orgunit.   " I don't know what fields they are
      itab-manager = result-manager.
      append itab.
    endloop.
    Please remember to award points for helpful answers and mark this post as solved if you question has been answered.  Thanks.
    Regards,
    Rich Heilman

  • Hi  problems in function module

    Hi friends I have the following problems.........
    When I am using this  following code  in a function module
    its not giving me output until i comment those two fields kwmeng and netwr..i have use VRKME and WAERS  for those two..........which are the components of a structure i have created....unless i comment them its giving dump
    but when i am using the same thing in report...i am getting
    values..off course there is no use of structures......i am creating internal tables and using them ...
    i need to use this functio module...how can i get the data from those two fields..tell me the
    SELECT vbak~vbeln
           vbak~erdat
           vbak~vkorg
           vbak~ABRVW
           vbak~augru
           vbak~kunnr
           vbap~posnr
           vbap~matnr
           vbap~vkaus
           vbap~spart
         vbap~netwr
           vbap~waerk
         vbap~kwmeng
           vbap~kondm
           vbap~mvgr1
           vbap~mvgr2
           vbap~mvgr3
           vbap~mvgr4
           vbap~mvgr5
      FROM vbak AS vbak INNER JOIN vbap AS vbap
      ON vbakvbeln EQ vbapvbeln
      INTO corresponding fields of TABLE tvbak
    WHERE vbak~vbeln = vbeln1.

    there is aproblem witht he last line of your code:
    WHERE vbak~vbeln = vbeln1.
    it should be
    WHERE vbakvbeln = vbapvbeln.
    There is no problem with selection of netwr or Kwmeng .
    Edited by: Rachana Singh on Jan 21, 2008 9:09 AM

  • Problems in Function Module of a Custom Virtual Cube

    Hi all,
    I have copied a Function Module-- RS_BCT_FIGL_DATA_GET_VC10 into a custom one ZRS_BCT_FIGL_DATA_GET_VC10. A custom Virtual Cube(ZFIGL_V10) was also created using this FM. The Function Module and Function Group are activated and there are no syntax errors in the custom FM.
    When I try to check data of this virtual cube using the T-CODE "listcube" it gives me the following errors.
    1. "An exception with the type CX_SY_DYN_CALL_ILLEGAL_FUNC occurred, but was neither handled locally, nor declared in a RAISING"
    2. "The function call failed; the function ZRS_BCT_FIGL_DATA_GET_V10 is either not activated or contains no code"
    Also some queries are not executing in this Virtual Cube.
    Could not figure out what the problem was.Can someone help me on this?
    Thanks
    Maddy

    HI,
    Can you check whether the FM is activated. Also check the function module group is activated or not. You can check the status of the same via SE80.
    Goto SE80 -> Select function grp -> give your function grp and press enter
    Double click on the below funtion grp to check status.
    Also expand FM and check whether it is activated.
    Also check the import and export parameters of the FM. Try to see whether there is any discrepancy.
    If any default values are specified, check whether they are correct.
    Also try to debug, put a breakpoint in your code and check whether it gets into the code or not.
    Regds,
    Shashank

Maybe you are looking for

  • Blocking Locks - What Was Likely Going On?

    I had a blocking lock yesterday that showed up in OEM under Cluster Database --> Cluster Database Locks. The blocking lock was a row exclusive (RX) table lock that was blocking 175 other sessions that were listed under the blocking lock as having req

  • T code f-02

    Hi friends, In the tcode F-02 if we give future document date it will give information message ---check-document date is in the future.How to change it into error message? This is urgent... Plz help.

  • Opening  camera RAW images in CS2...  It won't do it!

    I'm trying to open RAW images in CS2. When I try to do it, an error box pops up saying that it's an unknown file type(.nef). I've even tried using the software that my camera came with, but that won't let me either. Also, the image RAW dialog box doe

  • Have sound but no picture when i click on the video.Elements 10 on windows 7.Can you help.

    Have sound but no picture when i click on the video.Elements 10 on windows 7.Can you help.

  • Apple TV and photos on .Mac

    I have .Mac account and I do store there my photos in Web albums. How to view them in Apple TV 2.0. Apple TV asks to enter photo gallery name. What name is that? I tried titles for my photo galleries, I tried my log in name. Nothing seems to work. Do