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

smartforms

Former Member
0 Likes
974

how to know the driver program

i have selected the daa for header from vbak and kna1 tables and the item data from vbap tables

i have crated the complete layout for the form including the table designing and the loop

i have taken the loop for body from table vbap.

Now after this what should i do.

how can we call a driver program and how can we select the relavent driver program.

please help me in this regard

10 REPLIES 10
Read only

Former Member
0 Likes
938

If you have created a Z smartform then it is best that you create your own program to call the smartform.

If you want to attach you amartform to atransaction e.g vf01. then you will have to assign a output type to it using t-code NACE.

Hope this helps.

Read only

Former Member
0 Likes
938

Hi

Create a Zprogram, write the code, after that click on pattern and call the function module which you will get while you execute your smartform. After calling the function module in the tables field give the internal table which you created in the program. Then execute the program, it will call the smartform.

Hope this will help you.

Regards

Haritha.

Read only

0 Likes
938

hi friend

i have created the z program ant it is

TYPES : BEGIN OF TY_VBAK,

VBELN TYPE VBELN_VA, " CUSTOMER NUMBER

VKORG TYPE VKORG, " SALES ORGANISATION

VTWEG TYPE VTWEG, " DISTRIBUTION CHANNEL

VKGRP TYPE VKGRP, " SALES GROUP

END OF TY_VBAK,

BEGIN OF TY_KNA1,

KUNNR TYPE KUNNR, " CUSTOMER

NAME TYPE NAME1_GP, " NAME

CITY TYPE ORT01, " CITY

REGIO TYPE REGIO, " REGION

END OF TY_KNA1,

BEGIN OF TY_VBAP,

VBELN TYPE VBELN_VA, " ITEM NUMBER

MATNR TYPE MATNR, " MATERIAL NUMBER

MATKL TYPE MATKL, " MATERIAL DESCRIPTION

NETWR TYPE NETWR, " NET VALUE

MEINS TYPE MEINS, " UNIT OF MEASURE

END OF TY_VBAP.

*DECLARATION FOR INTERNAL TABLES

DATA : T_VBAK TYPE STANDARD TABLE OF TY_VBAK INITIAL SIZE 0,

T_KNA1 TYPE STANDARD TABLE OF TY_KNA1 INITIAL SIZE 0,

T_VBAP TYPE STANDARD TABLE OF TY_VBAP INITIAL SIZE 0.

*DECLARATION FOR WORK AREAS

DATA : W_VBAK TYPE TY_VBAK,

W_KNA1 TYPE TY_KNA1,

W_VBAP TYPE TY_VBAP.

  • GLOBAL VALUE DECLARATION

DATA : G_VBELN TYPE VBAK-VBELN.

*AT SELECTION-SCREEN .

SELECT-OPTIONS : S_VBELN FOR G_VBELN.

START-OF-SELECTION.

*VALIDATION FOR VBELN IN SELECTION SCREEN

PERFORM VALID_VBELN.

*pOPULATING DATA TO THE INTERNAL TABLES

PERFORM GET_DATA.

*DEFINING FUNCTION MODULE WITH A VARIABLE

DATA : V_FM_NAME TYPE .

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ztestform'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = V_FM_NAME

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.

&----


*& Form VALID_VBELN

&----


  • text

----


form VALID_VBELN .

SELECT SINGLE VBELN

FROM VBAK INTO W_VBAK

WHERE VBELN IN S_VBELN.

IF SY-SUBRC <> 0.

MESSAGE E001(ZVAM).

ENDIF.

endform. " VALID_KUNNR

&----


*& Form GET_DATA

&----


  • POPULATING THE DATA TO INTERNAL TABLES

----


form GET_DATA .

SELECT VBELN

VKORG

VTWEG

VKGRP FROM VBAK

INTO TABLE T_VBAK

WHERE VBELN IN S_VBELN.

SELECT KUNNR

NAME1

ORT01

REGIO FROM KNA1

INTO TABLE T_KNA1

FOR ALL ENTRIES IN T_VBAK

WHERE KUNNR = T_VBAK-VBELN.

SELECT VBELN

MATNR

MATKL

NETWR

MEINS FROM VBAP

INTO TABLE T_VBAP

FOR ALL ENTRIES IN T_VBAK

WHERE VBELN = T_VBAK-VBELN.

endform. " GET_DATA

in this can u show me where exactly the changes are required. in the function call i required to call the function module ccreated for the smartform

how can i do that

it will be more help ful if u clarify my dought with example

Read only

Former Member
0 Likes
938

if you are creating your own smart form and want to execute thru selection screen. you have create the print program and getting the input data through select statements and call the FM which is generated on activation of smartform which is created.(To know the FM. execute the smartform ) and pass the values.

other, thru the standard transaction. If you are creating the smartform and executed that through standard transaction. the client generally gives the Output type and the smartform, std print program will be assigned to that output type . you can find the smartform assigned to the output type in NACE transaction.

i think you just have a look in smartform which will give much info this.

thanks

Read only

0 Likes
938

&----


*& Report ZTESTSMART *

*& *

&----


*& *

*& *

&----


REPORT ztestsmart .

*STRUCTURE DECLARATIONS

TYPES : BEGIN OF TY_VBAK,

VBELN TYPE VBELN_VA, " CUSTOMER NUMBER

VKORG TYPE VKORG, " SALES ORGANISATION

VTWEG TYPE VTWEG, " DISTRIBUTION CHANNEL

VKGRP TYPE VKGRP, " SALES GROUP

END OF TY_VBAK,

BEGIN OF TY_KNA1,

KUNNR TYPE KUNNR, " CUSTOMER

NAME TYPE NAME1_GP, " NAME

CITY TYPE ORT01, " CITY

REGIO TYPE REGIO, " REGION

END OF TY_KNA1,

BEGIN OF TY_VBAP,

VBELN TYPE VBELN_VA, " ITEM NUMBER

MATNR TYPE MATNR, " MATERIAL NUMBER

MATKL TYPE MATKL, " MATERIAL DESCRIPTION

NETWR TYPE NETWR, " NET VALUE

MEINS TYPE MEINS, " UNIT OF MEASURE

END OF TY_VBAP.

*DECLARATION FOR INTERNAL TABLES

DATA : T_VBAK TYPE STANDARD TABLE OF TY_VBAK INITIAL SIZE 0,

T_KNA1 TYPE STANDARD TABLE OF TY_KNA1 INITIAL SIZE 0,

T_VBAP TYPE STANDARD TABLE OF TY_VBAP INITIAL SIZE 0.

*DECLARATION FOR WORK AREAS

DATA : W_VBAK TYPE TY_VBAK,

W_KNA1 TYPE TY_KNA1,

W_VBAP TYPE TY_VBAP.

  • GLOBAL VALUE DECLARATION

DATA : G_VBELN TYPE VBAK-VBELN.

*AT SELECTION-SCREEN .

SELECT-OPTIONS : S_VBELN FOR G_VBELN.

START-OF-SELECTION.

*VALIDATION FOR VBELN IN SELECTION SCREEN

PERFORM VALID_VBELN.

*pOPULATING DATA TO THE INTERNAL TABLES

PERFORM GET_DATA.

*DEFINING FUNCTION MODULE WITH A VARIABLE

DATA : V_FM_NAME TYPE RS38L_FNAM.

*CALL FUNCTION '/1BCDWB/SF00000093'

  • EXPORTING

    • ARCHIVE_INDEX =

    • ARCHIVE_INDEX_TAB =

    • ARCHIVE_PARAMETERS =

    • CONTROL_PARAMETERS =

    • MAIL_APPL_OBJ =

    • MAIL_RECIPIENT =

    • MAIL_SENDER =

    • OUTPUT_OPTIONS =

    • USER_SETTINGS = 'X'

  • w_vbak = w_vbak

  • w_kna1 = w_kna1

    • IMPORTING

    • DOCUMENT_OUTPUT_INFO =

    • JOB_OUTPUT_INFO =

    • JOB_OUTPUT_OPTIONS =

  • tables

  • t_vbap = t_vbap

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

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ztestform'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = V_FM_NAME

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.

&----


*& Form VALID_VBELN

&----


  • text

----


form VALID_VBELN .

SELECT SINGLE VBELN

FROM VBAK INTO W_VBAK

WHERE VBELN IN S_VBELN.

IF SY-SUBRC <> 0.

MESSAGE E001(ZVAM).

ENDIF.

endform. " VALID_KUNNR

&----


*& Form GET_DATA

&----


  • POPULATING THE DATA TO INTERNAL TABLES

----


form GET_DATA .

SELECT VBELN

VKORG

VTWEG

VKGRP FROM VBAK

INTO TABLE T_VBAK

WHERE VBELN IN S_VBELN.

SELECT KUNNR

NAME1

ORT01

REGIO FROM KNA1

INTO TABLE T_KNA1

FOR ALL ENTRIES IN T_VBAK

WHERE KUNNR = T_VBAK-VBELN.

SELECT VBELN

MATNR

MATKL

NETWR

MEINS FROM VBAP

INTO TABLE T_VBAP

FOR ALL ENTRIES IN T_VBAK

WHERE VBELN = T_VBAK-VBELN.

endform. " GET_DATA

this is the code

and when i try to find out the function module kname from smartforms-> environment iam geeting the information message box

how to know the name of the function module

what are the changes required for this code

please help me inthis issue

Read only

0 Likes
938

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

<b>formname = 'ZTESTFORM'</b>

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

<b>fm_name = V_FM_NAME</b>

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.

V_FM_NAME --->GIVE U THE FM NAME....

NOW CALL THIS FM...

call function V_FM_NAME
exporting....
importing..
tables..

Read only

0 Likes
938

hello kishan negi

in the cll function modele

i have given fm_name = v_fm_name

but i want to know what should be the value of v_fm_name

we have to decalre V_FM_NAME

from where we can generate the function module name of the smartform

Read only

0 Likes
938

no it not need it automativaly take from smartform name that's the use of this fm...

either if u want to know the name of smartform fm.

go to smartforms transaction write the smartform name.

press f8 it show u the fm name... and also check in debugger mode .

Read only

0 Likes
938

hello kishan

when iam executing the form iam getting this

in the function module iam getting

/1BCDWB/SF00000093

when i called this in the abap editor and exicute with the entreis as shown in the code above it is giving an error function module not found

what should ido know

Read only

0 Likes
938

ok..

1st activate it...

use logic like that in driver program.

DATA: g_formname TYPE tdsfname VALUE 'ZBSG_FORM1',
      g_fm_name TYPE rs38l_fnam.


CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname                 = g_formname
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
 IMPORTING
   fm_name                  = g_fm_name
 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 g_fm_name

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

kunnr = p_kunnr

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

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