cancel
Showing results for 
Search instead for 
Did you mean: 

Form Layout calling ?

Former Member
0 Kudos

Hello ABAPers,

I have designed a smartform and it is working fine i want to implement that form in ME22N where i have given the in processing rouitnes of NACE Txcode

FORM NAME - (Subroutine name)

Progarm Name -(Subroutine pool program name)

SMARTFORM NAME - (Smartform name)

Over all my customized smartform layout is calling when i am taking the print preview in ME22N like what ever form that i have designed it is coming but the data that has to fecth from the database table and display is not coming(displaying)

My Coding Part of Subroutine-Pool Program....

PROGRAM ZSMART_SUB.

FORM ENTRY using ent_retco ent_screen.

TABLES : NAST.

DATA : W_EKPO TYPE EKPO,

W_MAKT TYPE MAKT,

T_EKPO TYPE STANDARD TABLE OF EKPO INITIAL SIZE 0,

T_MAKT TYPE STANDARD TABLE OF MAKT INITIAL SIZE 0,

DATA : G_FUN TYPE RS38L_FNAM.

DATA: IT_NAST LIKE NAST OCCURS 0 WITH HEADER LINE,

W_NAST TYPE ITAB.

  • DATA FETCHING STATEMENTS

SELECT SINGLE OBJKY FROM NAST INTO W_NAST WHERE OBJKY = IT_NAST-OBJKY.

SELECT * FROM MAKT INTO W_MAKT FOR ALL ENTRIES IN T_EKPO WHERE

MATNR = T_EKPO-MATNR.

ENDSELECT.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZFORM' "SMARTFORM NAME"

IMPORTING

FM_NAME = G_FUN

.

IF SY-SUBRC <> 0.

ENDIF.

CALL FUNCTION G_FUN

EXPORTING

W_EKPO = W_EKPO

W_MAKT = W_MAKT

TABLES

T_EKPO = T_EKPO

T_MAKT = T_MAKT

.

IF SY-SUBRC <> 0.

ENDIF.

ENDFORM. "entry_neu

Waiting for your valuable suggestions....

Points will be rewarded for helpful answer.

Thks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi ,

i have gone through your code and 2 things i would lie to say

1.use select single in query

SELECT single * FROM MAKT INTO W_MAKT FOR ALL ENTRIES IN T_EKPO WHERE

MATNR = T_EKPO-MATNR.

ENDSELECT.

or else if u want to use ur own query uu have to use T_MAKT instead of W_MAKT.

and the second thing is

2. there is no tables option in SMARTFORM generated function module. for example i have shown the my form generated FM.

CALL FUNCTION '/1BCDWB/SF00000001'

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

G_SAL =

HRA =

INCOMETAX =

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

  • SALARY =

  • 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.

so take care of those things.

please reward me if helpful,

and let me know if any queries.

gupta pullipudi

Former Member
0 Kudos

Hi thanks for your interest on my query. I want to confirm you one thing the i have not given all my coding i mean i have used 3 more tables internal tables and work area but for privacy i have not given my all my code.

When i am excecuteing my code with selection parameters in SE38 it is working perfectly.

But only when i am implementing my Driver program name into Subroutine pool program and giving it in NACE..

I want to know one thing i am going wrong in connecting the PO number which is present in the screen like if my driver program can communicate with PO No present on screen then my program works.

Want to know how to communicate the PO No of screen in our program.

Waiting for your reply....

Thks

Former Member
0 Kudos

Use

nast-objky which wil be your PO number

Former Member
0 Kudos

Yes i have used NAST-OBJKY in my select statement but it is not retrieveing the data.

I want to know how my PO No present in ME22N screen will communicate with my program. I am using NAST-OBJKY but only issue according to my knowledge why it is not excecuteing is like my program is not communicating with my PO No present in ME22N.

If you know this answer please share it with me.

Waiting for your reply.

Thks

Former Member
0 Kudos

hi venkat,

thats very easy.

just follow the steps.

1.please change ur driver program in this way..

or

just copy the code into ur driver program.(below is the code--dont chnage anyhting in the prg)

2. in ur smart form under form interface declare

IS_NAST type nast.

3.fetch the data based on nast-objky.

now u will get it.

if u dont get plzz ask questions.

I did this today only.

reward points if useful

regards

parthu

TABLES: nast.

  • Variable Declaration

DATA: g_retcode TYPE sy-subrc , " Returncode

g_xscreen(1) TYPE c , " Output on printer or screen

g_fm_name TYPE rs38l_fnam, " Function Module Name

g_formname TYPE tdsfname . " Form Name

----


  • FORM ENTRY *

----


  • Entry form for Calling Smartforms from Standard Transaction *

----


FORM entry USING return_code TYPE i

us_screen TYPE c.

CLEAR g_retcode.

g_xscreen = us_screen.

  • Calling Smartforms through standard Tcodes

PERFORM sub_processing.

IF g_retcode NE 0.

return_code = 1.

ELSE.

return_code = 0.

ENDIF.

ENDFORM. "ENTRY

&----


*& Form SUB_PROCESSING

&----


  • This routine is for calling Smartforms through standard Tcodes

----


FORM sub_processing .

  • For getting Form name

PERFORM sub_get_formname.

IF g_formname IS NOT INITIAL.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = g_formname

IMPORTING

fm_name = g_fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

CASE sy-subrc.

WHEN 1.

MESSAGE e000(38) WITH 'No Form Found'(001)

space space space.

WHEN 2.

MESSAGE e000(38) WITH 'No Function Module'(002)

space space space.

WHEN OTHERS.

MESSAGE e000(38) WITH 'Unknown Error'(003)

space space space.

ENDCASE.

ENDIF.

CALL FUNCTION g_fm_name

EXPORTING

is_nast = nast

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

CASE sy-subrc.

WHEN 1.

MESSAGE e000(38) WITH 'Formatting Error'(004)

space space space.

WHEN 2.

MESSAGE e000(38) WITH 'Internal Error'(005)

space space space.

WHEN 3.

MESSAGE e000(38) WITH 'Send Error'(006)

space space space.

WHEN 4.

MESSAGE e000(38) WITH 'User Cancelled'(007)

space space space.

WHEN OTHERS.

MESSAGE e000(38) WITH 'Unknown Error'(003)

space space space.

ENDCASE.

ENDIF.

ELSE. " Form Does not exits

MESSAGE e000(38) WITH 'No Form Found For This Output Type'(008)

nast-kschl space space.

ENDIF.

ENDFORM. " SUB_PROCESSING

&----


*& Form SUB_GET_FORMNAME

&----


  • This routine is for Getting formname based on Condition Type

  • Message transmission medium and Application from table NAST

----


FORM sub_get_formname .

SELECT SINGLE sform

INTO g_formname

FROM tnapr

WHERE kschl EQ nast-kschl

AND nacha EQ nast-nacha

AND kappl EQ nast-kappl.

ENDFORM. " SUB_GET_FORMNAME