cancel
Showing results for 
Search instead for 
Did you mean: 

OPEN HUB DESTINATION

Former Member
0 Kudos

When we do open hub destination with application server, two files will be generated with one header file and other one with data file.

But how can we get only one file with both header and data?

Can any one please help me about this issue?

It's very urgent requirement for our project, please answer for this as soon as possible.....

i'll be thankfull to u..

Regards

M Manjunath

+919538220285

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vishali,

Why it is generating two different file on Application server? are you using two different open hub or DTP for generate file on Application server?

Regards,

Ashish

Former Member
0 Kudos

Hi Sir,

If u run Open Hub 4 Flat File.System will create 2 files one is Header File and Data File. but i want both header row and data in same file.That's my client requirement.

Regards,

Vishali.

Former Member
0 Kudos

Hi Vishali,

Got it so you are talking about information header file. which contains DTP detail, timestamp informations and data filed details.

If you want to merge this information header file with data file, then i will suggest write one program which copy content of both this files and paste it into single new file. and use that program in your process chain after open hub data load.

You will find the copy file code in lots of forum so i am not writing it here. kindly check those.

But if you do this then client have to create some intelligent system which will identify what is header information and data. It will be headache for them.

Regards,

Ashish

Former Member
0 Kudos

Hi Sir,

I didn't get that info can u plz send the link.

Regards,

Vishali.

Former Member
0 Kudos

Hi Vishali,

Kindly use below code as a refrence code.

DATA: BEGIN OF int_file OCCURS 1,

line(1000) TYPE x,

END OF int_file.

DATA:

ilength TYPE p,

count_table TYPE p,

line LIKE int_file-line,

bin_filesize TYPE p.

FIELD-SYMBOLS: <f1>.

  • Open file of Application Server

OPEN DATASET sourcepath FOR INPUT

IN BINARY MODE.

IF sy-subrc <> 0.

CONCATENATE 'Invalid Source File Path' sourcepath

INTO message SEPARATED BY space.

MESSAGE message TYPE 'E'.

ENDIF.

  • read in Information File

REFRESH int_file.

bin_filesize = 0.

DO.

READ DATASET sourcepath INTO int_file LENGTH ilength.

IF sy-subrc = 0.

APPEND int_file.

bin_filesize = bin_filesize + ilength.

ELSE.

IF sy-subrc = 8.

  • open of file failed

CONCATENATE 'File' wa_apfile-name 'can not be opened.'

INTO message SEPARATED BY space.

MESSAGE message TYPE 'E'.

ELSE.

  • end of file reached

APPEND int_file.

bin_filesize = bin_filesize + ilength.

EXIT.

ENDIF.

ENDIF.

ENDDO.

  • close file on application server

CLOSE DATASET sourcepath.

  • correct content of last line

DESCRIBE TABLE int_file LINES count_table.

IF count_table <> 0.

READ TABLE int_file INDEX count_table.

CLEAR line.

IF ilength > 0.

ASSIGN int_file-line(ilength) TO <f1>.

line = <f1>.

ELSE.

CLEAR line.

ENDIF.

CLEAR int_file-line.

int_file-line = line.

MODIFY int_file INDEX count_table.

ENDIF.

  • transfer to targetfile

  • open file on application server

OPEN DATASET targetpath FOR OUTPUT

IN BINARY MODE.

IF sy-subrc <> 0.

CONCATENATE 'Invalid Target File Path' targetpath

INTO message SEPARATED BY space.

MESSAGE message TYPE 'E'.

ENDIF.

  • correction content of lat line

DESCRIBE TABLE int_file LINES count_table.

ilength = bin_filesize MOD 1000.

  • Length file

  • length = bin_filesize.

  • write to file

LOOP AT int_file.

IF sy-tabix <> count_table.

TRANSFER int_file TO targetpath.

ELSE.

TRANSFER int_file TO targetpath LENGTH ilength.

ENDIF.

IF sy-subrc <> 0.

CONCATENATE 'Invalid Target File Path' targetpath

INTO message SEPARATED BY space.

MESSAGE message TYPE 'E'.

ENDIF.

ENDLOOP.

  • close file on application server

CLOSE DATASET targetpath.

In above code, we have just copied 1 file data to other file.

Just include read in information file for read the 2nd file.

Regards,

Ashish

Former Member
0 Kudos

Hi sir,

Thank u very much.

regards,

Vishali.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Manjunath,

It's not possiable to correct automatically if you want that you can get two files and do some code like VB you can achive that requirement.

http://help.sap.com/erp2005_ehp_04/helpdata/En/43/58e1cdbed430d9e10000000a11466f/content.htm

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/5092a542-350f-2d10-50bd-fc8cb3902...

Thanks and Regards,

Venkat.