Tuesday, March 24, 2009

Puchace Order Smartform Driver Program

************************************************************************
* Druckroutinen für Einkaufsbelege *
************************************************************************
*----------------------------------------------------------------------*
* Datenteil
*----------------------------------------------------------------------*
INCLUDE ZFM06PTOP.
*INCLUDE FM06PTOP.
*----------------------------------------------------------------------*
* Datenbeschaffung
*----------------------------------------------------------------------*
*INCLUDE FM06PF01.
*----------------------------------------------------------------------*
* Formularausgabe
*----------------------------------------------------------------------*
*INCLUDE FM06PF02.
*----------------------------------------------------------------------*
* Sonstige PERFORM-Routinen
*----------------------------------------------------------------------*
*INCLUDE FM06PF03.
*----------------------------------------------------------------------*
* Dienstleistungsabwicklung
*----------------------------------------------------------------------*
*INCLUDE FM06PF04.
*----------------------------------------------------------------------*
* Matrixdruck für Varianten
*----------------------------------------------------------------------*
*INCLUDE FM06PFVA.
*----------------------------------------------------------------------*
* Entries
*----------------------------------------------------------------------*
*INCLUDE FM06PE01.
*INCLUDE FM06PF05.
*INCLUDE FM06PF06.
*INCLUDE FM06PF07.
*INCLUDE FM06PF08.
*INCLUDE FM06PF09.
INCLUDE ZFM06PE02.
*INCLUDE FM06PE02.
INCLUDE ZFM06PE03.
*INCLUDE FM06PE03.
INCLUDE ZFM06PE04.
*INCLUDE FM06PE04.

*&---------------------------------------------------------------------*
*& Form GET_EKKO_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_EKKO_DATA .
SELECT *
FROM EKKO
INTO TABLE IT_EKKO
WHERE EBELN = NAST-OBJKY.
IF SY-SUBRC <> 0.
* --- On Failure display message
MESSAGE S000(ZSAS_MSGCLASS) WITH 'No Data found with selection criteria'(003).
ENDIF.
ENDFORM. " GET_EKKO_DATA
*&---------------------------------------------------------------------*
*& Form GET_EKPO_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_EKPO_DATA .
IF NOT IT_EKKO[] IS INITIAL.
SELECT *
FROM EKPO
INTO TABLE IT_EKPO
FOR ALL ENTRIES IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
IF SY-SUBRC <> 0.
* --- On Failure display message
MESSAGE S000(ZSAS_MSGCLASS) WITH 'No Data found with selection criteria'(003).
ENDIF.
ENDIF.
ENDFORM. " GET_EKPO_DATA
*&---------------------------------------------------------------------*
*& Form GET_T001W_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_T001W_DATA .
IF NOT IT_EKPO[] IS INITIAL.
*-------SELECT construct to get the plant details
SELECT * "werks name1
FROM T001W
INTO TABLE IT_T001W
FOR ALL ENTRIES IN IT_EKPO
WHERE WERKS = IT_EKPO-WERKS.
IF SY-SUBRC <> 0.
* --- On Failure display message
MESSAGE S000(ZSAS_MSGCLASS) WITH 'No Data found with selection criteria'(003).
ENDIF.
ENDIF.
ENDFORM. " GET_T001W_DATA
*&---------------------------------------------------------------------*
*& Form GET_LFA1_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_LFA1_DATA .
IF NOT IT_EKKO IS INITIAL.
SELECT *
FROM LFA1
INTO TABLE IT_LFA1
FOR ALL ENTRIES IN IT_EKKO
WHERE LIFNR = IT_EKKO-LIFNR.
IF SY-SUBRC <> 0.
* --- On Failure display message
MESSAGE S000(ZSAS_MSGCLASS) WITH 'No Data found with selection criteria'(003).
ENDIF.
ENDIF.
ENDFORM. " GET_LFA1_DATA
*&---------------------------------------------------------------------*
*& Form GET_ADRC_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_ADRC_DATA .
IF NOT IT_T001W[] IS INITIAL.
SELECT * "addrnumber str_suppl3 location fax_number
FROM ADRC
INTO TABLE IT_ADRC
FOR ALL ENTRIES IN IT_T001W
WHERE ADDRNUMBER = IT_T001W-ADRNR.
IF SY-SUBRC <> 0.
* --- On Failure display message
MESSAGE S000(ZSAS_MSGCLASS) WITH 'No Data found with selection criteria'(003).
ENDIF.
ENDIF.
ENDFORM. " GET_ADRC_DATA
*&---------------------------------------------------------------------*
*& Form GET_ADR6_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_ADR6_DATA .
IF NOT IT_T001W[] IS INITIAL.
SELECT * "addrnumber smtp_addr
FROM ADR6
INTO TABLE IT_ADR6
FOR ALL ENTRIES IN IT_T001W
WHERE ADDRNUMBER = IT_T001W-ADRNR.
IF SY-SUBRC <> 0.
* --- On Failure display message
MESSAGE S000(ZSAS_MSGCLASS) WITH 'No Data found with selection criteria'(003).
ENDIF.
ENDIF.
ENDFORM. " GET_ADR6_DATA
*&---------------------------------------------------------------------*
*& Form GET_KONV_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_KONV_DATA .
IF NOT IT_EKKO[] IS INITIAL.
SELECT *
FROM KONV
INTO TABLE IT_KONV
FOR ALL ENTRIES IN IT_EKKO
WHERE KNUMV = IT_EKKO-KNUMV
AND KSCHL IN ('R001','P001').
IF SY-SUBRC <> 0.
* --- On Failure display message
MESSAGE S000(ZSAS_MSGCLASS) WITH 'No Data found with selection criteria'(003).
ENDIF.
ENDIF.
ENDFORM. " GET_KONV_DATA
*&---------------------------------------------------------------------*
*& Form GET_MAKT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_MAKT_DATA .
IF NOT IT_EKPO[] IS INITIAL.
SELECT *
FROM MAKT
INTO TABLE IT_MAKT
FOR ALL ENTRIES IN IT_EKPO
WHERE MATNR = IT_EKPO-MATNR.
IF SY-SUBRC <> 0.
* --- On Failure display message
MESSAGE S000(ZSAS_MSGCLASS) WITH 'No Data found with selection criteria'(003).
ENDIF.
ENDIF.
ENDFORM. " GET_MAKT_DATA
ZFM06PTOP

*&---------------------------------------------------------------------*
*& Include ZFM06PTOP
*&---------------------------------------------------------------------*
PROGRAM SAPFM06P MESSAGE-ID ME.
TYPE-POOLS: ADDI, meein,
MMPUR.
INCLUDE RVADTABL.
INCLUDE FM06P_CONST.
*----------------------------------------------------------------------*
* DATA DECLARATIONS *
*----------------------------------------------------------------------*
DATA: LF_FORMNAME TYPE TDSFNAME, " To get the Form name
LF_FM_NAME TYPE RS38L_FNAM. " To get the Fun.Module Name
DATA : CF_RETCODE.
DATA: ANZAL LIKE NAST-ANZAL. "HUNGARY
DATA: NAST_ANZAL LIKE NAST-ANZAL. "Number of outputs (Orig. + Cop.)
DATA: XSCREEN(1) TYPE C. "Output on printer or screen
DATA: REPEAT(1) TYPE C.
DATA: LS_COMPOSER_PARAM TYPE SSFCOMPOP.
DATA: LS_RECIPIENT TYPE SWOTOBJID.
DATA: LS_CONTROL_PARAM TYPE SSFCTRLOP.
DATA: LS_SENDER TYPE SWOTOBJID.
DATA: BEGIN OF OTFDATA1 OCCURS 0 .
INCLUDE STRUCTURE ITCOO .
DATA: END OF OTFDATA1 .

*----------------------------------------------------------------------*
* INTERNAL TABLE DECLARATIONS
*----------------------------------------------------------------------*
*--- Internal table to hold Plant
DATA : IT_T001W TYPE TABLE OF T001W,
*--- Internal table to hold Purchasing Document Header
IT_EKKO TYPE TABLE OF EKKO,
*--- Internal table to hold Purchasing Document Item
IT_EKPO TYPE TABLE OF EKPO,
*--- Internal table to hold Vendor
IT_LFA1 TYPE TABLE OF LFA1,
*--- Internal table to hold the Address details
IT_ADRC TYPE TABLE OF ADRC,
*--- Internal table to hold the Email Address details
IT_ADR6 TYPE TABLE OF ADR6,
*--- Internal table to hold the Condition data for the PO'S
IT_KONV TYPE TABLE OF KONV ,
*--- Internal table to hold the Material Descriptions
IT_MAKT TYPE TABLE OF MAKT,
*--- Internal Table to hold the Payments terms text
IT_T052U TYPE TABLE OF T052U,
*--- Internal table to hold long Texts
IT_TLINE TYPE TABLE OF TLINE,
IT_TLINE1 type table of TLINE,
IT_TLINE2 type table of TLINE.
DATA : wa_ekko type ekko.

ZFM06PE02

*&---------------------------------------------------------------------*
*& Include ZFM06PE02
*&---------------------------------------------------------------------*
FORM ENTRY_NEU USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.

CLEAR: ENT_RETCO, CF_RETCODE.
IF NAST-AENDE EQ SPACE.
L_DRUVO = '1'.
ELSE.
L_DRUVO = '2'.
ENDIF.
*--- Perform to get the Purchasing Document Header
PERFORM GET_EKKO_DATA.
*--- Perform to get the Purchasing Document Item
PERFORM GET_EKPO_DATA.
*--- Perform to get the plant details.
PERFORM GET_T001W_DATA.
*--- Perform to get the vendor details
PERFORM GET_LFA1_DATA.
*--- Perform to get the address details
PERFORM GET_ADRC_DATA.
*--- Perform to get the EMAIL Address
PERFORM GET_ADR6_DATA.
*--- Perform to get the Conditions
PERFORM GET_KONV_DATA.
*--- Perform to get the material description
PERFORM GET_MAKT_DATA.
*--- Perform to get the long text details

* call function 'ME_READ_PO_FOR_PRINTING'
* exporting
* ix_nast = nast
* ix_screen = ent_screen
* importing
* ex_retco = ent_retco
* ex_nast = l_nast
* doc = l_doc
* changing
* cx_druvo = l_druvo
* cx_from_memory = l_from_memory.
* check ent_retco eq 0.
* call function 'ME_PRINT_PO'
* exporting
* ix_nast = l_nast
* ix_druvo = l_druvo
* doc = l_doc
* ix_screen = ent_screen
* ix_from_memory = l_from_memory
* ix_toa_dara = toa_dara
* ix_arc_params = arc_params
* ix_fonam = tnapr-fonam "HW 214570
* importing
* ex_retco = ent_retco.
CLEAR : OTFDATA1,OTFDATA1[].
LF_FORMNAME = TNAPR-SFORM.
IF CF_RETCODE = 0.
*Changes By Dheeraj Upadhyaya on 22.07.2008 requested by Nilesh Damahe
if wa_ekko-frgke = 'R' or wa_ekko-frgke = ' '.
*End of Changes
*--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.
IF SY-SUBRC <> 0.
* error handling
CF_RETCODE = SY-SUBRC.
PERFORM PROTOCOL_UPDATE.
ENDIF.
*Changes By Dheeraj Upadhyaya on 22.07.2008 requested by Nilesh Damahe
else.
MESSAGE s001(ZSAS_MSGCLASS) WITH text-005.
exit.
endif.
*End of Changes
ENDIF.
IF CF_RETCODE = 0.
PERFORM CHECK_REPEAT.
IF NAST-KSCHL+2(1) = '0'.
CLEAR REPEAT.
ELSE.
REPEAT = 'X'.
ENDIF.
IF LS_COMPOSER_PARAM-TDCOPIES EQ 0.
NAST_ANZAL = 1.
ELSE.
NAST_ANZAL = LS_COMPOSER_PARAM-TDCOPIES.
ENDIF.
DO NAST_ANZAL TIMES.
*--In case of repetition only one time archiving
* if sy-index > 1 and nast-tdarmod = 3.
* nast_tdarmod = nast-tdarmod.
* nast-tdarmod = 1.
* ls_composer_param-tdarmod = 1.
* endif.
IF SY-INDEX NE 1 AND REPEAT IS INITIAL.
REPEAT = 'X'.
ENDIF.
CALL FUNCTION LF_FM_NAME
EXPORTING
ARCHIVE_INDEX = TOA_DARA
ARCHIVE_PARAMETERS = ARC_PARAMS
CONTROL_PARAMETERS = LS_CONTROL_PARAM
MAIL_RECIPIENT = LS_RECIPIENT
MAIL_SENDER = LS_SENDER
OUTPUT_OPTIONS = LS_COMPOSER_PARAM
USER_SETTINGS = SPACE
IS_NAST = NAST
IS_REPEAT = REPEAT
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
TABLES
IT_EKKO = IT_EKKO
IT_EKPO = IT_EKPO
IT_T001W = IT_T001W
IT_LFA1 = IT_LFA1
IT_ADRC = IT_ADRC
IT_ADR6 = IT_ADR6
IT_KONV = IT_KONV
IT_MAKT = IT_MAKT
IT_TLINE = IT_TLINE
IT_TLINE1 = IT_TLINE1
IT_TLINE2 = IT_TLINE2
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
* IF SY-SUBRC <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
* CALL FUNCTION LF_FM_NAME
* EXPORTING
* ARCHIVE_INDEX = TOA_DARA
* ARCHIVE_PARAMETERS = ARC_PARAMS
* CONTROL_PARAMETERS = LS_CONTROL_PARAM
* MAIL_RECIPIENT = LS_RECIPIENT
* MAIL_SENDER = LS_SENDER
* OUTPUT_OPTIONS = LS_COMPOSER_PARAM
* USER_SETTINGS = SPACE
* IS_NAST = NAST
* IS_REPEAT = REPEAT
* WA_EKKO = WA_EKKO
* WA_LFA1 = WA_LFA1
* WA_ADR6 = WA_ADR6
* WA_T001W = WA_T001W
* WA_EXCISE = WA_EXCISE
* WA_T052U = WA_T052U
* WA_T005T = WA_T005T
* WA_T024 = WA_T024
** IMPORTING
** DOCUMENT_OUTPUT_INFO =
** JOB_OUTPUT_INFO =
** JOB_OUTPUT_OPTIONS =
* TABLES
* IT_EKPO = IT_EKPO
* IT_KONV = IT_KONV
* IT_EKET = IT_EKET
* IT_T685T = IT_T685T
* IT_TLINE = IT_TLINE
* T_COLLECT = T_COLLECT
* T_KTEXT = T_KTEXT
* IT_ESLL = IT_ESLL
* IT_TLINE2 = IT_TLINE2
* IT_TLINE1 = IT_TLINE1
* EXCEPTIONS
* FORMATTING_ERROR = 1
* INTERNAL_ERROR = 2
* SEND_ERROR = 3
* USER_CANCELED = 4
* OTHERS = 5.
IF SY-SUBRC <> 0.
*--error handling
CF_RETCODE = SY-SUBRC.
PERFORM PROTOCOL_UPDATE.
ENDIF.
*--Parameter set for OTF output.
* LS_CONTROL_PARAM-PREVIEW = ' '.
* LS_CONTROL_PARAM-GETOTF = 'X'.
* LS_CONTROL_PARAM-NO_DIALOG = 'X'.
ENDDO.
ENDIF.
CLEAR it_ADR6.
ENDFORM. "entry_neu
*---------------------------------------------------------------------*
* FORM PROTOCOL_UPDATE *
*---------------------------------------------------------------------*
* The messages are collected for the processing protocol. *
*---------------------------------------------------------------------*
FORM PROTOCOL_UPDATE.
CHECK XSCREEN = SPACE.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
MSG_ARBGB = SYST-MSGID
MSG_NR = SYST-MSGNO
MSG_TY = SYST-MSGTY
MSG_V1 = SYST-MSGV1
MSG_V2 = SYST-MSGV2
MSG_V3 = SYST-MSGV3
MSG_V4 = SYST-MSGV4
EXCEPTIONS
OTHERS = 1.
ENDFORM. "PROTOCOL_UPDATE
*---------------------------------------------------------------------*
* FORM CHECK_REPEAT *
*---------------------------------------------------------------------*
* A text is printed, if it is a repeat print for the document. *
*---------------------------------------------------------------------*
FORM CHECK_REPEAT.
CLEAR REPEAT.
CLEAR ANZAL.
SELECT * INTO *NAST FROM NAST WHERE KAPPL = NAST-KAPPL
AND OBJKY = NAST-OBJKY
AND KSCHL = NAST-KSCHL
AND SPRAS = NAST-SPRAS
AND PARNR = NAST-PARNR
AND PARVW = NAST-PARVW
AND NACHA BETWEEN '1' AND '4'.
IF *NAST-VSTAT = '1'.
ANZAL = ANZAL + *NAST-ANZAL.
REPEAT = 'X'.
ENDIF.
ENDSELECT.
ENDFORM. "CHECK_REPEAT
*eject
*----------------------------------------------------------------------*
* Umlagerungsbestellung, Hinweis 670912 *
*----------------------------------------------------------------------*
FORM ENTRY_NEU_STO USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT,
F_STO. "670912

CLEAR ENT_RETCO.
IF NAST-AENDE EQ SPACE.
L_DRUVO = '1'.
ELSE.
L_DRUVO = '2'.
ENDIF.
F_STO = 'X'. "670912
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IX_STO = F_STO "670912
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_neu_sto
*eject
*----------------------------------------------------------------------*
* Mahnung
*----------------------------------------------------------------------*
FORM ENTRY_MAHN USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
L_DRUVO = '3'.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_mahn
*eject
*----------------------------------------------------------------------*
* Auftragsbestätigungsmahnung
*----------------------------------------------------------------------*
FORM ENTRY_AUFB USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
L_DRUVO = '7'.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_aufb
*eject
*----------------------------------------------------------------------*
* Lieferabrufdruck für Formular MEDRUCK mit Fortschrittszahlen
*----------------------------------------------------------------------*
FORM ENTRY_LPHE USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_XFZ,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
L_DRUVO = '9'.
L_XFZ = 'X'.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_XFZ = L_XFZ
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_lphe
*eject
*----------------------------------------------------------------------*
* Lieferabrufdruck für Formular MEDRUCK ohne Fortschrittszahlen
*----------------------------------------------------------------------*
FORM ENTRY_LPHE_CD USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
L_DRUVO = '9'.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_lphe_cd
*eject
*----------------------------------------------------------------------*
* Feinabrufdruck für Formular MEDRUCK mit Fortschrittszahlen
*----------------------------------------------------------------------*
FORM ENTRY_LPJE USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_XFZ,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
L_DRUVO = 'A'.
L_XFZ = 'X'.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_XFZ = L_XFZ
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_lpje
*eject
*----------------------------------------------------------------------*
* Feinabrufdruck für Formular MEDRUCK ohne Fortschrittszahlen
*----------------------------------------------------------------------*
FORM ENTRY_LPJE_CD USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
L_DRUVO = 'A'.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_lpje_cd
*eject
*----------------------------------------------------------------------*
* INCLUDE FM06PE02 *
*----------------------------------------------------------------------*
FORM ENTRY_NEU_MATRIX USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
IF NAST-AENDE EQ SPACE.
L_DRUVO = '1'.
ELSE.
L_DRUVO = '2'.
ENDIF.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_MFLAG = 'X'
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_neu_matrix
*eject
*----------------------------------------------------------------------*
* Angebotsabsage
*----------------------------------------------------------------------*
FORM ENTRY_ABSA USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
L_DRUVO = '4'.
CLEAR ENT_RETCO.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_absa
*eject
*----------------------------------------------------------------------*
* Lieferplaneinteilung
*----------------------------------------------------------------------*
FORM ENTRY_LPET USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
IF NAST-AENDE EQ SPACE.
L_DRUVO = '5'.
ELSE.
L_DRUVO = '8'.
ENDIF.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_lpet
*eject
*----------------------------------------------------------------------*
* Lieferplaneinteilung
*----------------------------------------------------------------------*
FORM ENTRY_LPFZ USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
IF NAST-AENDE EQ SPACE.
L_DRUVO = '5'.
ELSE.
L_DRUVO = '8'.
ENDIF.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_XFZ = 'X'
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_lpfz
*eject
*----------------------------------------------------------------------*
* Mahnung
*----------------------------------------------------------------------*
FORM ENTRY_LPMA USING ENT_RETCO ENT_SCREEN.
DATA: L_DRUVO LIKE T166K-DRUVO,
L_NAST LIKE NAST,
L_FROM_MEMORY,
L_DOC TYPE MEEIN_PURCHASE_DOC_PRINT.
CLEAR ENT_RETCO.
L_DRUVO = '6'.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
IX_NAST = NAST
IX_SCREEN = ENT_SCREEN
IMPORTING
EX_RETCO = ENT_RETCO
EX_NAST = L_NAST
DOC = L_DOC
CHANGING
CX_DRUVO = L_DRUVO
CX_FROM_MEMORY = L_FROM_MEMORY.
CHECK ENT_RETCO EQ 0.
CALL FUNCTION 'ME_PRINT_PO'
EXPORTING
IX_NAST = L_NAST
IX_DRUVO = L_DRUVO
DOC = L_DOC
IX_SCREEN = ENT_SCREEN
IX_FROM_MEMORY = L_FROM_MEMORY
IX_TOA_DARA = TOA_DARA
IX_ARC_PARAMS = ARC_PARAMS
IX_FONAM = TNAPR-FONAM "HW 214570
IMPORTING
EX_RETCO = ENT_RETCO.
ENDFORM. "entry_lpma

ZFM06PE03

*&---------------------------------------------------------------------*
*& Include ZFM06PE03
*&---------------------------------------------------------------------*
*&--------------------------------------------------------------------*
*& Form adobe_entry_neu
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->ENT_RETCO text
* -->ENT_SCREEN text
*---------------------------------------------------------------------*
FORM adobe_entry_neu USING ent_retco LIKE sy-subrc
ent_screen TYPE c.
DATA: xdruvo TYPE c.
IF nast-aende EQ space.
xdruvo = prntev_new.
ELSE.
xdruvo = prntev_chg.
ENDIF.
PERFORM adobe_print_output USING xdruvo
ent_screen
CHANGING ent_retco.

ENDFORM. " adobe_entry_neu


*&--------------------------------------------------------------------*
*& Form adobe_entry_mahn
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->ENT_RETCO text
* -->ENT_SCREEN text
*---------------------------------------------------------------------*
FORM adobe_entry_mahn USING ent_retco LIKE sy-subrc
ent_screen TYPE c.
DATA: xdruvo TYPE c.
xdruvo = prntev_mahn.
PERFORM adobe_print_output USING xdruvo
ent_screen
CHANGING ent_retco.
ENDFORM. " adobe_entry_mahn


*&--------------------------------------------------------------------*
*& Form adobe_entry_aufb
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->ENT_RETCO text
* -->ENT_SCREEN text
*---------------------------------------------------------------------*
FORM adobe_entry_aufb USING ent_retco LIKE sy-subrc
ent_screen TYPE c.
DATA: xdruvo TYPE c.
xdruvo = prntev_aufb.
PERFORM adobe_print_output USING xdruvo
ent_screen
CHANGING ent_retco.
ENDFORM. " adobe_entry_aufb.
ZFM06PE04

*&---------------------------------------------------------------------*
*& Include ZFM06PE04
*&---------------------------------------------------------------------*
FORM adobe_print_output USING value(if_druvo) TYPE druvo
value(if_preview) TYPE c
CHANGING ef_retco LIKE sy-subrc.
DATA: cl_output_po TYPE REF TO cl_purchase_order_output,
cl_output_knt TYPE REF TO cl_purchase_contract_output,
cl_output_schedagr TYPE REF TO cl_purchase_sched_agr_output,
fp_docparams TYPE sfpdocparams,
fp_outputparams TYPE sfpoutputparams,
fp_formoutput TYPE fpformoutput,
fp_interfacetype TYPE fpinterfacetype,
lf_formname TYPE fpname,
l_errstr TYPE string.
DATA: l_ebeln TYPE ebeln,
ls_ekko TYPE ekko,
W_CX_ROOT TYPE REF TO CX_ROOT,
MESG TYPE STRING.

IF nast-kappl = 'EF'.
CREATE OBJECT cl_output_po TYPE cl_purchase_order_output
EXPORTING c_mode = if_druvo
es_nast = nast.
CALL METHOD cl_output_po->read.
ELSE.
MOVE nast-objky(10) TO l_ebeln.
SELECT SINGLE * FROM ekko INTO ls_ekko
WHERE ebeln EQ l_ebeln.
IF ls_ekko-bstyp = 'K'.
CREATE OBJECT cl_output_knt TYPE cl_purchase_contract_output
EXPORTING c_mode = if_druvo
es_nast = nast.
CALL METHOD cl_output_knt->read.
ELSE.
CREATE OBJECT cl_output_schedagr
TYPE cl_purchase_sched_agr_output
EXPORTING c_mode = if_druvo
es_nast = nast.
CALL METHOD cl_output_schedagr->read.
ENDIF.
ENDIF.
DATA: ls_function TYPE rs38l_fnam, "LIKE tnapr-funcname,
ls_options TYPE ssfcompop,
ls_control TYPE ssfctrlop.
CLEAR ef_retco.
ls_function = tnapr-funcname.
IF NOT tnapr-fonam IS INITIAL.
lf_formname = tnapr-fonam.
TRY.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = lf_formname
IMPORTING
e_funcname = ls_function
e_interface_type = fp_interfacetype .
CATCH CX_ROOT INTO W_CX_ROOT.
MESG = W_CX_ROOT->GET_TEXT( ).
WRITE:/ MESG.
ENDTRY.
IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.

PERFORM fill_control_structure USING nast
if_preview
CHANGING fp_outputparams.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_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.
CLEAR: fp_docparams.
fp_docparams-langu = nast-tdspras.
fp_docparams-country = nast-tland.
IF nast-kappl = 'EF'.
call function ls_function
EXPORTING
/1bcdwb/docparams = fp_docparams
mode = cl_output_po->mode
header = cl_output_po->is_ekko
addressinfo = cl_output_po->is_t024e
headerinfo = cl_output_po->is_t166u
contactinfo = cl_output_po->is_t024
headertext = cl_output_po->it_t166k
paymentterms = cl_output_po->it_payment
item = cl_output_po->it_ekpo
itemline = cl_output_po->it_item
schedule = cl_output_po->it_eket
conditions = cl_output_po->it_komvd
manfdetails = cl_output_po->it_htnmat
changetext = cl_output_po->it_t166t
account = cl_output_po->it_ekkn
qmtext = cl_output_po->it_qmtext
texts = cl_output_po->it_t166p
documents = cl_output_po->it_drad
komk = cl_output_po->is_komk
componentshdr = cl_output_po->it_complist_hdr
components = cl_output_po->it_complist
invoice = cl_output_po->it_fpltdr
invoiceper = cl_output_po->it_fpltdr_per
invoiceval = cl_output_po->it_fpltdr_val
appendixtext = cl_output_po->it_t166a
shipinstr = cl_output_po->it_t027b
variants = cl_output_po->it_pekpov
configmat = cl_output_po->it_econf_out
services = cl_output_po->it_ml_esll
srvlines = cl_output_po->it_srvlines
srvtyp = cl_output_po->it_srvtyp
srvhdr = cl_output_po->it_srvhdr
srvtime = cl_output_po->it_time
srvvalue = cl_output_po->it_esuh
formulahdr = cl_output_po->it_formel
formulabody = cl_output_po->it_variablen
srvconditions = cl_output_po->it_komvd_srv
srvtext = cl_output_po->it_t166p_srv
chgtxtsrv = cl_output_po->it_t166t_srv
mainthdr = cl_output_po->it_mmpt
maintpos = cl_output_po->it_mpos.

ELSE.
IF ls_ekko-bstyp = 'K'.
call function ls_function
EXPORTING
/1bcdwb/docparams = fp_docparams
mode = cl_output_knt->mode
header = cl_output_knt->is_ekko
addressinfo = cl_output_knt->is_t024e
headerinfo = cl_output_knt->is_t166u
contactinfo = cl_output_knt->is_t024
headertext = cl_output_knt->it_t166k
paymentterms = cl_output_knt->it_payment
item = cl_output_knt->it_ekpo
itemline = cl_output_knt->it_item
schedule = cl_output_knt->it_eket
contconditions = cl_output_knt->it_ekomd
quanconditions = cl_output_knt->it_ekomd_quant
valueconditions = cl_output_knt->it_ekomd_value
lineconditions = cl_output_knt->it_ekomd_cond
manfdetails = cl_output_knt->it_htnmat
changetext = cl_output_knt->it_t166t
account = cl_output_knt->it_ekkn
qmtext = cl_output_knt->it_qmtext
texts = cl_output_knt->it_t166p
documents = cl_output_knt->it_drad
komk = cl_output_knt->is_komk
invoice = cl_output_knt->it_fpltdr
invoiceper = cl_output_knt->it_fpltdr_per
invoiceval = cl_output_knt->it_fpltdr_val
appendixtext = cl_output_knt->it_t166a
shipinstr = cl_output_knt->it_t027b
variants = cl_output_knt->it_pekpov
configmat = cl_output_knt->it_econf_out
services = cl_output_knt->it_ml_esll
srvlines = cl_output_knt->it_srvlines
srvtyp = cl_output_knt->it_srvtyp
srvhdr = cl_output_knt->it_srvhdr
srvtime = cl_output_knt->it_time
srvvalue = cl_output_knt->it_esuh
formulahdr = cl_output_knt->it_formel
formulabody = cl_output_knt->it_variablen
srvconditions = cl_output_knt->it_komvd_srv
srvtext = cl_output_knt->it_t166p_srv
chgtxtsrv = cl_output_knt->it_t166t_srv
mainthdr = cl_output_knt->it_mmpt
maintpos = cl_output_knt->it_mpos.
ELSE.
call function ls_function
EXPORTING
/1bcdwb/docparams = fp_docparams
mode = cl_output_schedagr->mode
header = cl_output_schedagr->is_ekko
addressinfo = cl_output_schedagr->is_t024e
headerinfo = cl_output_schedagr->is_t166u
contactinfo = cl_output_schedagr->is_t024
headertext = cl_output_schedagr->it_t166k
paymentterms = cl_output_schedagr->it_payment
item = cl_output_schedagr->it_ekpo
itemline = cl_output_schedagr->it_item
schedule = cl_output_schedagr->it_eket
conditions = cl_output_schedagr->it_komvd
contconditions = cl_output_schedagr->it_ekomd
quanconditions = cl_output_schedagr->it_ekomd_quant
valueconditions = cl_output_schedagr->it_ekomd_value
lineconditions = cl_output_schedagr->it_ekomd_cond
manfdetails = cl_output_schedagr->it_htnmat
changetext = cl_output_schedagr->it_t166t
account = cl_output_schedagr->it_ekkn
qmtext = cl_output_schedagr->it_qmtext
texts = cl_output_schedagr->it_t166p
documents = cl_output_schedagr->it_drad
komk = cl_output_schedagr->is_komk
invoice = cl_output_schedagr->it_fpltdr
invoiceper = cl_output_schedagr->it_fpltdr_per
invoiceval = cl_output_schedagr->it_fpltdr_val
appendixtext = cl_output_schedagr->it_t166a
shipinstr = cl_output_schedagr->it_t027b
variants = cl_output_schedagr->it_pekpov
configmat = cl_output_schedagr->it_econf_out
services = cl_output_schedagr->it_ml_esll
srvlines = cl_output_schedagr->it_srvlines
srvtyp = cl_output_schedagr->it_srvtyp
srvhdr = cl_output_schedagr->it_srvhdr
srvtime = cl_output_schedagr->it_time
srvvalue = cl_output_schedagr->it_esuh
formulahdr = cl_output_schedagr->it_formel
formulabody = cl_output_schedagr->it_variablen
srvconditions = cl_output_schedagr->it_komvd_srv
srvtext = cl_output_schedagr->it_t166p_srv
chgtxtsrv = cl_output_schedagr->it_t166t_srv
mainthdr = cl_output_schedagr->it_mmpt
maintpos = cl_output_schedagr->it_mpos.
ENDIF.
ENDIF.
CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'
IMPORTING
E_ADSERRSTR = l_errstr.


CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_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.
ENDFORM. " adobe_print_output


*&---------------------------------------------------------------------*
*& Form fill_control_structure
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_NAST text
* -->P_IF_PREVIEW text
* <--P_FP_OUTPUTPARAMS text
*----------------------------------------------------------------------*
FORM fill_control_structure USING value(is_nast) TYPE nast
value(if_preview) TYPE c
CHANGING es_outparms TYPE sfpoutputparams.
CLEAR: es_outparms.
IF if_preview IS INITIAL.
CLEAR: es_outparms-preview.
ELSE.
es_outparms-preview = 'X'.
ENDIF.
es_outparms-nodialog = 'X'.
es_outparms-dest = is_nast-ldest.
es_outparms-reqimm = is_nast-dimme.
es_outparms-reqdel = is_nast-delet.
es_outparms-copies = is_nast-anzal.
es_outparms-dataset = is_nast-dsnam.
es_outparms-suffix1 = is_nast-dsuf1.
es_outparms-suffix2 = is_nast-dsuf2.
es_outparms-covtitle = is_nast-tdcovtitle.
es_outparms-cover = is_nast-tdocover.
es_outparms-receiver = is_nast-tdreceiver.
es_outparms-division = is_nast-tddivision.
es_outparms-reqfinal = 'X'.
es_outparms-arcmode = is_nast-tdarmod.
es_outparms-schedule = is_nast-tdschedule.
es_outparms-senddate = is_nast-vsdat.
es_outparms-sendtime = is_nast-vsura.

ENDFORM. " fill_control_structure

Wednesday, March 18, 2009

Dynamic Table Maintainance

REPORT ZDEMO NO STANDARD PAGE HEADING.
TYPE-POOLS: rsds.
DATA: is_x030l TYPE x030l,
it_dfies TYPE TABLE OF dfies,
is_dfies TYPE dfies,
it_fdiff TYPE TABLE OF field_dif,
is_fdiff TYPE field_dif.
DATA: w_selid TYPE rsdynsel-selid,
it_tables TYPE TABLE OF rsdstabs,
is_tables TYPE rsdstabs,
it_fields TYPE TABLE OF rsdsfields,
it_expr TYPE rsds_texpr,
it_ranges TYPE rsds_trange,
it_where TYPE rsds_twhere,
is_where TYPE rsds_where,
w_active TYPE i.
DATA: it_content TYPE REF TO data,
it_modif TYPE REF TO data,
it_fcat TYPE lvc_t_fcat.
DATA: w_okcode TYPE sy-ucomm.

FIELD-SYMBOLS: TYPE STANDARD TABLE,
TYPE STANDARD TABLE.

* Macros
DEFINE table_error.
message e398(00) with 'Table' p_table &1.
END-OF-DEFINITION.
DEFINE fixed_val.
is_fdiff-fieldname = is_dfies-fieldname.
is_fdiff-fixed_val = &1.
is_fdiff-no_input = 'X'.
append is_fdiff to it_fdiff.
END-OF-DEFINITION.

* Selection screen
SELECTION-SCREEN: BEGIN OF BLOCK b01 WITH FRAME.
PARAMETERS: p_table TYPE tabname OBLIGATORY "table
MEMORY ID dtb
MATCHCODE OBJECT dd_dbtb_16.
SELECTION-SCREEN: BEGIN OF LINE,
PUSHBUTTON 33(20) selopt USER-COMMAND sel,
COMMENT 55(15) selcnt,
END OF LINE.
SELECTION-SCREEN: SKIP.
PARAMETERS: p_rows TYPE i. "rows
SELECTION-SCREEN: END OF BLOCK b01,
SKIP,
BEGIN OF BLOCK b02 WITH FRAME.
PARAMETERS: p_displ TYPE c AS CHECKBOX. "display
SELECTION-SCREEN: END OF BLOCK b02.
* Initialization
INITIALIZATION.
MOVE '@4G@ Filter records' TO selopt.
* PBO
AT SELECTION-SCREEN OUTPUT.
IF w_active IS INITIAL.
CLEAR: selcnt.
ELSE.
WRITE w_active TO selcnt LEFT-JUSTIFIED.
ENDIF.
* PAI
AT SELECTION-SCREEN.
IF p_table NE is_x030l-tabname.
CALL FUNCTION 'DDIF_NAMETAB_GET'
EXPORTING
tabname = p_table
IMPORTING
x030l_wa = is_x030l
TABLES
dfies_tab = it_dfies
EXCEPTIONS
OTHERS = 1.
IF is_x030l IS INITIAL.
table_error 'does not exist or is not active'.
ELSEIF is_x030l-tabtype NE 'T'.
table_error 'is not selectable'.
ELSEIF is_x030l-align NE 0.
table_error 'has alignment - cannot continue'.
ENDIF.
* Default values for system fields
REFRESH: it_fdiff.
is_fdiff-tabname = p_table.
LOOP AT it_dfies INTO is_dfies.
IF is_dfies-datatype = 'CLNT'.
fixed_val sy-mandt.
ELSEIF is_dfies-rollname = 'ERDAT'
OR is_dfies-rollname = 'ERSDA'
OR is_dfies-rollname = 'AEDAT'
OR is_dfies-rollname = 'LAEDA'.
fixed_val sy-datum.
ELSEIF is_dfies-rollname = 'ERTIM'
OR is_dfies-rollname = 'AETIM'.
fixed_val sy-uzeit.
ELSEIF is_dfies-rollname = 'ERNAM'
OR is_dfies-rollname = 'AENAM'.
fixed_val sy-uname.
ENDIF.
ENDLOOP.
* Prepare free selection on table
REFRESH it_tables.
is_tables-prim_tab = p_table.
APPEND is_tables TO it_tables.
CLEAR: w_selid.
ENDIF.
IF sy-ucomm = 'SEL'.
IF w_selid IS INITIAL.
* Init free selection dialog
CALL FUNCTION 'FREE_SELECTIONS_INIT'
EXPORTING
expressions = it_expr
IMPORTING
selection_id = w_selid
expressions = it_expr
TABLES
tables_tab = it_tables
EXCEPTIONS
OTHERS = 1.
ENDIF.
* Display free selection dialog
CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
EXPORTING
selection_id = w_selid
title = 'Selection'
status = 1
as_window = 'X'
IMPORTING
expressions = it_expr
field_ranges = it_ranges
number_of_active_fields = w_active
TABLES
fields_tab = it_fields
EXCEPTIONS
OTHERS = 1.
ENDIF.

* Start of processing
START-OF-SELECTION.
PERFORM f_create_table USING p_table.
PERFORM f_select_table.
PERFORM f_display_table.

*---------------------------------------------------------------------*
* FORM f_create_table *
*---------------------------------------------------------------------*
FORM f_create_table USING in_tabname.
FIELD-SYMBOLS: TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = in_tabname
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
* Complete field catalog
LOOP AT it_fcat ASSIGNING .
-tabname = in_tabname.
ENDLOOP.
CALL FUNCTION 'LVC_FIELDCAT_COMPLETE'
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
OTHERS = 1.
ELSE.
WRITE: 'Error building field catalog'.
STOP.
ENDIF.
* Create dynamic table for data
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_content.
IF sy-subrc = 0.
ASSIGN it_content->* TO .
ELSE.
WRITE: 'Error creating internal table'.
STOP.
ENDIF.
* Create dynamic table for modif
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_modif.
IF sy-subrc = 0.
ASSIGN it_modif->* TO .
ELSE.
WRITE: 'Error creating internal table'.
STOP.
ENDIF.
ENDFORM.

*---------------------------------------------------------------------*
* FORM f_select_table *
*---------------------------------------------------------------------*
FORM f_select_table.
IF w_active = 0.
SELECT * FROM (p_table)
INTO CORRESPONDING FIELDS OF TABLE
UP TO p_rows ROWS.
ELSE.
* Selection with parameters
CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_WHERE'
EXPORTING
field_ranges = it_ranges
IMPORTING
where_clauses = it_where.
READ TABLE it_where INTO is_where WITH KEY tablename = p_table.
SELECT * FROM (p_table)
INTO CORRESPONDING FIELDS OF TABLE
UP TO p_rows ROWS
WHERE (is_where-where_tab).
ENDIF.
IF sy-dbcnt = 0.
WRITE: 'No record selected'.
STOP.
ENDIF.
ENDFORM.

*---------------------------------------------------------------------*
* FORM f_display_table *
*---------------------------------------------------------------------*
FORM f_display_table.
DATA: l_answer TYPE c,
l_eflag TYPE c.
CLEAR: w_okcode.
REFRESH: .
* Display table contents
CALL FUNCTION 'STC1_FULLSCREEN_TABLE_CONTROL'
EXPORTING
header = p_table
tabname = p_table
display_only = p_displ
endless = 'X'
no_button = space
IMPORTING
okcode = w_okcode
TABLES
nametab = it_dfies
table =
fielddif = it_fdiff
modif_table =
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
IF p_displ IS INITIAL AND w_okcode = 'SAVE'.
* Confirm update
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = p_table
text_question = 'Do you want to update table ?'
default_button = '2'
display_cancel_button = ' '
IMPORTING
answer = l_answer
EXCEPTIONS
OTHERS = 1.
IF l_answer = '1'.
* Apply modifications
IF NOT [] IS INITIAL.
PERFORM f_add_system USING space.
MODIFY (p_table) FROM TABLE .
IF sy-subrc NE 0.
l_eflag = 'X'.
ENDIF.
ENDIF.
* Apply deletions
IF l_eflag IS INITIAL.
REFRESH: .
CALL FUNCTION 'STC1_GET_DATA'
TABLES
deleted_data =
EXCEPTIONS
OTHERS = 1.
IF NOT [] IS INITIAL.
DELETE (p_table) FROM TABLE .
IF sy-subrc NE 0.
ROLLBACK WORK.
l_eflag = 'X'.
ENDIF.
ENDIF.
ENDIF.
* Apply creations
IF l_eflag IS INITIAL.
REFRESH: .
CALL FUNCTION 'STC1_GET_DATA'
TABLES
new_data =
EXCEPTIONS
OTHERS = 1.
IF NOT [] IS INITIAL.
PERFORM f_add_system USING 'X'.
INSERT (p_table) FROM TABLE .
IF sy-subrc NE 0.
ROLLBACK WORK.
l_eflag = 'X'.
ENDIF.
ENDIF.
ENDIF.
IF l_eflag IS INITIAL.
COMMIT WORK.
MESSAGE s261(53).
ELSE.
MESSAGE s075(3i).
PERFORM f_select_table.
ENDIF.
ENDIF.
* Display table again
PERFORM f_display_table.
ENDIF.
ENDIF.
ENDFORM.

*---------------------------------------------------------------------*
* FORM f_add_system *
*---------------------------------------------------------------------*
FORM f_add_system USING new TYPE c.
FIELD-SYMBOLS: TYPE ANY,
TYPE ANY.
LOOP AT it_fdiff INTO is_fdiff.
READ TABLE it_dfies INTO is_dfies
WITH KEY fieldname = is_fdiff-fieldname.
LOOP AT ASSIGNING .
ASSIGN COMPONENT is_fdiff-fieldname OF STRUCTURE TO .
IF is_dfies-datatype = 'CLNT'.
= sy-mandt.
ELSE.
CASE is_dfies-rollname.
WHEN 'AENAM'.
= sy-uname.
WHEN 'AEDAT' OR 'LAEDA'.
= sy-datum.
WHEN 'AETIM'.
= sy-uzeit.
WHEN OTHERS.
ENDCASE.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM.

Tabstrip on Selection Screen

TABLES: sscrfields.
* SUBSCREEN 1 For Tabstrip BUTTON1
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p1(10) TYPE c,
p2(10) TYPE c,
p3(10) TYPE c.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN END OF SCREEN 100.
* SUBSCREEN 2 For Tabstrip BUTTON2
SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS: q1(10) TYPE c OBLIGATORY,
q2(10) TYPE c.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 200.
* Go to tcode SE51 Create screen no 0300
* with screen type = subscreen
* STANDARD SELECTION SCREEN
PARAMETERS: h1(10) TYPE c.
SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 10 LINES,
TAB (20) button1 USER-COMMAND push1
DEFAULT SCREEN 100,
TAB (20) button2 USER-COMMAND push2
DEFAULT SCREEN 200,
TAB (20) button3 USER-COMMAND push3
DEFAULT SCREEN 300,
END OF BLOCK mytab.
INITIALIZATION.
button1 = 'This is sel-screen 100'.
button2 = 'This is sel-screen 200'.
button3 = 'This is screen 300'.
mytab-prog = sy-repid.
mytab-dynnr = 100.
mytab-activetab = 'BUTTON1'.
AT SELECTION-SCREEN.
CASE sy-dynnr.
WHEN 1000.
WHEN 100.
IF p1 IS INITIAL.
sscrfields-ucomm = 'PUSH1'.
MESSAGE I888(sabapdocu) WITH 'Make an entry in P1'.
ENDIF.
WHEN 200.
MESSAGE s888(sabapdocu) WITH 'Validation on' sy-dynnr.
ENDCASE.

START-OF-SELECTION.
WRITE: / 'P1:', p1,'Q1:', q1,
/ 'P2:', p2,'Q2:', q2,
/ 'P3:', p3.

Tuesday, March 17, 2009

Separators exchange in the Displaying of Amount

HRCM_AMOUNT_TO_STRING_CONVERT
Converts the Decimal Separators and the Thosand Separators
Ex: Input : 1000,000.00
Output : 1000.000,

Subtotal and Grand Total Text

*---type pools
TYPE-POOLS: slis.
*---internal tables
DATA: BEGIN OF it_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN,
ERDAT LIKE VBAK-ERDAT,
NETWR LIKE VBAK-NETWR,
END OF it_VBAK,
*--internal tables for alv
it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fcat LIKE LINE OF it_fieldcat,
* layout TYPE slis_layout_alv,
gd_layout type slis_layout_alv,
it_sort type slis_t_sortinfo_alv,
wa_sort like line of it_sort.
*---start-of-selection .
START-OF-SELECTION.CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_VBAK'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
*----get data
SELECT VBELN
ERDAT
NETWR
FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE it_VBAK
UP TO 20 ROWS.
.
wa_fcat-do_sum = 'X'.
MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
WHERE fieldname = 'NETWR' .
wa_sort-fieldname = 'ERDAT'.
wa_sort-group = 'UL'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
wa_sort-fieldname = 'ERDAT'.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
*-----------------------
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
GD_LAYOUT-SUBTOTALS_TEXT = 'SubTotals'.
gd_layout-totals_text = 'Totals'.
*-----------------------
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = gd_layout
it_fieldcat = it_fieldcat
it_sort = it_sort
TABLES
t_outtab = it_VBAK
EXCEPTIONS
program_error = 1.

Wednesday, March 11, 2009

SD User Exits

Sales realated exits
SDAPO001 Activating Sourcing Subitem Quantity Propagation
SDTRM001 Reschedule schedule lines without a new ATP check
V45A0001 Determine alternative materials for product selection
V45A0002 Predefine sold-to party in sales document
V45A0003 Collector for customer function modulpool
MV45AV45A0004 Copy packing proposal
V45E0001 Update the purchase order from the sales order
V45E0002 Data transfer in procurement elements (PRreq., assembly)
V45L0001 SD component supplier processing (customer enhancements)
V45P0001 SD customer function for cross-company code sales
V45S0001 Update sales document from configuration
V45S0003 MRP-relevance for incomplete configuration
V45S0004 Effectivity type in sales order
V45W0001 SD Service Management: Forward Contract Data to Item
V46H0001 SD Customer functions for resource-related billing
V60F0001 SD Billing plan (customer enhancement) diff. to billing planI
NCLUDE MV45ATZZ - For entering metadata for sales document processing.
INCLUDE MV45AOZZ - For entering additional installation-specific modules for sales document processing which are called up by the screen and run under PBO (Process Before Output) prior to output of the screen.
INCLUDE MV45AIZZ - For entering additional installation-specific modules for sales document processing. These are called up by the screen and run under PAI (Process After Input) after data input (for example, data validation).
INCLUDE MV45AFZZ and MV45EFZ1 - For entering installation-specific FORM routines and for using user exits, which may be required and can be used if necessary.
For more details see Help link below.
Billing related exits
SDVFX001 User exit header line in delivery to accounting
SDVFX002 User exit for A/R line in transfer to accounting
SDVFX003 User exit cash clearing in transfer to accounting
SDVFX004 User exit G/L line in transfer to accounting
SDVFX005 User exit reserves in transfer to accounting
SDVFX006 User exit tax line in transfer to accounting
SDVFX007 User exit: Billing plan during transfer to Accounting
SDVFX008 User exit: Processing of transfer structures
SD-FISDVFX009 Billing doc. processing KIDONO (payment reference number)
SDVFX010 User exit item table for the customer lines
SDVFX011 Userexit for the komkcv- and kompcv-structures
V05I0001 User exits for billing index
V05N0001 User Exits for Printing Billing Docs. using POR Procedure
V60A0001 Customer functions in the billing document
V60P0001 Data provision for additional fields for display in lists
V61A0001 Customer enhancement: Pricing
Delivery related exits
V50PSTAT - Delivery: Item Status Calculation
V50Q0001 - Delivery Monitor: User Exits for Filling Display Fields
V50R0001 - Collective processing for delivery creation
V50R0002 - Collective processing for delivery creation
V50R0004 - Calculation of Stock for POs for Shipping Due Date List
V50S0001 - User Exits for Delivery Processing
V53C0001 - Rough workload calculation in time per item
V53C0002 - W&S: RWE enhancement - shipping material type/time slot
V53W0001 - User exits for creating picking waves
VMDE0001 - Shipping Interface: Error Handling - Inbound IDoc
VMDE0002 - Shipping Interface: Message PICKSD (Picking, Outbound)
VMDE0003 - Shipping Interface: Message SDPICK (Picking, Inbound)
VMDE0004 - Shipping Interface: Message SDPACK (Packing, Inbound)
V02V0001 - Sales area determination for stock transport order
V02V0002 - User exit for storage location determination
V02V0003 - User exit for gate + matl staging area determination (headr)
V02V0004 - User Exit for Staging Area Determination (Item)
MV50AFZ1 - User Exits for Delivery Processing
MV50AFZ2 - User Exit for Batch Quantity Allocation
MV50AFZ3 - LIPS-KOQUI (Picking is subject to confirmation) determination
MV50AFZK - The user exits in this include can be used to fill the condition tables for material listing and material exclusion (KOMKG and KOMPG) and product selection (KOMKD and KOMPD) with own data.
MV50AFZL - In delivery creation process for sales orders there is the possibility to restrict the delivery creation to some order items. If these order items are member of a delivery group, but not all items of this delivery group are includes in the restriction range of the order item nubers, you can specify in this routine what to do.
MV50AFZP - This user exit can be used to modify change mode of pricing screens in delivery processing.
MV50AFZZ - Users Exit for Batch Determination; LIPS-LGORT determination
User Exits for Transportation
INCLUDE MV56AOZZ - You can include your own modules in this program, to be processed in shipment processing screens during PBO.
INCLUDE MV56AIZZ - You can include your own modules in this program, to be processed in shipment processing screens during PAI.
INCLUDE MV56AFZY - You can include your own FORM routines in this program. They can contain your own adjustments for shipment processsing.
INCLUDE MV56AFZZ - This program contains pre-defined FORM routines, in which you can carry out your own adjustments for transportation processing.
For additional user exits see CMOD transaction and SAP Help link below.
User Exits for Price Determination
USEREXIT_PRICING_PREPARE_TKOMK (module pool SAPLV60A, program RV60AFZZ)This user exit allows you to copy additional fields for pricing in the TKOMK communication structure (header fields), which have not been provided in the standard SAP system. These fields can also be used for pricing in the billing document.This user exit is described in detail in the "New fields in pricing" section.
USEREXIT_PRICING_PREPARE_TKOMP (module pool SAPLV60A, program RV60AFZZ)This user exit allows you to copy additional fields for pricing in the TKOMP communication structure (item fields), which have not been provided in the standard SAP system. These fields can also be used for pricing.This user exit is described in detail in the "New fields in pricing" section.
USEREXIT_FIELD_MODIFICATION (module pool SAPMV61A, program MV61AFZA)You can use this user exit to adjust the display of individual lines in the condition screen by changing the display attributes of the screen fields. This does not include the display of subtotals.This user exit is also used in order processing.
USEREXIT_FIELD_MODIFIC_KZWI (module pool SAPMV61A, program MV61AFZB)You can change the display of subtotals in the condition screen by changing the display attributes of the screen fields.This user exit is also used in order processing.
USEREXIT_FIELD_MODIFIC_KOPF (module pool SAPMV61A, program MV61AFZB)You can adjust the display of subtotals in the condition screen to your requirements by changing the display attributes of the screen fields.This user exit is also used in order processing.
USEREXIT_FIELD_MODIFIC_LEER (module pool SAPMV61A, program MV61AFZB)You can adjust the display of blank lines in the condition screen to your requirements by changing the display attributes of the screen fields.This user exit is also used in order processing.
USEREXIT_PRICING_CHECK (module pool SAPMV61, program MV61AFZA)You can install additional checks to the standard checks of condition lines (e.g. maximum/minimum value).
USEREXIT_PRICING_RULE (module pool SAPLV61A, program RV61AFZA)In the standard SAP system, it is predefined which condition categories and classes can be copied or recalculated per pricing type. You can change the predefined standard procedure for each pricing type.
USEREXIT_CHANGE_PRICING_RULE (module pool SAPMV61A, program MV61AFZA)You can use this user exit to change the pricing type that has been predefined in the copying control table in billing.
USEREXIT_XKOMV_BEWERTEN_INIT (module pool SAPLV61A, program RV61AFZB)This field is used in the formulas and therefore initialized before the loop for the pricing procedure starts.
USEREXIT_XKOMV_BEWERTEN_END (module pool SAPLV61A, program RV61AFZB)Within a loop for the price components during pricing, specific values can be transferred into the communication structures in pricing to be further processed.
USEREXIT_XKOMV_ERGAENZEN (module pool SAPLV61A, program RV61AFZB)In change mode, you can change the dynamic part of the condition record (KONVD) that is always redetermined (i.e. it is not stored in database table KONV).
USEREXIT_XKOMV_ERGAENZEN_MANU (module pool SAPLV61A, program RV61AFZB)You can use this user exit to change the ready-for-input fields of the manually entered condition record in add mode in the condition screen.
USEREXIT_XKOMV_FUELLEN (module pool SAPLV61A, program RV61AFZB)This user exit is always called up during a redetermination of all or individual price components. You can change the work fields of the condition line. However, this only applies to conditions that have been determined via a condition record.
USEREXIT_XKOMV_FUELLEN_O_KONP (module pool SAPLV61A, program RV61AFZB)This user exit is always called up during a redetermination of all or individual price components. You can change the work fields of the condition line. However, this only applies to conditions that have been determined via a condition record. This may include subtotals, manually entered conditions or conditions that have been calculated with a formula.
USEREXIT_PRICING_COPY (module pool SAPLV61A, program RV61AFZA)You can change the KONV fields for copied price components.
Note: as of Release 4.6A, the display of the condition screen (screen 6201) has been converted from a full screen to a subscreen. The full screen is included in the SAPMV61A module pool, the subscreen, however, in program SAPLV69A. Therefore, instead of MV61AFZA and MV61AFZB, the user exits in LV69AFZZ should be used. For reference, see OSS note 313569.
User Exits for Partner Determination
Partner determination contains the following user exits for your use:
EXIT_SAPLV09A_001You can use this user exit to control whether an address that was entered manually and has already been used in other documents (referenced), should be referenced again if it changes or whether a new address shold be created (duplicated).
EXIT_SAPLV09A_002Call up this user exit if a customer has not been maintained in the current sales area.
EXIT_SAPLV09A_003Use this user exit to control the origin of partners in the partner determination procedure (origin X, Y or Z). If X, Y, or Z has been entered in the Origin field, this user exit is automatically called up during partner determination.
EXIT_SAPLV09A_004Use this user exit to integrate your own check in a program, that runs before the partner is saved in the document.For more detailed information, see the program documentation for each ofthe user exits.
User Exits For Credit Checks
If you want to carry out your own individual credit checks, that differ from those in the standard system, you must define them in the following user exits:LVKMPTZZLVKMPFZ1: USER_CREDIT_CHECK1LVKMPFZ2: USER_CREDIT_CHECK2LVKMPFZ3: USER_CREDIT_CHECK3
User Exit for availability check
User exit USEREXIT_AVAIL_CHECK_CREDIT exists in Include MV45AFZF.This user exit allows you to determine whether the system should or should not carry out an availability check after a blocked document has been released or after a new credit check.
User Exit for Risk Management for Receivables
RVKMPUS2Using this user exit, you can define new forms of payment guarantee.
User Exits for Billing Plan
RV60FUS1 - User Exit from SAPLV60F, Billing Plan: Distribute Difference
RV60FUS2 - User exit from SAPLV60F, Billing plan: Prepare pricing
RV60FUS3 - User Exit From SAPLV60F, Bill. Plan: Deadline Proposal From Source
RV60FUS4 - User exit from SAPLV60F, field preparation field selection for screen
RV60FUS5 - This userexit can be used to split date lines TKOMK for Header fields
RV60FUST - User Part for Billing Plan - Data Definition
Additional User Exits in Billing Document
Fill in the fields in VBRK/VBRP tables - USEREXIT_FILL_VBRK_VBRP in the include RV60AFZC.
Determine the number range for internal document number - USEREXIT_NUMBER_RANGE_INV_DATE in the include RV60AFZC.
User exits for printing - include RV61AFZB

SAP Help - User Exits in Sales Document

http://help.sap.com/saphelp_46c/helpdata/en/1c/f62c7dd435d1118b3f0060b03ca329/content.htm

SAP Help - User Exits for Billing

http://help.sap.com/saphelp_40b/helpdata/es/18/f62c7dd435d1118b3f0060b03ca329/content.htm

SAP Help - Transferring new SD fields to Accounting

http://help.sap.com/saphelp_40b/helpdata/es/0b/f62c7dd435d1118b3f0060b03ca329/content.htm

SAP Help - User Exits in Transportation

http://help.sap.com/saphelp_40b/helpdata/pt/17/f62c7dd435d1118b3f0060b03ca329/content.htm

SAP Help - User Exits for Billing Plan

http://help.sap.com/saphelp_45b/helpdata/en/22/f62c7dd435d1118b3f0060b03ca329/content.htm