Application Development and Automation 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: 
Read only

Conversion program required to update Ztable

Former Member
0 Likes
716

Hi All,

My requirement is iam having TAB -Delimited text file in some directory .I need to write a conversion program which will pick the file and uploadin the zeetable.Inbetween we need to some validations in the conversion program.Can any one send some IDEA on this requiremnet .

-> If any one send some sample program which do the same function it would be great.THANKS IN ADVANCE.

Regards,

Sriram

6 REPLIES 6
Read only

Former Member
0 Likes
689

Hi

For ur zee table simply create table maintenance generator. After activiting again go to utilities->Table Maintenance generator-> Environment->Modifications->events and create new entries inside this include write ur own validations which u required for ur ztable during uploading data.

Read only

Former Member
0 Likes
689

Hello,

Hope the following will help you.

<< Unformatable code rmoved >>

Regards

Edited by: Rob Burbank on Apr 20, 2009 9:48 AM

Read only

Former Member
0 Likes
689

HI,

1. Get the TAB -Delimited file from the directory into internal table itab using GUI_DOWNLOAD.

2. Perfrom the validation on the itab and append the sucessuful records in I_FINAL.

3 Using MODIFY statement update the Z table.

Read only

Former Member
0 Likes
689

Hi Sriram,

According to your requirement,the solution goes in the following way

1) have a path in your program to upload the file(tab delimited) eg: C:/Document sand Settings/test.txt

2) SAP has given many interface FM's like GUI_DOWNLOAD which suits your requirement,this FM downloads the non sap data in the tab delimited file into an internal table

3)Immediately calling the FM use sy-subrc if its 1 then make the validations in your internal table

4) Finally MODIFY enables us to modify the Z customized DB table.

If anything else revert back

Thanks and Regards

Srikanth.P

Read only

Former Member
0 Likes
689

hey..check this code..

DATA: BEGIN OF itab OCCURS 0,

text(1520) TYPE c,

END OF itab.

DATA: wa_itab like line of itab.

CONSTANTS: co_var(9) VALUE 'FNAME',

ABAP_TRUE(5) VALUE 'TRUE'.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002 .

PARAMETER: p_lfile TYPE rlgrap-filename.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_lfile.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

program_name = syst-repid

dynpro_number = syst-dynnr

field_name = co_var

CHANGING

file_name = p_lfile

EXCEPTIONS

mask_too_long = 1

OTHERS = 2.

START-OF-SELECTION.

DATA fsize type i.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = p_lfile

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = 'X'

    • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

IMPORTING

FILELENGTH = fsize

  • 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.

Loop at itab into wa_itab.

INSERT DB_TAB from wa_itab.

ENDLOOP.

endif.

Edited by: Krishna Chaitanya G on Apr 20, 2009 8:23 PM

Read only

Former Member
0 Likes
689

apart from the all above replies, would like to give u 1 more tip: its self explanatory, if u find any such prog.s in ur system itself ( preferably in QA system).

example specify GUI_DOWNLOAD in se37 and then use WHERE USED LIST and select Z prog. in ur system.

thanq