cancel
Showing results for 
Search instead for 
Did you mean: 

PLEASE LET ME KNOW WHERE I HAVE TO CHANGE (URGENT)

Former Member
0 Kudos

REPORT ZRATETARIF_CATEGORY.

TABLES: ZHTTARIFCAT.

DATA: BEGIN OF ITAB OCCURS 0,

RATECAT LIKE ZHTTARIFCAT-RATECAT,

TARIFCAT LIKE ZHTTARIFCAT-TARIFCAT,

METERED LIKE ZHTTARIFCAT-METERED,

END OF ITAB.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'D:\ZISU_TARIFTYP_DS.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = '|'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = itab

  • 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

  • OTHERS = 17

.

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 itab INTO ZHTTARIFCAT.

INSERT itab.

WRITE:/ ZHTTARIFCAT-RATECAT, ZHTTARIFCAT-TARIFCAT, ZHTTARIFCAT-METERED.

clear ZHTTARIFCAT.

ENDLOOP.

IF sy-subrc = 0.

WRITE:/ 'The records has sucessfully updated into the table'.

ENDIF.

IF sy-subrc <> 0.

WRITE:/ 'There is no data in the file'.

ENDIF.

LOOP AT ZHTTARIFCAT.

WRITE:/ ZHTTARIFCAT-RATECAT, ZHTTARIFCAT-TARIFCAT, ZHTTARIFCAT-METERED.

ENDLOOP.

I AM USING THIS PROGRAM TO UPLOAD DATA FROM FLAT FILE TO A ZTABLE.

THE DATA IN THE FLAT FILE ARE LIKE THIS:: 011H5OTH06 H5 M

BUT WHEN I AM EXECUTING THIS PROGRAM SOME DATA GET TRUNCATED

LIKE::

RATECAT,=H5OTH06

TARIFCAT, H5

METERED.........

THE LAST FIELD IS COMMIING BLANK AND THE IN THE FIRST FEILD IT IS COMMING H5OTH06 AND 011 IS TRUNCATED..

PLEASE LET ME KNOW WHERE I HAVE TO CHANGE THE CODE..

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Maybe the problem comes from this :

LOOP AT itab INTO ZHTTARIFCAT.

...

ENDLOOP.

You didn't declare any MANDT field in ITAB and if there is one in ZHTTARIFCAT then all your data go into the wrong fields :

011 goes into MANDT

H5OTH06 goes into RATECAT

... etc

The solution is to make explicit assignations to the fields :

loop at itab.

zhttarifcat-mandt = sy-mandt.

zhttarifcat-ratecat = itab-ratecat.

zhttarifcat-tarifcat = itab-tarifcat.

zhttarifcat-metered = itab-metered.

insert zhttarifcat.

endloop.

Please reward if helpful.

regards,

Nicolas.

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi nichlos,

it will be

.....................

zhttarifcat-client = sy-mandt.

..

.

.

.

endloop.

But the approach is right

Former Member
0 Kudos

Hi Nicolas Saulnier,

This solve the problem ,,

thanks a lot..

i have assigned the points to u ...

thanks,

Former Member
0 Kudos

Hi,

Take another internal table which will have the length 200 charectes, then move the entire data into this folder, then loop this internal table and move the fields using the offset

LOOP AT ITAB.
ITAB1-FIELD1 = ITAB-FIELD+0(5).
ITAB1-FIELD2 = ITAB-FIELD+5(10).
ITAB1-FIELD3 = ITAB-FIELD+15(5).
ITAB1-FIELD4 = ITAB-FIELD+20(10).
append ITAB1.
ENDLOOP.

Regards

Sudheer

jaideeps
Advisor
Advisor
0 Kudos

hi,

plz check out this link for all relevant things..

https://www.sdn.sap.com/irj/sdn/advancedsearch?query=upload%20file%20to%20ztable&cat=sdn_all

thanks

jaideep

*reward points if useful...

Former Member
0 Kudos

Hello,

Declare all the fields as of type c like char12,char18 as the actual lengths.

Regards,

Deepu.K

Former Member
0 Kudos

its urgent

che_eky
Active Contributor
0 Kudos

Set a break point straight after the function call to GUI_UPLOAD and check the contents of table ITAB. There is probably a problem with the end of line seperator. Also does table ZHTTARIFCAT not have a MANDT field?

Hope it helps