Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Passing data to custom smartform from a custom program...

Hello Gurus,

Since, the function module gets generated dynamically at runtime when smartform is activated, I know that first I should use "SSF_FUNCTION_MODULE_NAME" and pass custom smartform name to it to get the name of function module. Then I have to use call function '/XXXXXXXXX'.

Now, I am writing a custom code and I want the data from my select program in custom program to be passed to smartform ? How can I pass the data from my custom program to smartform ? Do I pass it before using function module "SSF_FUNCTION_MODULE_NAME" ? If yes, how ?

Regards,

Rajesh.

Tags:
Former Member
replied

hi,

u have to declare ur structures in form interface and can retrive the data from custom program.

check this sample code.

declare structure in interface.

WA_MKPF TYPE MKPF.

write ur custom code lik this.

DATA: wahz TYPE zmemigo_form_header,

wa_mkpf TYPE mkpf.

DATA: t_itemz LIKE zmemigo_form_item OCCURS 0,

t_mseg TYPE mseg OCCURS 0,

waitemz TYPE zmemigo_form_item,

waitem TYPE mseg.

DATA : form_name TYPE tdsfname VALUE 'ZPS_STN'.

DATA : fnc_module TYPE rs38l_fnam.

SELECT SINGLE mblnr INTO wa_mkpf-mblnr FROM mseg

CLIENT SPECIFIED WHERE mandt EQ sy-mandt

AND mblnr EQ p_mblnr

AND mjahr EQ p_mjahr

AND bwart EQ '351'

AND shkzg EQ 'H'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = form_name

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = fnc_module

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION fnc_module

EXPORTING

wa_headz = wahz

wa_mkpf = wa_mkpf

TABLES

it_itemz = t_itemz

it_mseg = t_mseg

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.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question