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: 

Regarding GUI_UPLOAD/GUI_DOWNLOAD

Former Member
0 Kudos

Hi Experts,

I have created a program with gui_upload and download function. its working. But in this program I have to create a log file where I have to maintain the information like how much data is uploaded and downloaded and if some records are not uploaded then why and which are these records. In short I have to create a log file with number of lines inserted , failed, reason for fail etc.

Can anybody help me that how I can do this?

Thanks in advance

6 REPLIES 6

Former Member
0 Kudos

hii

i think for how much records are uploaded or downloaded..you can use following statement for internal table which you are using for getting data and passing in FM.

it will give you total number of records

and for which records are uploaded or downloaded,you can print internal table's values.it will be same.

DESCRIBE TABLE i_output LINES w_line.

regards

twinkal

Former Member
0 Kudos

I assume that you are using BDC for data upload.

use the FM FORMAT_MESSAGE to know the status of your uploaded record with reason.

you can find out record is uploaded or failed with reasong for failure from this FM.

CALL TRANSACTION 'XD01' USING BDCDATA MESSAGES INTO IBDCERR.

LOOP AT IBDCERR.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = IBDCERR-MSGID

LANG = 'EN'

NO = IBDCERR-MSGNR

V1 = IBDCERR-MSGV1

V2 = IBDCERR-MSGV2

V3 = IBDCERR-MSGV3

V4 = IBDCERR-MSGV4

IMPORTING

MSG = NMSG

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

ENDLOOP.

Thanks

Ganesh

Former Member
0 Kudos

Hi,

Please refer to below code

CALL TRANSACTION lv_trans USING gi_bdcdata MODE lv_mode MESSAGES INTO gi_messtab.

LOOP AT gi_messtab INTO wa_messtab

WHERE msgtyp = 'E' OR

msgtyp = 'A' OR

msgtyp = 'X'.

lv_msgv1 = wa_messtab-msgv1.

lv_msgv2 = wa_messtab-msgv2.

lv_msgv3 = wa_messtab-msgv3.

lv_msgv4 = wa_messtab-msgv4.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = wa_messtab-msgid

lang = 'EN'

no = wa_messtab-msgnr

v1 = lv_msgv1

v2 = lv_msgv2

v3 = lv_msgv3

v4 = lv_msgv4

IMPORTING

msg = lv_msgtext

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

WRITE: /'Error in record ',

gv_bukrs, '/', wa_datatab-anln1, '/', wa_datatab-anln2, '-', lv_msgtext.

ENDIF.

ENDLOOP.

IF sy-subrc <> 0.

WRITE: /'Record for',

gv_bukrs, '/', wa_datatab-anln1, '/', wa_datatab-anln2,

'posted successfully.'.

ENDIF.

I hope it will help.

Regards

Natasha Garg

0 Kudos

But I am not using BDC. I have created a program in se38 with GUI_UPLOLAD and GUI_DOWNLOAD function.

0 Kudos

Hi,

We can get only the number of record uploaded or downloaded, but we can't validate the data with using FM GUI_UPLOAD or GUI_DOWNLOAD.

To get no of records uploaded use Describe statement as Twinkle sujjested

after data is uploaded to internal table.

DESCRIBE TABLE i_intput LINES w_line.

just before GUI_DOWNLOAD FM, use this

DESCRIBE TABLE i_output LINES w_line1.

and compare the no of records in downloaded file.

If you still want to validate do validations after data is uploaded in internal table in LOOP and ENDLOOP.

Ex:-

Syntax

For each record in the internal table i_infile perform the validations.

a) Check Material is valid

Select single matnr from mara where matnr = i_infile-material.

If sy-subrc <> 0.

Move the error description into Error Log with the following details

Move <Material Num, Plant, and Material Type>: Invalid Material

Move the current record to table i_error_rec.

Go To Next Record.

Endif.

b) Check Plant is valid

Select single werks from T001W where werks = i_infile-plant.

If sy-subrc <> 0.

Move the error description into Error Log with the following details

Move <Material Num, Plant, and Material Type>: Invalid Plant

to i_err_log.

Move the current record to i_error_rec.

Go To Next Record.

Endif.

Regards

Bala Krishna.

Edited by: Bala Krishna on Sep 4, 2008 1:26 PM

0 Kudos

hi,

I know the way in BDC.

In report, you can't know the reason for each record failure but file failure because you are uploading the data at one go.

But you can know the records inserted by using the statement:

Describe table <table_name> lines lv_line.

Regards

Natasha Garg