cancel
Showing results for 
Search instead for 
Did you mean: 

Perform command in Scripts

0 Kudos

Hi All,

I have a doubt that why we use the 'Perform' and 'endperform' command in the script editor.

Why can't we use this 'Perform' statement in the print program itself and pass the result to Form??

Thanks in advance

Taj.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

see the below .

SCRIPT

/: &TEXT& = ' '

/: PERFORM MATERIAL_DISCRIPTION IN PROGRAM ZZSDS004

/: USING &VBDPL-MATNR&

/: USING &VBDKL-VKORG&

/: USING &VBDPL-VTWEG&

/: CHANGING &TEXT&

/: ENDPERFORM

SUBROUTINE DEFINITION

form MATERIAL_DISCRIPTION in_par structure itcsy

out_par structure itcsy.

data:l_f_matnr type matnr,

l_f_vkorg type vkorg,

l_f_vtweg type vtweg,

l_f_maktx type maktx.

*get material no

READ TABLE in_par INDEX 1.

CHECK sy-subrc = 0.

l_f_matnr = in_par-value.

*get sales organization

READ TABLE in_par INDEX 2.

CHECK sy-subrc = 0.

l_f_vkorg = in_par-value.

*get distribution channel

READ TABLE in_par INDEX 3.

CHECK sy-subrc = 0.

l_f_vtweg = in_par-value.

select maktx into l_f_maktx

from maktx

where matnr = l_f_matnr.

if sy-subrc = 0.

loop at out_par.

if out_par-name = 'TEXT'.

out_par-value = l_f_maktx.

endif.

endloop.

endform.

Thanks,

NN.

0 Kudos

Hi Nethaji,

I know how to write the subroutine and how to call it in Script.

My quetion is why can't we write the 'Perform' statement in print program itself.

Former Member
0 Kudos

Hi,

You can do that but if you need to understand the coding in the predefined driver program you require a lot of time and you also need to change the lot of code to suit according to your requirment. So It is better to use the perform statements in the sapscript instead of the driver program.

If you can change the driver program accordingly it is well and good it is not mandatory. One thing to remember as the format of the layout differs from one company to another company. We need to modify the lay out according to client requirement. As we are changing the layout we have to go with perform and endperform in the sapscript for any other fields that are not coming from the driver program.

Thanks,

NN.