Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

If-Endif statement

Hi All,

I have the following code six times from matnr2 to matnr7. What is the best way to modify these statements.

If not gs_zcoop-matnr2 IS INITIAL.

WRITE: /01 sy-vline,

04 sy-vline,

07 sy-vline,

10 sy-vline,

13 sy-vline,

22 sy-vline,

53 sy-vline,

75 sy-vline,

89 sy-vline,

90 gs_zcoop-matnr2,

95 sy-vline,

96 gs_zcoop-prdct2,

135 sy-vline,

136 gs_zcoop-camount2,

151 sy-vline,

168 sy-vline,

184 sy-vline,

200 sy-vline,

203 sy-vline,

214 sy-vline,

225 sy-vline,

256 sy-vline,

268 sy-vline,

279 sy-vline,

285 sy-vline,

292 sy-vline,

307 sy-vline,

329 sy-vline,

340 sy-vline,

356 sy-vline.

ENDIF.

If not gs_zcoop-matnr3 IS INITIAL.

WRITE: /01 sy-vline,

04 sy-vline,

07 sy-vline,

10 sy-vline,

13 sy-vline,

22 sy-vline,

53 sy-vline,

75 sy-vline,

89 sy-vline,

90 gs_zcoop-matnr3,

95 sy-vline,

96 gs_zcoop-prdct3,

135 sy-vline,

136 gs_zcoop-camount3,

151 sy-vline,

168 sy-vline,

184 sy-vline,

200 sy-vline,

203 sy-vline,

214 sy-vline,

225 sy-vline,

256 sy-vline,

268 sy-vline,

279 sy-vline,

285 sy-vline,

292 sy-vline,

307 sy-vline,

329 sy-vline,

340 sy-vline,

356 sy-vline.

ENDIF.

Thanks,

Veni.

Tags:
Former Member replied
If not gs_zcoop-matnr2 IS INITIAL.
perform write_line using gs_zcoop-matnr2 .
endif.

If not gs_zcoop-matnr3 IS INITIAL.
perform write_line using gs_zcoop-matnr3 .
endif.

...... etc

form write_line using p_var.

-


the rest of your code

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question