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: 

Hi. problem in donwloading the internal table to file

Former Member
0 Kudos

Hi all,

I wanted to download an file in the following structure

Rect TYp

H ..............

KK ..............

KA ..............

for which i have declared an internal table as below in the source code.. When i download the file

the file is not coming in the above format the KK record is getting merged with H and comes in single line..

how to get it in the above format.. can anyone help me

  • Type declaration for the header record

TYPES: BEGIN OF TY_Header,

RECTY TYPE CHAR2, "Record ype

LGSID TYPE CHAR10, "Legacy ystem ID

RLOUT TYPE CHAR8, "Rollout ID

ACTIO TYPE CHAR1, "Action Flag

KUNNR TYPE CHAR30, "Customer

KKBER TYPE CHAR4, "Credit Control Area

KRAUS TYPE CHAR11, "Credit Information No.

END OF TY_header.

  • Type declaration for the Knkk records of the output

"input table

TypeS: Begin of TY_KNKK,

RECTY TYPE CHAR2, "Record Type

kraus type kraus_cm. "Credit info number

INCLUDE STRUCTURE J_1FAKNKK.

"Credit control mgmnt

TypeS: END OF TY_KNKK.

  • Type declaration for the Knka records of the output

  • input table

TYPES: BEGIN OF TY_KNKA,

RECTY TYPE CHAR2. "Record Type

INCLUDE STRUCTURE J_1FAKNKA."Credit.Contl Extn

TYPES END OF TY_KNKA.

  • Type declaration for defining structured type

TYPES: BEGIN OF TY_OUT.

INCLUDE TYPE TY_HEADER

as ty_rec renaming with suffix ty_rech.

INCLUDE TYPE TY_KNKK

as ty_KNK renaming with suffix ty_sKNKk.

INCLUDE TYPE TY_KNKA

as ty_KKA renaming with suffix ty_sknka.

TYPES END OF TY_OUT.

Thanks in advance

Guhapriyan

3 REPLIES 3

naimesh_patel
Active Contributor
0 Kudos

Hello,

If you want to download the records into rows, then your table structure is like that. Based on your defination structure of output table consists only one row, rather it should have three rows for three different types.

let say if you want to download header records first,

then yor WS_DOWNLOAD with mode = 'A'

ane again call WS_download with mode = 'A' and table KK

and again call ws_download with mode = 'A' and table KA.

And, if you want to download like

H...

KK...

KA...

H...

KK...

KA...

then call the WS_DOWNLOAD with mode "A" in loop assigning only single records of the table to one temp table.

Regards,

Naimesh

Reward points, if it is useful..!

Former Member
0 Kudos

If you have sap 4.7 or newer use function gui_upload / gui_download insteed of ws_*

Br, Jacek

Former Member
0 Kudos

Hello,

Can u also dump the program to analyse the issue. The defination of strucutre doen't give much idea.