‎2014 Mar 22 9:41 AM
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.
‎2014 Mar 22 10:04 AM
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.
‎2014 Mar 22 9:50 AM
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 |
‎2014 Mar 22 10:04 AM
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.
‎2014 Mar 22 1:27 PM
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.
‎2014 Mar 24 7:12 AM
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.
‎2014 Mar 22 11:45 AM
‎2014 Mar 22 7:06 PM
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
:
‎2014 Mar 22 7:49 PM
Hi,
You are doing it on one window?How many Windows you had taken?
Regards,
Abhishek K.
‎2014 Mar 24 6:33 AM
‎2014 Mar 24 6:39 AM
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.
‎2014 Mar 24 7:16 AM
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.
‎2014 Mar 24 7:22 AM
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.