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

I can organize the data in the write without the numbers of columns?

Hi!! people.

In the write statement I can organize the data without the numbers of the line of a column? Because I do a report that write the month and quarter that the user want by a date. And if one month dont have information, the month is not displayed.

Example: JANUARY FEBRUARY JUN

$1,000 1,999 900

thanks!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 09:52 PM

    Use WRITE AT statement, Your code will look something like this.

    <b>data: Pos like sy-fdpos.</b>

    IF t_itab-monat = '01' .

    WRITE <b>at POS</b> 'JANUARY'.

    <b>Pos = Pos + 20.</b>

    ENDIF.

    IF t_itab-monat = '02' .

    WRITE <b>at POS</b> 'FEBRUARY'.

    <b>Pos = Pos + 20.</b>

    ENDIF.

    IF t_itab-monat = '03' .

    WRITE <b>at POS</b> 'FIRST QUARTER'.

    <b>Pos = Pos + 20.</b>

    ENDIF.

    IF t_itab-monat = '04' .

    WRITE <b>at POS</b> 'APRIL'.

    <b>Pos = Pos + 20.</b>

    ENDIF.

    20 need not be a constant you can vary it depending on the length of the string.

    Pls. reward points if this solves your issue.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 07:28 PM

    You can WRITE UNDER. From the help for WRITE:

    Align output to the reference fields:

    FIELD-SYMBOLS <FNAME>.

    ASSIGN 'First Name' TO <FNAME>.

    WRITE: /3 'Name'(001), 15 <FNAME>, 30 'RoomNo', 40 'Age'(002).

    ...

    WRITE: / 'Peterson' UNDER 'Name'(001),

    'Ron' UNDER <FNAME>,

    '5.1' UNDER 'RoomNo',

    (5) 24 UNDER TEXT-002.

    This produces the following output (numbers appear right-justified in their output fields!):

    Name First Name RoomNo Age

    Peterson Ron 5.1 24

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 20, 2005 at 07:52 PM

    Can you not simply use IF statement to check whether data is present and write the output accordingly?

    IF monthinformation is initial.

    *-- don't write anything.

    ELSE.

    write:/ 'month information'.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 08:38 PM

    HI people, thanks for your help but I dont know why the system put my example in a wrong form.

    This is my correcting example. The lines (-------) represent spaces because the system don't respect the spaces.

    JANUARY -FEBRUARY --


    JUN

    $1,000-- -1,999 --


    900

    How can I put JUN in the first place if JANUARY is not display because no have information.

    thanks people.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 08:52 PM

    OK, this is the definition of my tables:

    DATA: BEGIN OF t_bsis OCCURS 0,

    bukrs TYPE bsis-bukrs,

    dmbtr TYPE bsis-dmbtr,

    monat TYPE bsis-monat,

    gjahr TYPE bsis-gjahr,

    hkont TYPE bsis-hkont,

    END OF t_bsis.

    DATA: BEGIN OF t_itab OCCURS 0,

    dmbtr TYPE bsas-dmbtr,

    bukrs TYPE bsas-bukrs,

    monat TYPE bsas-monat,

    gjahr TYPE bsas-gjahr,

    hkont TYPE bsas-hkont,

    precio TYPE bsas-dmbtr,

    monat1 TYPE bsas-monat,

    END OF t_itab.

    -


    This is an example of my IF:

    *monat = month

    IF t_itab-monat = '01' .

    WRITE: 11 'JANUARY'.

    ENDIF.

    IF t_itab-monat = '02' .

    WRITE: 33 'FEBRUARY'.

    ENDIF.

    IF t_itab-monat = '03' .

    WRITE: 53 'FIRST QUARTER'.

    ENDIF.

    IF t_itab-monat = '04' .

    WRITE: 84 'APRIL'.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      In my earlier post, I was suggesting you do:

      REPORT ztemp LINE-SIZE 80 MESSAGE-ID zc.
      
      DATA: BEGIN OF t_itab OCCURS 0,
        dmbtr TYPE bsas-dmbtr,
        bukrs TYPE bsas-bukrs,
        monat TYPE bsas-monat,
        gjahr TYPE bsas-gjahr,
        hkont TYPE bsas-hkont,
        precio TYPE bsas-dmbtr,
        monat1 TYPE bsas-monat,
      END OF t_itab.
      *---------------------------------------------------------
      
      t_itab-dmbtr = 100.
      t_itab-monat = '01'.
      APPEND t_itab.
      t_itab-dmbtr = 200.
      t_itab-monat = '02'.
      APPEND t_itab.
      t_itab-dmbtr = 300.
      t_itab-monat = '03'.
      APPEND t_itab.
      t_itab-dmbtr = 400.
      t_itab-monat = '04'.
      APPEND t_itab.
      
      LOOP AT t_itab.
        IF t_itab-monat = '01' .
          WRITE: /11 'JANUARY',
                 /   t_itab-dmbtr UNDER 'JANUARY'.
        ENDIF.
      
        IF t_itab-monat = '02' .
          WRITE: /33 'FEBRUARY',
                 /   t_itab-dmbtr UNDER 'FEBRUARY'.
        ENDIF.
      
        IF t_itab-monat = '03' .
          WRITE: /53 'FIRST QUARTER',
                 /   t_itab-dmbtr UNDER 'FIRST QUARTER'.
        ENDIF.
      
        IF t_itab-monat = '04' .
          WRITE: /84 'APRIL',
                 /   t_itab-dmbtr UNDER 'APRIL'.
        ENDIF.
      ENDLOOP.

      Rob

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.