Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8734

Re: Read from 6 tables, create 1 file

$
0
0

I dont fully understand what you need.

 

You need to write a file like this ?

 

KNA1

KNVV

KNVV

KNVP

ADRC

ADRC

ADRC

ADR6

ADR6

AUSP

AUSP

KNA1

KNVV

.....

 

1- Make a select from KNA1 to gt_KNA1

2- Then make each select to the next tables using FOR ALL ENTRIES gt_KNA1 (so you will have gt_KNVV, gt_ADRC, etc)

3- You now have all the data, the next thing make a LOOP AT gt_KNA1, inside make a LOOP for each table u need, appending all to a gt_FILE with only a field of 1024 chars.

 

Something like this:

 

LOOP AT gt_KNA1.

"Concatenate all the fields you need

  CONCATENATE gt_KNA1-field1 gt_KNA1-field2 ... INTO gs_file-line SEPARATED BY cl_abap_char_utilities=>horizontal_tab

  APPEND gs_file to gt_file

 

  LOOP AT gt_KNVV WHERE KUNNR = gt_KNA1-KUNNR.

    CONCATENATE gt_KNVV1-field1 gt_KNVV-field2 ... INTO gs_file-line SEPARATED BY cl_abap_char_utilities=>horizontal_tab

    APPEND gs_file to gt_file

  ENDLOOP.

 

"for ech table like the one before

 

ENDLOOP.

 

"Here you will have gt_file with all your file needed

 

You should also add a id field at the beginning of the line so you know what entry correspond to with table.

 

Regards


Viewing all articles
Browse latest Browse all 8734

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>