cancel
Showing results for 
Search instead for 
Did you mean: 

Smart forms creation using selection screen input

Former Member
0 Kudos

My requirement is to print the Smartform(For sales order information:Header n Item details in main window) on user requesting the sales order on selection screen.

so wat r the steps to achieve the smartform according to my requirement.

I mean steps to create for Print program n smart from(Particularly).

Please help me out.

Thanks & regards.

Santosh kumar.

Accepted Solutions (0)

Answers (5)

Answers (5)

jayanthi_jayaraman
Active Contributor
Former Member
0 Kudos

This is a sample program that i have done. U can change the internal table declarations accourding to ur needs

REPORT ZAVP_STUDY_SMARTFORMS_3.

*Data declaration

DATA: I_VBAK LIKE ZSTR_VBAK OCCURS 0,

I_VBAP LIKE ZSTR_VBAP OCCURS 0,

CONTROL LIKE SSFCTRLOP,

P_VBELN LIKE VBAK-VBELN,

FM_NAME TYPE RS38L_FNAM.

CONTROL-NO_DIALOG = 'X'.

CONTROL-PREVIEW = 'X'.

*Selection screen

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

SELECT-OPTIONS: S_VBELN FOR P_VBELN.

SELECTION-SCREEN END OF BLOCK B1.

SELECT

VBELN

ERDAT

ERZET

ERNAM

AUART

NETWR

WAERK

VKORG

KNUMV

BSTNK

INTO TABLE I_VBAK

FROM VBAK

WHERE VBELN IN S_VBELN.

SELECT

VBELN

POSNR

MATNR

ARKTX

PRODH

GSBER

NETWR

WAERK

BRGEW

NTGEW

GEWEI

VOLUM

INTO TABLE I_VBAP

FROM VBAP

FOR ALL ENTRIES IN I_VBAK

WHERE VBELN = I_VBAK-VBELN.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZAVP_STUDY_SMARTFORMS_3'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = 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 FM_NAME

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = CONTROL

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

I_VBAK = I_VBAK[]

I_VBAP = I_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.

Please come back for doubts

Former Member
0 Kudos

Really! Tank u very much, ur answer has helped me a lot dis wat the answer i was looking for 2-3 hrs.

Thank & regards

Santhosh kumar.

Former Member
0 Kudos

Hi anoop,

I hav modified ur program according to my requirement i have faced d following problem.

Im getting dis runtime error please solve my problem in select statement.The error description is mentioned as below.

" The data read during a SELECT access could not be inserted into the target field.

Either conversion is not supported for the target field's type or the

target field is too short to accept the value or the data are not in a

form that the target field can accept.

Please help me out quickly,

Former Member
0 Kudos

I tink d 1st select statement.

SELECT

VBELN

ERDAT

BSTNK

VDATU

INTO TABLE Y_I_VBAK

FROM VBAK

WHERE VBELN IN Y_S_VBEL.

Former Member
0 Kudos

Hi santhosh,

I think the problem is because of the fields u r fetching. Can u mention what r the fields that u r fetching? Also check if the internal table u r passing and the receiving table have the same declaration. The error is bcoz u r trying to put a field into some other field. so it might be the problem with the internal table declaration in the smartform only

former_member225631
Active Contributor
0 Kudos

In form interface, you can define the fields, you want give as like on selection-screen.

You can use program in se38 to write the code.

You can write the code in smartform itself.

1. Define all the internal table types and internal tables in Global definitions.

2. Use program template to write the code.

Former Member
0 Kudos

hi u need to create structure with sign option low n high fields for selection screen field in se11.

Former Member
0 Kudos

Hi, santosh,

for select opetion in sgorm

u need to create structure in se11 n declare that table in form interface of sform...