Application Development 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: 

Perform statement in SmartForms - getting a syntax error

Former Member
0 Kudos

Hi all,

I am getting a syntax error in the following perform statement. The error is "<b>Field "VBLKP-MATNR" is unknown.</b> I have VBLKP in the interface. I tried putting it in both the tables tab and the import tab but both give me the same error.

PERFORM convert_to_pallets
  USING vblkp-matnr
        vblkp-lfimg
        vblkp-vrkme
  CHANGING w_nbrpal
           w_nbrpce
           w_nbrft2.

Regards,

Davis

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


data: w_bzirk              LIKE knvv-bzirk.
  data: w_kunnr(10)          TYPE c,
        w_vkorg(4)           TYPE c.

  CLEAR w_bzirk.

  SELECT * INTO TABLE t_knvv FROM knvv
     WHERE kunnr = w_kunnr
     AND   vkorg = w_vkorg.

data: wa_knvv type t_knvv.

  LOOP AT t_knvv into wa_knvv.
    TRANSLATE wa_knvv-bzirk TO UPPER CASE.
    IF wa_knvv-bzirk = 'CARLSH' OR
         wa_knvv-bzirk = 'CCWSH'.
      w_bzirk = wa_knvv-bzirk.
      EXIT.
    ENDIF.
  ENDLOOP.

Regards,

Ferry Lianto

17 REPLIES 17

Former Member
0 Kudos

Be sure to include that field in the input parameters of your Program Lines node.

0 Kudos

Shoot, thanks a lot for that help!

I have another question along these lines. I have a few performs that I have to copy from several programs. There are many structures needed by these performs. Is there a way to declare these structures in a program lines node so that they are global?

Regards,

Davis.

0 Kudos

Declare them in Global Definitions. You can define the Types in the Types tab and then declare your tables workareas in the Global Data tab.

0 Kudos

Alright, thanks. I was trying to declare the table in the types section and it wasn't working. I now know why.

Thanks again for your help!

ferry_lianto
Active Contributor
0 Kudos

Hi Davis,

You can declare them at global definitions.

Regards,

Ferry Lianto

0 Kudos

Here is what I have in an abap program. I need to copy a perform from this program and include some structures/tables in my SmartForm. The following is an example of the tables.

DATA:  BEGIN OF T_KNVV OCCURS 0.
        INCLUDE STRUCTURE KNVV.
DATA:  END OF T_KNVV.

I tried to delcare a strutcure like this:

[code]TYPES: BEGIN OF ty_knvv,

include structure knvv,

END OF ty_knvv.[/quote]

But it gives me a syntax error asking for a ',' after INCLUDE.

Regards,

Davis

0 Kudos

In the Global Definitions - Global Data do this

I_KNVV TYPE TABLE OF KNVV INITIAL SIZE 0

Variable Name = I_KNVV

Type = TYPE

Reference = TABLE OF KNVV INITIAL SIZE 0

Message was edited by:

Matt Nagel

0 Kudos

Matt, thanks for the suggestion. However I still get a syntax error when I am trying to access a field in t_knvv. I get the syntax error "<b>Field "T_KNVV-BZIRK" is unknown.</b>

    IF T_KNVV-BZIRK = 'CARLSH' OR
         T_KNVV-BZIRK = 'CCWSH'.

Regards,

Davis

0 Kudos

If you are doing it Ferry's way then you will have to have it like this

IF T_KNVV-KNVV-BZIRK = 'CARLSH' OR
         T_KNVV-KNVV-BZIRK = 'CCWSH'.

If you are doing it my way then you will need to loop at the table into a workarea first. I think.

0 Kudos

Sorry, I thought it was working but it is still giving me the same error.

Message was edited by:

Davis

Former Member
0 Kudos

I have a follow-up question posted above

ferry_lianto
Active Contributor
0 Kudos

Hi Davis,

Please try this.


TYPES: BEGIN OF TY_KNVV,
         KNVV TYPE KNVV,
       END OF TY_KNVV.

Regards,

Ferry Lianto

0 Kudos

Ferry, I just tried that and I still get the syntax error on T_KNVV-BZIRK.

Regards,

Davis

ferry_lianto
Active Contributor
0 Kudos

Hi Davis,

Please try this.



TYPES: TY_KNVV TYPE KNVV.

...

IF TY_KNVV-BZIRK = 'CARLSH' OR
    TY_KNVV-BZIRK = 'CCWSH'.
  ...
ENDIF.

Also can you show your coding?

Regards,

Ferry Lianto

Former Member
0 Kudos

Ferry, here is my code:

*&---------------------------------------------------------------------*
*&      Form  CHECK_KNVV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM check_knvv.
  data: w_bzirk              LIKE knvv-bzirk.
  data: w_kunnr(10)          TYPE c,
        w_vkorg(4)           TYPE c.
  CLEAR w_bzirk.
  SELECT * INTO TABLE t_knvv FROM knvv
     WHERE kunnr = w_kunnr
     AND   vkorg = w_vkorg.
  LOOP AT t_knvv.
    TRANSLATE t_knvv-bzirk TO UPPER CASE.
    IF t_knvv-bzirk = 'CARLSH' OR
         t_knvv-bzirk = 'CCWSH'.
      w_bzirk = t_knvv-bzirk.
      EXIT.
    ENDIF.
  ENDLOOP.


ENDFORM.                    " CHECK_KNVV

It is still not recognizing any field in T_KNVV.

Regards,

Davis

It loops at and into t_knvv without a problem. The error is when you try to access t_knvv-bzirk.

Message was edited by:

Davis

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


data: w_bzirk              LIKE knvv-bzirk.
  data: w_kunnr(10)          TYPE c,
        w_vkorg(4)           TYPE c.

  CLEAR w_bzirk.

  SELECT * INTO TABLE t_knvv FROM knvv
     WHERE kunnr = w_kunnr
     AND   vkorg = w_vkorg.

data: wa_knvv type t_knvv.

  LOOP AT t_knvv into wa_knvv.
    TRANSLATE wa_knvv-bzirk TO UPPER CASE.
    IF wa_knvv-bzirk = 'CARLSH' OR
         wa_knvv-bzirk = 'CCWSH'.
      w_bzirk = wa_knvv-bzirk.
      EXIT.
    ENDIF.
  ENDLOOP.

Regards,

Ferry Lianto

0 Kudos

Thanks a lot Ferry. I keep forgetting that these program nodes are just small abap editors and that I can treat them as such.

I used your code but changed

data: wa_knvv type t_knvv.

to

data: wa_knvv like line of t_knvv.

Regards,

Davix