ABAP Prog Propios RPT Puntua
- .report znadar1
- .parameters: prog(32)
- ,save as checkbox default ' '
- ,prin radiobutton group r01 default 'X'
- ,fina radiobutton group r01
- * El sorce de entrada tiene que ser abap-strict
- .data src(72) occurs 0 with header line
- .data di(72)
- .end-of-selection
- .data: ax(2)
- ,bx(2) type n
- ,al(1)
- .break-point
- .read report prog into src
- .al = '.'
- .if prin = 'X'
- .loop at src
- .perform punt_al_principio
- .write: / src
- .endloop
- .if sy-subrc eq 0
- .src = al
- .append src
- .write: / src
- .endif
- .else
- .loop at src
- .perform punto_al_final
- .write: / src
- .endloop
- .endif
- .if not save is initial
- .insert report prog from src
- .endif
- .form punt_al_principio
- *Pone el punto al principio
- *
- * Bugs conocidos:
- * * Cuando hay comentarios en la misma lnea habra que truncarlos
- * y comprobar en que acaba
- *
- * * Los comandos multilineas fallan al colocar el punto final.
- *
- .check src+0(1) ne '*'
- .check src+0(1) ne '"'
- .check src ne '*'
- .check not src is initial
- .if src cp '*.'
- .ax = strlen( src )
- .if ax <= 71
- .ax = ax - 1
- .bx = '01'
- .src+ax(bx) = ' '
- .di = src
- .while di+0(1) = ' '
- .shift di left
- .if di is initial. exit. endif
- .endwhile
- .ax = strlen( src ) - strlen( di ) - 1
- .if ax < 0
- .concatenate al src into src
- .else
- .src+ax(bx) = al
- .endif
- .al = '.'
- .modify src index sy-tabix
- .else
- .src = al
- .insert src index sy-tabix
- .endif
- .endif
- .if src cp '*,'
- .ax = strlen( src )
- .if ax <= 71
- .ax = ax - 1
- .bx = '01'
- .src+ax(bx) = ' '
- .di = src
- .while di+0(1) = ' '
- .shift di left
- .if di is initial. exit. endif
- .endwhile
- .ax = strlen( src ) - strlen( di ) - 1
- .if ax < 0
- .concatenate al src into src
- .else
- .src+ax(bx) = al
- .endif
- .al = ','
- .modify src index sy-tabix
- .else
- .src = al
- .insert src index sy-tabix
- .endif
- .endif
- .endform
- .form punto_al_final
- *Pone el punto al final, en la columna 72
- .check src+0(1) ne '*'
- .if src cp '*.'
- .ax = strlen( src )
- .check ax <= 71
- .ax = ax - 1
- .bx = '01'
- .src+ax(bx) = ' '
- .src+71(1) = '.'
- .modify src index sy-tabix
- .endif
- .if src cp '*,'
- .ax = strlen( src )
- .check ax <= 71
- .ax = ax - 1
- .bx = '01'
- .src+ax(bx) = ' '
- .src+71(1) = ','
- .modify src index sy-tabix
- .endif
- .endform
- .