cancel
Showing results for 
Search instead for 
Did you mean: 

smartform on purchase order

Former Member
0 Kudos

frends,am working on a purchase order smart form ,i hav created the lay out from

scratch and i need to write the coding from scratch.here i dont hav any selection

screen and i need to write the driver program so i want the ebeln created as to write the select queries .how to get that ebeln.this smart form is goin to trigger

when ever a pur order is created and saved.it would be helpful if any one can provide the solution.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

There is a std smartform and program for PO

If you design your own driver program it will not trigger from the Std transaction ME21N. so better use the std program and smartform

modify them and attach in the NACE tcode

PUCHASE ORDER

Output type : NEU

ScriptForm Name : MEDRUCK

Driver Program Name : SAPMF06P

<b>smartform name : /SMB40/MMPO_L

smartform driver program: /SMB40/FM06P</b>

Reward points for useful Answers

Regards

Anji

Former Member
0 Kudos

I am working on ECC 6.0 and i am not finding tat program here.

Could you please send me the driver program for PO if u have

thanks in advance

jana

Former Member
0 Kudos

Hi,

You can try modifying the print program used for the SAP SCRIPT SAPFM06P

and remove all the FMs used for the script

Regards

Shiva

former_member567553
Participant
0 Kudos

Hi

I tried using smartform name : /SMB40/MMPO_L

smartform driver program: /SMB40/FM06P

I ended up with error "System message 041 from work area SSFCOMPOSER does not exist."

How do I go about this?

TIA

Answers (3)

Answers (3)

former_member480923
Active Contributor
0 Kudos

change the following form routine name from PRINT_FORM to ENTRY and retry the program, also check if the perform routine name defined in the NACE transaction is the same as that in the program.

Hope that Helps

Anirban M.

Former Member
0 Kudos

Hi ANirban,

I am getting a dump at RSNAST000 at NAST = TEMP-NAST.. could you clarify me in detail..I will reward you points .please help me in resolving this issue. MY program shud get triggered whenever a user creates a PO. I have defined an output type and atatched my program.

thanks in advance.

Regards

jana

former_member480923
Active Contributor
0 Kudos

hi Nast is a structure so TEMP-NAST should not be used rather make it temp_NAST type NAST. Or make the following code

Move-corresponding NAST to TEMP-NAST.

Hope that Helps

Anirban M.

Former Member
0 Kudos

Hi ,

To print the output of po you will be using the tcode ME9F .

The driver program you will be making of type subroutine pool .

FORM entry_xyz USING ent_retco TYPE any ent_screen TYPE any.

Inside you will put all the logic . No logic will be given outside apart from declarations .

endform .

Make the program type as subroutine pool .

In the declaration section you will crearte a varible of type ebeln .

ebeln = nast-objky .

nast-objky contains parameters passed by tcode and those values can be used in program .

Regards

Former Member
0 Kudos

Hi ,

I have written a driver program but its incomplete and i am not able to understand ..its giving me a dump at RSNAST000 ... please help me in resolving this. i am attaching the driver program. here please correct me ..

report ZOP_TFB_S008_DRIVER.

*&----


*

*& Internal Table declarations

*&----


*

tables : NAST.

data :

WA_JPTIDCDASSIGN type JPTIDCDASSIGN,

WA_MAKT type MAKT,

WA_EKKO type EKKO,

WA_EKPO type EKPO,

IT_EKPO type standard table of EKPO,

WA_LFA1 type LFA1,

WA_KNA1 type KNA1,

WA_T001W type T001W,

WA_ADRC type ADRC,

WA_ADRC1 type ADRC.

data : FM_NAME type RS38L_FNAM.

data : FORMNAME type TDSFNAME.

data: WA_OUTPUT_OPTION type SSFCOMPOP.

data: WA_CONTROL_PARAM type SSFCTRLOP.

data: WA_SSFCRESC1 type SSFCRESCL.

data : V_LEN_IN type I.

data : PDF_TAB like TLINE occurs 0 with header line.

data : TAB_OTF_FINAL type ITCOO occurs 0 with header line.

WA_CONTROL_PARAM-NO_DIALOG = 'X'.

WA_OUTPUT_OPTION-TDDELETE = 'X'.

WA_OUTPUT_OPTION-TDFINAL = 'X'.

WA_OUTPUT_OPTION-TDIEXIT = 'X'.

*&----


*

*& Selection Screen

*&----


*

*SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

*PARAMETERS : P_EBELN TYPE EBELN.

*SELECTION-SCREEN : END OF BLOCK B1.

*&----


*

*& Event Processing

*&----


*

start-of-selection.

perform GET_DATA.

perform PRINT_FORM.

*&----


*

*& Form get_data

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

form GET_DATA .

select single EBELN

LIFNR

ZTERM

BEDAT

INCO1

KUNNR

from EKKO

into corresponding fields of WA_EKKO

where EBELN = NAST-OBJKY.

if SY-SUBRC eq 0.

select EBELN

MATNR

EBELP

WERKS

MENGE

MEINS

NETPR

NETWR

KUNNR

from EKPO

into corresponding fields of table IT_EKPO

where EBELN = WA_EKKO-EBELN.

endif.

loop at IT_EKPO into WA_EKPO.

select single MATNR

SPRAS

MAKTX

from MAKT

into corresponding fields of WA_MAKT

where MATNR = WA_EKPO-MATNR and SPRAS = 'E'.

call function 'ISM_SD_GET_IDENTCODE'

exporting

IN_MATNR = WA_EKPO-MATNR

  • IN_IDCODETYPE =

importing

OUT_IDENTCODE = WA_JPTIDCDASSIGN-IDENTCODE

OUT_IDCODETYPE = WA_JPTIDCDASSIGN-IDCODETYPE

exceptions

NOT_FOUND = 1

others = 2

.

if SY-SUBRC <> 0.

message id SY-MSGID type SY-MSGTY number SY-MSGNO

with SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

select single KUNNR

ADRNR

from KNA1

into corresponding fields of WA_KNA1

where KUNNR = WA_EKPO-KUNNR.

endloop.

if SY-SUBRC eq 0.

select single ADDRNUMBER

NAME1

STREET

HOUSE_NUM1

MC_CITY1

POST_CODE1

REGION

COUNTRY

from ADRC into corresponding fields of WA_ADRC1

where ADDRNUMBER = WA_KNA1-ADRNR.

endif.

select single LIFNR

ADRNR

from LFA1

into corresponding fields of WA_LFA1

where LIFNR = WA_EKKO-LIFNR.

if SY-SUBRC eq 0.

select single ADDRNUMBER

NAME1

STREET

HOUSE_NUM1

MC_CITY1

POST_CODE1

REGION

COUNTRY

from ADRC

into corresponding fields of WA_ADRC

where ADDRNUMBER = WA_LFA1-ADRNR.

endif.

if not IT_EKPO[] is initial.

select WERKS

NAME1

STRAS

PSTLZ

ORT01

LAND1

REGIO

from T001W

into corresponding fields of WA_T001W

for all entries in IT_EKPO

where WERKS = IT_EKPO-WERKS.

endselect.

endif.

endform. " get_data

*&----


*

*& Form print_form

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

form PRINT_FORM .

data: I_OTF type ITCOO occurs 0 with header line,

I_TLINE type table of TLINE with header line,

I_RECEIVERS type table of SOMLRECI1 with header line,

I_RECORD like SOLISTI1 occurs 0 with header line,

  • Objects to send mail.

I_OBJPACK like SOPCKLSTI1 occurs 0 with header line,

I_OBJTXT like SOLISTI1 occurs 0 with header line,

I_OBJBIN like SOLISTI1 occurs 0 with header line,

I_RECLIST like SOMLRECI1 occurs 0 with header line,

  • Work Area declarations

WA_OBJHEAD type SOLI_TAB,

W_CTRLOP type SSFCTRLOP,

W_COMPOP type SSFCOMPOP,

W_RETURN type SSFCRESCL,

WA_DOC_CHNG type SODOCCHGI1,

W_DATA type SODOCCHGI1,

WA_BUFFER type STRING,"To convert from 132 to 255

MY_TABIX type SY-TABIX,

ID_RECEIVER like SY-SUBRC,

  • Variables declarations

V_FORM_NAME type RS38L_FNAM,

V_LEN_IN like SOOD-OBJLEN,

V_LEN_OUT like SOOD-OBJLEN,

V_LEN_OUTN type I,

V_LINES_TXT type I,

V_LINES_BIN type I.

****************for the first smartform*******************************

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

FORMNAME = 'ZOP_TFB_S008'

importing

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

W_CTRLOP-GETOTF = ' '.

W_CTRLOP-NO_DIALOG = 'X'.

W_COMPOP-TDNOPREV = ' '.

call function V_FORM_NAME

exporting

CONTROL_PARAMETERS = W_CTRLOP

OUTPUT_OPTIONS = W_COMPOP

USER_SETTINGS = 'X'

WA_EKKO = WA_EKKO

WA_KNA1 = WA_KNA1

WA_LFA1 = WA_LFA1

WA_ADRC = WA_ADRC

WA_ADRC1 = WA_ADRC1

WA_T001W = WA_T001W

WA_JPTIDCDASSIGN = WA_JPTIDCDASSIGN

WA_MAKT = WA_MAKT

importing

JOB_OUTPUT_INFO = W_RETURN

tables

IT_EKPO = IT_EKPO

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.

I_OTF[] = W_RETURN-OTFDATA[].

**********removing the initial and final markers from the OTF data*********

delete W_RETURN-OTFDATA where TDPRINTCOM = '//'.

****************searching for the end-of-page in OTF table***********

read table I_OTF with key TDPRINTCOM = 'EP'. MY_TABIX = SY-TABIX + 1.

*

********appending the modified OTF table to the final OTF table*******

insert LINES OF W_RETURN-OTFDATA into I_OTF index MY_TABIX.

                        • converting OTF data into pdf data**************************

call function 'CONVERT_OTF'

exporting

FORMAT = 'PDF'

MAX_LINEWIDTH = 132

importing

BIN_FILESIZE = V_LEN_IN

tables

OTF = I_OTF

LINES = I_TLINE

exceptions

ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

others = 4.

  • Fehlerhandling

if SY-SUBRC <> 0.

endif.

loop at I_TLINE.

translate I_TLINE using '~'.

concatenate WA_BUFFER I_TLINE into WA_BUFFER.

endloop.

translate WA_BUFFER using '~'.

do.

I_RECORD = WA_BUFFER.

append I_RECORD.

shift WA_BUFFER left by 255 places.

if WA_BUFFER is initial.

exit.

endif.

enddo.

  • Attachment

refresh:

I_RECLIST,

I_OBJTXT,

I_OBJBIN,

I_OBJPACK.

clear WA_OBJHEAD.

I_OBJBIN[] = I_RECORD[].

  • APPEND I_RECORD.

              • Create Message Body Title and Description****************

I_OBJTXT = 'test with pdf-Attachment!'.

append I_OBJTXT.

describe table I_OBJTXT lines V_LINES_TXT.

read table I_OBJTXT index V_LINES_TXT.

WA_DOC_CHNG-OBJ_NAME = 'smartform'.

WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.

WA_DOC_CHNG-OBJ_DESCR = 'smartform'.

WA_DOC_CHNG-SENSITIVTY = 'F'.

WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.

        • Main Text*****************************

clear I_OBJPACK-TRANSF_BIN.

I_OBJPACK-HEAD_START = 1.

I_OBJPACK-HEAD_NUM = 0.

I_OBJPACK-BODY_START = 1.

I_OBJPACK-BODY_NUM = V_LINES_TXT.

I_OBJPACK-DOC_TYPE = 'PDF'.

append I_OBJPACK.

        • Attachment (pdf-Attachment)*************

I_OBJPACK-TRANSF_BIN = 'X'.

I_OBJPACK-HEAD_START = 1.

I_OBJPACK-HEAD_NUM = 1.

I_OBJPACK-BODY_START = 1.

I_OBJPACK-BODY_NUM = V_LINES_BIN.

I_OBJPACK-DOC_TYPE = 'PDF'.

I_OBJPACK-OBJ_NAME = 'smartform'.

concatenate I_OBJPACK-OBJ_NAME I_OBJPACK-DOC_TYPE into I_OBJPACK-OBJ_DESCR separated by '.'.

  • I_OBJPACK-OBJ_DESCR = 'test'.

I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .

append I_OBJPACK.

  • Länge des Attachment ermitteln

clear I_RECLIST.

I_RECLIST-RECEIVER = 'prabhaschandv@gmail.com'.

I_RECLIST-REC_TYPE = 'U'.

I_RECLIST-EXPRESS = 'X'.

data: TAB_LINES like SY-TABIX.

describe table I_OBJBIN lines TAB_LINES.

append I_RECLIST.

call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'

exporting

DOCUMENT_DATA = WA_DOC_CHNG

PUT_IN_OUTBOX = 'X'

COMMIT_WORK = 'X'

tables

PACKING_LIST = I_OBJPACK

OBJECT_HEADER = WA_OBJHEAD

CONTENTS_BIN = I_OBJBIN

CONTENTS_TXT = I_OBJTXT

RECEIVERS = I_RECLIST

exceptions

TOO_MANY_RECEIVERS = 1

DOCUMENT_NOT_SENT = 2

DOCUMENT_TYPE_NOT_EXIST = 3

OPERATION_NO_AUTHORIZATION = 4

PARAMETER_ERROR = 5

X_ERROR = 6

ENQUEUE_ERROR = 7

others = 8.

if SY-SUBRC <> 0.

write:/ 'Error When Sending the File', SY-SUBRC.

else.

write:/ 'Mail sent'.

endif.

endform. "print_form

regards

jana

former_member480923
Active Contributor
0 Kudos

go table TNAPR and with application = EF, spras = EN NACHA = 1. Pick up any standard Smartform and driver program and follow the logic.

Hope that Helps

Anirban M.