Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic "write" position

Former Member
0 Likes
4,077

Dear all,

I want to know how to code a write statement with dynamic positioning like below:

Data: V_POS type i.

V_POS = 10.
Write:/V_POS 'Testing'.

I'm getting syntax error for the above. Please comment.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,029

REPORT ZTESTTT.

Data: V_POS type i.

V_POS = 10.

Write: at V_POS 'Testing'.

REPORT ZTESTTT.

Data: V_POS type i.

V_POS = 10.

Write: at V_POS 'Testing'.

9 REPLIES 9
Read only

Former Member
0 Likes
2,029

Hi,

It should work fine.

Nothing wrong in this.

you can write like this.

Try one more time and check.

Regards,

Rajitha.

Read only

Former Member
0 Likes
2,030

REPORT ZTESTTT.

Data: V_POS type i.

V_POS = 10.

Write: at V_POS 'Testing'.

Read only

Former Member
0 Likes
2,029

Try like this :

WRITE : /(var) 'TEST'.

Read only

Former Member
0 Likes
2,029

try this

Data: V_POS type i.

V_POS = 10.

Write at v_pos 'Testing'.

Read only

Former Member
0 Likes
2,029

hiii

you can use PATTERN for write statement there you will get pattern for AT POS also or use like below

Data: wa_pos type i.

wa_pos = 2.

Write: at wa_pos 'program'.

regards

twinkal

Read only

Former Member
0 Likes
2,029

Hi,

Data: V_POS type i.

V_POS = 10.

Write:/ v_POS. " give space after the "/"

Now it works fine

Thanks & Regards.

Y.R.Prem Kumar

Read only

Former Member
0 Likes
2,029

The following is the information from SAP Help.

You can position the output of a WRITE statement on the list by making a format specification before the field name as follows:

Syntax

WRITE AT [/][<pos>][(<len>)] <f>.

where

the slash '/' denotes a new line,

<pos> is a number or variable up to three digits long denoting the position on the screen,

<len> is a number or variable up to three digits long denoting the output length.

If the format specification contains only direct values (that is, no variables), you can omit the keyword AT.

WRITE 'First line.'.

WRITE 'Still first line.'

WRITE / 'Second line.'

WRITE /13 'Third line.'

For more info, see link:

[http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9e3035c111d1829f0000e829fbfe/content.htm]

Regards,

Lakshmi.

Read only

Former Member
0 Likes
2,029

Hi,

I think there should a space between : and / that could be oneof the problem....

Data: V_POS type i.

V_POS = 10.

Write: /V_POS 'Testing'.

Read only

Former Member
0 Likes
2,029

Hi efc,

i guess the best way for this is as many other has also told...

Data:
  v_pos type i.

v_pos = 10.

write at v_pos 'testing'.

regards.

pritam