Skip to Content
author's profile photo Former Member
Former Member

Problem In Integrating 3 Internal Tables to make data for email attachment

Hi All,

I am facing a problem. I am having some data in 3 internal tables. Consider it Header Data, Details Data, Tail Data in 3 different Internal tables with different Fields.

Now I want to send this data as an attachment in email. Now the problem is I am integrating the data in 3 internal tables into 1 single internal table with the help of following code :

loop at it1.

concatenate it1-field1

it1-field2

into itab.

append itab.

endloop.

loop at it2.

concatenate it2-field1

it2-field2

into itab.

append itab.

endloop.

similarly for 3rd internal table. But here it goes wrong.

For each and every field in each record, some specific number of characters are fixed. If any field doesn't uses those characters to complete, it has to leave the remaining characters blank and should start next field from there.

E.g.

Like record is :

AAA reserved chars : 10

XXX " " : 15

YYY " " : 8

so it should print like :

AAA XXX YYY .

But in attachment it is printing like :

AAAXXXYYY.

This is because I am using concatenate function. Please suggest me a way to integrate the data of 3 internal tables into a single internal table including the spaces reserved for each field.

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Oct 29, 2007 at 11:55 AM

    Hi Ravi,

    Did u try to use de addicion 'Separated by space' in the concatenate function?

    If it doesn't work, try this...

    You have to do as if you want to create a text file, using de offset function.

    Creating an internal table with one field and put all the records of your tables into this internal table.

    data: wa_line(400).

    data: begin of itab_line occurs 0,

    line(400),

    endif itab_line.

    Loop at itab1.

    clear wa_line.

    write: itab1-field1 to wa_line+0(10).

    write: itab1-field2 to wa_line+10(8).

    .

    .

    .

    write: itab1-fieldN to wa_line+nn(mm).

    append wa_line to itab_line.

    clear itab_line.

    endloop.

    Do the same with itab2 and itab3.

    Cheers,

    FC.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Francisco,

      your idea worked, but now I am facing another problem.

      I declared a variable wa_line(400) type c,

      Also I declared an internal table

      begin of itab occurs 0,

      ws_line(400) type c,

      end of itab.

      now the data in each reocrd is of length 281, while mu record is stripped after around 245-250 characters. I think the internal table is not allowing the length if variable ws_line of 400. It is taking just 255 characters.

      Please help how could I get the data of 281 characters in the file. Thanks.

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2007 at 12:46 PM

    Hi Mr:Ahuja,

    Here I am giving a code which satisfies exactly your requirement. Use this logic for your 3 tables.

    DATA:wa_sflight TYPE sflight.

    DATA:wrk_string TYPE c LENGTH 100.

    SELECT SINGLE * FROM sflight INTO wa_sflight.

    DATA:lv_count TYPE i,

    lv_len TYPE i,

    lv_var TYPE i.

    FIELD-SYMBOLS: <fs> TYPE ANY.

    DO.

    lv_count = lv_count + 1.

    ASSIGN COMPONENT lv_count OF STRUCTURE wa_sflight TO <fs>.

    IF sy-subrc NE 0.

    EXIT.

    ENDIF.

    IF lv_count = 1.

    lv_var = 0.

    ELSE.

    lv_var = lv_var + lv_len.

    ENDIF.

    DESCRIBE FIELD <fs> LENGTH lv_len IN BYTE MODE.

    wrk_string+lv_var(lv_len) = <fs>.

    ENDDO.

    WRITE: wrk_string.

    Rewards if find useful..

    Regards,

    Antony Thomas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2007 at 11:54 AM

    in your concatenate statement

    use

    concatenate it1-field1
    it1-field2
    into itab <b>separated by space</b>.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 01:45 PM

    Done

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.