Skip to Content

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

Calling subroutine program from script

Hi,

I am calling a subrouting program from a script. Actually i should pass a parameter to the form and need to get back a internal table values. It's going to dump when i execute the script, saying too many parameters specified with perform. Please find my coding below

Script:

/: BREAK-POINT.

/* Define Variables

/: DEFINE &INVAR1& = '0000271151'.

/: DEFINE &OUTVAR1& = ' '

/: DEFINE &MATTOT& = ' '

/: DEFINE &VAMTTOT& = ' '

/: DEFINE &VTAXTOT& = ' '

/: DEFINE &TAXSA& = ' '

/: DEFINE &PLANT& = ' '

/: DEFINE &FMATTOT& = ' '

/: DEFINE &FVAMTTOT& = ' '

/: DEFINE &FVTAXTOT& = ' '

/: DEFINE &FTAXSA& = ' '

/: DEFINE &NUM& = '1'

/: DEFINE &GT_CONS_LST_F& = ''

/E CALL THE ROUTINE

/: PERFORM FETCH_CONSIGN_DATA IN PROGRAM ZMM_CONSIGN_SUBROUTINE_POOL

/: USING &INVAR1&

/: TABLES &GT_CONS_LST_F&

/: ENDPERFORM.

Program:

PROGRAM ZMM_CONSIGN_SUBROUTINE_POOL.

&----


*& Form fetch_consign_data

&----


  • text

----


  • --> in_tab text

  • <-- out_tab text

----


*FORM fetch_consign_data TABLES in_tab STRUCTURE itcsy

  • out_tab STRUCTURE itcsy.

FORM fetch_consign_data USING invar1 TYPE ELIFN

TABLES gt_cons_lst_f.

************************************************************************

  • tables *

************************************************************************

TABLES: RKWA,

T001W,

MAKT,

MARD,

BSEG.

***********************************************************************************

  • T Y P E S *

***********************************************************************************

types: begin of it_cons_list,

werks type RKWA-WERKS,

name1 type T001W-NAME1,

matnr type RKWA-MATNR,

maktx type MAKT-MAKTX,

bstmg type RKWA-BSTMG,

bwaer type RKWA-Bwaer,

wrbtr type RKWA-WRBTR,

curr type RKWA-BSTME,

klabs type MARD-KLABS,

taxsa type RKWA-WRBTR,

taxpv type RKWA-WRBTR,

totpv type RKWA-WRBTR,

end of it_cons_list.

types: begin of it_plant_desc,

werks type RKWA-WERKS,

name1 type T001W-NAME1,

end of it_plant_desc.

types: begin of it_mat_desc,

matnr type RKWA-MATNR,

maktx type MAKT-MAKTX,

klabs type MARD-KLABS,

end of it_mat_desc.

types: begin of it_gnrl_det,

werks type RKWA-WERKS,

matnr type RKWA-MATNR,

bstmg type RKWA-BSTMG,

wrbtr type RKWA-WRBTR,

end of it_gnrl_det.

types: begin of it_bseg_det,

matnr type BSEG-MATNR,

wrbtr type BSEG-WRBTR,

end of it_bseg_det.

DATA: gt_cons_list TYPE STANDARD TABLE OF it_cons_list,

gt_plant_desc TYPE STANDARD TABLE OF it_plant_desc,

gt_mat_desc TYPE STANDARD TABLE OF it_mat_desc,

gt_gnrl_det TYPE STANDARD TABLE OF it_gnrl_det,

gt_cons_list_f TYPE STANDARD TABLE OF it_cons_list with header line,

gt_bseg_det TYPE STANDARD TABLE OF it_bseg_det,

  • gt_cons_lst_f TYPE STANDARD TABLE OF it_cons_list with header line,

w_cons_temp TYPE it_cons_list,

w_bseg_temp TYPE it_bseg_det,

w_plant_desc TYPE it_plant_desc,

w_mat_desc TYPE it_mat_desc,

i_text TYPE STANDARD TABLE OF tline INITIAL SIZE 0,

w_header LIKE thead,

w_text TYPE tline,

l_isqnt like RKWA-BSTMG,

l_matamt like RKWA-WRBTR.

CONSTANTS: c_par TYPE char2 VALUE ',,'. " Sign for tabs

  • Select Plant & material details for the vendor

SELECT werks matnr bstmg wrbtr bwaer

FROM rkwa

INTO CORRESPONDING FIELDS OF TABLE gt_cons_list

  • WHERE lifnr EQ '0000271151'.

WHERE mjahr EQ '2008'.

  • Select Plant & Material description

SELECT werks name1

FROM t001w

INTO CORRESPONDING FIELDS OF TABLE gt_plant_desc

FOR ALL ENTRIES IN gt_cons_list

WHERE werks EQ gt_cons_list-werks.

SELECT amatnr amaktx b~klabs

INTO CORRESPONDING FIELDS OF TABLE gt_mat_desc

FROM ( MAKT as a join MARD as b

ON amatnr EQ bmatnr )

FOR ALL ENTRIES IN gt_cons_list

WHERE a~matnr EQ gt_cons_list-matnr.

  • Get UOM & on-hand values

LOOP AT gt_cons_list INTO w_cons_temp.

LOOP AT gt_plant_desc INTO w_plant_desc.

IF w_plant_desc-werks EQ w_cons_temp-werks.

MOVE w_plant_desc-name1 TO w_cons_temp-name1.

MODIFY gt_cons_list FROM w_cons_temp.

ENDIF.

ENDLOOP.

ENDLOOP.

CLEAR w_cons_temp.

LOOP AT gt_cons_list INTO w_cons_temp.

LOOP AT gt_mat_desc INTO w_mat_desc.

IF w_mat_desc-matnr EQ w_cons_temp-matnr.

MOVE:

w_mat_desc-maktx TO w_cons_temp-maktx,

w_mat_desc-klabs TO w_cons_temp-klabs.

MODIFY gt_cons_list FROM w_cons_temp.

ENDIF.

ENDLOOP.

ENDLOOP.

  • Calcualte tax paid to vendor & total paid to vendor

SELECT MATNR WRBTR

INTO CORRESPONDING FIELDS OF TABLE gt_bseg_det

FROM BSEG

FOR ALL ENTRIES IN gt_cons_list

WHERE MATNR EQ gt_cons_list-MATNR

AND WERKS EQ gt_cons_list-WERKS.

  • "AND LIFNR EQ gt_cons_list-

LOOP AT gt_cons_list INTO w_cons_temp.

LOOP AT gt_bseg_det INTO w_bseg_temp.

w_cons_temp-taxpv = w_bseg_temp-wrbtr - w_cons_temp-wrbtr.

w_cons_temp-totpv = w_cons_temp-wrbtr + w_cons_temp-taxpv.

MODIFY gt_cons_list FROM w_cons_temp.

ENDLOOP.

ENDLOOP.

  • Calculate total issued quantity & material amt as per vendor/plant/material no

LOOP AT gt_cons_list INTO w_cons_temp.

COLLECT w_cons_temp INTO gt_cons_list_f.

CLEAR w_cons_temp.

ENDLOOP.

gt_cons_lst_f = gt_cons_list_f.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question