Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI return (BAPIRET2) error message to link with upload file

Former Member
0 Kudos

Dear ,

Please let me know how can i link upload file row number with error log , i am saving the error log through CALL FUNCTION 'GUI_DOWNLOAD'.

Regards,
Sandeep

1 ACCEPTED SOLUTION

former_member182550
Active Contributor
0 Kudos

You don't give too much information.

Save the upload file row number as you start to process it,  create a custom error message and use that with the saved row number as one of the parameters.

You would be better off creating an application log (see function group SBAL) rather than downloading the messages.

Rich

9 REPLIES 9

Shubham1
Employee
Employee
0 Kudos

GUI_UPLOAD for excel? | SCN

Hello

Please find above a useful thread.

Specific FM and codes are mentioned in the same.

Shubham

Former Member
0 Kudos

Hi,

Thanks for your reply,

I am looking for 'GUI_DOWNLOAD'. , how can i link error record with upload file row number.

0 Kudos

Told you how above.  How do you mean 'GUI_DOWNLOAD' ??

former_member182550
Active Contributor
0 Kudos

You don't give too much information.

Save the upload file row number as you start to process it,  create a custom error message and use that with the saved row number as one of the parameters.

You would be better off creating an application log (see function group SBAL) rather than downloading the messages.

Rich

0 Kudos

Thanks richard,

For your reply,

Requirement is to download the log every time when user upload the data ,

We are using standard BAPI for the same, and we need to save this log with reference to row number of respective file.

0 Kudos

How do you mean 'With reference to' ??

Clemenss
Active Contributor
0 Kudos

Hi Sandeep,

I would be happy to help you, but some (if not all) details are missing.

The best way will be to issue a custom message liek "Error in line & of input file" and store that in BAPIRET2 table.

If your program does not know the line number where the error was detected, you may use a random number to issue.

Regards Clemens

Former Member
0 Kudos

Hi Clemens,

Thanks for your reply , I am using BAPI_EQUI_CREATE for uploading equipment ,

in upload program i am using CALL FUNCTION 'GUI_DOWNLOAD' , for downloading error

        EXPORTING

*        BIN_FILESIZE                    =

          FILENAME                        = 'D:/DEMO.TXT'

         FILETYPE                        = 'ASC'

*        APPEND                           = LT_RETURN

*        WRITE_FIELD_SEPARATOR           = 'X'

*        HEADER                          = '00'

*        TRUNC_TRAILING_BLANKS           = ' X'

*        WRITE_LF                        = 'X'

*        COL_SELECT                      = ' '

*        COL_SELECT_MASK                 = ' '

*        DAT_MODE                        = ' '

*        CONFIRM_OVERWRITE               = ' '

*        NO_AUTH_CHECK                   = ' '

*        CODEPAGE                        = ' '

*        IGNORE_CERR                     = ABAP_TRUE

*        REPLACEMENT                     = '#'

*        WRITE_BOM                       = ' '

*        TRUNC_TRAILING_BLANKS_EOL       = 'X'

*        WK1_N_FORMAT                    = ' '

*        WK1_N_SIZE                      = ' '

*        WK1_T_FORMAT                    = ' '

*        WK1_T_SIZE                      = ' '

*        WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE

*        SHOW_TRANSFER_STATUS            = ABAP_TRUE

*        VIRUS_SCAN_PROFILE              = '/SCET/GUI_DOWNLOAD'

*      IMPORTING

*        FILELENGTH                      =

        TABLES

          DATA_TAB                        = LT_RETURN

         FIELDNAMES                      BAPIRET2

       EXCEPTIONS

*        FILE_WRITE_ERROR                = 1

*        NO_BATCH                        = 2

*        GUI_REFUSE_FILETRANSFER         = 3

*        INVALID_TYPE                    = 4

*        NO_AUTHORITY                    = 5

*        UNKNOWN_ERROR                   = 6

*        HEADER_NOT_ALLOWED              = 7

*        SEPARATOR_NOT_ALLOWED           = 8

*        FILESIZE_NOT_ALLOWED            = 9

*        HEADER_TOO_LONG                 = 10

*        DP_ERROR_CREATE                 = 11

*        DP_ERROR_SEND                   = 12

*        DP_ERROR_WRITE                  = 13

*        UNKNOWN_DP_ERROR                = 14

*        ACCESS_DENIED                   = 15

*        DP_OUT_OF_MEMORY                = 16

*        DISK_FULL                       = 17

*        DP_TIMEOUT                      = 18

*        FILE_NOT_FOUND                  = 19

*        DATAPROVIDER_EXCEPTION          = 20

*        CONTROL_FLUSH_ERROR             = 21

         OTHERS                          = 22

                .

      IF SY-SUBRC <> 0.

* Implement suitable error handling here

      ENDIF.

data i have declared as -

DATA: bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.

DATA : wa_DATA_GENERAL type BAPI_ITOB,

        wa_DATA_SPECIFIC type BAPI_ITOB_EQ_ONLY.

TYPES:fs_struct(4096) TYPE c OCCURS 0 .

Data : LT_RETURN TYPE STANDARD TABLE OF BAPIRET2 ,

        WA_return type BAPIRET2 .

   DATA: SUBRC    LIKE SY-SUBRC,

         LANGUAGE LIKE SY-LANGU.


Please let me know for any more details are required.

Clemenss
Active Contributor
0 Kudos

Hi sandeep,

please try to

- describe the expected result in detail

- read the documentation for GUI_DOWNLOAD, documentation for parameter FIELDNAMES

- Do not deactivate any exception - the value helps you to know whats wrong

I do not understand your 'declarations', what is bdcdata good for, where is TYPE fs_struc used?

Sorry, I do't know what it's all about.

Regards, Clemens