PDF ФОРМУЛЯРЫ
транзакция sfp
Уроки: http://saptechnical.com/Tutorials/AdobeForms/
EXAMPLE
В интерфейсе параметр инпут EMPLOYEE_NAME типа ENAME
Функция FM_NAME сгенерирована по патерну из /1BCDWB/SM00000010 , значение которого взято из запустившейся формы на транзакции sfp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
REPORT ZPDF_TEST. DATA: CUSTOMER TYPE SCUSTOM, BOOKINGS TYPE TY_BOOKINGS, CONNECTIONS TYPE TY_CONNECTIONS, FM_NAME TYPE RS38L_FNAM, FP_DOCPARAMS TYPE SFPDOCPARAMS, FP_OUTPUTPARAMS TYPE SFPOUTPUTPARAMS. 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. ENDIF. CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' EXPORTING I_NAME = 'ZDEMO_FORM1' IMPORTING E_FUNCNAME = FM_NAME. IF SY-SUBRC <> 0. ENDIF. CALL FUNCTION FM_NAME EXPORTING * /1BCDWB/DOCPARAMS = EMPLOYEE_NAME = 'nimkm' * IMPORTING * /1BCDWB/FORMOUTPUT = * EXCEPTIONS * USAGE_ERROR = 1 * SYSTEM_ERROR = 2 * INTERNAL_ERROR = 3 * OTHERS = 4 . IF SY-SUBRC <> 0. * Implement suitable error handling here ENDIF. CALL FUNCTION 'FP_JOB_CLOSE' * IMPORTING * E_RESULT = EXCEPTIONS USAGE_ERROR = 1 SYSTEM_ERROR = 2 INTERNAL_ERROR = 3 OTHERS = 4. IF SY-SUBRC <> 0. ENDIF. |
С таблицей (вывод)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
*&---------------------------------------------------------------------* *& Report ZPDF_TEST1 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT zpdf_test1. TABLES: zavto. DATA: ztab TYPE TABLE OF zavto. SELECT * FROM zavto INTO TABLE ztab. DATA: CUSTOMER TYPE SCUSTOM, BOOKINGS TYPE TY_BOOKINGS, CONNECTIONS TYPE TY_CONNECTIONS, FM_NAME TYPE RS38L_FNAM, FP_DOCPARAMS TYPE SFPDOCPARAMS, FP_OUTPUTPARAMS TYPE SFPOUTPUTPARAMS. 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. ENDIF. CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' EXPORTING I_NAME = 'ZDEMO_FORM' IMPORTING E_FUNCNAME = FM_NAME. IF SY-SUBRC <> 0. ENDIF. CALL FUNCTION FM_NAME EXPORTING * /1BCDWB/DOCPARAMS = avto = ztab. * IMPORTING * /1BCDWB/FORMOUTPUT = * EXCEPTIONS * USAGE_ERROR = 1 * SYSTEM_ERROR = 2 * INTERNAL_ERROR = 3 * OTHERS = 4 . IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. CALL FUNCTION 'FP_JOB_CLOSE' * IMPORTING * E_RESULT = EXCEPTIONS USAGE_ERROR = 1 SYSTEM_ERROR = 2 INTERNAL_ERROR = 3 OTHERS = 4. IF SY-SUBRC <> 0. ENDIF. |
BADI
1 2 3 4 5 6 7 8 9 10 |
REPORT ZDEMO_BADI. ENHANCEMENT-POINT ZTEST_EHN_BADI SPOTS ZTEST_EHN_BADI . *$*$-Start: ZTEST_EHN_BADI----------------------------------------------------------------------$*$* ENHANCEMENT 1 ZTEST_EHN1_BADI. "active version * DATA: handler TYPE REF TO ZDEMO_BADI. GET BADI handler. CALL BADI handler->dispmsg. ENDENHANCEMENT. |
se18, внедрение -> создать
Можно обращаться к полям таблицы вот так
1 |
CHECK TTEXT[ 1 ]-maktx = 'test'. |
Пример BADI. Выдает сообщение, если описание товара начинается на заглавную букву A (eng.)
На транзакции se18 добавил реализацию бади ( бади узнал на транзакции SE24, указываем класс “cl_exithandler”.) Далее брэйк на case sy-subrc метода get Instance. и в отладчике ловим имя бади в переменной exit_name
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
DATA desc TYPE SKTEXT. DATA name TYPE sktext-maktx. READ TABLE ttext INTO desc INDEX 1. IF desc-maktx = 'test'. MESSAGE 'check add retail' TYPE 'I'. ENDIF. name = desc-maktx. CHECK name(1) = 'A'. MESSAGE 'check add retail' TYPE 'I'. |
Пример вывода сообщения во встроенный класс
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
METHOD if_ex_badi_material_check~check_data_retail. * CHECK wmara-matnr = '000000000000000008'. DATA msg TYPE merrdat. DATA desc TYPE sktext. DATA name TYPE sktext-maktx. READ TABLE ttext INTO desc INDEX 1. name = desc-maktx. CHECK name(1) = 'A'. msg-matnr = wmara-matnr. msg-msgid = 'ZERR_MM42'. msg-msgno = '001'. msg-msgty = 'E'. msg-msgv1 = desc-maktx. APPEND msg TO rt_errdat. ENDMETHOD. |