cancel
Showing results for 
Search instead for 
Did you mean: 

adding fields in scripts........

Former Member
0 Kudos

hi guys please send me the process or code for adding the fields to a standard script ......

with scenario.

regards,

karthik.M

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Copy the standard form to Z form. If you can change the driver program then you can declare the fileds in that and you can retrieve the vlaues for those fileds. Now you can use these fileds to print in the form. Just put the fields wherever you want.

If you can't change the driver program then create one subroutines pool say ZSUBPOOL.

now you can write the suibroutines in the script as follows. You need toi writev these subroutines just before you print the fileds.

In the following example i have to fetch the distance and time reading for the Equipment number.

/: PERFORM ODOMETER_READING IN PROGRAM ZSUBPOOL

/: USING &VIQMEL-EQUNR&

/: CHANGING &PV_DISTANCE&

/: CHANGING &PV_TIME&.

/: ENDPERFORM.

Create a sub routine pool in the Se38 with program name ZSUBPOOL.

Inside the Program, give the form as follows.

FORM odometer_reading TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.

Here the structure itcsy will have two fields:

1) Name

2) Value

Initially the OUT_TAB Internal table will be filled as shown below: These names are nothing but the variables that has been passed from the scripts.

Name

PV_DISTANCE

PV_TIME

After fetching the distance and time readings, follow the below code to fill the corresponding value field for the names.

READ TABLE out_tab WITH KEY name = 'PV_DISTANCE'.

IF sy-subrc = 0.

CONDENSE v_distance.

out_tab-value = v_distance. " latest Odometer Reading

MODIFY out_tab INDEX 1 TRANSPORTING value.

ENDIF.

CLEAR out_tab.

READ TABLE out_tab WITH KEY name = 'PV_TIME'.

IF sy-subrc = 0.

CONDENSE v_time.

out_tab-value = v_time. " Passing latest Engine Hours

MODIFY out_tab INDEX 2 TRANSPORTING value.

ENDIF.

These procedures will make the values to be fetched inside the sap script using sub-routine pool.

Reward points if useful.

Regards,

Nageswar