cancel
Showing results for 
Search instead for 
Did you mean: 

smartform

Former Member
0 Kudos

Hello All,

I am developed a SMARTFORM and trying to write the print program. i wrote the code but i am getting some errors. Can any one explain whats wrong with my code. i am giving the code below:...........

TABLES: EKKO, EKPO.

DATA: BEGIN OF I_EKKO OCCURS 0,

EBELN LIKE EKKO-EBELN,

BUKRS LIKE EKKO-BUKRS,

END OF I_EKKO.

DATA: BEGIN OF I_EKPO OCCURS 0,

EBELN LIKE EKPO-EBELN,

EBELP LIKE EKPO-EBELP,

MENGE LIKE EKPO-MENGE,

NETPR LIKE EKPO-NETPR,

END OF I_EKPO.

DATA: BEGIN OF I_OUT OCCURS 0,

EBELN LIKE EKKO-EBELN,

BUKRS LIKE EKKO-BUKRS,

EBELP LIKE EKPO-EBELP,

MENGE LIKE EKPO-MENGE,

NETPR LIKE EKPO-NETPR,

END OF I_OUT.

PARAMETERS: COMPCODE LIKE EKPO-BUKRS.

SELECT EBELN BUKRS

INTO TABLE I_EKKO

FROM EKKO

  • UP TO 10 ROWS

WHERE BUKRS EQ COMPCODE.

IF SY-SUBRC EQ 0.

SORT I_EKKO BY EBELN.

SELECT EBELN EBELP MENGE NETPR

INTO TABLE I_EKPO

FROM EKPO

FOR ALL ENTRIES IN I_EKKO

WHERE EBELN EQ I_EKKO-EBELN.

IF SY-SUBRC EQ 0.

SORT I_EKPO BY EBELN EBELP.

ENDIF.

ENDIF.

LOOP AT I_EKKO.

MOVE: I_EKKO-EBELN TO I_OUT-EBELN,

I_EKKO-BUKRS TO I_OUT-BUKRS.

MOVE: I_EKPO-EBELN TO I_OUT-EBELP,

I_EKPO-MENGE TO I_OUT-MENGE,

I_EKPO-NETPR TO I_OUT-NETPR.

APPEND I_OUT.

ENDLOOP.

DATA: FM_NAME TYPE RS38L_FNAM.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZRKSFEG1'

  • 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_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

GT_OUT = I_OUT

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

  • <error handling>

ENDIF.

Regards

Accepted Solutions (0)

Answers (2)

Answers (2)

messier31
Active Contributor
0 Kudos

Hi,

Can you tell us what error you are geting?

Enjoy SAP.

Pankaj Singh.

former_member196280
Active Contributor
0 Kudos

You below code looks ok, this could be the problem....

GOTO Smartform Tcode, and identify the function module name, goto your print program, click pattern and give the function module name next to call function, now replace the function module name with <b>FM_NAME</b> pass all the required parameters to the function module.

Only other problem I see is I_OUT is the internal table you created in your print program, you cannot pass the internal table directly to smartform, for this kind you can either use program line inside smartform or create a structure instead of internal table.

If useful reward points.

Regards,

Sairam

Former Member
0 Kudos

hi Reddy,

Thanks for the reply..

I used program lines in side the smart form.

Can you explain how to write the programe if i used the program lines..

Regards

former_member196280
Active Contributor
0 Kudos

In program line you can write your code similar to your ABAP editor(SE38).

Regards,

SaiRam

Former Member
0 Kudos

Hi

Can i know the what error u got

Regards

Pavan

Former Member
0 Kudos

Hi Reddy,

So there is no need to write again the program in SE38(If i used program lines) wright?

and i am getting runtime exception error saying there is an error in calling the function module fm_name.

Regards

messier31
Active Contributor
0 Kudos

Hi,

We don't know what logic you are implementing inside the program line of smartform.

But yes you will need Se38 program which will collect data based on inputs provided on selection and pass this data to smartform function module . This se38 program is similar to driver program of sapscript. and the program line of smartform is similar to calling external routine in sapscript using PERFORM.

Smartform the displays these data in proper format.

Now the error which you are getting seems like some of parameters of smartform func modu in se38 program are of differnent data type as that you have mentin in smartforms table parameter.... Can you just cross check this?

Also I want you to chekc if your form is activated. Just to be sure.

Enjoy SAP.

Pankaj Singh.