cancel
Showing results for 
Search instead for 
Did you mean: 

collect in smartforms

former_member182371
Active Contributor
0 Kudos

Hi,

i had an ordinary samrtform that displayed: item material qty

e.g.

10 MAT1 100

20 MAT2 100

30 MAT1 200

40 MAT2 300

Now i need that this smartform displays: material gty

That is, if i have several items with the same material i need to do a sort of COLLECT and just display the results by material.

e.g.(for the above data)

MAT1 300

MAT2 400

How can i do this?

Best regards.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Either by performing the "COLLECT" in the program that generates the data for the smarform, or by creating a new internal table in the smartform which only holds material and quantity (global definitions -> Initialization) and looping over this new table.

Regards,

John.

Answers (3)

Answers (3)

former_member182371
Active Contributor
0 Kudos

Hi,

i´ve done as suggested and when i verify i get the message:

"ITAB" has already been declared

.

Best regards.

Former Member
0 Kudos

Hi,

This is impossible... Are you sure you have only added the ITAB in the output parameters of the Initialization TAB??

Regards,

John.

former_member182371
Active Contributor
0 Kudos

Hi,

i´ve created an internal table in

Global Definitions -> Initialization

tab thus:
DATA: ITAB TYPE T_ITAB OCCURS 0 WITH HEADER LINE.
DATA: WA_DLV_DELNOTE-IT_GEN LIKE LINE OF IS_DLV_DELNOTE-IT_GEN.

LOOP AT IS_DLV_DELNOTE-IT_GEN INTO WA_DLV_DELNOTE-IT_GEN.
MOVE-CORRESPONDING WA_DLV_DELNOTE-IT_GEN TO ITAB.
COLLECT ITAB.
ENDLOOP.

in

Types

tab:
TYPES: BEGIN OF T_ITAB,
MATERIAL TYPE MATNR,
DLV_QTY TYPE LFIMG,
SALES_UNIT TYPE VRKME,
UECHA TYPE UECHA,
END OF T_ITAB,

TY_T_ITAB TYPE STANDARD TABLE OF T_ITAB.

and in

Global

data tab:
WA_ITAB TYPE T_ITAB
ITAB TYPE TY_T_ITAB

later in window

MAIN

in

Data

i´ve got:

LOOP ITAB INTO WA_ITAB.

But i don´t get anything when doing the output.

Have i missed something?

Best regards.

Former Member
0 Kudos

Hi Pablo,

You are nearly there! In the Initialization tab to have to add ITAB in the "output parameters". Could you try this please?

Regards,

John.

Former Member
0 Kudos

Hi,

One suggestion would be declare one more internal table ITAB1 similar to the internal table ITAB.

Insert Program lines before MAIN window, specify ITAB as the input parameters, and ITAB1 as the output parameters.

Now in the code lines,

sort itab by material.

loop at itab.

collect itab into itab1.

endloop.

In the main window's loop..endloop node, give

loop ITAB1 into WA_ITAB.

Refer to ITAB1 fields in all the text elements.

Regards

Subramanian

former_member188827
Active Contributor
0 Kudos

hi

right click the window which contains text element displaying data.

create...>flow logic...>program lines

and add ur code dere just as u'd do in editor.

dont forget 2 giv appropriate input output parameters

rgds

plz reward points if it helps

Former Member
0 Kudos

Sort the fields based on material number and use the following code;

DELETE ADJACENT DUPLICATES FROM itab COMPARING variable.

Now sum up the numbers.