‎2017 Jul 04 1:01 PM
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 !!!!
‎2017 Jul 04 3:35 PM
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
‎2017 Jul 04 3:00 PM
‎2017 Jul 04 3:35 PM
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
‎2017 Jul 05 1:02 PM
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 ??
‎2017 Jul 05 4:24 PM
Hello,
What is the problem now :
- T3 is not well filled?
- T3 display is corrupted?
- Other?
‎2017 Jul 05 7:13 PM
same happens again ,count is printing as ..........'''blank ......3,5,7,9
and cooler serial numbers repeating multiple times
‎2017 Jul 06 9:19 AM
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)
‎2017 Jul 11 12:55 PM
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.
‎2017 Jul 19 11:06 AM
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.