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

ABAP program

hi,

i want to write the program to print the pattern

12345

5432

234

43

3

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 06:25 AM

    Hi

    try this code...

    data: w_no type i value 1,

    w_line type i value 5,

    y type i.

    do 5 times.

    y = w_line mod 2.

    if y eq 1.

    do w_line times.

    write w_no.

    w_no = w_no + 1.

    enddo.

    write /.

    w_line = w_line - 1.

    w_no = w_no - 1.

    endif.

    if y eq 0.

    do w_line times.

    write w_no.

    w_no = w_no - 1.

    enddo.

    write /.

    w_line = w_line - 1.

    w_no = w_no + 1.

    endif.

    enddo.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 06:25 AM

    Hi

    Use the Loops like DO..ENDDO.

    or WHILE..ENDWHILE.. and print the numbers with conditions

    Regards

    Anji

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 23, 2007 at 06:30 AM

    Its simple .. take your text in a character field.

    data:wf_char(5) type c, "Text

    wf_length type i. "Length

    wf_char = '12345'.

    wf_length = strlen(wf_char).

    do.

    if wf_length = 0.

    exit.

    endif.

    write:/ wf_char(wf_length).

    Call Function string_reverse.

    wf_length = wf_length - 1.

    wf_char = wf_char(wf_length).

    enddo.

    regards,

    abhishek

    Message was edited by:

    Abhishek Jolly

    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.