BAPI exception

Hi folks,
I have a question, currently I am using a BAPI which is called by a web application through .NET, when I run the BAPI  on the SAP system by entering the pernr  I am not getting any error, it is picking up the pay periods. it looks fine. However the BAPi has code to handle error.
But on the application side when many people are accessing the info, the BAPi is called continously at afaster rate, while debugging on  the  web application, is returning an error from this BAPI. The BAPI is throwing an exception, but I do not get that on the SAP side.
I checked the ST22 to see if there is any shortdump and there are no records there.
What  might be the reason for this exception, how can I trace it?
Any thoughts would be really helpful.
Thanks,
SK

Most bapis  do not have exception. INstead they have a RETURN table which will be populated in case of errors, Try to use that table to handle errors.

Similar Messages

  • Error while mapping the BAPI exception to the Fault Messge

    Hi
    I have a scenario SOAP to BAPI ...
    when i try test the scenarion from Altova XML SPY for BAPI exception ... i am getting the following error....
    When i tried to map the BAPI exception to the Fault Message its giving me the error...
    com.sap.aii.af.ra.ms.api.DeliveryException: com.sap.aii.af.ra.ms.api.MessagingException: Could not parse XMBMessage due to Unexpected length of element <sap:Error><sap:ApplicationFaultMessageNamespace> =

    Hi,
            Fault messages can be used for inbound proxies....for BAPI also it can be used i am also not sure....How are you tracking that the data is getting posted into the SAP table with the help of BAPI?
    Thanks
    Arijit

  • RFC/BAPI Exception in PI 7.0

    Hi there,
      currently we have a scenario where the message come from middleware and pass through PI to POSDM system via RFC.
    my target structue is an BAPI .
      for some reason if the BAPI execution gets failed on POSDM system then the BAPI should return some exception back to PI system,
      can this be achived only by just adding the fault message type (ExchangeFaultData) in Inbound MI, whill this setting sufficient to get any error info from BAPI to PI via rfc, or do we need to do some exception mapping? if so can some one explain/

    Monika,
    RFM that pretends to be a BAPI has to follow a few strict rules. Some of them are :
    - BAPI is called always synchronously and are always successful i.e. errors are returned in EXPORT parameter (so  no matter if BAPI created some document/posting or not is successful!)
    - it does not return exceptions!
    so you should not advise to make use exceptions ...  otherwise it will not be a BAPI
    The one of possible solution is to wrap BAPI either using proxy or RFM and then you can propagate exceptions to SAP PI.
    /Jakub

  • BAPI Exception Handling  + JCA

    Iam having problems handling exceptions of a BAPI connecting thru JCA.
    MappedRecord exportParams =     (MappedRecord) interaction.execute(interactionSpec, importParams);
    IRecord exportStructure = (IRecord) exportParams.get("RETURN");
    if (exportStructure.getString("TYPE").toUpperCase().equals("E"))
         myBean.setException(exportStructure.getString("MESSAGE"));
    IRecordSet table = (IRecordSet)exportParams.get("MY_Table");
    table.beforeFirst();
    while(table.next()){
    After executing the BAPI, it shud check for the RETURN Structure and if there is nothing the flow shud be normal otherwise it shud set the bean.
    Somehow the above 'if' block is blocking the normal flow even if RETURN throws nothing.It does fine if remove the if block...
    IS that the correct of handling the Exceptions??
    I found a sample code by prakash,
    IRecord exportStructure = (IRecord) exportParams.get("RETURN");
    if (exportStructure.getString("TYPE").toUpperCase().equals("A")|| exportStructure.getString("TYPE").toUpperCase().equals("E"))
    throw new Exception(exportStructure.getString("MESSAGE"));
    Thanks...Hoping some suggestions..

    Hi Robert,
       Your code looks like fine and looks like your bapi is returning some error message. Are you getting any error message. i would code the error logic in following way?
    if (exportStructure.getString("TYPE").compareToIgnoreCase("E"))
      myBean.setException(exportStructure.getString("MESSAGE"));
      break;

  • BAPI exception when executing from external system.

    Hi Experts,
    I using the Function Module BAPI_MATERIAL_GET_ALL to get the Material and Plant attributes by giving Material and Plant data.I am able to get all the required
    attributes when I execute this Funtion Module in SAP but when I try to execute this
    Function Module from external system I am getting all the details except plant details.
    When I give plant data the Function module is throwing the below exception.
    java.lang.Exception: BapiWarning: I:MM:376 0001
       (0001 is the plant value)
    Please help me out over this issue.
    Thanks,
    Kiran.

    Hi ,
    i think u are getting this error
    W MM376 No planning data exists in plant 1000, u will get this message only if u pass the plant values to this FM , bcos its trying to get planning data from this plant.
    Regards
    Prabhu

  • Exception during BAPI execution

    Hello:
    I've been working with JCAPS, but today I'm having an exception that I cannot resolve.
    [#|2008-11-20T20:00:36.418-0600|SEVERE|IS5.1.2|STC.eWay.SAP.BAPI.java.lang.Class|_ThreadID=55; ThreadName=Worker: 62;|----- Error occurred during execute -----
    |#]
    [#|2008-11-20T20:00:36.419-0600|SEVERE|IS5.1.2|STC.eWay.SAP.BAPI.java.lang.Class |_ThreadID=55; ThreadName=Worker: 62;|\
    *********** Exception occurred while executing the BAPI
    ****************Exception String = No RFC function available to execute
    Unfortunately, I don't have more information, except that this code was working yesterday ....
    Regards, Alfredo

    If the outcome of the relaunch is random it sounds like a connection or network issue to me. Do you get any more information in the ide.log when you can't relaunch the OTD?
    /Alex

  • How to Fill values in BAPI internal table ?

    I am creating sales order from ABAP Dynpro , all the values are getting passed to bapi except those in internal table, it gives lead selection error and whn i change the cardinality of the Node to 1.1 to shows the page but whenever i create the SO it gives WRONG_DATA error . I debugged it and found the data in the internal table for material is not getting passed.

    Hi Jasjit,
    Could you be a bit more clear about the issue you are facing.
    Try using the cardinality 0:n for node that holds the data that you are passing as internal table to bapi.
    Regards,
    Sravan Varagani

  • BAPI for posting account with special GL indicator

    Hi all,
    is there any other BAPI except than BAPI_ACC_DOCUMENT_POST that can be used to post unt with special GL indicator

    use program RFBIBL00, by setting the TCODE 'FB01' in the structure BBKPF, but if the transaction FB01 does not support the special G/L indicator you require, it may not be possible. I would still give it a shot.
    read the documentation of the program. Additionally, it can be used in conjunction with LSMW for easy setup.
    Re: program to upload vendor/customer items with special GL indicator?

  • Problem Automating FPOP

    Hi,
    Iu2019m new to SAP (and BW), so please bear with me.  We went live with CRB and BW about four months ago.  At that time we could not automate our Sales Statistics and Business Partner data extractors because of various issues.  Weu2019ve since resolved those issues and are now attempting to automate these extractors.
    Our Basis team is working on getting these two processes automated in Redwood (we had to purchase this scheduling software to resolve some of our CRB issues).  The data extractor for Sales Statistics (BW-DQ-SS) works fine, but the extractor for Business Partner (FPOP), for the FICA BP Items Transaction process chain produces an error in Redwood (I have included the error message at the end of this post).
    Basis believes the problem is due to the Parallel Processing Object (u2018KEYPPu2019 u2013 3-Character Number) set on the Technical Settings tab, which was selected by the consultants that set up the process.  If we select help on the Object field under Parallel Processing Object, it actually mentions u2018GPARTu2019 for business partner in the help text.  However, this field is read-only.  The process runs fine with this object when we run it manually; it just fails when we try to automate it with Redwood.
    Can anyone tell me what they are using for this parameter, and how we can change it (new variant, etc)?  Or does anyone have any other suggestions on how we can get this process automated?
    Thank you very much for your help!
    program rw_macp.
    Form rwChangeParameters.
    data: h_basics  type FKK_MAD_BASICS.
    data: h_addons  type FKK_MAD_BWOP.
      import basics to h_basics from memory id 'FKKMADBASICS'.
      import addons to h_addons from memory id 'FKKMADADDONS'.
    processing field OBJECT
      h_basics-TECH-OBJECT = 'KEYPP'.
    processing field VARI
      h_basics-TECH-VARI = 'LESVar2'.
    processing field USE_LOAD_BALA
      h_basics-TECH-USE_LOAD_BALA = 'X'.
    processing field JOBS_LOAD_BALA
      h_basics-TECH-JOBS_LOAD_BALA = 5.
      export basics from h_basics to memory id 'FKKMADBASICS'.
      export addons from h_addons to memory id 'FKKMADADDONS'.
    EndForm.
    com.redwood.scheduler.connector.sap.rfc.connection.exception.SapBapiException: BAPI exception while calling /SCJS/ISU_NEW_PARAMETER_SET: E XM 300  {FKKBW,121} Enter an interval distribution [BWOP,,09/23/2011,84T] [, {FKKBW,121}, Enter an interval distribution, [BWOP,,09/23/2011,84T]]
    BAPI exception while calling /SCJS/ISU_NEW_PARAMETER_SET: E XM 300  {FKKBW,121} Enter an interval distribution [BWOP,,09/23/2011,84T] [, {FKKBW,121}, Enter an interval distribution, [BWOP,,09/23/2011,84T]]
                    at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.checkBapiReturnCode(ClientConnectionImpl.java:789)
                    at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.call(ClientConnectionImpl.java:602)
                    at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection$4.doPerform(AbstractRfcConnection.java:296)
                    at com.redwood.scheduler.connector.sap.rfc.connection.RemoteFunctionCall.perform(RemoteFunctionCall.java:120)
                    at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection.perform(AbstractRfcConnection.java:456)
                    at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection.execute(AbstractRfcConnection.java:289)
                    at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.SapFunctionModuleWrapper.execute(SapFunctionModuleWrapper.java:200)
                    at com.redwood.scheduler.connector.sap.rfc.jco.AbstractSapFunctionModule.execute(AbstractSapFunctionModule.java:109)
                    at com.redwood.scheduler.connector.sap.rfc.command.impl.MassActivityRunCommand.doExecute(MassActivityRunCommand.java:110)
                    at com.redwood.scheduler.connector.sap.rfc.command.impl.AbstractMassActivityCommand.execute(AbstractMassActivityCommand.java:57)
                    at com.redwood.scheduler.connector.sap.rfc.command.AbstractXbpCommand.doExecute(AbstractXbpCommand.java:85)
                    at com.redwood.scheduler.connector.sap.rfc.command.AbstractCommand.execute(AbstractCommand.java:56)
                    at com.redwood.scheduler.connector.sap.rfc.service.SapJobWork.doWork(SapJobWork.java:99)
                    at com.redwood.scheduler.infrastructure.workqueue.Worker.run(Worker.java:74)
                    at java.lang.Thread.run(Thread.java:708)

    Jeff:
    The parallel processing variant KEYPP is the object which is used internally by the system to break up all of the relevant data into more manageable chunks.  KEYPP is not related to BP - it is essentially a counter field.  See the SE11 documentation for data element KEYPP_KK.  The system uses these values to break up the documents by comparing their last 3 digits to that in the intervals.
    As to your issue, it is possible that you are not properly using the interval variant within the scheduled process.  Maybe you are using a variant that does not exist?  If you are trying to run something in parallel without providing a valid parallel variant, then i think that might be an issue.
    regards,
    bill.

  • Follow-up question for Chris H on longtext in BDC for IW31

    Chris -
    Here's the relevant part of my code:
    PERFORM DYNPRO USING:
    'X' 'SAPLCOIH'          '3000',            "
    ' ' 'CAUFVD-KTEXT   '   SCRN_PROBLEM1,     " 1st line problem text
    ' ' 'CAUFVD-ANLZU   '   CAUFVD-ANLZU,      " System condition
    ' ' 'BDC_OKCODE'       '=LTXK'.            "
    LOOP AT i_txt INTO wa_txt.
      v_txtln_ctr_n = sy-tabix + 2.    " Chris - note that I'm bumping to "3" here
      v_txtln_ctr_c = v_txtln_ctr_n.
      CONCATENATE 'RSTXT-TXLINE('
                  v_txtln_ctr_c
             INTO v_bdc_txtln_lit.
      CONDENSE v_bdc_txtln_lit NO-GAPS.
      PERFORM DYNPRO USING:
        'X' 'SAPLSTXX'          '1100',              "
        ' ' v_bdc_txtln_lit     wa_txt,              " line of problem text
        ' ' 'BDC_OKCODE'        '=ENTR'.             "
    ENDLOOP.
    This actually works - it creates an order in which the long text begins with what is in the variable SCRN_PROBLEM1 and continues with what is in i_txt concatenated together.  So I get, for example:
    "This is the short description. a b c d e"
    where:
    scrn_problem1 = 'This is the short description'
    row 1 of i_txt = 'a'
    row 2 of i_txt = 'b'
    row 3 of i_txt = 'c'
    row 4 of i_txt = 'd'
    row 5 of i_txt = 'e'
    The only problem is that the BDC doesn't go thru on its own.  When I change 'N' to 'E', the BDC brings up a screen with the title:
    "Change order text header Alternative Language EN"
    Then, when I just "back-arrow" from this, the BDC does complete successfully and I can see the correct text saved for the order in IW32.
    What am I doing wrong to cause this "change order text header" screen to come up?  Is it the "LTXK" value of the OK-CODE in the first dynpro call above?
    Or maybe something with my default user parameters?  I had to set quite a few of these in order to get the BDC to go with just a system, priority, and short text/long text.
    I'm really hoping you can see what's going on here because I'm at a loss.
    Thanks for whatever help you can provide.  You seem to have coded this BDC before, so that's why I'm directing this question to you.
    BTW, I'd try the BAPI except the documentation specifically says it won't observe user default parameters and this is a must in our situation.
    Thanks again
    Dave

    Chris/Rich -
    My suspicion was correct.  In the last loop over the longtext itab, the ok_code must be 'TXBA', not 'ENTR'.
    Here's the code that works without any 'E' interruptions:
    PERFORM DYNPRO USING:
    'X' 'SAPLCOIH'          '3000',            "
    ' ' 'CAUFVD-KTEXT   '   SCRN_PROBLEM1,     " 1st line problem text
    ' ' 'CAUFVD-ANLZU   '   CAUFVD-ANLZU,      " System condition
    ' ' 'BDC_OKCODE'       '=LTXK'.            "
    DESCRIBE TABLE i_txt LINES v_txt_cnt.
    LOOP AT i_txt INTO wa_txt.
      v_txtln_ctr_n = sy-tabix + 2.
      v_txtln_ctr_c = v_txtln_ctr_n.
      CONCATENATE 'RSTXT-TXLINE('
                  v_txtln_ctr_c
             INTO v_bdc_txtln_lit.
      CONDENSE v_bdc_txtln_lit NO-GAPS.
      IF sy-tabix = v_txt_cnt.
        v_txt_ok = '=TXBA'.                    " no more text lines coming
      ELSE.
        v_txt_ok = '=ENTR'.                    " more text lines coming
      ENDIF.
      PERFORM DYNPRO USING:
        'X' 'SAPLSTXX'          '1100',       
        ' ' v_bdc_txtln_lit     wa_txt,        " line of problem text
        ' ' 'BDC_OKCODE'        v_txt_ok.      " ok_code
    ENDLOOP.
    The result is that the longtest display in IW32 will be what's in "SCRN_PROBLEM1" followed by all the lines that are in i_txt.
    Reagrds
    djh

  • Job is getting cancelled in CPS

    Hi,
    We have implemented CPS on SOLMAN, and  when we were submitting a job for one of the SAP system and we are using Job chain method for submiting the job.
    Job is getting cancelled with the below error,please find the below error and log.
    Failed to create the job in the SAP system
    BAPI exception while calling BAPI_XBP_JOB_ADD_ABAP_STEP: E XM 034 Internal problem (function BAPI_XBP_JOB_ADD_ABAP_STEP) [BAPI_XBP_JOB_ADD_ABAP_STEP, , , ]
         at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.checkBapiReturnCode(ClientConnectionImpl.java:818)
         at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.call(ClientConnectionImpl.java:605)
         at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection$4.doPerform(AbstractRfcConnection.java:289)
         at com.redwood.scheduler.connector.sap.rfc.connection.RemoteFunctionCall.perform(RemoteFunctionCall.java:130)
         at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection.perform(AbstractRfcConnection.java:445)
         at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection.execute(AbstractRfcConnection.java:282)
         at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.SapFunctionModuleWrapper.execute(SapFunctionModuleWrapper.java:194)
         at com.redwood.scheduler.connector.sap.rfc.jco.AbstractSapFunctionModule.execute(AbstractSapFunctionModule.java:107)
         at com.redwood.scheduler.connector.sap.rfc.command.impl.AbapRunPrintCommand.doAddSteps(AbapRunPrintCommand.java:353)
         at com.redwood.scheduler.connector.sap.rfc.command.AbstractXbpJobRunCommand.execute(AbstractXbpJobRunCommand.java:177)
         at com.redwood.scheduler.connector.sap.rfc.command.AbstractXbpCommand.doExecute(AbstractXbpCommand.java:123)
         at com.redwood.scheduler.connector.sap.rfc.command.AbstractCommand.execute(AbstractCommand.java:56)
         at com.redwood.scheduler.connector.sap.rfc.service.SapJobWork.doWork(SapJobWork.java:107)
         at com.redwood.scheduler.infrastructure.workqueue.Worker.run(Worker.java:59)
         at java.lang.Thread.run(Thread.java:770)

    This message is most of the times thrown when the parameters you specify for the job to run are inconsistent. Possibly a variant name that does not exist or is missing, maybe a printer/sap user name/application server name that does not exist in the target system.

  • How to populate internal table field with text data?

    Hello Experts,
    I was able to load text file to a internal table but data is not populating each field. Can someone help me how to populate each field of internal table from text file?
    Here is the text file:
    io_name, io_type, io_txsht, io_txlng, io_datatype, io_length
    ZEA_IO1, CHA, IO Test,     IO Test 1, CHAR,       20
    ZEA_IO2, CHA, IO Test,     IO Test 2, CHAR,       20
    Here is the Code:
    *& Report  ZAS_BAPI_TEST                                               *
    *& InfoObject Creation through BAPI.
    *& Read the Text file, call a BAPI to create InfoObjects.              *
    *& Text file will hold the Info Object Structure. Text file will be    *
    *& located either work station or local PC.
    *& Step 1. Create internal table to hold InfoObject structure          *
    *& Step 2. Retrieve/Load text file into Internal Table structure       *
    *& Step 3. Call BAPI Function to Create IO                             *
    *& Step 4. Call BAPI Function to Activate IO                           *
    REPORT  ZAS_BAPI_TEST                           .
    Make data separator a comma
    CONSTANTS: gc_tab TYPE c VALUE ','.
          Declaring Internal table for creating InfoObject
    DATA: p_file TYPE string.
    DATA: BEGIN OF itab-bapi OCCURS 0,
            io_name like BAPI6108-infoobject,
            io_type like BAPI6108-type,
            io_txsht like BAPI6108-textshort,
            io_txlng like BAPI6108-textlong,
            io_datatype like BAPI6108-datatp,
            io_length like BAPI6108-intlen,
          END OF itab-bapi.
    DATA ibapi LIKE STANDARD TABLE OF itab-bapi.
    PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
          PUT THE TEXT FILE PATH TO P_FILE
    p_file = sel_file.
         Copy the file from the workstation to the server        ****
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                = p_file
                   FILETYPE                = 'ASC'
                   HAS_FIELD_SEPARATOR     = SPACE
                   HEADER_LENGTH           = 0
                   DAT_MODE                = SPACE
                   CODEPAGE                = SPACE
                   IGNORE_CERR             = ABAP_TRUE
                   REPLACEMENT             = '#'
                   READ_BY_LINE            = 'X'
                 IMPORTING
                   FILELENGTH              =
                   HEADER                  =
      TABLES
        data_tab                = itab-bapi[]
      EXCEPTIONS
        file_open_error         = 1
        file_read_error         = 2
        no_batch                = 3
        gui_refuse_filetransfer = 4
        invalid_type            = 5
        no_authority            = 6
        unknown_error           = 7
        bad_data_format         = 8
        header_not_allowed      = 9
        separator_not_allowed   = 10
        header_too_long         = 11
        unknown_dp_error        = 12
        access_denied           = 13
        dp_out_of_memory        = 14
        disk_full               = 15
        dp_timeout              = 16
        not_supported_by_gui    = 17
        error_no_gui            = 18
        OTHERS                  = 19.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
      &1 &2 issued return code &3
       ELSE.
         pit_data[] = lit_data[].
       ENDIF.
    ENDIF.
    loop at itab-bapi.
      write: /5 itab-bapi-io_name,
               20 itab-bapi-io_type,
               30 itab-bapi-io_txsht,
               50 itab-bapi-io_txlng,
               75 itab-bapi-io_datatype,
               85 itab-bapi-io_length.
    endloop.
          SELECT THE LOCATION FOR TEXT FILE
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_filename     = ''
          def_path         = 'C:\'
          mask             = ',Documentos de texto (*.txt), *.txt.'
          mode             = ''
        IMPORTING
          filename         = p_file
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
      find '.txt' IN p_file.
      if sy-subrc <> 0.
        concatenate p_file '.txt' into sel_file.
      else.
        sel_file = p_file.
      endif.
          Create InfoObject through BAPI Function
    *CALL FUNCTION 'BAPI_IOBJ_CREATE'.
    *IMPORTING
        VALUE(DETAILS) LIKE  BAPI6108 STRUCTURE  BAPI6108
    *EXPORTING
        VALUE(INFOOBJECT) LIKE  BAPI6108-INFOOBJECT
        VALUE(RETURN) LIKE  BAPIRET2 STRUCTURE  BAPIRET2
    TABLES
         COMPOUNDS STRUCTURE  BAPI6108CM OPTIONAL
         ATTRIBUTES STRUCTURE  BAPI6108AT OPTIONAL
         NAVIGATIONATTRIBUTES STRUCTURE  BAPI6108AN OPTIONAL
         ATRNAVINFOPROVIDER STRUCTURE  BAPI6108NP OPTIONAL
         HIERARCHYCHARACTERISTICS STRUCTURE  BAPI6108HC OPTIONAL
         ELIMINATION STRUCTURE  BAPI6108IE OPTIONAL
         RETURNTABLE STRUCTURE  BAPIRET2 OPTIONAL
          Activate InfoObject through BAPI Function
    CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
    *ENDFORM.                    " RETRIEVE_DATASET
    I appreciate your help.
    Regards,
    Mau

    I have used tab delimited file.
    Here are file contents
    io_name     io_type     io_txsht     io_txlng     io_datatype     io_length
    ZEA_IO1     CHA     IO Test     IO Test 1     CHAR     20
    ZEA_IO2     CHA     IO Test     IO Test 2     CHAR     20
    And here is program used
    *& Report ZAS_BAPI_TEST *
    *& InfoObject Creation through BAPI.
    *& Read the Text file, call a BAPI to create InfoObjects. *
    *& Text file will hold the Info Object Structure. Text file will be *
    *& located either work station or local PC.
    *& Step 1. Create internal table to hold InfoObject structure *
    *& Step 2. Retrieve/Load text file into Internal Table structure *
    *& Step 3. Call BAPI Function to Create IO *
    *& Step 4. Call BAPI Function to Activate IO *
    REPORT ZAS_BAPI_TEST .
    Make data separator a comma
    CONSTANTS: gc_tab TYPE c VALUE ','.
    Declaring Internal table for creating InfoObject
    DATA: p_file TYPE string.
    DATA: BEGIN OF itab-bapi OCCURS 0,
    io_name like BAPI6108-infoobject,
    io_type like BAPI6108-type,
    io_txsht like BAPI6108-textshort,
    io_txlng like BAPI6108-textlong,
    io_datatype like BAPI6108-datatp,
    io_length like BAPI6108-intlen,
    END OF itab-bapi.
    DATA ibapi LIKE STANDARD TABLE OF itab-bapi.
    PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
    PUT THE TEXT FILE PATH TO P_FILE
    p_file = sel_file.
    Copy the file from the workstation to the server ****
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = p_file
    <b>FILETYPE = 'ASC'
    HAS_FIELD_SEPARATOR = 'X'</b>
    TABLES
    data_tab = itab-bapi[]
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    not_supported_by_gui = 17
    error_no_gui = 18
    OTHERS = 19.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
    &1 &2 issued return code &3
    ELSE.
    pit_data[] = lit_data[].
    ENDIF.
    ENDIF.
    loop at itab-bapi.
    write: /5 itab-bapi-io_name,
    20 itab-bapi-io_type,
    30 itab-bapi-io_txsht,
    50 itab-bapi-io_txlng,
    75 itab-bapi-io_datatype,
    85 itab-bapi-io_length.
    endloop.
    SELECT THE LOCATION FOR TEXT FILE
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    def_filename = ''
    def_path = 'C:\'
    mask = ',Documentos de texto (*.txt), *.txt.'
    mode = ''
    IMPORTING
    filename = p_file
    EXCEPTIONS
    inv_winsys = 1
    no_batch = 2
    selection_cancel = 3
    selection_error = 4
    OTHERS = 5.
    find '.txt' IN p_file.
    if sy-subrc <> 0.
    concatenate p_file '.txt' into sel_file.
    else.
    sel_file = p_file.
    endif.
    Create InfoObject through BAPI Function
    *CALL FUNCTION 'BAPI_IOBJ_CREATE'.
    *IMPORTING
    VALUE(DETAILS) LIKE BAPI6108 STRUCTURE BAPI6108
    *EXPORTING
    VALUE(INFOOBJECT) LIKE BAPI6108-INFOOBJECT
    VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
    TABLES
    COMPOUNDS STRUCTURE BAPI6108CM OPTIONAL
    ATTRIBUTES STRUCTURE BAPI6108AT OPTIONAL
    NAVIGATIONATTRIBUTES STRUCTURE BAPI6108AN OPTIONAL
    ATRNAVINFOPROVIDER STRUCTURE BAPI6108NP OPTIONAL
    HIERARCHYCHARACTERISTICS STRUCTURE BAPI6108HC OPTIONAL
    ELIMINATION STRUCTURE BAPI6108IE OPTIONAL
    RETURNTABLE STRUCTURE BAPIRET2 OPTIONAL
    Activate InfoObject through BAPI Function
    CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
    *ENDFORM. " RETRIEVE_DATASET
    This program is working fine. You can test it.
    Only problem is as the column headings are big for some columns, they are getting truncated which you can always change by changing the column width in declaration
    Please let me know if this helps.
    ashish

  • Bapi_acc_document_post: how to populate dmbtr

    hi experts,
    I m posting AR Transaction data using bapi_acc_document_post.
    I populated all the fields in bapi except two fields, one is amount in local currency(DMBTR) and the other one is tax amount in local
    currency (MWSTS).
    The reason is, those two fields are not in that bapi table currencamount.
    i tried to use  bapi extension , but the structure acccr is not having those two fields.
    Functional people want those two fields to be updated .
    How to populate those fields?
    Pls give the solution.  It is urgent.
    thanks,

    at table currencyamount (at FM BAPI_ACC_DOCUMENT_POST),
    after insert a doc currency and amount value, add for local currency,
    sample :
      lt_curr-itemno_acc = ld_itemno.
      lt_curr-curr_type = '10'.
      lt_curr-currency = t_itab-waers1.
      lt_curr-amt_doccur = t_itab-dmbtr.
      IF t_itab-shkzg = 'H'.
        lt_curr-amt_doccur = lt_curr-amt_doccur * -1.
      ENDIF.
      APPEND lt_curr. CLEAR lt_curr.

  • How to Upload a file in a Batch Mode ?

    Hi, I want to upload a Comma separated value File via RFC to a BW system.
    The scenario is the following: From a Portal server i call the BAPI using JC0/JCA.
    The problem is that GUI_UPLOAD does not support a BATCH job. At least i get a error when calling the BAPI: Exception condition "NO_BATCH" raised. 
    How do i upload a file in a Batch Mode ?
    Thanks,
    Kai

    Hi Kai,
    Sorry for the delay. The delay was in trying to get to talk to the Basis team.
    Here is how we have it.
    On the message server of every instance, there will be a SAP admin id that is '<SID>ADM' or 'SAPSERVER<SID>' where SID is the system ID. We use the '<SID>ADM' user id.
    On the external NT fileserver, there has to be a user id created on the NT box with the same SAP admin id and this id on the NT box should have access rights do Read/Write.
    All of these have to be in the same domain (or different domains that have trust access to each other).
    So, there is basis,network and security groups involved.
    Once these are in place, we can have file access to the external fileserver box.
    We use logical filenames at our place (Transaction FILE).
    This makes all the file transfer locations well organized and manageable.
    Hope that answers your question regarding this.
    Regards,
    -Ramesh

  • Filling an XML structure with data

    Hi
    I’m about to write a program that shall do GL postings based on IDocs, using standard FM BAPI_ACC_DOCUMENT_POST.
    The challenge is that the program shall return the results of the postings back to the sending system in XML-format.
    The interface team has defined an XML/XSD/WSDL document containing the required structure:
    <i><?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Receipt xmlns:ns0="http://www.compello.com/xi/glposting">
       <Header>
          <Filler1/>
          <Title/>
          <Filler2/>
          <Filler3/>
          <Filler4/>
          <Filler5/>
          <Filler6/>
          <Filler7/>
          <Filler8/>
          <b><Bilagsnr/></b>     
          <Filler9/>
       </Header>
       <b><Error> (Occurrence = 0 .. unbounded)
          <Filler1/>
          <ErrorCode/>
          <ErrorText/>
       </Error></b>
    </ns0:MT_Receipt></i>
    …and I’m supposed to fill this structure with the reference document number in the element <Bilagsnr/> and all messages returned from the BAPI (except those of type ‘I’ and ‘S’) in the <Error>-table.
    I have tried to understand what to do by looking into several threads, but as I am quite a novice when it comes to XML, I’m still a bit uncertain of how to solve this task.
    Can anyone give an example how to solve this, preferably referring to the above described structure?
    I’m working on an SAP ECC 6.0 system.
    Thanks

    Not exactly a rush of answers, maybe I should have posted it in the XI forum instead. However, I finally managed to resolve it myself.
    Message was edited by:
            Ole Kristian Branæ

Maybe you are looking for

  • How to use a sleep timer with iTunes

    I just whipped up a little sleep timer for iTunes on request, and wanted to make it available to anyone who was looking for a way to listen to iTunes for a set amount of time and then have it paused (instead of having to make a playlist of a particul

  • Creation of sales order

    While creating a sales order iam getting a error message which says "The appropriate pricing procedure could not be determined because no entry with keys 'GOZ1 G1 G1' 'A' '' exists in table 683V. Can u help please ?? Nikhil

  • Gaming on a Mac

    I am in the process of buing a mac for the first time and was wondering if they were good for Gaming now that they are compatible with Windows software.

  • How to distribute from cost center to profit centers?

    Dear Experts, We have created profit centers as per business.  We have certain expenses that are common.  e.g. IT, A/c, HR etc.  We have created cost centers for the same.  Now we want to assign it to various PCs.  How to distribute from cost center

  • Does cflocation cancel sessions?

    In ColdFusion 7 (or above) is this true or not? If it is, I need to dramatically modify my CMS security structure. The problem in other words... If a CMS login routine and subsequent cfif redirects, all using cflocation plus url variables, is build i