cancel
Showing results for 
Search instead for 
Did you mean: 

Scripts Need

Former Member
0 Kudos

Hi,

In Address Window why they r suing with comment and what is the use of Define statement, pls explain?

/* TITLE &DKADR-ANRED&

/* DEFINE &NAME& = ''.

/* DEFINE &LAND& = ''.

why this statement is using Perform?

/* PERFORM GET_COMPANY_ADDRESS IN PROGRAM

ZUTFI_CUSTOMER_STATEMENT

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Anything with /* is a commented line. You neednt worry about that.

Define is used to define local variables that can be used in layouts.

When PERFORM is used a subroutine is called, in your case as that is also commented out just forget that.

If you want to know more about subroutines then just search the forum or chk out an example below:

Say if you have to add the unit price (KOMVD-KBERT) then in the main window whereever tat value is picked write this routine

/: DEFINE &TOT_PRICE&

/: PERFORM F_GET_PRICE IN PROGRAM <subroutine prog name say YTEST>

/:USING &KOMVD-KBERT&

/:CHANGING &TOT_PRICE&

/:ENDPERFORM

Then write the variable where ever you want it to be printed (mostly it will be in footer window)

Then create subroutine pool program (YTEST) and you have to write the code.

FORM F_GET_PRICE tables int_cond structure itcsy

outt_cond structure itcsy.

data : value type kbert,

value1 type kbert.

Read int_cond table WITH KEY 'KOMVD-KBERT'.

IF SY-SUBRC EQ 0.

value = int_cond-value.

ENDIF.

value1 = value1 + value.

Read outt_cond table with key 'TOT_PRICE'.

IF SY-SUBRC EQ 0.

outt_cond-value = value1.

Modify outt_cond index SY-TABIX.

ENDIF.

ENDFORM.

Regards,

Narendra.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

DEFINE is used to define the variables .

PERFORM is used to call subroutine pool so that data could be extracted from database tables or some operations could be performed as scripts itself doesnot support select queries or commands like loop etc.

Moreover in scripts we cannot directly perform operations.

So a subroutine is needed and to move data to and fro 'PERFORM' statement is needed.

Thanks,

Parul.