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

Smart form doubt

Former Member
0 Likes
1,166

Hi, I am new to ABAP. I have just started with Smart forms. My doubt is:

I should create two tables.

First table data should be at the top left hand side of the page. Datas to be filled in are from two tables, MSEG and MKPF. It should be filled one below the other.

Second table should be below the first one, and the data to be printed line wise from tables MSEG and EKPO.

Do i need to create three different structures for these three tables containing the corresponding fields or two structures corresponding to two tables? Im very confused. Please help. Attached is the file which contains how the smart form should look like.

1 ACCEPTED SOLUTION
Read only

former_member187748
Active Contributor
0 Likes
1,132

If you are talking about program structures, its not mandatory, you can create only a single structure

or can create 2 structure one for header data (used in templates) and one for line items (used in tables), and it will be easy to you to loop for line items.

But you can also create a single structure but keep both types of data in separate internal table, so that you may not get confusion for looping in line items data for your tables.

11 REPLIES 11
Read only

former_member187748
Active Contributor
0 Likes
1,132

Hi Niti,

if you have limited no of fields in first set , i.e

PO number:

GR date:

Current dat:

Plant:

Storage Location:

Vendor:

then you can create template having two column and in left column you put these text and in right column you can print its corresponding values.

Now you can create a table just below this template with 4 columns where your below 4 values will get displayed, please revert if still not getting

slno    material number    description     unit of measure    quantity
Read only

former_member187748
Active Contributor
0 Likes
1,133

If you are talking about program structures, its not mandatory, you can create only a single structure

or can create 2 structure one for header data (used in templates) and one for line items (used in tables), and it will be easy to you to loop for line items.

But you can also create a single structure but keep both types of data in separate internal table, so that you may not get confusion for looping in line items data for your tables.

Read only

0 Likes
1,132

Thanks for the reply. Im working on it. Actually, in the first table, i am getting repeated field, like

Po number, gr date, current date, plant, vendor, then again po number, gr date, current date, vendor and again po number, gr date, current date(till this). like 13 fields are in total.

This is my code.

DATA: WA_MSEG1 TYPE ZMSEG1"HEADER DETAILS : OF TABLE 1

       T_MSEG1 TYPE ZMSEG1_TY, "HEADER TABLE TYPE

       WA_MSEG2 TYPE ZMSEG2,   "line details : OF TABLE 2

       T_MSEG2 TYPE ZMSEG2_TY, "LINE TABLE TYPE.

       V_FUNCNAME TYPE RS38L_FNAM.

SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME TITLE TEXT-123.

   PARAMETERS: P_EBELN TYPE BSTNR.

SELECTION-SCREEN END OF BLOCK B.

"START-OF-SELECTION.

   SELECT EBELN BLDAT CPUDT WERKS LIFNR

     INTO table T_MSEG1

     from mseg INNER JOIN MKPF

     ON MSEG~MBLNR = MKPF~MBLNR

     WHERE EBELN = P_EBELN.

*    LOOP AT T_MSEG1 INTO WA_MSEG1.

*      SELECT MSEG~MATNR

*             EKPO~TXZ01

*              MSEG~LSMEH

*              MSEG~LSMNG

*     INTO TABLE T_MSEG2

*          FROM MSEG

*     FOR ALL ENTRIES IN T_MSEG1

*     WHERE EBELN = P_EBELN.

*    ENDLOOP.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

                    EXPORTING

                      formname                 = 'ZRG_SLIP'

*                    VARIANT                  = ' '

*                    DIRECT_CALL              = ' '

                   IMPORTING

                     FM_NAME                  = V_FUNCNAME

                   EXCEPTIONS

                     NO_FORM                  = 1

                     NO_FUNCTION_MODULE       = 2

                     OTHERS                   = 3

                            .

                  IF sy-subrc <> 0.

* Implement suitable error handling here

                  ENDIF.

                             CALL FUNCTION V_FUNCNAME

                              EXPORTING

*                               ARCHIVE_INDEX              =

*                               ARCHIVE_INDEX_TAB          =

*                               ARCHIVE_PARAMETERS         =

*                               CONTROL_PARAMETERS         =

*                               MAIL_APPL_OBJ              =

*                               MAIL_RECIPIENT             =

*                               MAIL_SENDER                =

*                               OUTPUT_OPTIONS             =

*                               USER_SETTINGS              = 'X'

                                 GW_MSEG1                   WA_MSEG1

                                 GW_MSEG2                   WA_MSEG2

                             TABLES

                               GT_MSEG1                     = T_MSEG1

                              EXCEPTIONS

                                FORMATTING_ERROR           = 1

                                INTERNAL_ERROR             = 2

                                SEND_ERROR                 = 3

                                USER_CANCELED              = 4

                                OTHERS                     = 5

                                       .

                             IF sy-subrc <> 0.

* Implement suitable error handling here

                             ENDIF.


Read only

0 Likes
1,132

Hi,

in the second table, while coding, its showing matnr is unclear. can you help me with the code please?

*********table1*****************

SELECT EBELN BLDAT CPUDT WERKS LIFNR                

     INTO table T_MSEG1

     from mseg INNER JOIN MKPF

     ON MSEG~MBLNR = MKPF~MBLNR

     WHERE EBELN = P_EBELN.


***********table1 corresponding details to be filled in table2********

      SELECT  MATNR  TXZ01  LSMEH  LSMNG

           INTO TABLE T_MSEG2

           FROM MSEG INNER JOIN EKPO

           ON EKPO~EBELN = MSEG~EBELN

           WHERE EBELN = P_EBELN.



Read only

Former Member
0 Likes
1,132

follow the Sanjeev kumar link

I think it works.....

Read only

VenkatRamesh_V
Active Contributor
0 Likes
1,132

Hello Sir,

In your Requirement you are passing Parameters as purchase Order.

In Functional their will be only one  Data for the

PO number, GR date, Plant, Storage Location, Vendor(Only Duplicates Available)

Get all this data to a Variables in Abap Editor.

In smart forms .

In form Interface Tab-> Imports.

Declare the Variables. for the Following Po, GR, Plant, Location ,vendor, Activate the Smartforms

Call the Functional module Generated , you can see the all the Declared variables, pass the variables with Abap Editor Variables, Dont need any table Stru for Header Data,

create One Tables Structure for the slno, material Des,  UOM, Quantity.

Regards,

Venkat Ramesh

:

Read only

0 Likes
1,132

Hi,

You are doing it on one window?How many Windows you had taken?

Regards,

Abhishek K.

Read only

0 Likes
1,132

hi,

It has two windows.

Read only

0 Likes
1,132

Hi Niti,

why you have created two windows, just create a main window and put a template for your header data,and a table for your item data just below your templates, whats the problem in printing values.Please understand the program flow.

First create an internal table and fetch your data from your select-options for your templates, then create another internal table and fetch your data to be shown in tables, and then pass these internal tables into your smartforms.

Please read how to create smartforms, before using it.

Read only

0 Likes
1,132

Hi,

Thanks fr the reply. i worked on it. and its ouput is correct. now the problem is with the coding of the second table.

Read only

0 Likes
1,132

Hi

based on the values of your table data (just create another internal table and fetch all these fields in second another table you wants to display), lets say for your template data (header data you have fetched your values), now for tables fetch another data based on the PO no, and put into another internal table, then into the smartforms just loop into your tables data.

Still if you are not getting please revert with the issue you are facing.