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 - Table Printing

Former Member
0 Likes
1,025

Hi All..

I need to print a Table in SmartForm with some fields from the internal table only. Even i want to print 2 fields value in one colum also. Is it possible to print like this. If it is can u plz help me to print the table.

Regards

Raj

5 REPLIES 5
Read only

Former Member
0 Likes
861

Hii ,

describe a structure like this internal table.

In your smartforms, set a table with the structure that you just create.

you can create another internal table with length equal of sum of both fields .

and loop at first itab and conacatenate those two fieds and move to itab2 and pass itab2 to smart forms.

TABLES: MKPF.

DATA: FM_NAME TYPE RS38L_FNAM.

DATA: BEGIN OF INT_MKPF OCCURS 0.
        INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.

SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.

SELECT * FROM MKPF 
       <b>UPTO 2 ROWS</b>
       WHERE MBLNR IN S_MBLNR.
      MOVE-CORRESPONDING MKPF TO INT_MKPF.
   APPEND INT_MKPF.

ENDSELECT.

* At the end of your program.
* Passing data to SMARTFORMS

call function 'SSF_FUNCTION_MODULE_NAME'
  exporting
    formname                 = 'ZSMARTFORM'
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
  IMPORTING
    FM_NAME                  = FM_NAME
  EXCEPTIONS
    NO_FORM                  = 1
    NO_FUNCTION_MODULE       = 2
    OTHERS                   = 3.

if sy-subrc <> 0.
   WRITE: / 'ERROR 1'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

call function FM_NAME
* EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
*   CONTROL_PARAMETERS         =
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = 'X'
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
  TABLES
    GS_MKPF                    = INT_MKPF
  EXCEPTIONS
    FORMATTING_ERROR           = 1
    INTERNAL_ERROR             = 2
    SEND_ERROR                 = 3
    USER_CANCELED              = 4
    OTHERS                     = 5.

if sy-subrc <> 0.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

rEGARDS

Naresh

Read only

dani_mn
Active Contributor
0 Likes
861

Hi,

Use table node in the smartform and name your internal table in data tab, Also create a workarea of same structure in global definations and give that to copy a line from internal table into workarea.

Now open table tab and create your column there using table painter or manully.

Now add a text element in the table node and write your field name their.

you can use 'new line', 'new cell' option to write your fields in same column.

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
861

hi Raj,

please follows below steps

DATA: it_tab TYPE TABLE OF kna1,

wa_tab TYPE kna1.

Populate the it_tab with your selection data.

DATA: fm_name TYPE RS38L_FNAM.

CALL FUNCTION SSF_FUNCTION_MODULE_NAME.

EXPORTING

FORMNAME = 'ZXXXX' (your smartform name).

IMPORING

FM_NAME = fm_name.

CALL FUNCTION fm_module.

EXPORTING

-


-


IMPORTING

-


-


TABLES

IS_KNA1 = it_kna1.

In the smartform layout.

form interface -> table section.

IS_KNA1 TYPE KNA1.

In Global fields, decleare a work area w_kna1 type kna1

Now, Create a Main Window and create a TABLE NODE.

in TABLE NODE, under TABLE tab, creat new line type (cell width and heligh) using table painer or you can create manually.

under DATA tab, enter the internal table name IS_KNA1 INTO W_KNA1.

Now, create a text element and give the fields as below

&W_KNA1-KUNNR& &W_KNA1-NAME1&.

So, like above you can display more fields in the same column. But make sure that the column have sufficient width to display fields data.

and also donot forget to give cell position in the table.

let me know if you have any questions.

Ram

thats it.

Regards,

Ram

Read only

Clemenss
Active Contributor
0 Likes
861

Hi Rajendra,

as already said: First create a TABLE node in (under) your (MAIN) window in the page you want.

First define a line type of any name, set columns widths using table painter or (I think better) in Details screen.

Then create as many text nodes under the table node as you need columns.

In Genaral attributes, you have a text where you can place the value(s) freely for output in that column. In Output optinos tab, check the new line and new cell flags and insert your previously defined line type.

This should be it. Have a look at Form LB_BIL_INVOICE, Pages and Windows -> First Page 1 -> MAIN Main Window -> TABLEITEM Invoice Items. Quite complex what they did there, but you can derive any information missing here.

Be aware: If output does not fit into a cell, processing will stop with no form created and no error generated.

That is just one reason not to use SMARTFORMS.

Best regards,

Clemens

Read only

venkat_o
Active Contributor
0 Likes
861

Hi Prasad,

<b>1</b>.

Use table node to loop ur Internal table .

<b>2</b>.

Drag two fields into ur single column and modify .

<b>3</b>.

Right click on the COLUMN =>Create->FlowLogic->Program lines .

Then give ur two fields as Input parameters and one field as Output parameter.

Whatever u want ,do means concatenation and all those.

Then display that field .

<b>Thanks,

Venkat.O</b>