Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Using Subroutines in SAP script

Hi Experts,

I am trying to get value of Z variables from a subroutine pool program using Perform ... EndPerform in my sap script form.

In my form window i have written

PERFORM ITEM_LINE_2F IN PROGRAM ZMEPRINTFORMS

USING &EKPO-MENGE&

CHANGING &V_EKPO_MENGE&

ENDPERFORM

and in my subroutine pool program i have written:

FORM ITEM_LINE_2F TABLES IN_PAR STRUCTURE ITCSY

out_par structure itcsy.

data : ZLV_ekpo_menge(17),

v_ekpo_menge(17),

ZLV_temp_split_1(14),

ZLV_temp_split_2(3),

ZLV_temp_menge(8) type p.

constants: zc_menge type TDTPRGNAME value 'EKPO-MENGE'.

field-symbols: <tab> type itcsy.

loop at in_par assigning <tab>.

case <tab>-name.

when zc_menge.

zlv_ekpo_menge = <tab>-value.

when others.

endcase.

endloop.

unassign <tab>.

V_EKPO_MENGE = zlv_ekpo_menge.

SPLIT V_EKPO_MENGE AT '.' INTO ZLV_TEMP_SPLIT_1 ZLV_TEMP_SPLIT_2.

IF ZLV_TEMP_SPLIT_2+0(3) = '000'.

ZLV_TEMP_MENGE = zlv_ekpo_menge.

WRITE ZLV_TEMP_MENGE TO V_EKPO_MENGE.

ELSE.

WRITE zlv_ekpo_MENGE TO V_EKPO_MENGE.

ENDIF.

loop at out_par assigning <tab>.

case <tab>-name.

when V_EKPO_MENGE.

<tab>-value = v_ekpo_menge.

when others.

Modify out_par.

endcase.

endloop.

unassign <tab>.

replied

hi,

FORM ITEM_LINE_2F TABLES IN_PAR STRUCTURE ITCSY

out_par structure itcsy.

data : ZLV_ekpo_menge(17),

v_ekpo_menge(17),

ZLV_temp_split_1(14),

ZLV_temp_split_2(3),

ZLV_temp_menge(8) type p.

read table in_par index 1.

V_EKPO_MENGE = zlv_ekpo_menge = in_par-value.

SPLIT V_EKPO_MENGE AT '.' INTO ZLV_TEMP_SPLIT_1 ZLV_TEMP_SPLIT_2.

IF ZLV_TEMP_SPLIT_2+0(3) = '000'.

ZLV_TEMP_MENGE = zlv_ekpo_menge.

WRITE ZLV_TEMP_MENGE TO V_EKPO_MENGE.

ELSE.

WRITE zlv_ekpo_MENGE TO V_EKPO_MENGE.

ENDIF.

read table out_par index 1.

out_par-value = v_ekpo_menge.

Modify out_par.

but frankly speaking... i dint understand your logic... finally you are passing the same value ????????

regards

padma

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question