cancel
Showing results for 
Search instead for 
Did you mean: 

Loop doesn't work

Former Member
0 Kudos

Hello!

I have got the following situation concerning my S m a r t f o r m:

The "Program lines" at the node HEADER there is existing below

shown code. The TEXT has the follwing entry:

*Text

Loading Point: &G_ABLD& Storage Depot: &G_HALLE& Gate: &G_TOR&

*Program lines

SELECT * FROM /DCA/P000_BWPOS

INTO table LS_BWPOS_it

WHERE KEYTYP EQ '/G2A/KEY_CU_ABL_PARTNER'.

LOOP AT LS_BWPOS_it INTO LS_BWPOS.

g_bw_data = LS_BWPOS.

g_vstl = g_bw_data+33(4).

if LC_VA_WERKS EQ g_vstl.

g_abld = g_bw_data+37(3).

g_halle = g_bw_data+143(1).

g_tor = g_bw_data+144(3).

endif.

ENDLOOP.

The problem is I do get only one output instead of

many outputs. There are 4 entries in the table existing

which has been given out. What is wrong in that case.

All other variables which are mentioned here

they are declared global. Is it necessary to write

additional Loop in the TEXT section ?

friendly regards

Ilhan

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Create a Type in the Types tab of the Global Definitions.

The Type should contain the three variables that you would like to print out.

Now declare a Table and Workarea in the Global Data tab of the Global Definitions that reference your Type.

In your Program Lines Node move the G_ABLD, G_HALLE, and G_TOR to your workarea and Append the workarea to your table.

Now create a Loop Node where you loop through your internal table into your workarea.

Beneath the Loop Node create a Text Node where you print the three variables from the workarea.

I hope this makes sense.

Former Member
0 Kudos

HI,

In the program lines have only the Select statement and pass the output table in the output parameters column. Since this is a table that you are returning, declare that in the global definitions also.

Now define a Loop node and in that pass the internal table and the workarea to store the current index values.

Inside this Loop. you can either have table control, or template or text or program lines or whatever.

Regards

Subramanian

Former Member
0 Kudos

Hi,

In the Smartform, you need to trigger a node called LOOP, create the LOOP node, Create -> Floe logic --> Loop ,, here click the Operand and give the Internal table name, here create the Program lnines under this node and write your logic in that Program lines.

Regards

Sudheer

Former Member
0 Kudos

LOOP AT LS_BWPOS_it INTO LS_BWPOS.

g_bw_data = LS_BWPOS.

g_vstl = g_bw_data+33(4).

if LC_VA_WERKS EQ g_vstl.

g_abld = g_bw_data+37(3).

g_halle = g_bw_data+143(1).

g_tor = g_bw_data+144(3).

endif.

ENDLOOP.

the thing is cursor goes inside and fills the value...once again overwrites the value. so at any point only one value exists....so, either u have to call the element within the loop to print all values or else u have to use this loop in ur smartform to print all the values.