cancel
Showing results for 
Search instead for 
Did you mean: 

Perform call in SAP script

Former Member
0 Kudos

Hi All ,

I am using a perform call in my SAP script.

The following is the call.

PERFORM FETCH_ADDRRESS IN PROGRAM ZCREDIT_MEMO

USING T001-BUKRS

ENDPERFORM

and the program ZCREDIT_MEMO is like this.

REPORT ZCREDIT_MEMO.

DATA : IT_T001 LIKE TABLE OF T001." OCCURS 0.

FORM FETCH_ADDRRESS USING COMAPNY_CODE .

Select * from T001 into corresponding fields of table it_t001 where BUKRS = COMAPNY_CODE.

DATA : CODE_TEMP LIKE SY-TABIX.

CODE_TEMP = 4.

ENDFORM.

When I am using this through F.62 the short dump is created and the error is due to parameters mismatch.

The more parameters are passed this error is thrown. Please sugggest the error in the code.

Thank You,

Regards,

Anuj Saraswat

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I'm a bit puzzled by your code. What is it's purpose? Are you trying to retrieve the address for T001-BUKRS or just checking if it exists?

The following code would retrieve the address number:

PERFORM FETCH_ADDRESS IN PROGRAM ZCREDIT_MEMO

USING &T001-BUKRS&

CHANGING &T001-ADRNR&

ENDPERFORM

REPORT ZCREDIT_MEMO

FORM fetch_addresss TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy.

DATA: w_bukrs LIKE t001-bukrs.

READ TABLE in_par WITH KEY NAME = 'T001-BUKRS'.

IF sy-subrc = 0.

out_par-name = 'T001-ADRNR'.

w_bukrs = in_par-value.

SELECT SINGLE adrnr FROM t001 INTO out_par-value WHERE bukrs = w_bukrs.

MODIFY out_par INDEX 1.

ENDIF.

ENDFORM.

But it you have a value for T001-BUKRS, you likely already have T001-ADRNR...

Still, this shows you the basic format. USING values fill in_par, CHANGING values fill out_par.

Former Member
0 Kudos

Hi,

Please refer the below code:

PERFORM CONVERT_MATERIAL IN PROGRAM ZSD_SUB_PROFORMA_INVOICE

USING &VBDPR-MATNR&

CHANGING &Z1633MATNR&

ENDPERFORM

In the program, the form....endform is having the following code.

&----


*& Form CONVERT_MATERIAL

&----


FORM CONVERT_MATERIAL TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA: v_matnr TYPE mara-matnr,

wa_mara type mara,

z1633matnr(20),

v_1633matnr(20).

READ TABLE in_tab WITH KEY 'VBDPR-MATNR'.

IF sy-subrc IS INITIAL.

v_matnr = in_tab-value.

SELECT SINGLE zzinvtp zzlstnr zzlblcd zzinvsz

FROM mara

INTO CORRESPONDING FIELDS OF wa_mara

WHERE MATNR = v_matnr.

IF sy-subrc = 0.

CONCATENATE wa_mara-zzinvtp wa_mara-zzlstnr wa_mara-zzlblcd

wa_mara-zzinvsz into v_1633matnr. "z1633matnr.

  • SHIFT v_1633matnr LEFT DELETING LEADING space.

  • CONDENSE v_1633matnr.

ENDIF.

ENDIF.

LOOP AT out_tab.

CASE out_tab-name.

WHEN 'Z1633MATNR'.

MOVE v_1633matnr TO out_tab-value.

  • SHIFT out_tab-value LEFT DELETING LEADING space.

  • CONDENSE out_tab-value.

ENDCASE.

MODIFY out_tab.

ENDLOOP.

ENDFORM. " CONVERT_MATERIAL

former_member585060
Active Contributor
0 Kudos

Do like this, change feilds which ever u need.

In sapscript

===========================================

/:PERFORM FETCH_ADDRRESS IN PROGRAM ZCREDIT_MEMO

/:USING &EKKO-BUKRS&

/:USING &EKKO-SPRAS&

/:CHANGING &SADR-NAME1&

/:CHANGING &SADR-NAME2&

/:CHANGING &SADR-NAME3&

/:CHANGING &SADR-PSTLZ&

/:CHANGING &SADR-NAME4&

/:ENDPERFORM

P1 &SADR-NAME1&

P1 &SADR-NAME2&

P1 &SADR-NAME3&

P1 &SADR-PSTLZ&

P1 &SADR-NAME4&

In Subroutine program ZCREDIT_MEMO

=======================================

  • Company address according to Company code

DATA : w_bukrs TYPE ekko-bukrs, "Company code

w_name1 TYPE t001-butxt, "Company name

w_rcomp TYPE t001-rcomp, "

w_stret TYPE t880-stret, "Street address

w_pstlc TYPE t880-pstlc, "Postal code

w_ort01 TYPE t001-ort01, "City

w_city TYPE t880-city, "City

w_landx TYPE t005t-landx, "Country name

w_land1 TYPE t001-land1. "Country code

FORM FETCH_ADDRRESS TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

READ TABLE in_tab INDEX 1.

w_bukrs = in_tab-value.

READ TABLE in_tab INDEX 2.

w_spras = in_tab-value.

SELECT butxt

rcomp

land1 FROM t001 INTO (w_name1, w_rcomp, w_land1)

WHERE bukrs = w_bukrs.

SELECT SINGLE stret

pstlc

city FROM t880 INTO (w_stret, w_pstlc, w_city)

WHERE rcomp = w_rcomp.

SELECT SINGLE landx FROM t005t INTO w_landx

WHERE land1 = w_land1

AND spras = w_spras.

ENDSELECT.

READ TABLE out_tab INDEX 1.

MOVE w_name1 TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

READ TABLE out_tab INDEX 2.

MOVE w_stret TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

READ TABLE out_tab INDEX 3.

MOVE w_city TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

READ TABLE out_tab INDEX 4.

MOVE w_pstlc TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

READ TABLE out_tab INDEX 5.

MOVE w_landx TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDFORM. "FETCH_ADDRRESS

===========================================

Look for tables from where u can get the complete address, the above example is which i used for my script.

Regards

Bala Krishna

Former Member
0 Kudos

HI,

FORM FETCH_ADDRRESS *USING* COMAPNY_CODE

.

Your corresponding form for the perform in script should be

form fetch_addrress tables in_tab structure itcsy

read table in_tab index 1.

company_code = in_tab-value.

--

--

endform.

regards

padma

Former Member
0 Kudos

Hi,

Check the syntax for calling subroutine in Script-