Reg: Smart forms and print programs
Hi
I would like to locate the print programs and the corresponding smart forms. say for invoice we have a smart form available and how to track the print program for it. pls advise.
thkx
Prabhu
Hi Prabhu,
You can track the Program through mainintaing table TNAPR. TNAPR is the table which is having entries for "Processing Programs for output".
Here you have fields like
pgnam - Program Name
sform - Smartform Name
fonam - Script Name
kschl - Output type
Here,You can maintain form against a program name.
Hope you are clear.
Regards,
Siddhesh Sanghvi.
Similar Messages
-
Smart forms and print program needed
Can anyone provide me with the following print programs and smart forms? I can't find it in my SAP. Thanks.
Print Program:
/SMB40/M07DR
Smart Forms:
/SMB40/MMGR1_A
/SMB40/MMGR3_A
/SMB40/MMGI1_A
Please kindly email me at [email protected]Hi
I appreciate for your sincierty i cant send through mail but i'm sending directly plz copy all the programs
INCLUDE /SMB40/M07DRTOP.
PROGRAM /BPR3PF/m07dr MESSAGE-ID m7.
DATA lgortsplit LIKE am07m-xselk.
DATA ladr LIKE sadr.
DATA *ladr LIKE sadr.
CONSTANTS: a TYPE c VALUE 'A',
b TYPE c VALUE 'B',
c TYPE c VALUE 'C',
d TYPE c VALUE 'D',
e TYPE c VALUE 'E',
f TYPE c VALUE 'F',
g TYPE c VALUE 'G',
h TYPE c VALUE 'H',
i TYPE c VALUE 'I',
j TYPE c VALUE 'J',
k TYPE c VALUE 'K',
l TYPE c VALUE 'L',
m TYPE c VALUE 'M',
n TYPE c VALUE 'N',
o TYPE c VALUE 'O',
p TYPE c VALUE 'P',
q TYPE c VALUE 'Q',
r TYPE c VALUE 'R',
s TYPE c VALUE 'S',
t TYPE c VALUE 'T',
u TYPE c VALUE 'U',
v TYPE c VALUE 'V',
w TYPE c VALUE 'W',
x TYPE c VALUE 'X',
y TYPE c VALUE 'Y',
z TYPE c VALUE 'Z'.
CONSTANTS: plus TYPE c VALUE '+',
minus TYPE c VALUE '-',
punkt TYPE c VALUE '.',
null TYPE c VALUE '0',
eins TYPE c VALUE '1',
zwei TYPE c VALUE '2',
drei TYPE c VALUE '3',
vier TYPE c VALUE '4',
fuenf TYPE c VALUE '5',
sechs TYPE c VALUE '6',
sieben TYPE c VALUE '7',
acht TYPE c VALUE '8',
neun TYPE c VALUE '9',
einsi TYPE i VALUE '1',
zweii TYPE i VALUE '2',
dreii TYPE i VALUE '3',
vieri TYPE i VALUE '4',
nzwei TYPE i VALUE '02',
ndrei TYPE i VALUE '03'.
CONSTANTS: actvt01 LIKE tact-actvt VALUE '01',
actvt02 LIKE tact-actvt VALUE '02',
actvt03 LIKE tact-actvt VALUE '03',
actvt04 LIKE tact-actvt VALUE '04',
actvt06 LIKE tact-actvt VALUE '06',
actvt65 LIKE tact-actvt VALUE '65',
actvt70 LIKE tact-actvt VALUE '70'.
CONSTANTS: maximum TYPE f VALUE 9999999999999,
minimum TYPE f VALUE -9999999999999,
maximum_gld TYPE f VALUE 99999999999,
minimum_gld TYPE f VALUE -99999999999,
maxvalue LIKE am07m-maxvalue VALUE 9999999999999,
minvalue LIKE am07m-maxvalue VALUE -9999999999999,
cnull(18) TYPE c VALUE '000000000000000000',
pf02(4) TYPE c VALUE 'PF02',
pf15(4) TYPE c VALUE 'PF15',
stern TYPE c VALUE '*',
doublestar(2) TYPE c VALUE '**',
underscore TYPE c VALUE '_',
slasch TYPE c VALUE '/',
dpunkt TYPE c VALUE ':',
curtp00 LIKE smbew-curtp VALUE '00', "Transaktionswährung
curtp10 LIKE smbew-curtp VALUE '10', "ML in Hauswährung
auto_best LIKE mseg-ebeln VALUE '9999999999',
modulpool LIKE sy-repid VALUE 'SAPMM07M'.
CONSTANTS: BEGIN OF hlp,
b(4) TYPE c VALUE 'HLPB',
f(4) TYPE c VALUE 'HLPF',
g(4) TYPE c VALUE 'HLPG',
m(4) TYPE c VALUE 'HLPM',
r(4) TYPE c VALUE 'HLPR',
v(4) TYPE c VALUE 'HLPV',
END OF hlp.
"Equates für Alphabet
TABLES:
afko,
aufk,
itcpo,
mkpf,
*mkpf,
mseg,
*mseg,
ekko,
ekkn,
*ekko,
arc_params,
ekpo,
ekbe,
lfa1,
*lfa1,
thead,
toa_dara,
am07m,
*am07m,
t001,
t001w,
*t001w,
t027b,
t027c,
t027d,
t156,
t156t,
t157e,
*t157e,
t159m,
t159n,
t159o,
t159p,
t159s,
t159e,
t024,
t024d,
*t024,
t064b,
nast,
*nast,
tnapr.
TABLES: mabdr,
mtcom,
mtcor,
twlad.
* Reportinterne Daten *
*--- Strukturen ------------------------------------------------------*
DATA: x_protab TYPE c,
x_bwart TYPE c,
bwart LIKE mseg-bwart,
eintraege LIKE sy-tfill,
anzahl LIKE mseg-weanz,
anzahl1(7) TYPE n,
x_kont TYPE c, "Mehrfachkontierung
x_kont1 TYPE c, "Einfache Kontierung (WE unbewertet)
x_form TYPE c,
x_open TYPE c.
DATA: BEGIN OF jahr,
jahr(4) TYPE n,
monat(2) TYPE n,
tag(2) TYPE n,
END OF jahr.
DATA:
BEGIN OF we,
version1 VALUE '1', "Standardversion
version2 VALUE '2', "Version mit Prüftext
version3 VALUE '3', "WE-Sammelschein
END OF we,
BEGIN OF alt,
matnr LIKE mseg-matnr,
bwart LIKE mseg-bwart,
ebeln LIKE mseg-ebeln,
usnam LIKE mkpf-usnam,
END OF alt,
BEGIN OF kunde,
kdauf LIKE mseg-kdauf,
kdpos LIKE mseg-kdpos,
kdein LIKE mseg-kdein,
END OF kunde,
BEGIN OF anlage,
anln1 LIKE mseg-anln1,
anln2 LIKE mseg-anln2,
END OF anlage,
BEGIN OF belpos,
mblnr LIKE mseg-mblnr,
zeile LIKE mseg-zeile,
END OF belpos,
xskkz,
xpsty,
xkdanr VALUE 'C',
xkde VALUE 'E',
xfert VALUE 'F',
xrvkdanr VALUE 'A',
xanlage VALUE 'A',
xanln1 VALUE 'I',
xkostl VALUE 'K',
xprojn VALUE 'P',
xmunbw VALUE 'M',
xumlag VALUE 'U',
xvbelg VALUE 'V',
xnplan VALUE 'N',
xkonsi(2) VALUE 'KB',
xwabel(2) VALUE 'WA',
xwibel(2) VALUE 'WI',
xwebel(2) VALUE 'WE',
xsele, "Position selektiert
xkont, "Kontierungswechsel
xsamm, "Sammel-WE-Schein
xanha. "Mehrfachkontierung
DATA BEGIN OF theader.
INCLUDE STRUCTURE thead.
DATA END OF theader.
*--- Interne Tabellen -------------------------------------------------*
DATA:
BEGIN OF dummy OCCURS 0,
dummy,
END OF dummy.
DATA:
BEGIN OF ausgabe OCCURS 20,
mblnr LIKE mseg-mblnr,
END OF ausgabe.
DATA: BEGIN OF xekkn OCCURS 50.
INCLUDE STRUCTURE ekkn.
DATA: END OF xekkn.
DATA: BEGIN OF xmseg OCCURS 50.
INCLUDE STRUCTURE mseg.
DATA: END OF xmseg.
DATA: BEGIN OF dtext OCCURS 1.
INCLUDE STRUCTURE tline.
DATA: END OF dtext.
DATA: BEGIN OF dktext OCCURS 1.
INCLUDE STRUCTURE tline.
DATA: END OF dktext.
DATA: BEGIN OF dptext OCCURS 1.
INCLUDE STRUCTURE thead.
DATA: END OF dptext.
DATA: BEGIN OF nast_key,
mblnr LIKE mkpf-mblnr,
mjahr LIKE mkpf-mjahr,
zeile LIKE mseg-zeile,
END OF nast_key.
DATA: BEGIN OF beltab OCCURS 20.
INCLUDE STRUCTURE mseg.
DATA: vgart LIKE mkpf-vgart,
blart LIKE mkpf-blart,
blaum LIKE mkpf-blaum,
bldat LIKE mkpf-bldat,
budat LIKE mkpf-budat,
cpudt LIKE mkpf-cpudt,
cputm LIKE mkpf-cputm,
aedat LIKE mkpf-aedat,
usnam LIKE mkpf-usnam,
tcode LIKE mkpf-tcode,
xblnr LIKE mkpf-xblnr,
bktxt LIKE mkpf-bktxt,
frath LIKE mkpf-frath,
frbnr LIKE mkpf-frbnr,
wever LIKE mkpf-wever,
kzdru LIKE t156-kzdru,
END OF beltab.
DATA: BEGIN OF traptab OCCURS 50.
INCLUDE STRUCTURE mseg.
DATA: vgart LIKE mkpf-vgart,
blart LIKE mkpf-blart,
blaum LIKE mkpf-blaum,
bldat LIKE mkpf-bldat,
budat LIKE mkpf-budat,
cpudt LIKE mkpf-cpudt,
cputm LIKE mkpf-cputm,
aedat LIKE mkpf-aedat,
usnam LIKE mkpf-usnam,
tcode LIKE mkpf-tcode,
xblnr LIKE mkpf-xblnr,
bktxt LIKE mkpf-bktxt,
frath LIKE mkpf-frath,
frbnr LIKE mkpf-frbnr,
wever LIKE mkpf-wever,
END OF traptab.
DATA: BEGIN OF inthead OCCURS 50.
INCLUDE STRUCTURE thead.
DATA: END OF inthead.
DATA: BEGIN OF intline OCCURS 50.
INCLUDE STRUCTURE tline.
DATA: END OF intline.
DATA: BEGIN OF intline1 OCCURS 50.
INCLUDE STRUCTURE tline.
DATA: END OF intline1.
*-------- Hilfsfelder -------------------------------------------------*
DATA: index_z LIKE sy-tabix,
drucker LIKE rm07m-ldest,
old_tdform LIKE t159o-tdform,
r_werks LIKE t001w-werks,
r_name1 LIKE t001w-name1,
x_form3 TYPE c,
x_nopdest TYPE c,
language LIKE t001w-spras,
zaehler_m LIKE sy-tabix,
edruck TYPE c.
DATA: old_mkpf LIKE mkpf-usnam,
old_budat LIKE mkpf-budat,
old_cpudt LIKE mkpf-cpudt,
old_werks LIKE t001w-werks,
old_name1 LIKE t001w-name1,
old_mblnr LIKE mkpf-mblnr,
old_lifnr LIKE ekko-lifnr,
old_ebeln LIKE ekko-ebeln,
old_ekgrp LIKE ekko-ekgrp,
old_reswk LIKE ekko-reswk,
old_linam LIKE am07m-name1,
old_lina2 LIKE am07m-name2,
old_eknam LIKE t024-eknam,
old_ektel LIKE t024-ektel,
old_ematn LIKE mseg-ematn,
old_lfa1 LIKE lfa1,
old_lgort LIKE mseg-lgort,
old_ladr LIKE ladr,
save_mkpf LIKE mkpf-usnam,
save_budat LIKE mkpf-budat,
save_cpudt LIKE mkpf-cpudt,
save_werks LIKE t001w-werks,
save_name1 LIKE t001w-name1,
save_mblnr LIKE mkpf-mblnr,
save_lifnr LIKE ekko-lifnr,
save_reswk LIKE ekko-reswk,
save_ebeln LIKE ekko-ebeln,
save_ekgrp LIKE ekko-ekgrp,
save_linam LIKE am07m-name1,
save_lina2 LIKE am07m-name2,
save_eknam LIKE t024-eknam,
save_ektel LIKE t024-ektel,
save_ematn LIKE mseg-ematn,
save_lfa1 LIKE lfa1,
save_lgort LIKE mseg-lgort,
save_ladr LIKE ladr,
offwhile TYPE c,
& TYPE c VALUE '&',
blank TYPE c VALUE ' ',
fenster(5) TYPE c VALUE 'WIN ',
fcount(2) TYPE c,
text1(21) TYPE c VALUE 'INTLINE-TDLINE+ ( )',
text2(22) TYPE c VALUE 'INTLINE1-TDLINE+ ( )',
text5(22) TYPE c VALUE 'INTLINE1-TDLINE+ ( )',
hifeld1(21) TYPE c VALUE 'INTLINE-TDLINE+ (10)',
shift(2) TYPE n,
fpage LIKE sy-pagno,
xscreen(1) TYPE c,
retco LIKE sy-subrc,
mblnr LIKE mkpf-mblnr,
zeile LIKE mseg-zeile,
new_page,
xkopfdr, "Kopf bereits gedruckt
n_vornr LIKE resb-vornr. "Netzplanvorgang
INCLUDE /SMB40/M07DRMTA.
*------Lesen Tabelle T001----------------------------------------------*
FORM TAB001_LESEN.
IF NOT T001-BUKRS = MSEG-BUKRS.
SELECT SINGLE * FROM T001 WHERE BUKRS = MSEG-BUKRS.
ENDIF.
ENDFORM.
*-------Lesen Tabelle T001w--------------------------------------------*
FORM TAB001W_LESEN.
IF NOT T001W-WERKS = MSEG-WERKS.
SELECT SINGLE * FROM T001W WHERE WERKS = MSEG-WERKS.
ENDIF.
R_WERKS = T001W-WERKS.
R_NAME1 = T001W-NAME1.
* Sprache für Formular aus Kondition, sonst aus Werk
IF NOT NAST-SPRAS IS INITIAL.
LANGUAGE = NAST-SPRAS.
ELSE.
LANGUAGE = T001W-SPRAS.
ENDIF.
SET LANGUAGE LANGUAGE.
ENDFORM.
*-------Lesen Tabelle T001w bei Werkswechsel --------------------------*
FORM TAB001W_LESEN_2.
IF NOT MSEG-WERKS = T001W-WERKS.
SELECT SINGLE * FROM T001W WHERE WERKS = MSEG-WERKS.
ENDIF.
ENDFORM.
*--------Lesen Tabelle T156--------------------------------------------*
FORM TAB156_LESEN.
IF NOT T156-BWART = MSEG-BWART.
SELECT SINGLE * FROM T156 WHERE BWART = MSEG-BWART.
ENDIF.
ENDFORM.
*-------Lesen Tabelle T156t--------------------------------------------*
FORM TAB156T_LESEN.
SELECT SINGLE * FROM T156T WHERE SPRAS = LANGUAGE
AND BWART = MSEG-BWART
AND SOBKZ = MSEG-SOBKZ
AND KZBEW = MSEG-KZBEW
AND KZZUG = MSEG-KZZUG
AND KZVBR = MSEG-KZVBR.
ENDFORM.
*------Lesen Tabelle T024----------------------------------------------*
FORM TAB024_LESEN.
IF NOT T024-EKGRP = EKKO-EKGRP.
SELECT SINGLE * FROM T024 WHERE EKGRP = EKKO-EKGRP.
ENDIF.
ENDFORM.
*------Lesen Tabelle T024D---------------------------------------------*
FORM TAB024D_LESEN.
SELECT SINGLE * FROM T024D WHERE WERKS = MSEG-WERKS
AND DISPO = AFKO-DISPO.
ENDFORM.
*---------------------- T027B,C lesen ---------------------------------*
FORM T027_LESEN.
SELECT SINGLE * FROM T027B WHERE SPRAS = LANGUAGE
AND EVERS = MSEG-EVERS.
CHECK NOT MSEG-EVERE IS INITIAL.
SELECT SINGLE * FROM T027C WHERE EVERS = MSEG-EVERS
AND EVERE = MSEG-EVERE.
IF NOT T027C-EVDRK IS INITIAL.
SELECT SINGLE * FROM T027D WHERE SPRAS = LANGUAGE
AND EVERS = MSEG-EVERS
AND EVERE = MSEG-EVERE.
ENDIF.
ENDFORM.
*------------ Lesen der Tabelle T159P Barcode oder Mehrfachdruck ------*
*----------------------- gewünscht ? ----------------------------------*
FORM LESEN_T159P.
IF NOT T159P-TDDEST = NAST-LDEST.
SELECT SINGLE * FROM T159P WHERE TDDEST = NAST-LDEST.
ENDIF.
ENDFORM.
*& Form T064B_LESEN
* Lesen Text zur Bestandsart Qualität/Gesperrt bei WE
FORM T064B_LESEN.
DATA: BSTAR LIKE T064B-BSTAR.
CASE MSEG-INSMK.
WHEN SPACE.
CLEAR T064B.
EXIT.
WHEN F.
CLEAR T064B.
EXIT.
WHEN X.
BSTAR = ZWEI.
WHEN ZWEI.
BSTAR = ZWEI.
WHEN S.
BSTAR = VIER.
WHEN DREI.
BSTAR = VIER.
ENDCASE.
IF NOT T064B-BSTAR = BSTAR.
SELECT SINGLE * FROM T064B WHERE SPRAS = LANGUAGE
AND BSTAR = BSTAR.
ENDIF.
ENDFORM. " T064B_LESEN
INCLUDE /SMB40/M07DRMMA.
*---------Material lesen-----------------------------------------------*
FORM MATERIAL_LESEN.
CLEAR MTCOM.
MTCOM-KENNG = 'MABDR'.
MTCOM-MATNR = MSEG-MATNR.
MTCOM-WERKS = MSEG-WERKS.
MTCOM-LGORT = MSEG-LGORT.
MTCOM-SPRAS = LANGUAGE.
MTCOM-NOMUS = 'X'.
CALL FUNCTION 'MATERIAL_LESEN'
EXPORTING
SCHLUESSEL = MTCOM
IMPORTING
MATDATEN = MABDR
RETURN = MTCOR
TABLES
SEQMAT01 = DUMMY.
IF NOT T156-KZMHD IS INITIAL.
IF NOT MABDR-MHDLP IS INITIAL.
IF T001W-VLFKZ = B. "Zentrale ?
PERFORM MHD_BERECHNEN.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.
*----------------- Mindesthaltbarkeit berechnen ---------------------*
FORM MHD_BERECHNEN.
IF NOT EKPO-MHDRZ IS INITIAL.
AM07M-MHDAT = MSEG-VFDAT - ( EKPO-MHDRZ * MABDR-MHDLP / 100 ).
ELSEIF NOT MABDR-MHDRZ IS INITIAL.
AM07M-MHDAT = MSEG-VFDAT - ( MABDR-MHDRZ * MABDR-MHDLP / 100 ).
ENDIF.
ENDFORM.
*----------------- Prueftext lesen-------------------------------------*
FORM PRUEFTEXT_LESEN.
CLEAR DPTEXT.
CLEAR THEADER.
REFRESH DPTEXT.
THEADER-TDID = 'PRUE'.
THEADER-TDSPRAS = LANGUAGE.
THEADER-TDNAME = MSEG-MATNR.
THEADER-TDOBJECT = 'MATERIAL '.
CALL FUNCTION 'SELECT_TEXT'
EXPORTING
ID = THEADER-TDID
LANGUAGE = THEADER-TDSPRAS
NAME = THEADER-TDNAME
OBJECT = THEADER-TDOBJECT
IMPORTING
ENTRIES = EINTRAEGE
TABLES
SELECTIONS = DPTEXT.
ENDFORM.
* Lesen der Herstellerteilenummer *
FORM LESEN_HTN.
SELECT SINGLE MFRPN FROM MARA
INTO (AM07M-MFRPN) WHERE MATNR = MSEG-EMATN.
ENDFORM.
INCLUDE /SMB40/M07DRMBE.
*-------------Bestellung lesen-----------------------------------------*
FORM BESTELLUNG_LESEN."ORDER READING
DATA: NAME1 LIKE ADDR1_VAL-NAME1.
DATA: OLD_LIFNR LIKE EKKO-LIFNR.
CLEAR AM07M-NAME1.
CLEAR AM07M-NAME2.
IF EKKO-EBELN NE MSEG-EBELN.
SELECT SINGLE * FROM EKKO WHERE EBELN = MSEG-EBELN.
ENDIF.
SELECT SINGLE * FROM EKPO WHERE EBELN = MSEG-EBELN
AND EBELP = MSEG-EBELP.
* Purchase order history because of XBLNR read, since from MKPF can
*deviate
SELECT SINGLE * FROM EKBE WHERE EBELN = MSEG-EBELN
AND EBELP = MSEG-EBELP
AND VGABE = '1'
AND GJAHR = MSEG-MJAHR
AND BELNR = MSEG-MBLNR
AND BUZEI = MSEG-ZEILE.
IF NOT SY-SUBRC IS INITIAL.
CLEAR EKBE.
ELSE.
IF NOT EKBE-XBLNR IS INITIAL.
MKPF-XBLNR = EKBE-XBLNR.
ENDIF.
ENDIF.
CALL FUNCTION 'MM_ADDRESS_GET'
EXPORTING I_EKKO = EKKO
IMPORTING E_NAME1 = NAME1
EXCEPTIONS OTHERS = 1.
AM07M-NAME1 = NAME1.
IF NOT EKKO-LLIEF IS INITIAL.
OLD_LIFNR = EKKO-LIFNR.
EKKO-LIFNR = EKKO-LLIEF.
CALL FUNCTION 'MM_ADDRESS_GET'
EXPORTING I_EKKO = EKKO
IMPORTING E_NAME1 = NAME1
EXCEPTIONS OTHERS = 1.
AM07M-NAME2 = NAME1.
EKKO-LIFNR = OLD_LIFNR.
ENDIF.
XPSTY = EKPO-KNTTP.
CASE XPSTY.
WHEN B.
XPSTY = XKDE.
WHEN D.
XPSTY = XKDE.
WHEN G.
XPSTY = XPROJN.
WHEN O.
XPSTY = XPROJN.
WHEN Q.
XPSTY = XPROJN.
ENDCASE.
ENDFORM.
*----------Bestelltext lesen, wenn Matnr. = 0--------------------------*
FORM BESTELLTEXT_LESEN.
CLEAR: THEADER,
THEAD,
DTEXT.
REFRESH
DTEXT.
THEADER-TDID = 'F01 '.
THEADER-TDSPRAS = EKKO-SPRAS.
THEADER-TDNAME(10) = MSEG-EBELN.
THEADER-TDNAME+10(5) = MSEG-EBELP.
THEADER-TDOBJECT = 'EKPO '.
CALL FUNCTION 'READ_TEXT'
EXPORTING ID = THEADER-TDID
LANGUAGE = THEADER-TDSPRAS
NAME = THEADER-TDNAME
OBJECT = THEADER-TDOBJECT
IMPORTING HEADER = THEAD
TABLES LINES = DTEXT
EXCEPTIONS ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5.
ENDFORM.
*------------Bestellkopf lesen für WE-Version 2.-----------------------*
FORM BESTELLKOPF_LESEN.
CLEAR: THEADER,
THEAD,
DKTEXT.
REFRESH:
DKTEXT.
THEADER-TDID = 'F01 '.
THEADER-TDSPRAS = EKKO-SPRAS.
THEADER-TDNAME(10) = MSEG-EBELN.
THEADER-TDOBJECT = 'EKKO '.
CALL FUNCTION 'READ_TEXT'
EXPORTING ID = THEADER-TDID
LANGUAGE = THEADER-TDSPRAS
NAME = THEADER-TDNAME
OBJECT = THEADER-TDOBJECT
IMPORTING HEADER = THEAD
TABLES LINES = DKTEXT
EXCEPTIONS ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5.
ENDFORM.
INCLUDE /SMB40/M07DRMFA.
*------ Auftragskopf lesen --------------------------------------------*
FORM AUFTRAG_LESEN.
SELECT SINGLE * FROM AFKO WHERE AUFNR = MSEG-AUFNR.
IF MSEG-MATNR IS INITIAL.
SELECT SINGLE * FROM AUFK WHERE AUFNR = MSEG-AUFNR.
IF NOT SY-SUBRC IS INITIAL.
MESSAGE E001 WITH 'AUFK' MSEG-AUFNR.
ELSE.
MABDR-MAKTX = AUFK-KTEXT.
ENDIF.
ENDIF.
ENDFORM.
INCLUDE /SMB40/M07DRKON.
FORM KONTIERUNG_LESEN.
REFRESH XEKKN. CLEAR XEKKN.
SELECT * FROM EKKN WHERE EBELN = EKPO-EBELN
AND EBELP = EKPO-EBELP.
MOVE-CORRESPONDING EKKN TO XEKKN.
APPEND XEKKN.
* x_kont = x.
ENDSELECT.
DESCRIBE TABLE XEKKN LINES INDEX_Z.
IF INDEX_Z GT 1.
X_KONT = X.
ELSE.
X_KONT1 = X.
ENDIF.
ENDFORM.
* Network plan process determine.
FORM NW_VORGANG_LESEN USING F_AUFPL F_APLZL.
CALL FUNCTION 'READ_NETWORK_NPLNR_VORNR'
EXPORTING
APLZL = F_APLZL
AUFPL = F_AUFPL
IMPORTING
VORNR = N_VORNR
EXCEPTIONS
NOT_FOUND = 01.
ENDFORM.
* FORM PSP_CONVERT *
* Konvertierung des internen Felds PS_PSP_PNR zur Ausgabe *
FORM PSP_CONVERT USING PSPNR LIKE MSEG-PS_PSP_PNR.
CALL FUNCTION 'CJPN_INTERN_TO_EXTERN_CONV'
EXPORTING
INT_NUM = PSPNR
IMPORTING
EXT_NUM = AM07M-KONTIERUNG.
ENDFORM.
INCLUDE /SMB40/M07DRF01.
FORM WF01_DRUCK.
CALL FUNCTION 'START_FORM'
EXPORTING FORM = TNAPR-FONAM
LANGUAGE = LANGUAGE.
BELPOS-MBLNR = MKPF-MBLNR.
BELPOS-ZEILE = MSEG-ZEILE.
CONDENSE BELPOS NO-GAPS.
AM07M-BELPOS = BELPOS.
IF T156-SHKZG = H.
AM07M-HDLNE = TEXT-020.
ELSE.
AM07M-HDLNE = TEXT-010.
ENDIF.
IF NOT T159P-BACOD IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'W1BACOKOPF'.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'W1KOPF'.
ENDIF.
IF XPSTY IS INITIAL.
IF MSEG-XBLVS IS INITIAL.
PERFORM WF1_LAGERMATERIAL. "Lagermaterial
ELSE.
PERFORM WF1_LVSMATERIAL. "LVS-Material
ENDIF.
ELSE.
PERFORM WF1_VERBRAUCHSMATERIAL.
ENDIF.
CALL FUNCTION 'END_FORM'.
PERFORM MKTO_DRUCK.
ENDFORM.
*------------ Drucken Lagermaterial ---------------------------------*
FORM WF1_LAGERMATERIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'W1LGMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'RUELGGRUND'.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'LGAUSST'.
ENDFORM.
FORM WF1_LVSMATERIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'W1LVSMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'RUELVSGRUND'.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'LVSAUSST'.
ENDFORM.
*-------------Drucken Verbrauchsmaterial------------------------------*
FORM WF1_VERBRAUCHSMATERIAL.
CASE XPSTY.
WHEN XKDANR. "Kundenauftrag
MOVE SPACE TO KUNDE.
CLEAR AM07M-KOTXT.
AM07M-KOTXT = TEXT-030.
KUNDE-KDAUF = MSEG-KDAUF.
KUNDE-KDPOS = MSEG-KDPOS.
KUNDE-KDEIN = MSEG-KDEIN.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE KUNDE NO-GAPS.
AM07M-KONTIERUNG = KUNDE.
WHEN XANLAGE. "Anlage
MOVE SPACE TO ANLAGE.
CLEAR AM07M-KOTXT.
AM07M-KOTXT = TEXT-040.
ANLAGE-ANLN1 = MSEG-ANLN1.
ANLAGE-ANLN2 = MSEG-ANLN2.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE ANLAGE NO-GAPS.
AM07M-KONTIERUNG = ANLAGE.
WHEN XKOSTL. "Kostenstelle
CLEAR AM07M-KOTXT.
AM07M-KOTXT = TEXT-050.
AM07M-KONTIERUNG = MSEG-KOSTL.
WHEN XPROJN. "Projekt/Netzplan
CLEAR AM07M-KOTXT.
IF MSEG-NPLNR IS INITIAL.
AM07M-KOTXT = TEXT-060.
PERFORM PSP_CONVERT USING MSEG-PS_PSP_PNR.
ELSE.
AM07M-KOTXT = TEXT-061.
AM07M-KONTIERUNG = MSEG-NPLNR.
PERFORM NW_VORGANG_LESEN USING MSEG-AUFPL MSEG-APLZL.
IF NOT N_VORNR IS INITIAL.
MOVE '/' TO AM07M-KONTIERUNG+12.
MOVE N_VORNR TO AM07M-KONTIERUNG+13.
ENDIF.
ENDIF.
ENDCASE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'W1VERBRMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'RUELVERBRGRUND'.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'VERBRAUSST'.
ENDFORM.
INCLUDE /SMB40/M07DRF02.
FORM WF02_DRUCK.
T001W-WERKS = R_WERKS.
T001W-NAME1 = R_NAME1.
CALL FUNCTION 'START_FORM'
EXPORTING FORM = TNAPR-FONAM
LANGUAGE = LANGUAGE.
PERFORM PRUEFTEXT_LESEN.
IF T156-SHKZG = 'H'. "Kennzeichen Haben ?
AM07M-HDLNE = TEXT-020.
ELSE.
AM07M-HDLNE = TEXT-010.
ENDIF.
IF NOT T159P-BACOD IS INITIAL.
BELPOS-MBLNR = MKPF-MBLNR.
BELPOS-ZEILE = MSEG-ZEILE.
CONDENSE BELPOS NO-GAPS.
AM07M-BELPOS = BELPOS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'WE2BACOKOPF'.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'WE2KOPF'.
ENDIF.
IF XPSTY IS INITIAL. "Lagermaterial ?
PERFORM W2_LAGERMATERIAL.
ELSE.
PERFORM W2_VERBRAUCHSMATERIAL.
ENDIF.
CALL FUNCTION 'END_FORM'.
PERFORM MKTO_DRUCK.
ENDFORM.
*-------------- Lagermaterial WE-Version 2 ---------------------------*
FORM WF2_LAGERMATERIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'WE2LGMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'RUELGGRUND'.
ENDIF.
THEAD-TDID = THEADER-TDID.
THEAD-TDNAME = THEADER-TDNAME.
THEAD-TDOBJECT = THEADER-TDOBJECT.
THEAD-TDSPRAS = THEADER-TDSPRAS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'PRTXTLGMAT'.
ENDFORM.
*------------ Verbrauchsmaterial WE-Version 2 ----------------------*
FORM WF2_VERBRAUCHSMATERIAL.
CASE XPSTY.
WHEN XKDANR.
MOVE SPACE TO KUNDE.
CLEAR AM07M-KOTXT.
AM07M-KOTXT = TEXT-030.
KUNDE-KDAUF = MSEG-KDAUF.
KUNDE-KDPOS = MSEG-KDPOS.
KUNDE-KDEIN = MSEG-KDEIN.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE KUNDE NO-GAPS.
AM07M-KONTIERUNG = KUNDE.
WHEN XANLAGE.
MOVE SPACE TO ANLAGE.
CLEAR AM07M-KOTXT.
AM07M-KOTXT = TEXT-040.
ANLAGE-ANLN1 = MSEG-ANLN1.
ANLAGE-ANLN2 = MSEG-ANLN2.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE ANLAGE NO-GAPS.
AM07M-KONTIERUNG = ANLAGE.
WHEN XKOSTL.
CLEAR AM07M-KOTXT.
AM07M-KOTXT = TEXT-050.
AM07M-KONTIERUNG = MSEG-KOSTL.
WHEN XPROJN.
CLEAR AM07M-KOTXT.
IF MSEG-NPLNR IS INITIAL.
AM07M-KOTXT = TEXT-060.
PERFORM PSP_CONVERT USING MSEG-PS_PSP_PNR.
ELSE.
AM07M-KOTXT = TEXT-061.
AM07M-KONTIERUNG = MSEG-NPLNR.
PERFORM NW_VORGANG_LESEN USING MSEG-AUFPL MSEG-APLZL.
IF NOT N_VORNR IS INITIAL.
MOVE '/' TO AM07M-KONTIERUNG+12.
MOVE N_VORNR TO AM07M-KONTIERUNG+13.
ENDIF.
ENDIF.
ENDCASE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'WE2VERBRMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'RUEVERBRGRUND'.
ENDIF.
THEAD-TDID = THEADER-TDID.
THEAD-TDNAME = THEADER-TDNAME.
THEAD-TDOBJECT = THEADER-TDOBJECT.
THEAD-TDSPRAS = THEADER-TDSPRAS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'PRTXTVERBRMAT'.
ENDFORM.
INCLUDE /SMB40/M07DRE01.
FORM WE01_DRUCK.
T001W-WERKS = R_WERKS.
T001W-NAME1 = R_NAME1.
ENDFORM.
*------------ Drucken Lagermaterial ---------------------------------*
FORM W1_LAGERMATERIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'W1LGMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'RUELGGRUND'.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'LGAUSST'.
ENDFORM.
FORM W1_LVSMATERIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'W1LVSMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'RUELVSGRUND'.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'LVSAUSST'.
ENDFORM.
*-------------Drucken Verbrauchsmaterial------------------------------*
FORM W1_VERBRAUCHSMATERIAL.
CLEAR: AM07M-KOTXT, AM07M-KONTIERUNG.
CASE XPSTY.
WHEN XFERT. "Fertigungsauftrag
AM07M-KOTXT = TEXT-062.
IF X_KONT1 IS INITIAL.
AM07M-KONTIERUNG = MSEG-AUFNR.
ELSE.
AM07M-KONTIERUNG = EKKN-AUFNR.
ENDIF.
WHEN XKDE. "Kundeneinzelbest.
MOVE SPACE TO KUNDE.
AM07M-KOTXT = TEXT-030.
IF X_KONT1 IS INITIAL.
KUNDE-KDAUF = MSEG-KDAUF.
KUNDE-KDPOS = MSEG-KDPOS.
ELSE.
KUNDE-KDAUF = EKKN-VBELN.
KUNDE-KDPOS = EKKN-VBELP.
ENDIF.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE KUNDE NO-GAPS.
AM07M-KONTIERUNG = KUNDE.
WHEN XKDANR. "Kundenauftrag
MOVE SPACE TO KUNDE.
AM07M-KOTXT = TEXT-030.
IF X_KONT1 IS INITIAL.
KUNDE-KDAUF = MSEG-KDAUF.
KUNDE-KDPOS = MSEG-KDPOS.
KUNDE-KDEIN = MSEG-KDEIN.
ELSE.
KUNDE-KDAUF = EKKN-VBELN.
KUNDE-KDPOS = EKKN-VBELP.
KUNDE-KDEIN = EKKN-VETEN.
ENDIF.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE KUNDE NO-GAPS.
AM07M-KONTIERUNG = KUNDE.
WHEN XANLAGE. "Anlage
MOVE SPACE TO ANLAGE.
AM07M-KOTXT = TEXT-040.
IF X_KONT1 IS INITIAL.
ANLAGE-ANLN1 = MSEG-ANLN1.
ANLAGE-ANLN2 = MSEG-ANLN2.
ELSE.
ANLAGE-ANLN1 = EKKN-ANLN1.
ANLAGE-ANLN2 = EKKN-ANLN2.
ENDIF.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE ANLAGE NO-GAPS.
AM07M-KONTIERUNG = ANLAGE.
WHEN XKOSTL. "Kostenstelle
AM07M-KOTXT = TEXT-050.
IF X_KONT1 IS INITIAL.
AM07M-KONTIERUNG = MSEG-KOSTL.
ELSE.
AM07M-KONTIERUNG = EKKN-KOSTL.
ENDIF.
WHEN XPROJN. "Projekt/Netzplan
IF X_KONT1 IS INITIAL.
IF MSEG-NPLNR IS INITIAL.
AM07M-KOTXT = TEXT-060.
PERFORM PSP_CONVERT USING MSEG-PS_PSP_PNR.
ELSE.
AM07M-KOTXT = TEXT-061.
AM07M-KONTIERUNG = MSEG-NPLNR.
PERFORM NW_VORGANG_LESEN USING MSEG-AUFPL MSEG-APLZL.
IF NOT N_VORNR IS INITIAL.
MOVE '/' TO AM07M-KONTIERUNG+12.
MOVE N_VORNR TO AM07M-KONTIERUNG+13.
ENDIF.
ENDIF.
ELSE.
IF EKKN-NPLNR IS INITIAL.
AM07M-KOTXT = TEXT-060.
PERFORM PSP_CONVERT USING EKKN-PS_PSP_PNR.
ELSE.
AM07M-KOTXT = TEXT-061.
AM07M-KONTIERUNG = EKKN-NPLNR.
PERFORM NW_VORGANG_LESEN USING EKKN-AUFPL EKKN-APLZL.
IF NOT N_VORNR IS INITIAL.
MOVE '/' TO AM07M-KONTIERUNG+12.
MOVE N_VORNR TO AM07M-KONTIERUNG+13.
ENDIF.
ENDIF.
ENDIF.
ENDCASE.
CLEAR X_KONT1.
* User-Exit über Erweiterung MBCF0005
CALL CUSTOMER-FUNCTION '001'
EXPORTING
I_MKPF = MKPF
I_MSEG = MSEG
I_EKKO = EKKO
I_EKPO = EKPO
I_NAST = NAST
I_TNAPR = TNAPR
TABLES
I_EKKN = XEKKN
CHANGING
C_AM07M = AM07M
EXCEPTIONS
OTHERS = 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'W1VERBRMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'RUELVERBRGRUND'.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'VERBRAUSST'.
ENDFORM.
INCLUDE /SMB40/M07DRE02.
* FORM WE02_DRUCK *
FORM WE02_DRUCK.
T001W-WERKS = R_WERKS.
T001W-NAME1 = R_NAME1.
CALL FUNCTION 'START_FORM'
EXPORTING
FORM = TNAPR-FONAM
LANGUAGE = LANGUAGE.
PERFORM PRUEFTEXT_LESEN.
IF NOT MSEG-VFDAT IS INITIAL.
AM07M-MHTXT = TEXT-105.
ENDIF.
IF NOT AM07M-MHDAT IS INITIAL.
AM07M-MHZTX = TEXT-106.
ENDIF.
IF EKKO-BSART = 'UB'.
AM07M-LITXT = TEXT-101.
AM07M-LIBZG = EKKO-RESWK.
ELSE.
AM07M-LITXT = TEXT-100.
AM07M-LIBZG = EKKO-LIFNR.
IF NOT EKKO-LLIEF IS INITIAL.
AM07M-LIBZ2 = EKKO-LLIEF.
ELSE.
AM07M-LIBZ2 = EKKO-LIFNR.
ENDIF.
ENDIF.
IF T156-SHKZG = 'H'. "Kennzeichen Haben ?
AM07M-HDLNE = TEXT-020.
ELSE.
AM07M-HDLNE = TEXT-010.
ENDIF.
IF NOT T159P-BACOD IS INITIAL.
BELPOS-MBLNR = MKPF-MBLNR.
BELPOS-ZEILE = MSEG-ZEILE.
CONDENSE BELPOS NO-GAPS.
AM07M-BELPOS = BELPOS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE2BACOKOPF'.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE2KOPF'.
ENDIF.
IF XPSTY IS INITIAL. "Lagermaterial ?
* User-Exit über Erweiterung MBCF0005
CALL CUSTOMER-FUNCTION '001'
EXPORTING
I_MKPF = MKPF
I_MSEG = MSEG
I_EKKO = EKKO
I_EKPO = EKPO
I_NAST = NAST
I_TNAPR = TNAPR
TABLES
I_EKKN = XEKKN
CHANGING
C_AM07M = AM07M
EXCEPTIONS
OTHERS = 0.
IF MSEG-XBLVS IS INITIAL.
PERFORM W2_LAGERMATERIAL. "Lagermaterial
ELSE.
PERFORM W2_LVSMATERIAL. "LVS-Material
ENDIF.
ELSE.
PERFORM W2_VERBRAUCHSMATERIAL.
ENDIF.
CALL FUNCTION 'END_FORM'.
PERFORM MKTO_DRUCK.
ENDFORM.
*-------------- Lagermaterial WE-Version 2 ---------------------------*
FORM W2_LAGERMATERIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE2LGMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'RUELGGRUND'.
ENDIF.
THEAD-TDID = THEADER-TDID.
THEAD-TDNAME = THEADER-TDNAME.
THEAD-TDOBJECT = THEADER-TDOBJECT.
THEAD-TDSPRAS = THEADER-TDSPRAS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'PRTXTLGMAT'.
ENDFORM.
*-------------- LVS-Daten WE-Version 2 ---------------------------*
FORM W2_LVSMATERIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'W1LVSMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'RUELVSGRUND'.
ENDIF.
THEAD-TDID = THEADER-TDID.
THEAD-TDNAME = THEADER-TDNAME.
THEAD-TDOBJECT = THEADER-TDOBJECT.
THEAD-TDSPRAS = THEADER-TDSPRAS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'PRTXTLVSMAT'.
ENDFORM.
*------------ Verbrauchsmaterial WE-Version 2 ----------------------*
FORM W2_VERBRAUCHSMATERIAL.
CLEAR: AM07M-KOTXT, AM07M-KONTIERUNG.
CASE XPSTY.
WHEN XFERT. "Fertigungsauftrag
AM07M-KOTXT = TEXT-062.
IF X_KONT1 IS INITIAL.
AM07M-KONTIERUNG = MSEG-AUFNR.
ELSE.
AM07M-KONTIERUNG = EKKN-AUFNR.
ENDIF.
WHEN XKDE.
MOVE SPACE TO KUNDE.
AM07M-KOTXT = TEXT-030.
IF X_KONT1 IS INITIAL.
KUNDE-KDAUF = MSEG-KDAUF.
KUNDE-KDPOS = MSEG-KDPOS.
ELSE.
KUNDE-KDAUF = EKKN-VBELN.
KUNDE-KDPOS = EKKN-VBELP.
ENDIF.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE KUNDE NO-GAPS.
AM07M-KONTIERUNG = KUNDE.
WHEN XKDANR.
MOVE SPACE TO KUNDE.
AM07M-KOTXT = TEXT-030.
IF X_KONT1 IS INITIAL.
KUNDE-KDAUF = MSEG-KDAUF.
KUNDE-KDPOS = MSEG-KDPOS.
KUNDE-KDEIN = MSEG-KDEIN.
ELSE.
KUNDE-KDAUF = EKKN-VBELN.
KUNDE-KDPOS = EKKN-VBELP.
KUNDE-KDEIN = EKKN-VETEN.
ENDIF.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE KUNDE NO-GAPS.
AM07M-KONTIERUNG = KUNDE.
WHEN XANLAGE.
MOVE SPACE TO ANLAGE.
AM07M-KOTXT = TEXT-040.
IF X_KONT1 IS INITIAL.
ANLAGE-ANLN1 = MSEG-ANLN1.
ANLAGE-ANLN2 = MSEG-ANLN2.
ELSE.
ANLAGE-ANLN1 = EKKN-ANLN1.
ANLAGE-ANLN2 = EKKN-ANLN2.
ENDIF.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE ANLAGE NO-GAPS.
AM07M-KONTIERUNG = ANLAGE.
WHEN XKOSTL.
AM07M-KOTXT = TEXT-050.
IF X_KONT1 IS INITIAL.
AM07M-KONTIERUNG = MSEG-KOSTL.
ELSE.
AM07M-KONTIERUNG = EKKN-KOSTL.
ENDIF.
WHEN XPROJN.
IF X_KONT1 IS INITIAL.
IF MSEG-NPLNR IS INITIAL.
AM07M-KOTXT = TEXT-060.
PERFORM PSP_CONVERT USING MSEG-PS_PSP_PNR.
ELSE.
AM07M-KOTXT = TEXT-061.
AM07M-KONTIERUNG = MSEG-NPLNR.
PERFORM NW_VORGANG_LESEN USING MSEG-AUFPL MSEG-APLZL.
IF NOT N_VORNR IS INITIAL.
MOVE '/' TO AM07M-KONTIERUNG+12.
MOVE N_VORNR TO AM07M-KONTIERUNG+13.
ENDIF.
ENDIF.
ELSE.
IF EKKN-NPLNR IS INITIAL.
AM07M-KOTXT = TEXT-060.
PERFORM PSP_CONVERT USING EKKN-PS_PSP_PNR.
ELSE.
AM07M-KOTXT = TEXT-061.
AM07M-KONTIERUNG = EKKN-NPLNR.
PERFORM NW_VORGANG_LESEN USING EKKN-AUFPL EKKN-APLZL.
IF NOT N_VORNR IS INITIAL.
MOVE '/' TO AM07M-KONTIERUNG+12.
MOVE N_VORNR TO AM07M-KONTIERUNG+13.
ENDIF.
ENDIF.
ENDIF.
ENDCASE.
CLEAR X_KONT1.
* User-Exit über Erweiterung MBCF0005
CALL CUSTOMER-FUNCTION '001'
EXPORTING
I_MKPF = MKPF
I_MSEG = MSEG
I_EKKO = EKKO
I_EKPO = EKPO
I_NAST = NAST
I_TNAPR = TNAPR
TABLES
I_EKKN = XEKKN
CHANGING
C_AM07M = AM07M
EXCEPTIONS
OTHERS = 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE2VERBRMAT'.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'RUEVERBRGRUND'.
ENDIF.
THEAD-TDID = THEADER-TDID.
THEAD-TDNAME = THEADER-TDNAME.
THEAD-TDOBJECT = THEADER-TDOBJECT.
THEAD-TDSPRAS = THEADER-TDSPRAS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'PRTXTVERBRMAT'.
ENDFORM.
INCLUDE /SMB40/M07DRE03.
* FORM WE03_AUSGABE *
FORM WE03_AUSGABE using lgortsplit.
*----------------Drucken WE-Version 3 Überschrift---------------------*
if lgortsplit is initial.
ON CHANGE OF MKPF-MBLNR OR MSEG-EBELN OR MSEG-BWART
OR NAST-KSCHL OR MSEG-WERKS.
CLEAR XKOPFDR.
endon.
else.
ON CHANGE OF MKPF-MBLNR OR MSEG-EBELN OR MSEG-BWART
OR NAST-KSCHL OR MSEG-WERKS
OR MSEG-LGORT.
CLEAR XKOPFDR.
endon.
endif.
IF XKOPFDR IS INITIAL.
XKOPFDR = X.
IF NEW_PAGE = X.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'NEW-PAGE'.
ENDIF.
IF EKKO-BSART = 'UB'.
AM07M-LITXT = TEXT-101.
AM07M-LIBZG = EKKO-RESWK.
ELSE.
AM07M-LITXT = TEXT-100.
AM07M-LIBZG = EKKO-LIFNR.
IF NOT EKKO-LLIEF IS INITIAL.
AM07M-LIBZ2 = EKKO-LLIEF.
ELSE.
AM07M-LIBZ2 = EKKO-LIFNR.
ENDIF.
ENDIF.
IF T156-SHKZG = H.
AM07M-HDLNE = TEXT-020.
ELSE.
AM07M-HDLNE = TEXT-010.
ENDIF.
IF XPSTY IS INITIAL. "Lagermaterial ?
IF MSEG-XBLVS IS INITIAL.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
IF NOT T159P-BACOD IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3BACOKOPF'
WINDOW = 'RÜKOPF'.
NEW_PAGE = X.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3KOPF'
WINDOW = 'RÜKOPF'.
NEW_PAGE = X.
ENDIF.
ELSE.
IF NOT T159P-BACOD IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3BACOKOPF'
WINDOW = 'KOPF'.
NEW_PAGE = X.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3KOPF'
WINDOW = 'KOPF'.
NEW_PAGE = X.
ENDIF.
ENDIF.
ELSE.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
IF NOT T159P-BACOD IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3BACOLVSKOPF'
WINDOW = 'RÜKOPF'.
NEW_PAGE = X.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3LVSKOPF' "RL-Material
WINDOW = 'RÜKOPF'.
NEW_PAGE = X.
ENDIF.
ELSE.
IF NOT T159P-BACOD IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3BACOLVSKOPF'
WINDOW = 'KOPF'.
NEW_PAGE = X.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3LVSKOPF' "RL-Material
WINDOW = 'KOPF'.
NEW_PAGE = X.
ENDIF.
ENDIF.
ENDIF.
ELSE.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
IF NOT T159P-BACOD IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3BACOKOPF1'
WINDOW = 'RÜKOPF'.
NEW_PAGE = X.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3KOPF1'
WINDOW = 'RÜKOPF'.
NEW_PAGE = X.
ENDIF.
ELSE.
IF NOT T159P-BACOD IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3BACOKOPF1'
WINDOW = 'KOPF'.
NEW_PAGE = X.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3KOPF1'
WINDOW = 'KOPF'.
NEW_PAGE = X.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*------------- Drucken WE-Version 3 Position --------------------------*
**perform w3_lieferplan. "Routine Lieferplan
CLEAR T157E.
IF T156-SHKZG = H AND
NOT MSEG-GRUND IS INITIAL.
SELECT SINGLE * FROM T157E WHERE BWART = MSEG-BWART
AND GRUND = MSEG-GRUND
AND SPRAS = LANGUAGE.
ENDIF.
IF MSEG-EBELN IS INITIAL.
IF NOT MABDR-MAKTX IS INITIAL.
EKPO-TXZ01 = MABDR-MAKTX.
ENDIF.
ENDIF.
IF MABDR-WERTU IS INITIAL AND
MABDR-MENGU = X OR "Bestandsfuehrung = UNBW oder
XPSTY IS INITIAL. "Lagermaterial ?
* User-Exit über Erweiterung MBCF0005
CALL CUSTOMER-FUNCTION '001'
EXPORTING
I_MKPF = MKPF
I_MSEG = MSEG
I_EKKO = EKKO
I_EKPO = EKPO
I_NAST = NAST
I_TNAPR = TNAPR
TABLES
I_EKKN = XEKKN
CHANGING
C_AM07M = AM07M
EXCEPTIONS
OTHERS = 0.
IF MSEG-XBLVS IS INITIAL.
PERFORM W3_LAGERMATERIAL. "Routine Lagermaterial
ELSE.
PERFORM W3_LVSMATERIAL. "Routine RL-Material
ENDIF.
ELSE.
PERFORM W3_VERBRAUCHSMATERIAL. "Routine Verbrauchsmaterial
ENDIF.
*-------------- Drucken WE-Version 3 Seitenfuss ----------------------*
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3FUSS'
WINDOW = 'FUSS'
FUNCTION = 'APPEND'.
ENDFORM.
*--------------Unteroutinen für Positionsdruck -----------------------*
FORM W3_LAGERMATERIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3LGMAT'.
ENDFORM.
* FORM W3_LVSMATERIAL *
FORM W3_LVSMATERIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'WE3LVSMAT'.
ENDFORM.
* FORM W3_VERBRAUCHSMATERIAL *
FORM W3_VERBRAUCHSMATERIAL.
CLEAR: AM07M-KONTIERUNG.
AM07M-RSTYP = XPSTY.
CASE XPSTY.
WHEN XFERT. "Fertigungsauftrag
IF X_KONT1 IS INITIAL.
AM07M-KONTIERUNG = MSEG-AUFNR.
ELSE.
AM07M-KONTIERUNG = EKKN-AUFNR.
ENDIF.
WHEN XANLAGE.
MOVE SPACE TO ANLAGE.
IF X_KONT1 IS INITIAL.
ANLAGE-ANLN1 = MSEG-ANLN1.
ANLAGE-ANLN2 = MSEG-ANLN2.
ELSE.
ANLAGE-ANLN1 = EKKN-ANLN1.
ANLAGE-ANLN2 = EKKN-ANLN2.
ENDIF.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE ANLAGE NO-GAPS.
AM07M-KONTIERUNG = ANLAGE.
WHEN XKDE. "Kundeneinzelbestand?
MOVE SPACE TO KUNDE.
IF X_KONT1 IS INITIAL.
KUNDE-KDAUF = MSEG-KDAUF.
KUNDE-KDPOS = MSEG-KDPOS.
ELSE.
KUNDE-KDAUF = EKKN-VBELN.
KUNDE-KDPOS = EKKN-VBELP.
ENDIF.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE KUNDE NO-GAPS.
AM07M-KONTIERUNG = KUNDE.
WHEN XKDANR. "Kundenauftrag ?
MOVE SPACE TO KUNDE.
IF X_KONT1 IS INITIAL.
KUNDE-KDAUF = MSEG-KDAUF.
KUNDE-KDPOS = MSEG-KDPOS.
KUNDE-KDEIN = MSEG-KDEIN.
ELSE.
KUNDE-KDAUF = EKKN-VBELN.
KUNDE-KDPOS = EKKN-VBELP.
KUNDE-KDEIN = EKKN-VETEN.
ENDIF.
MOVE SPACE TO AM07M-KONTIERUNG.
CONDENSE KUNDE NO-GAPS.
AM07M-KONTIERUNG = KUNDE.
WHEN XKOSTL. "auf Kostenstelle kontiert
IF X_KONT1 IS INITIAL.
AM07M-KONTIERUNG = MSEG-KOSTL.
ELSE.
AM07M-KONTIERUNG = EKKN-KOSTL.
ENDIF.
WHEN XPROJN. "auf Projekt/Netzplan
IF X_KONT1 IS INITIAL.
IF MSEG-NPLNR IS INITIAL.
PERFORM PSP_CONVERT USING MSEG-PS_PSP_PNR.
ELSE.
AM07M-KONTIERUNG = MSEG-NPLNR.
PERFORM NW_VORGANG_LESEN USING MSEG-AUFPL MSEG-APLZL.
IF NOT N_VORNR IS INITIAL.
MOVE '/' TO AM07M-KONTIERUNG+12.
MOVE N_VORNR TO AM07M-KONTIERUNG+13.
ENDIF.
ENDIF.
ELSE.
IF EKKN-NPLNR IS INITIAL.
PERFORM PSP_CONVERT USING EKKN-PS_PSP_PNR.
ELSE.
AM07M-KONTIERUNG = EKKN-NPLNR.
PERFORM NW_VORGANG_LESEN USING EKKN-AUFPL EKKN-APLZL.
IF NOT N_VORNR IS INITIAL.
-
Hello friends ,
I have a print program that has been configured for HR . I have 2 z forms .When I activated the debugger it went to just one form . When I checked form2 it showed the z program as one of the print programs . How do I relate the form2 to my print program ? I need to change the layout of form2 . Before that I want to know when is the print program calling the form2 .
Thanks & Regards,Hello Hari,
First create a output type for the form2. GO to Transaction NACE and assign the Form name , Print Program and Routine name to that Output type.
Process the output tyepe now. You will get the second form.
Regards,
Vasanth -
Error when exexuting a smart form from print program
Hi,
I have created a Print Program & Layout Set [Smart Form].
Now when i executed Print program it is throwing following error.
As internal table that we are passing to F.M is not having any data i have appended some data in debug mode.
After htting Print Immediaely Button Following EXIT Error is coming.
No table is currently processed, switching lines is not possible.
Message no. SSFCOMPOSER 183
Diagnosis
You tried to switch to the next table line, but currently no table is open for output.
System Response
The system issues an error message.
Procedure
This is probably an internal error. Please contact the SAP hotline and report the problem.
Can anybody solve this issue!
Thanks in advance.
Thanks,
Deep.Make sure that you have proper definations of internal table in program and smartform.
Regards,
Amey -
Forms and Print program Urgent please!!
I have created a copy from a standard form (F150_dunn_01) and a print program (SAPLF150). Now, Could you tell me how can I know if the form is assigned to the program? or How to assign the program to the form?
I mean, assign to the Zform and Zprogram
Thanks and regards.Hi .
There are two ways to find out the corresponding
print program for a sapscript form .
they are ,
1.go to the change editor of ur sapscript form in transaction se78 ,place ur cursor at any of ur screen field and goto ->print program ->symbol definition with dialog .
here u can find out the print program of ur corrsponding form.
2.when u r in ur main screen of tansaction se78 ,goto
form->check->texts.
here u can find out the print program of ur corrsponding form.
these r the two ways in finding out ur print programs of sapscript form.
reg any doubt reply me .
with regs,
karthik srinivasan -
Develop a form and print program using VBAP, VBAK, MRKT.
I have 2 tables VBAK [fields: VBELN, ERDAT, ERNAM, AUDAT, VBTYP, VKORG] and VBAP [Fields: POSNR, MATNR, CHARG, WAERK] and In output(form) i need the following fields,
Output table:
-VBELN
-ERDAT
-VKORG
-POSNR
-MATNR
-MAKTX <- this field is from table MAKT. (I need the Material descriptions too for all the materials.)
Form Layout should have Header, Logo (SAP ENJOY), Main, Footer.
Problem is that i need footer only after the End of Complete data in Main Window, thats is footer should be placed only in last window. How should i do that ?
Logic which i thot to make the print program is : First declare an internal table itab1 with VBAP, VBAP using the above fields from two tables and fetch the product based on matnr.
declare one internal table itab2 and select the records from the table makt by checking the condition itab1 is not initial.
sample code.
IF ITAB1 IS NOT INITIAL.
SELECT FIELD LIST FROM MAKT INTO TABLE ITAB2 WHERE MATNR EQ ITAB1-MATNR.
ENDIF.
hope this shuld work. ?????Hi
see the sample script program and do accordingly
*& Report ZTEST12121
*& SAPScripts Example 1
REPORT ztest12121.
*DATABASE TABLES
TABLES: ekko,ekpo,lfa1.
*INTERNAL TABLES AND STRUCTURES
DATA i_ekko LIKE ekko.
DATA i_ekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.
DATA i_lfa1 LIKE lfa1.
*PARAMETERS
PARAMETERS: p_ebeln LIKE ekko-ebeln.
*VARIABLES
DATA MAT TYPE STRING VALUE 'MAT NO'.
DATA iTe TYPE STRING VALUE 'ITEM NO'.
DATA QTY TYPE STRING VALUE 'QTY'.
DATA UOM TYPE STRING VALUE 'UOM'.
DATA NET TYPE STRING VALUE 'NET PRICE'.
Data var type integer value 0.
*DATABASE SELECTS
*Header data
SELECT SINGLE * FROM ekko INTO i_ekko WHERE ekko~ebeln = p_ebeln.
IF sy-subrc = 0.
*Item Data
SELECT * FROM ekpo INTO TABLE i_ekpo WHERE ekpo~ebeln = p_ebeln.
IF sy-subrc NE 0.
WRITE 'PURCHASE DOCUMENT ITEM DATA ERROR'.
ELSE.
*Vendor Details
SELECT SINGLE * FROM lfa1 INTO i_lfa1 WHERE lfa1~lifnr = i_ekko-lifnr.
IF sy-subrc NE 0.
WRITE 'VENDOR DOCUMENT ITEM DATA ERROR'.
ENDIF.
ENDIF.
ELSE.
WRITE 'THIS PURCHASE DOCUMENT NUMBER DOESNOT EXISTS'.
ENDIF.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
form = 'ZSCRIPT_1'
language = sy-langu
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
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 'WRITE_FORM'
EXPORTING
ELEMENT = 'OFFICEAD'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'OFFICEAD'
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 'WRITE_FORM'
EXPORTING
ELEMENT = 'PODET'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'PODET'
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 'WRITE_FORM'
EXPORTING
ELEMENT = 'TOP'
FUNCTION = 'SET'
TYPE = 'TOP'
WINDOW = 'MAIN'
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT I_EKPO.
var = i_ekpo-netpr * i_ekpo-menge.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'BODY'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Structure of a print program
OPEN_FORM function
CLOSE_FORM function
WRITE_FORM
START_FORM function
END_FORM function
CONTROL_FORM function
The print program is used to print forms. The program retieves the necesary data from datbase tables, defines the order of in which text elements are printed, chooses a form for printing and selects an output device and print options.
Function modules in a printprogram:
When you print a form you must used the staments OPEN_FORM and CLOSE_FORM. To combine forms into a single spool request use START_FORM and END_FORM.
To print textelements in a form use WRITE_FORM. The order in which the textelements are printed, is determined by the order of the WRITE_FORM statements. Note: for printing lines in the body, you can also use the WRITE_FORM_LINES function module.
To transfer control command to a form use CONTROL_FORM.
Structure of a print program
Read data
Tables: xxx.
SELECT *
FROM xxx.
Open form printing - Must be called before working with any of the other form function modules.
Must be ended with function module CLOSE FORM
call function 'OPEN_FORM'.....
To begin several indentical forms containing different data within a single spool request, begin each form using START_FORM, and end it using END_FORM
call funtion 'START_FORM'.....
Write text elements to a window of the form
call function 'WRITE_FORM'.....
Ends spool request started with START_FORM
call funtion 'END_FORM'.....
Closes form printing
call function 'CLOSE_FORM'...
OPEN_FORM function
Syntax:
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = ' '
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Some important parameters:
FORM Name of the form
DEVICE PRINTER : Print output using spool
TELEFAX: Fax output
SCREEN: Output to screen
OPTIONS Used to control attrubutes for printing or faxing (Number of copies, immediate output....
The input for the parameter is structure ITCPO.
CLOSE_FORM function
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 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.
Paramerters:
RESULT Returns status information and print/fax parameters after the form has been printed. RESULT is of structure ITCPP.
WRITE_FORM function
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = ' '
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
OTHERS = 9
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Some important parameters:
ELEMENT Specifies which textelement is printed
WINDOW Specifies which window is printed
TYPE Specifies the output area of the main window. This can be:
TOP - Used for headers
BODY
BOTTOM - Used for footers
FUNCTION Specifies whether text is to be appended, replaced or added
Example of how to use the WRITE_FORM function module together with a script.
Form layout of the MAIN window
/E INTRODUCTION
Dear Customer
/E ITEM_HEADER
IH Carrier, Departure
/E ITEM_LINE
IL &SBOOK-CARRID&, &SPFLI-DEPTIME&
/E CLOSING_REMARK
The print program
Writing INTRODUCTION
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'INTRODUCTION'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Writing ITEM_HEADER
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Set ITEM_HEADER into TOP area of main window for subsequent pages
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'SET'
TYPE = 'TOP'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Write ITEM_LINE
LOOP AT .....
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8.
ENDLOOP.
Delete ITEM_HEADER from TOP area of main window
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'DELETE'
TYPE = 'TOP'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Print CLOSING_REMARK
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'CLOSING_REMARK'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
START_FORM function
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
FORM = ' '
LANGUAGE = ' '
STARTPAGE = ' '
PROGRAM = ' '
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
OTHERS = 7
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
END_FORM function
CALL FUNCTION 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CONTROL_FORM function
The CONTROL_FORM function module alows you to create SapScript control statements from within an APAB program.
Syntax:
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command =
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 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.
Example:
Protecting the text element ITEM_LINE
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'PROTECT'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
TEXELEMENT = 'ITEM_LINE'.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'ENDPROTECT'.
Regards
Anji -
Hi,
Help please!
I am modifying the dunning forms, but i have a problem i need to do some modificactions to the standard print program, so what I made a copy but now how Can I do so that the form (SAPscript) uses the new print program?
Thanks.Hi Marisol
Please check the following link (for which i got reward poits too )
https://www.sdn.sap.com/sdn/collaboration.sdn?node=linkFnode6-1&contenttype=url&content=https://Re: Print Program
Regards
Ashish Jain -
How to get the PO no in the smart form and in the print program from ME23N
hello all,
I am new to smart form printing.I want to make a smartform along with print program that will show PO Details.It has to be created as an o/p type in ME23N. I have created an o/p type ZPO using NACE ..Can some one tell me how to get the PO number in the smart form and in the print program from ME23N ,so that I can then program the necessary calculations?plz help me with the code.Thanks in advance.
Subhabrata.Hello Everyone,
I am new to the forum and also to abap.
Excuse me if it is a basic question.
I am taking care of the output types.
This is 1st time SAP will be implemented .
For purchase order , I go to NACE ---EF----NEU---Processing routines
print output---SAPFM06P---ENTRY_NEU----MEDRUCK
FAX-----------SAPFM06P---ENTRY_NEU----MEDRUCK
EDI------------RANASTED--EDI_PROCESSING
DISTRIBUTION(ALE)---RANASTED---ALE_PROCESSING
Are the above settings fine ?
What are the standard programs for the PO outputs . I am looking for the smartforms and the driver program .
I searched and found that IN ECC 6 , we have to install OSS notes .
Gurus, please help me . Let me know what all oss notes be implemented and how to proceed from here .
Any help will be greatly appreciated ,
Monalisa -
Am using a standard smart form and a corresponding program.
hi
i am using a standard smart form and a corresponding program. i did evry possible thing but it is not executing..where could be the error.?
can any1 suggestHi,
Dude..!
you told that you created form and corresponding print program also....!
but you didn't mentioned what it is..! in the sense to which module..!
are you changing any standard form or what..! be clear while raising issue..! so that you can get your issue cleared..
and you have to assign your form and corresponding print program in NACE transaction for the given output type.
Thanks & regards,
Sasi Kanth. -
hallow
hi doing a smart form and in the print preview i see my page and its o.k. the problem is when i send the page to the printer noting is happen .
when i send from my computer a word document its working what is the problem can be .
i use a report program that call to smart function.
thankesHi antonio,
do you have set the CONTROL_PARAMETERS?
i do it like this:
CLEAR: CONTROL_PARAMETERS.
CONTROL_PARAMETERS-NO_DIALOG = 'X'.
it works OK.
Regards, Dieter -
hi,,
will u tell what is the difference between smart forms and scripts.hI
Sapscripts are client dependend and smartforms are client independet.
SAPscript are CLient Dependent, SmartForms are Client Independent. The reason why SmartForms are client independent is because when you activate a SMartForm, SAP actually generates a Function Module (which as you know is client independent). The Print Program (or as SAP likes to refer to them these days - Application Program) calls your generated FM.
In the "smartforms" transaction, when you are viewing a smartform, you can go to the Environment->Function Module Name menu path to see the FM name.
Look at the "Application Program" for the Invoice SmartForm (RLB_INVOICE):
determine smartform function module for invoice
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING formname = lf_formname
variant = ' '
direct_call = ' '
IMPORTING fm_name = lf_fm_name
EXCEPTIONS no_form = 1
no_function_module = 2
OTHERS = 3.
call smartform invoice
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_appl_obj =
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = space
is_bil_invoice = ls_bil_invoice
is_nast = nast
is_repeat = repeat
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.
<b>Difference with SMARTFORMS vs. SapScript (SE71)</b>
The Following are the differences :-
a) Multiple page formats are possible in smartforms which is not the case in SAPScripts
b) It is possible to have a smartform without a main window .
c) Labels cannot be created in smartforms.
d) Routines can be written in smartforms tool.
e) Smartforms generates a function module when activated.
Contributed by : SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips
f) Unlike sapscripts (RSTXSCRP), you cannot upload/download Smartform to your local harddisk.
It was said that it was provided in CRM 3.0 version, but not available in R/3. You can download smartforms into Local PC in a XML format. In the same way you can upload this XML format into Smartform. From the smartform editor itself you can call download option, if you are working in CRM 3.0 environment.
In R3 also, you can download into XML format. However, it's not sure about uploading. Refer to the program 'SF_XSF_DEMO'.
In 4.7 Enterprise, other have seen this utlity which is completey missing in 4.6c. There is functionality to downlaod a complete form or only a particular node. (Utilities -> Download form). It will create a XML file and save it in the hard disk.
For others, if you want to download/upload the Smartforms source, you will need the help from the Basis people. What you can do is to create a Transport and then FTP down to your local harddisk. When you need the Smartform source in another system, you have FTP up the Smartforms file back to the SAP server. Finally, the Basis team, will tp it into your system.
g) The protect and endprotect command in sapscript doesn't work with smartforms. For example on a invoice: First data of position no 80. is printed on page one, other data of position no 80 is printed on page 2. And there's nothing you can do about it. Actually, there is something you can do about it. By using a folder node and checking the 'protect' checkbox, everything in that folder will be page protected.
i) The main difference is that SAP script is client-dependant, while smartform is independent. Also there are some advanced and intreractive features available in smartforms.
You can use an External subroutine-call in sapscript editor like:
/: perform <form_name> in program <program_name>
/: using <var1>
/: using <var2>
/: changing <return1>
/: changing <return2>
/:endperform -
Purchase order smart forms and scripts
i need to create a smart form and script in simple purchase order there is no requirements has given to me, can any one tell me in detail how i need to do and what are the procedures i need to follow, example code will be usefull and steps to build it.
Hi,
Go through the links mentioned below.
http://www.****************/Tutorials/Smartforms/SFMain.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
http://www.sapmaterial.com/smartform_example.html
Re: Hands on SAP Smart Forms
smartforms
A Simple Smartform Tutorial
SAP Smartforms can be used for creating and maintaining forms for mass printing in SAP Systems. The output medium for Smartforms support printer, fax, e-mail, or the Internet (by using the generated XML output).
According to SAP, you need neither have any programming knowledge nor use a Script language to adapt standard forms. However, basic ABAP programming skills are required only in special cases (for example, to call a function module you created or for complex and extensive conditions).
1. Create a new smartforms
Transaction code SMARTFORMS
Create new smartforms call ZSMART
2. Define looping process for internal table
Pages and windows
First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
Here, you can specify your title and page numbering
&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
Main windows -> TABLE -> DATA
In the Loop section, tick Internal table and fill in
ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
3. Define table in smartforms
Global settings :
Form interface
Variable name Type assignment Reference type
ITAB1 TYPE Table Structure
Global definitions
Variable name Type assignment Reference type
ITAB2 TYPE Table Structure
4. To display the data in the form
Make used of the Table Painter and declare the Line Type in Tabstrips Table
e.g. HD_GEN for printing header details,
IT_GEN for printing data details.
You have to specify the Line Type in your Text elements in the Tabstrips Output options.
Tick the New Line and specify the Line Type for outputting the data.
Declare your output fields in Text elements
Tabstrips - Output Options
For different fonts use this Style : IDWTCERTSTYLE
For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
5. Calling SMARTFORMS from your ABAP program
REPORT ZSMARTFORM.
Calling SMARTFORMS from your ABAP program.
Collecting all the table data in your program, and pass once to SMARTFORMS
SMARTFORMS
Declare your table type in :-
Global Settings -> Form Interface
Global Definintions -> Global Data
Main Window -> Table -> DATA
Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
http://sapr3.tripod.com
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc <> 0.
WRITE: / 'ERROR 1'.
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 =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
GS_MKPF = INT_MKPF
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.
Additional Fonts for your SMARTFORMS
You can create additional fonts and style with transaction SMARTSTYLES
This can then be define in the paragraph and character formats, which you can then be assign to texts and fields in the Smart Form.
The character formats includes effects such as superscript, subscript, barcode and font attributes.
Also, you can refer to the below link for the explanation:
http://help.sap.com/saphelp_46c/helpdata/en/4b/83fb42df8f11d3969700a0c930660b/frameset.htm
Reward if helpful.
Regards,
Harini.S -
Hi,
Please let me know the difference betweeen Smart form and jet form and in which scenarios we use them.
thanksHI,
<b>
Smart forms</b>
<u>https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/formPrinting-SAPscript,Smartforms&</u>
Smartforms: Frequently Asked Questions
What are the differences between SAP Scripts and Smartforms?
How can I insert symbols in Smartforms?
I have a smartform which works fine in DEV. After trasnsporting it to PROD, there is no Function module generated for this smartform. As a result my program dumps in PROD?
How can I make the Smartforms to choose a printer name by default?
How can I make the Smartforms to display a print preview by default without displaying the popup for print parameters?
How can I display the total number of pages in Smartforms?
How can I display the total number of pages in Smartforms?
I'm using the variable SFSY-FORMPAGES, I get a star "*" instead of the total number of pages.
What are the various text formatting options in Smartforms?
How can I provide a background shading to the table?
Where can I provide the input parameters to the smartform?
Where can I define my own global types for the smartform?
I have defined my own Program Lines, where I have used a global variable G_TEXT. I get an error G_TEXT is not defined?
I have created a table node for display. Where can I check the condition which must satisfy to display the table?
How can I define Page Protect in Smartforms?
What is the difference between Template and Table in Smartforms?
Where can I define the paragraph and character format for the smartforms?
What are the differences between SAP Scripts and Smartforms?
SAP Scripts are client dependent whereas Smartforms are client independent.
SAP Scripts require a driver program to display the output whereas in smartforms the form routines can be written so that it is standalone.
An integrated Form Builder helps to design Smartforms more easily than SAP Scripts
An Table Painter and Smartstyles to assist in building up the smartforms
On activation a function module is generated for Smartforms
It is possible to create a Smartform without a main window
Smartforms generates XML output which can be viewed through the web
Multiple page formats is possible in smartforms
How can I insert symbols in Smartforms?
Select the Text node.
Change Editor (Click the button above Check near the Editor)
Go to menu Include->Characters->SAP Symbols
Choose the SAP symbol that you want to insert.
I have a smartform which works fine in DEV. After trasnsporting it to PROD, there is no Function module generated for this smartform. As a result my program dumps in PROD?
The Smartform that is created in the Development may not have the same name in the Production server. So it is always advised to use the Function Module SSF_FUNCTION_MODULE_NAME to get the Function Module name by passing the Smartform name.
DATA: fm_name TYPE rs38l_fnam.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSMARTFORM'
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
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.How can I make the Smartforms to choose a printer name by default?
In the CALL FUNCTION of the Smartform Function Module, set the output options parameter to set the printer name.
The output options is of the type SSFCOMPOP which contains the field TDDEST. Set the TDDEST field to your default printer name.
How can I make the Smartforms to display a print preview by default without displaying the popup for print parameters?
In the SSF_OPEN function module,
Set the OUTPUT OPTIONS paramter TDDEST to your printer name.
Set the CONTROL PARAMETERS and control parameters as shown below,
control-preview = 'X'.
control-no_open = 'X'.
control-no_close = 'X'.
control-no_dialog = 'X'.
control-device = 'PRINTER'.
control_parameters-no_dialog = 'X'.
control_parameters-no_open = 'X'.
control_parameters-no_close = 'X'.
OUTPUT_OPTIONS-TDDEST = 'PRINTER NAME'.
OUTPUT_OPTIONS-TDNOPRINT = 'X'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
output_options = output_options
control_parameters = control
user_settings = ' '
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.How can I display the total number of pages in Smartforms?
Use SFSY-FORMPAGES to display the total number of pages in the Smartforms
&SFSY-PAGE& Current page number
&SFSY-FORMPAGE& Total number of pages in the currently formatted layout set
&SFSY-JOBPAGE& Total number of pages in the currently formatted print request
&SFSY-COPYCOUNT& Original-1,1st copy-2
&SFSY-DATE& Date
&SFSY-TIME& Time
&SFSY-USERNAME& Username
I'm using the variable SFSY-FORMPAGES, I get a star "*" instead of the total number of pages.
There may not be enough space in the window to display the variable, either increase the window dimensions or condense the spaces using &SFSY-FORMPAGES(C)&
What are the various text formatting options in Smartforms?
&symbol(Z)& Omit Leading Zeros
&symbol(S)& Omit Leading Sign
&symbol(<)& Display Leading Sign to the Left
&symbol(>)& Display Leading Sign to the Right
&symbol(C)& Compress Spaces
&symbol(.N)& Display upto N decimal places
&symbol(T)& Omit thousands separator
&symbol(R)& Right justified
&symbol(I)& Suppress output of the initial value
How can I provide a background shading to the table?
In the Table Painter, you can specify the color and shading for the table lines.
Where can I provide the input parameters to the smartform?
The input parameters for the smartform can be defined in Global Settings->Form Interface.
The Associated Type must be defined in the ABAP Dictionary.
Where can I define my own global types for the smartform?
The global types(within the smartform) can be defined in Global Settings->Global Definitions->Types
The types defined here will be global through the entire smartform.
Also the form routines can be defined Global Settings->Global Definitions->Form Routines
I have defined my own Program Lines, where I have used a global variable G_TEXT. I get an error G_TEXT is not defined?
Whenever using the global variables in the Program Lines, enter the variable name in Input Parameters if you are going to use(read) the variable. If you are going to both read/write the variable value enter the same in Output Parameters.
I have created a table node for display. Where can I check the condition which must satisfy to display the table?
The conditions can be defined in the Conditions tab. In smartforms all the nodes have a condition tab where you can specify the condition to be satisfied to access the node.
How can I define Page Protect in Smartforms?
To define Page Protect for a node go to the Output options and check the Page Protection checkbox.
What is the difference between Template and Table in Smartforms?
The Template contains a fixed number of rows and columns, where the output is fixed.
The Table can have variable number of rows
Where can I define the paragraph and character format for the smartforms?
The paragraph and character format for the smartforms can be defined in the transaction SMARTSTYLES
Mohan
Award points if it adds information. -
Can anybody provide me good step by step procedurehow create smart form and module pool programming.
My email Id is [email protected]hi,
SAP Smartforms can be used for creating and maintaining forms for mass printing in SAP Systems. The output medium for Smartforms support printer, fax, e-mail, or the Internet (by using the generated XML output).
According to SAP, you need neither have any programming knowledge nor use a Script language to adapt standard forms. However, basic ABAP programming skills are required only in special cases (for example, to call a function module you created or for complex and extensive conditions).
1. Create a new smartforms
Transaction code SMARTFORMS
Create new smartforms call ZSMART
2. Define looping process for internal table
Pages and windows
First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
Here, you can specify your title and page numbering
&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
Main windows -> TABLE -> DATA
In the Loop section, tick Internal table and fill in
ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
3. Define table in smartforms
Global settings :
Form interface
Variable name Type assignment Reference type
ITAB1 TYPE Table Structure
Global definitions
Variable name Type assignment Reference type
ITAB2 TYPE Table Structure
4. To display the data in the form
Make used of the Table Painter and declare the Line Type in Tabstrips Table
e.g. HD_GEN for printing header details,
IT_GEN for printing data details.
You have to specify the Line Type in your Text elements in the Tabstrips Output options.
Tick the New Line and specify the Line Type for outputting the data.
Declare your output fields in Text elements
Tabstrips - Output Options
For different fonts use this Style : IDWTCERTSTYLE
For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
5. Calling SMARTFORMS from your ABAP program
REPORT ZSMARTFORM.
Calling SMARTFORMS from your ABAP program.
Collecting all the table data in your program, and pass once to SMARTFORMS
SMARTFORMS
Declare your table type in :-
Global Settings -> Form Interface
Global Definintions -> Global Data
Main Window -> Table -> DATA
Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
http://sapr3.tripod.com
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc <> 0.
WRITE: / 'ERROR 1'.
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 =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
GS_MKPF = INT_MKPF
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.
What is SAP Smart Forms?
SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms.
SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can
configure forms with data from an SAP System for the relevant business processes.
To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form. When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module.
You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output.
You can check individual nodes as well as the entire form and find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.
SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as background graphics. You use background graphics to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, you can suppress the background graphic, if desired.
SAP Smart Forms also support postage optimizing.
Also read SAP Note No. 168368 - Smart Forms: New form tool in Release 4.6C
What Transaction to start SAP Smart Forms?
Execute transaction SMARTFORMS to start SAP Smart Forms.
Key Benefits of SAP Smart Forms:
SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time.
You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics.
To make changes, use Drag & Drop, Copy & Paste, and select different attributes.
These actions do not include writing of coding lines or using a Script language.
Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic. So you do not need a group of function modules to print a form, but only one.
For Web publishing, the system provides a generated XML output of the processed form.
Smart Forms provides a data stream called XML for Smart Forms (XSF) to allow the use of 3rd party printing tools. XSF passes form content from R/3 to an external product without passing any layout information about the Smart Form.
PROGRAM YMPSKEL MESSAGE-ID YL.
DESCRIPTION
written by !
TABLES:
DATA: OK_CODE(4), " ok code - screen 1
OK_CODE2(4).
DATA C LIKE SY-INDEX. " Index for screen loop
*& Module USER_COMMAND_0100 INPUT
process after input for screen 0100 *
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'SAVE'.
WHEN 'DISP'.
WHEN 'LIST'.
C = 0. "reset loop control
WHEN OTHERS.
ENDCASE.
CLEAR OK_CODE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
process before output for screen 0100 *
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'AMEND'. " set gui status
SET TITLEBAR '100'. " set title
ENDMODULE. " STATUS_0100 OUTPUT
*& Form SAVE data
Save screen details
FORM SAVE.
CLEAR OK_CODE.
ENDFORM.
*& Form DISPLAY
FORM DISPLAY.
ENDFORM.
*& Module EXIT_COMMAND INPUT
exit commands are processed before validation *
defined by E against function in menu painter(function list)
MODULE EXIT_COMMAND INPUT.
CASE OK_CODE.
WHEN 'EXIT'. CLEAR OK_CODE. SET SCREEN 0. LEAVE SCREEN.
WHEN 'CANC'. CLEAR OK_CODE. SET SCREEN 0. LEAVE SCREEN.
WHEN 'BACK'. CLEAR OK_CODE. SET SCREEN 0. LEAVE SCREEN.
ENDCASE.
ENDMODULE. " EXIT_COMMAND INPUT
*& Form list
text *
FORM LIST.
CLEAR OK_CODE. SET SCREEN 200. LEAVE SCREEN.
ENDFORM. " LIST
*& Module EXIT_COMMAND_200 INPUT
exit command processing for screen 200 *
defined by E against function in menu painter(function list)
MODULE EXIT_COMMAND_200 INPUT.
CASE OK_CODE2.
WHEN 'EXIT'. CLEAR OK_CODE2. SET SCREEN 0. LEAVE SCREEN.
WHEN 'CANC'. CLEAR OK_CODE2. SET SCREEN 0. LEAVE SCREEN.
WHEN 'BACK'. CLEAR OK_CODE2. SET SCREEN 100. LEAVE SCREEN.
ENDCASE.
ENDMODULE. " EXIT_COMMAND_200 INPUT
*& Module STATUS_0200 OUTPUT
process before output for screen 200 *
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'POPUP'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0200 OUTPUT
Module pool programs are created in abap development work bench (TCODE: SE80).
Here we can do all the works whatever you can do in abap.
Module pool programs are also called dialog programs.
The module Pool are reports prepared for different screens and to manage the sequence of events of these screens, in the transaction SE80 you can see all the dynpros that you have for this kind of report, add new ones, add all types of element to the report.
Process Before Output is the part of the dynpro code that is processed before the user can do anything with the data in the screen
Process After Input is the part of the dynpro code that is processed after the interaction with the user.
module pool programs are excuted using Tcodes
regards,
sreelakshmi -
hi , i could find find the credit memo in FI standard form and standard program at the given path
SPRO->IMG->Financial Accounting->Accounts Receivable & Accounts Payable->Customer Accounts->Line Items->Correspondence->Carry out and check settings for correspondence->define Form Names for corresponding print> here u can c ur program along with the Form assigned to it...
I copied the standard form to z form and assigned to standard program, now to know the elements in a write form which are triggered , i need to apply breakpoint in standard program and run the application to view the elements.. But , to apply breakpoints in the standard program, no form routine is given...Then how to identify where to apply breakpoints to identify the elements....
i will be very thankfull for the reply..
thanks..Hi,
Activate debugger as above for FORM, or copy the Standard print program name and open it in SE38 in display mode, Look for OPEN_FORM or WRITE_FORM fm in the Main print program and put break point. when you run the application it will stop at the break point.
Regards
Bala Krishna
Maybe you are looking for
-
How do you connect ipad 2 to itunes library using home sharing
How do you connect the ipad 2 to the itunes library using home sharing so you can listen on your ipad 2? I've seen directions for the ipad which tell you how to setup home sharing then open ipod and touch library in the left column, but when I hit li
-
Anyone have any idea's on this error message when I run my JAVA Code: Error Below. The thing is if I use a internal E-mail TO: address the mail and attachement is send. This only happens when I try to send a letter outside the firms MS Exchange serve
-
hi, oracle forms provides signed jar-files (frmall.jar, jacob.jar,...). is there a way to determine the certificate with which the particular jar-file was signed? regards, matthias
-
Adding manual condition types to a service contract
Hi, I need to add a manual condition type and price value at billplan line item level in a service contract. Could anyone please let me know any way of adding it after the service contract has already been created?
-
IMac 27'' little bit blurry after changing resolution.
Hello. I recently bought a 27'' iMac 2013. As the screen is too big I changed the resolution from 2560x1440 to 2048x1152. But it look a little bit blurry now. 2560x1440 is really good but texts and other thing hard to see. Is that normal? I think App