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

Problem with WRITE of sy-vlines

this is my code :

LOOP AT i_final1.

ON CHANGE OF i_final-workcenter.

WRITE : /4 i_final1-zzopt_token LEFT-JUSTIFIED, 11 sy-vline,

12 i_final1-zzopt_token1 LEFT-JUSTIFIED, 19 sy-vline,

20 i_final1-ktext LEFT-JUSTIFIED, 29 sy-vline.

LOOP AT i_breakdown WHERE kapid = i_final1-workcenter.

WRITE : /144 i_breakdown-zrcod LEFT-JUSTIFIED, 148 sy-vline,

149 i_breakdown-zdure RIGHT-JUSTIFIED, 155 sy-vline,

156 i_breakdown-zrdes.

ENDLOOP.

ENDON.

WRITE : /30 i_final1-maktx NO-GAP LEFT-JUSTIFIED, 71 sy-vline,

72 i_final1-ferth , 83 sy-vline,

84 i_final1-pcode LEFT-JUSTIFIED, 93 sy-vline,

94 i_final1-blow RIGHT-JUSTIFIED, 98 sy-vline,

99 i_final1-lmnga RIGHT-JUSTIFIED, 113 sy-vline,

114 i_final1-xmnga RIGHT-JUSTIFIED, 128 sy-vline,

129 i_final1-zzcnt_readi LEFT-JUSTIFIED, 135 sy-vline,

136 i_final1-zzcnt_readf LEFT-JUSTIFIED, 143 sy-vline.

ENDLOOP.

my aim is whenever workcenter gets changed on change & endon fields get displayed once and other fields in i_final1 internal table displayed mulitiple times.

but this is not working properly.

blank lines are coming.

Edited by: Julius Bussche on Aug 11, 2008 11:37 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Aug 11, 2008 at 10:47 AM

    Hi Friend,

    This will be quite easy if you are doing in ALV, there just sort with workcenter and display it (pass the parameter in IT_SORT). ALV will take care rest of things.

    But if you want to do in report:

    Declare a global variable, in between CHAIN ENDCHAIN pass workcenter in that variable. Do not execute WRITE statement.

    In main LOOP body write as it is including that variable also which hold workcenter value. After write statment execution clear that variable.

    Hope it will help you.

    Regards

    Krishnendu

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2008 at 10:53 AM

    Hi ,

    ON CHANGE OF is unsuitable for recognizing control levels in loops of this type because it always creates a global auxiliary field which is used to check for changes. This global auxiliary field is only changed in the relevant ON CHANGE OF statement. It is not reset when the processing enters loops or subroutines, so unwanted effects can occur if the loop or subroutine is executed again. Also, since it is set to its initial value when created (like any other field), any ON CHANGE OF processing will be executed after the first test, unless the contents of the field concerned happen to be identical to the initial value.

    So instead of On change of Use At new i_final-workcenter .

    Chk this code..

    LOOP AT i_final1.

    i_final1_temp = ifinal1.

    At new workcenter.

    WRITE : /4 i_final1_temp-zzopt_token LEFT-JUSTIFIED, 11 sy-vline,

    12 i_final1_temp-zzopt_token1 LEFT-JUSTIFIED, 19 sy-vline,

    20 i_final1_temp-ktext LEFT-JUSTIFIED, 29 sy-vline.

    LOOP AT i_breakdown WHERE kapid = i_final1-workcenter.

    WRITE : /144 i_breakdown-zrcod LEFT-JUSTIFIED, 148 sy-vline,

    149 i_breakdown-zdure RIGHT-JUSTIFIED, 155 sy-vline,

    156 i_breakdown-zrdes.

    ENDLOOP.

    ENDON.

    WRITE : /30 i_final1-maktx NO-GAP LEFT-JUSTIFIED, 71 sy-vline,

    72 i_final1-ferth , 83 sy-vline,

    84 i_final1-pcode LEFT-JUSTIFIED, 93 sy-vline,

    94 i_final1-blow RIGHT-JUSTIFIED, 98 sy-vline,

    99 i_final1-lmnga RIGHT-JUSTIFIED, 113 sy-vline,

    114 i_final1-xmnga RIGHT-JUSTIFIED, 128 sy-vline,

    129 i_final1-zzcnt_readi LEFT-JUSTIFIED, 135 sy-vline,

    136 i_final1-zzcnt_readf LEFT-JUSTIFIED, 143 sy-vline.

    ENDLOOP.

    Regards,

    Sachin M M

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2008 at 12:01 PM

    Hi,

    Check your code

    ON CHANGE OF i_final1-workcenter.

    But u r using i_final

    ON CHANGE OF i_final-workcenter.

    And before use ON CHANGE sort the table

    SORT i_final1 BY workcenter.

    LOOP AT i_final1.

    ON CHANGE OF i_final1-workcenter.

    WRITE : /4 i_final1-zzopt_token LEFT-JUSTIFIED, 11 sy-vline,

    12 i_final1-zzopt_token1 LEFT-JUSTIFIED, 19 sy-vline,

    20 i_final1-ktext LEFT-JUSTIFIED, 29 sy-vline.

    LOOP AT i_breakdown WHERE kapid = i_final1-workcenter.

    WRITE : /144 i_breakdown-zrcod LEFT-JUSTIFIED, 148 sy-vline,

    149 i_breakdown-zdure RIGHT-JUSTIFIED, 155 sy-vline,

    156 i_breakdown-zrdes.

    ENDLOOP.

    ENDON.

    WRITE : /30 i_final1-maktx NO-GAP LEFT-JUSTIFIED, 71 sy-vline,

    72 i_final1-ferth , 83 sy-vline,

    84 i_final1-pcode LEFT-JUSTIFIED, 93 sy-vline,

    94 i_final1-blow RIGHT-JUSTIFIED, 98 sy-vline,

    99 i_final1-lmnga RIGHT-JUSTIFIED, 113 sy-vline,

    114 i_final1-xmnga RIGHT-JUSTIFIED, 128 sy-vline,

    129 i_final1-zzcnt_readi LEFT-JUSTIFIED, 135 sy-vline,

    136 i_final1-zzcnt_readf LEFT-JUSTIFIED, 143 sy-vline.

    ENDLOOP.

    Thanks,

    Durai.V

    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.