Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

sap script with external subroutines issue

Former Member
0 Likes
1,949

Hi i got the requirement which is standard script medruck in which i have to add new 2 additional fields fo this i should use external subroutine as for requirement i developed subroutine which is working correctly but i am not getting values into changing parameters and also what value i need to pass as input parameter how can i get it from program or from me21 tcode

Hi i got the requirement which is standard script medruck in which i have to add new 2 additional fields fo this i should use external subroutine as for requirement i developed subroutine which is working correctly but i am not getting values into changing parameters and also what value i need to pass as input parameter how can i get it from program or from me21 tcode

10 REPLIES 10
Read only

Former Member
0 Likes
1,865

HI Srinivas,

Can you share your Perform written in Program and SAP script?

You can put break point in subroutine and can test it.

Thanks.

Read only

0 Likes
1,865

what field pass as input parameter

Read only

0 Likes
1,865

what fields are pass as using parameters from me21 tcode

Read only

Former Member
0 Likes
1,865

Do you want he new columns in the standard Medruck form?

From which form is the external subroutine called from?

Read only

0 Likes
1,865

yes i have to add two new columns to po form as item fields

Read only

0 Likes
1,865

Can you post the screenshot of the subroutine call made in the form.

Read only

alessandroieva
Active Participant
0 Likes
1,865

Hi,

i attach you my test program.

let me know,

AI

Read only

0 Likes
1,865

HI,

Not able to open Zip file , Please attach or paste it again  if possible

Read only

0 Likes
1,865

Hi,

I think you are not printing the text in the script, check this once...

-Srikanth

Read only

0 Likes
1,865

Hi,

try with this

Note:

Italian is the language of the comments. if you want you can translate these texts.

program zdati . (tipo programma: subroutines).

*---------------------------------------------------------------------*

*       FORM datifooter                                               *

*---------------------------------------------------------------------*

*       ........                                                      *

*---------------------------------------------------------------------*

*  -->  TAB_IN                                                        *

*  -->  TAB_OUT                                                       *

*---------------------------------------------------------------------*

form datifooter tables tab_in  structure itcsy   ---> all'interno sono contenuti i valori in using nel sapscript

                       tab_out structure itcsy.    ---> all'interno sono contenuti i valori in changing nel sapscript

ALL'INTERNO DI QUESTA ROUTINE SI POSSONO FARE TUTTE LE OPERAZIONI.

L'IMPORTANTE è UTILIZZARE LE TABLES INDICATE ...

ALL'INTERNO DI ESSE CI SONO I DATI PASSATI ALLA CHIAMATA DELLA ROUTINE.

ESEMPIO:

  data: ap_bukrs like t001-bukrs,    

        va_gruppo(35)  type c,        

        va_cor(50) type c,

        va_soc(25) type c,

        va_gsber(5) type c,

        va_denom(40) type c.

  clear: ap_bukrs,

         va_gruppo,

         va_cor.

* lettura del campo società dalla tabin

  read table tab_in with key 'T001-BUKRS'.

  check sy-subrc = 0.

  ap_bukrs = tab_in-value.

* Lettura per gruppo appartenenza

  clear t001z.

  select single paval into va_gruppo from t001z

    where bukrs =  ap_bukrs

    and party = 'SAP023'.

  if sy-subrc = 0.

* Gruppo appartenenza in tab_out

    read table tab_out with key 'GRUPPO'.

    check sy-subrc = 0.

    tab_out-value = va_gruppo.

    modify tab_out index sy-tabix.

  endif.

* Lettura per Denominazione

  clear t001z.

  select single paval into va_cor from t001z

    where bukrs =  ap_bukrs

    and party = 'SAP024'.

  if sy-subrc = 0.

* Gruppo appartenenza in tab_out

    read table tab_out with key 'COR'.

    check sy-subrc = 0.

    tab_out-value = va_cor.

    modify tab_out index sy-tabix.

  endif.

endform.                               "DATIFOOTER

*---------------------------------------------------------------------*

*       FORM datifooter                                               *

*---------------------------------------------------------------------*

*       ........                                                      *

*---------------------------------------------------------------------*

*  -->  TAB_IN                                                        *

*  -->  TAB_OUT                                                       *

*---------------------------------------------------------------------*

form datifooter2 tables tab_in  structure itcsy

                       tab_out structure itcsy.

  data: ap_bukrs like t001-bukrs,      "società

        va_gruppo(35)  type c,          "registro imposte

        va_nome(35) type c,

        va_via(50) type c,

        va_cor(50) type c,

        va_soc(25) type c,

        va_gsber(5) type c,

        va_denom(40) type c,

        va_cs(25) type c,

        va_codfi(20) type c,

        va_codrea(20) type c.

  clear: ap_bukrs,

        va_gruppo,

        va_nome,

        va_via,

        va_cor,

        va_soc,

        va_gsber,

        va_denom,

        va_cs,

        va_codfi,

        va_codrea.

* lettura del campo società dalla tabin

  read table tab_in with key 'REGUH-ZBUKR'.

  check sy-subrc = 0.

  ap_bukrs = tab_in-value.

* Lettura per Nome Società

  clear t001z.

  select single paval into va_nome from t001z

    where bukrs =  ap_bukrs

    and party = 'SAPI11'.

  if sy-subrc = 0.

* Gruppo appartenenza in tab_out

    read table tab_out with key 'NAME1-SOC'.

    check sy-subrc = 0.

    tab_out-value = va_nome.

    modify tab_out index sy-tabix.

  endif.

* Lettura per gruppo appartenenza

  clear t001z.

  select single paval into va_gruppo from t001z

    where bukrs =  ap_bukrs

    and party = 'SAP023'.

  if sy-subrc = 0.

* Gruppo appartenenza in tab_out

    read table tab_out with key 'GRUPPO'.

    check sy-subrc = 0.

    tab_out-value = va_gruppo.

    modify tab_out index sy-tabix.

  endif.

* Lettura per Denominazione

  clear t001z.

  select single paval into va_cor from t001z

    where bukrs =  ap_bukrs

    and party = 'SAP024'.

  if sy-subrc = 0.

* Gruppo appartenenza in tab_out

    read table tab_out with key 'COR'.

    check sy-subrc = 0.

    tab_out-value = va_cor.

    modify tab_out index sy-tabix.

  endif.

* Lettura per Capitale Sociale

  clear t001z.

  select single paval into va_cs from t001z

    where bukrs =  ap_bukrs

    and party = 'SAP011'.

  if sy-subrc = 0.

* Gruppo appartenenza in tab_out

    read table tab_out with key 'CAP-SOC'.

    check sy-subrc = 0.

    tab_out-value = va_cs.

    modify tab_out index sy-tabix.

  endif.

* Lettura per Cod.Fiscale/P.IVA

  clear t001z.

  select single paval into va_codfi from t001z

    where bukrs =  ap_bukrs

    and party = 'SAP013'.

  if sy-subrc = 0.

* Gruppo appartenenza in tab_out

    read table tab_out with key 'VA_CODFI'.

    check sy-subrc = 0.

    tab_out-value = va_codfi.

    modify tab_out index sy-tabix.

  endif.

* Lettura per REA

  clear t001z.

  select single paval into va_codrea from t001z

    where bukrs =  ap_bukrs

    and party = 'SAP012'.

  if sy-subrc = 0.

* Gruppo appartenenza in tab_out

    read table tab_out with key 'VA_CODREA'.

    check sy-subrc = 0.

    tab_out-value = va_codrea.

    modify tab_out index sy-tabix.

  endif.

* Lettura per Indirizzo

  clear t001z.

  select single paval into va_via from t001z

    where bukrs =  ap_bukrs

    and party = 'SAP016'.

  if sy-subrc = 0.

* Gruppo appartenenza in tab_out

    read table tab_out with key 'VA_VIA'.

    check sy-subrc = 0.

    tab_out-value = va_via.

    modify tab_out index sy-tabix.

  endif.

endform.                               "DATIFOOTER2

let me know,

AI