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: 

Smartforms

Former Member
0 Kudos

Hi !

I'm having hard times defining my internal table in the smartform Global Settings. This my internal table declaration in the ABAP Smartform calling program:

DATA: BEGIN OF IT_AFKO OCCURS 0,

AUFNR LIKE AFKO-AUFNR, "Order Number

GAMNG LIKE AFKO-GAMNG, "Quantity

PLNBEZ LIKE AFKO-PLNBEZ, "Cod. FIH (Material Number)

MAKTX LIKE MAKT-MAKTX, "Product Header Description

BISMT LIKE MARA-BISMT, "Old Material Number)

MATNR LIKE RESB-MATNR, "Order Components (Material Number)

CMAKTX LIKE MAKT-MAKTX. "Order Component Description

DATA: END OF IT_AFKO.

What Reference type should I type for my internal table ? I've entered AFKO for reference type, but it does not work, for I know table AFKO and my internal table have not the same structure.

Do I still need to declare another table (ITAB2) to receive the data for the internal table?

Global settings :

Form interface

Variable name Type assignment Reference type

IT_AFKO LIKE ?

Global definitions

Variable name Type assignment Reference type

ITAB2 LIKE ?

In the Loop section, the Internal table is filled like this:

IT_AFKO INTO ITAB2

5 REPLIES 5

reedtzj
Active Participant
0 Kudos

Hi,

You need to define a TYPE structure in Smartforms, Global definitions, tab "Types" first that matches your internal table IT_AFKO. This is like (using the prefered command TYPE instead of LIKE):


types:
  begin of ty_afko,
     AUFNR type AFKO-AUFNR, "Order Number
     GAMNG type AFKO-GAMNG, "Quantity
     PLNBEZ type AFKO-PLNBEZ, "Cod. FIH (Material Number)
     MAKTX type MAKT-MAKTX, "Product Header Description
     BISMT type MARA-BISMT, "Old Material Number)
     MATNR type RESB-MATNR, "Order Components (Material Number)
     CMAKTX type MAKT-MAKTX. "Order Component Description
  end of ty_afko.

Then you must reference this "template" structure in your Global Data tab tab in Smartforms. The "coding" for this goes something like:

GT_AFKO type TABLE OF TY_AFKO

Voila, there you have your internal table defined.

The ITAB2 structure you should preferably be defined like:

GS_AFKO type TY_AFKO

The loop then obviously follows like:

"loop at GT_AFKO into GS_AFKO" interpreted the Smartforms way.

I think this solves your doubts! Happy smartforming!

Best regards, Johan

Former Member
0 Kudos

Hi, Johan !

I did exactly as you said, but I just can't get this "GT_AFKO type TABLE OF TY_AFKO" done in Form Interface tab "Tables". It says <b>TYPE TY_AFKO does not exist</b>, though I have defined in Global definitions tab "Types".

reedtzj
Active Participant
0 Kudos

Hi again,

If I remember correctly you first need to create the type TY_AFKO and then immeditely activate the form.

Then you can proceed and reference the TY_AFKO as mentioned.

Smartforms is a litte "special" in this respect. This can happen in other places as well. -> Rule: Always activate before using any own defined structures, types or the likes.

If this solves the problem - then award some points so that others can benefit from this answer as they then know this to be a working solution.

Regards, Johan

Former Member
0 Kudos

HI,

IN YOUR SMARTFORM IN GLOBAL DEFINITIONS DEFINE A STRUCTURE USING TYPES . THIS SHOULD BE OF SAME STRUCTURE OF YOUR INTERNAL TABLE DECLARED IN ABAP EDITOR. NOW IN YOUR FORM INTERFACE DECLARE A INTERNAL TABLE OF THIS STRUCTURE UNDER TABLES INTERFACE.

REGARDS,

SHAFI

learnsap
Active Participant
0 Kudos

Hi Antonio,

Go to SE11 and create a structure same as your internal table structure. And in the SMARTFORM form interface declare your form internal table type the created structure name.

This will solve the problem.

Correct me if I am wrong.

Regards,

Ramesh S

*Allocate points if reply is helpful