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

help with the ABAP code

Former Member
0 Likes
836

Hi "Friends",

I have small problem, but i don't know how to solve it.

I changed an old program which had just executable report function. The display was written with "WRITE" sentence.

here is the code:

WRITE: / OUTPUT-MATKL(4), '|',

T023T-WGBEZ, '|',

AT 30 OUTPUT-MATNR+12(6), '|',

AT 39 OUTPUT-MAKTX, '|',

AT 90 OUTPUT-LABST, '|',

AT 110 OUTPUT-OMENG, '|',

AT 135 OUTPUT-BMENG, '|',

AT 165 VERFUEGBAR, '|'.

How can I set in new code that the columns will start at the same point?

New code:

FORM BUILD_LINE USING IW_DATA. "$001 start

FIELD-SYMBOLS: <L_VALUE>, "$001

<L_DATUM_EX>. "$001

DATA: L_LEN TYPE I. "$001

DATA: L_STRLEN TYPE I. "$001

DATA: L_TYPE. "$001

DATA: H_DATE_EXTERNAL(10) TYPE C. "$001

CLEAR: G_TRANSFER. "$001

REFRESH: GTW_FIELDS. "$001

*******

APP_NAME 'MATKL'.

APP_NAME 'WGBEZ'.

APP_NAME 'MATNR'.

APP_NAME 'MAKTX'.

APP_NAME 'LABST'.

APP_NAME 'OMENG'.

APP_NAME 'BMENG'.

APP_NAME 'VERFUEGBAR'.

And my question is how to set in new code that the A column starts AT 30, second AT 90.... How to set this?

I put the AT 30 infront of the APP_NAME, but doesn't work!! Please help.

Thanks for the help,

<b><REMOVED BY MODERATOR></b>... and it is urgent )

BR

saso

Message was edited by: Saso

Saso Poljansek

Message was edited by:

Alvaro Tejada Galindo

7 REPLIES 7
Read only

Former Member
0 Likes
811

Hi Saso,

Your query is not so clear.As per my understanding ...we count the gap between subsequent fields by adding its field length..

suppose if first field ends at 30 then check the field length of second field add it to 30 ..this is the starting position of second field...

Read only

former_member386202
Active Contributor
0 Likes
811

Hi,

Use BACK statement and then write ur output using write statement.

Regards,

Prashant

Read only

0 Likes
811

Uf, sorry i don't understand

Can you explain a little bit more, how you can do this?

thanks

saso

Read only

Former Member
0 Likes
811

HI,

Its pretty simple:

<b>

1st example:</b>

WRITE :/ 10 watab-matnr , 25 watab-matkx , 40 watab-qty.

<b>2nd example:</b>

WRITE: / 10 OUTPUT-MATKL(4), 15 '|', 25 T023T-WGBEZ, 40 '|', 45 OUTPUT-MATNR+12(6),  60 '|'.

Best regards,

Prashant

Read only

0 Likes
811

Uf, but I would like to write on unix file now and this write is'n possible anymore...

Here is the code I need to change... At this piece of code i need to change that the columns will be a the same place as was before when I used write sentance... There is another external program behind and I need to have the same structure as I have before....

&----


*& Form build_line

&----


  • text

----


  • -->P_I_DATA text

----


FORM BUILD_LINE USING IW_DATA. "$001 start

FIELD-SYMBOLS: <L_VALUE>, "$001

<L_DATUM_EX>. "$001

DATA: L_LEN TYPE I. "$001

DATA: L_STRLEN TYPE I. "$001

DATA: L_TYPE. "$001

DATA: H_DATE_EXTERNAL(10) TYPE C. "$001

CLEAR: G_TRANSFER. "$001

REFRESH: GTW_FIELDS. "$001

*******

APP_NAME 'MATKL'. "$001

*****************write also this from the customizing table

APP_NAME 'WGBEZ'. "$001

APP_NAME 'MATNR'. "$001

APP_NAME 'MAKTX'. "$001

APP_NAME 'LABST'. "$001

APP_NAME 'OMENG'. "$001

APP_NAME 'BMENG'. "$001

*****************write also this from the customizing table

APP_NAME 'VERFUEGBAR'. "$001

LOOP AT GTW_FIELDS. "$001

CLEAR SY-SUBRC. "$001

ASSIGN COMPONENT GTW_FIELDS-NAME OF STRUCTURE IW_DATA "$001

TO <L_VALUE>. "$001

CHECK SY-SUBRC = 0. "$001

DESCRIBE FIELD <L_VALUE> OUTPUT-LENGTH L_LEN. "$001

DESCRIBE FIELD <L_VALUE> TYPE L_TYPE. "$001

CASE L_TYPE. "$001

WHEN 'D'. "$001

CLEAR: H_DATE_EXTERNAL. "$001

ASSIGN H_DATE_EXTERNAL TO <L_DATUM_EX>. "$001

CALL 'DATE_CONV_INT_TO_EXT' "$001

ID 'DATINT' FIELD <L_VALUE> "$001

ID 'DATEXT' FIELD <L_DATUM_EX>. "$001

UNASSIGN: <L_VALUE>. "$001

ASSIGN <L_DATUM_EX> TO <L_VALUE>. "$001

ENDCASE. "$001

L_STRLEN = STRLEN( G_TRANSFER ). "$001

WRITE <L_VALUE> TO G_TRANSFER+L_STRLEN(L_LEN). "$001

L_STRLEN = L_STRLEN + L_LEN. "$001

WRITE '|' TO G_TRANSFER+L_STRLEN. "$001

AT LAST. "$001

SHIFT G_TRANSFER BY 1 PLACES RIGHT. "$001

WRITE '|' TO G_TRANSFER+0(1). "$001

ENDAT. "$001

CLEAR: L_STRLEN. "$001

ENDLOOP. "$001

ENDFORM. " build_line "$001 end

Read only

0 Likes
811

Any suggestion?

Read only

Former Member
0 Likes
811

Hi, My dear friend Zlatko solved this problem!