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

Smartform issues

Former Member
2,005

Hello Guys,

In Smartform , when i Print Single column of Serial numbers and its corresponding invoice numbers all working well but when i try to print multiple column of serial number and invoice number on same line type in table control,all numbers gets repeat and serial numbers also not in sequence ,

and also if quantity/po is 23 then 23 serial number need to update and rest will be blank

I have attached both the snap PFAcapture2.pngcapture.png

Please help me out !!!!

1 ACCEPTED SOLUTION
Read only

bertrand_delvallee
Active Participant
0 Likes
1,771

Hello,

Here is how I would deal with it :

- Lets consider your old table is named T1 with fields "serial" and "value"

- Create a local data table with 6 columns (let call it T3) : serial1, value1, serial2, value2, serial3, value3

- Before table node, in the same folder, create a logical ABAP with in input : your old table ("T1"), in output "T3"

Put a code like this :

DATA w_mod TYPE p.
CLEAR t3.
FIELD-SYMBOLS <l1> LIKE LINE OF t1.
DATA l3 LIKE LINE OF t3.
CLEAR l3.
LOOP AT t1 ASSIGNING <l1>.
  w_mod = sy-tabix MOD 3.
  IF w_mod = 1.
    l3-serial1 = <l1>-serial.
    l3-valuel1 = <l1>-value.
  ELSEIF w_mod = 2.
    l3-serial2 = <l1>-serial.
    l3-valuel2 = <l1>-value.
  ELSE.
    l3-serial3 = <l1>-serial.
    l3-valuel3 = <l1>-value.
    APPEND l3 TO t3.
    CLEAR l3.
  ENDIF.
ENDLOOP.
IF l3 IS NOT INITIAL.
  APPEND l3 TO t3.
  CLEAR l3.
ENDIF.

- Display T3 instead of T1

Best regards

Bertrand

8 REPLIES 8
Read only

michal_majer
Contributor
1,771

It is propably some bug in Your code / smartform

Read only

bertrand_delvallee
Active Participant
0 Likes
1,772

Hello,

Here is how I would deal with it :

- Lets consider your old table is named T1 with fields "serial" and "value"

- Create a local data table with 6 columns (let call it T3) : serial1, value1, serial2, value2, serial3, value3

- Before table node, in the same folder, create a logical ABAP with in input : your old table ("T1"), in output "T3"

Put a code like this :

DATA w_mod TYPE p.
CLEAR t3.
FIELD-SYMBOLS <l1> LIKE LINE OF t1.
DATA l3 LIKE LINE OF t3.
CLEAR l3.
LOOP AT t1 ASSIGNING <l1>.
  w_mod = sy-tabix MOD 3.
  IF w_mod = 1.
    l3-serial1 = <l1>-serial.
    l3-valuel1 = <l1>-value.
  ELSEIF w_mod = 2.
    l3-serial2 = <l1>-serial.
    l3-valuel2 = <l1>-value.
  ELSE.
    l3-serial3 = <l1>-serial.
    l3-valuel3 = <l1>-value.
    APPEND l3 TO t3.
    CLEAR l3.
  ENDIF.
ENDLOOP.
IF l3 IS NOT INITIAL.
  APPEND l3 TO t3.
  CLEAR l3.
ENDIF.

- Display T3 instead of T1

Best regards

Bertrand

Read only

0 Likes
1,771

thank you for reply Bertrand

i am taking ''cooler sr. number'' from objk (sernr) and ''serial number'' as a count ,i had tried

what u suggested but still not got succeed .

any another option ??

Read only

0 Likes
1,771

Hello,

What is the problem now :

- T3 is not well filled?

- T3 display is corrupted?

- Other?

Read only

0 Likes
1,771

same happens again ,count is printing as ..........'''blank ......3,5,7,9

and cooler serial numbers repeating multiple times

Read only

0 Likes
1,771

Can you please add a BREAK-POINT instruction after the last "endif." and tell us that contains T3 and T1?

( 10 rows should be enought)

Read only

0 Likes
1,771

Bertrand,

This is at least the third time I have seen your answers promoting obsolete programming syntax. You should not be using internal tables with header lines. I know you state that it's with header lines just to simplify but that code will be copied and used. Please update with non-obsolete statements.

Read only

0 Likes
1,771

Hello Richard,

I'm not promoting anything, I write understandable abap/pseudo code centered on a solution and explaining how it works. I'm not answering "please copy/paste". Moreover here we don't even know the tables names and fields.

Header line I may used in some of my answers are in a context. TABLE parameter may be obsolete in FM and Smartforms interface but it still used by standard. For example, when you deal with IDOC there are template FM that you have to copy in Z* and they contained TABLE parameters. Of course you can then ignore the header line functionality in your code. I do. But doing so you can't reuse standard example codes.

Header line is evil : don't use it. Answer edited.