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

Failed to pass parameter from SAPscript to form subroutine

Former Member
0 Likes
3,768

Hi, Expert

Kindly need your help regarding passing parameter from SAPscript,

I have write a command below in SAPscript:

DEFINE : &LV_ACNO& = ''

DEFINE : &LV_BVTYP& = ''

PERFORM GET_ACCOUNT IN PROGRAM ZFIF_CHEQUEPRINT

USING &REGUH-LIFNR&

USING &REGUH-BVTYP&

CHANGING &LV_ACNO&

ENDPERFORM

in FORM:

FORM get_account TABLES intab STRUCTURE itcsy

                                         outtab STRUCTURE itcsy.

DATA:   p_input1     TYPE tdsymvalue,

            p_input2     TYPE tdsymvalue.

   READ TABLE intab INDEX 1.

   IF sy-subrc = 0.

     MOVE intab-value TO p_input1.

   ENDIF.


But, when i try to debug, there's got only one field in the INTAB as below, while, REGUH-BVTYP is missing.

Thought that, it will work based on looking around the forums - but it seems I am missing something.

Please help and guide.


Thanks in advance,

Regards,


Liyana.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,395

Hi All,

when try to debug sapscript, found as below screenshot, why USING &REGUH-BVTYP& is missing there? i already activate the sapscript.

Please advise.

Thanks and regards,

Liyana

Hi All,

when try to debug sapscript, found as below screenshot, why USING &REGUH-BVTYP& is missing there? i already activate the sapscript.

Please advise.

Thanks and regards,

Liyana

11 REPLIES 11
Read only

VenkatRamesh_V
Active Contributor
0 Likes
3,395

Hi ,

Try.

/: PERFORM GET_ACCOUNT IN PROGRAM 'ZFIF_CHEQUEPRINT'

/: USING &REGUH-LIFNR&

/: USING &REGUH-BVTYP&

/: CHANGING &LV_ACNO&

/: ENDPERFORM

FORM GET_ACCOUNT TABLES intab STRUCTURE itcsy

                     out_tab STRUCTURE itcsy.               "#EC *

READ TABLE intab WITH KEY name = 'REGUH-LIFNR'.

IF SY-SUBRC IS INITIAL.

       V_vendor = IN_TAB-VALUE.

ENDIF.

READ TABLE OUT_TAB WITH KEY NAME = 'LV_ACNO'.

     IF SY-SUBRC IS INITIAL.

       OUT_TAB-VALUE = V_TXT50.

       MODIFY OUT_TAB INDEX SY-TABIX.

Hope it helpful,

Regards,

Venkat

Read only

0 Likes
3,395

Thank you for your response,

just know i got problem to pass the parameter REGUH-BVTYP  to the subroutine

I'm  not so sure if there is something missing since i already follow the steps.
Please advise.

Thanks and Regards,

Liyana

Read only

0 Likes
3,395

Hi Liyana,

Have you activated your sap script. Please activate your sap script and start debugging.

Thanks

Read only

0 Likes
3,395

already activate it, but, still can't work.

Regards,

Liyana

Read only

0 Likes
3,395

HI Liyana,

Share the screen shot of 'perform' from SAP script and also subroutine pool.

Thanks

Read only

0 Likes
3,395

Hi always,

below attached the screen shot of 'perform' from SAP script and also subroutine pool

FORM get_account TABLES intab STRUCTURE itcsy

                        outtab STRUCTURE itcsy.

  TYPES:

    BEGIN OF lty_lfbk,

       bankl LIKE lfbk-bankl,

       bankn LIKE lfbk-bankn,

    END OF lty_lfbk.

  DATA: lt_lfbk TYPE STANDARD TABLE OF lty_lfbk WITH HEADER LINE,

        lw_lfbk TYPE lty_lfbk.

  DATA:   p_input1     TYPE tdsymvalue,

          p_input2     TYPE tdsymvalue,

          lv_output1   TYPE tdsymvalue,

          lv_acno(65)  TYPE c.

  READ TABLE intab INDEX 1.

  IF sy-subrc = 0.

    MOVE intab-value TO p_input1.

  ENDIF.

  READ TABLE intab INDEX 2.

  IF sy-subrc = 0.

    MOVE intab-value TO p_input2.

  ENDIF.

  IF p_input2 IS INITIAL.

    CLEAR lt_lfbk.

    SELECT bankl bankn

      INTO TABLE lt_lfbk

      FROM lfbk

     WHERE lifnr = p_input1

     ORDER BY bankn DESCENDING.

    READ TABLE lt_lfbk INTO lw_lfbk INDEX 1.

    IF sy-subrc = 0.

      MOVE: lw_lfbk-bankl TO lv_bankl,

            lw_lfbk-bankn TO lv_bankn.

    ENDIF.

  ELSE.

    CLEAR lt_lfbk.

    SELECT bankl bankn

      INTO TABLE lt_lfbk

      FROM lfbk

     WHERE lifnr = p_input1

       AND bvtyp = p_input2.

ENDIF.


  READ TABLE outtab INDEX 1.

  IF sy-subrc = 0.

    outtab-value = lv_output1.

    MODIFY outtab INDEX 1 .

  ENDIF.

ENDFORM.

Read only

Former Member
0 Likes
3,395

Hi,

in Formroutine GET_ACCOUNT you have Tables parameter. But in SAP-Script you give Using parameter. That can not fit.

as far as i know. Wahtever variable you want in SAP_SCRIPT has to be defined as global variable in the calling programm. when you want to do some complex work on the data, you can do this in a form routine defined somewhere in a programm. (in your case u defined the formroutine in programm ZFIF_CHEQUEPRINT). But actually it doesnt matter where its defined since you give all parameters as table, using and changing and exporting.

-> in your script coding look that the variables from your calling programm (sourroundes by &) are defined in your main programm.

-> give the subroutine GET_ACCOUNT some valid variables. if you want it to have a table-parameter, get a table parameter in your main programm too.

regards

Stefan Seeburger

Read only

Former Member
0 Likes
3,396

Hi All,

when try to debug sapscript, found as below screenshot, why USING &REGUH-BVTYP& is missing there? i already activate the sapscript.

Please advise.

Thanks and regards,

Liyana

Read only

0 Likes
3,395

Hi,

Please do a syntax check and then activate your form and this form is being called in EN.

Kindly check in which language you have implemented the change is sap script and also implement the change in EN language.

To know in how many language the form is available, please follow below path :-

Menu->Utilities->version

Thanks

Read only

0 Likes
3,395

Just a stab in the dark:

Sapscript is client-dependent, therefore if you're testing in a different client than the one you made your changes in it may be necessary to copy the changes to the testing client using transaction SCC1.

Read only

0 Likes
3,395

adding to Esti van Wyk,

Script is language dependent also.. please check in which language you are making changes..