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

How to make changes in another program?

Former Member
0 Likes
969

Hi evrybody,

how to make changes from one program to another program ?

Changes should be reflecting in other program.

thanx in advance n wud be surely Rewarded if answer is helpful.

3 REPLIES 3
Read only

Former Member
0 Likes
729

Hi there,,

right click on the program name in se80 and use copy to command.

i hope this helps.....

do reward or get back if need further assistance.

Read only

Former Member
0 Likes
729

Hi,

use code like this.


DATA: itab TYPE TABLE OF string,
      prog TYPE sy-repid,
      uc   TYPE trdir-uccheck.

FIELD-SYMBOLS  <line> TYPE string.

prog = 'ZEXAMPLE1'.

  READ REPORT prog INTO itab.
  LOOP AT itab ASSIGNING <line>.
    TRANSLATE <line> TO UPPER CASE.
    IF <line> CS 'DESCRIBE FIELD' AND
       <line> CS 'LENGTH' AND
       <line> NS 'MODE'.
      REPLACE '.' IN <line> WITH ' IN CHARACTER MODE.'.
    ENDIF.
  ENDLOOP.

  IF sy-subrc = 0.
    INSERT REPORT prog FROM itab UNICODE ENABLING 'X'.
  ENDIF.

this program will change the given program code into upper case.

we can add new lines of code also.

rgds,

bharat.

Read only

0 Likes
729

Hi Bharat,

Thanx for the info.

But what my requirement is , I'm scanning & reading another report into an Internal table. I want to change the Hyphen's

'-' used in variable declarations of another program into Underscore '_' .

My sample code is like this..

Report Zmain.

PARAMETERS:

p_prog LIKE sy-repid,

p_key LIKE stokex-str.

*"----


*

  • Internal Table t_itab *

*"----


*

DATA:

BEGIN OF t_itab OCCURS 0,

line(256) TYPE c,

END OF t_itab.

*" Data declarations...................................................

DATA:

t_statements LIKE sstmnt OCCURS 0 WITH HEADER LINE,

t_levels LIKE slevel OCCURS 0 WITH HEADER LINE,

t_tokens TYPE stokesx OCCURS 0 WITH HEADER LINE,

t_keywords LIKE t_itab OCCURS 0 WITH HEADER LINE,

w_i TYPE i,

w_j TYPE i.

----


  • START-OF-SELECTION *

----


START-OF-SELECTION.

APPEND p_key TO t_keywords.

READ REPORT p_prog INTO t_itab.

SCAN ABAP-SOURCE t_itab

STATEMENTS INTO t_statements

LEVELS INTO t_levels

TOKENS INTO t_tokens

KEYWORDS FROM t_keywords

WITH INCLUDES

WITH ANALYSIS

WITH COMMENTS.

----


  • END-OF-SELECTION *

----


END-OF-SELECTION.

LOOP AT t_statements.

READ TABLE t_levels INDEX t_statements-level.

w_i = t_statements-from.

w_j = t_statements-to.

  • IF t_statements-level > 0.

WHILE w_i < w_j.

READ TABLE t_tokens INDEX w_i.

REPLACE '-' WITH '_' INTO t_tokens-str.

w_i = w_i + 1.

ENDWHILE.

  • ENDIF.

ENDLOOP.

My called program is like this....

Report Zcalled.

DATA:

w-var1 TYPE c,

w-var2 TYPE c.

DATA:

fs_flight1 TYPE sflight,

t_flight1 LIKE STANDARD TABLE OF sflight.

START-OF-SELECTION.

INCLUDE zinclude3.

SELECT * FROM sflight

INTO TABLE t_flight1

WHERE carrid = 'AA'.

SELECT * FROM sflight

INTO TABLE t_flight1

WHERE carrid = 'LH'.

END-OF-SELECTION.

LOOP AT t_flight1 INTO fs_flight1.

WRITE: / fs_flight1-carrid,

fs_flight1-connid,

fs_flight1-fldate,

fs_flight1-price.

ENDLOOP.

Thanx very much.