REPORT ZETM_BDC_IE027.
************************************************************************
*TYPE-POOLS *
************************************************************************
TYPE-POOLS TRUXS.
************************************************************************
*TYPE DECLARATION *
************************************************************************
TYPES : BEGIN OF TYPE_BDCDATA,
PROGRAM TYPE BDC_PROG,
DYNPRO TYPE BDC_DYNR,
DYNBEGIN TYPE BDC_START,
FNAM TYPE FNAM_____4,
FVAL TYPE BDC_FVAL,
END OF TYPE_BDCDATA,
BEGIN OF TYPE_DATA,
EQUNR TYPE EQUNR,
SHTXT TYPE KTX01,
FLEET_CAT TYPE FLEET_CAT,
J_3GEIGNER TYPE J_3GEIGNER,
J_3GPMAUFE TYPE J_3GPMAUFE,
J_3GVERWAL TYPE J_3GVERWAL,
J_3GPMAUFV TYPE J_3GPMAUFV,
J_3GPACHT TYPE J_3GPACHT,
MEINS TYPE MEINS,
J_3GKZMENG TYPE J_3GKZMENG,
J_3GEIFR TYPE J_3GEIFR,
J_3GEQART TYPE J_3GEQART,
J_3GKONDE TYPE KONDM,
/SAPCEM/DISPOGR TYPE /SAPCEM/DISPOGR,
J_3GZDEQUI TYPE J_3GZDEQUI,
KLART TYPE KLASSENART,
CLASS TYPE KLASSE_D,
MNAME TYPE ATBEZ,
MWERT TYPE ATWRT,
END OF TYPE_DATA.
************************************************************************
*WORK AREA DECLARATION *
************************************************************************
DATA : WA_BDCDATA TYPE TYPE_BDCDATA,
WA_DATA TYPE TYPE_DATA,
WA_MESSTAB TYPE BDCMSGCOLL,
WA_RAW TYPE TRUXS_T_TEXT_DATA.
************************************************************************
*INTERNAL TABLE DECLARATION *
************************************************************************
DATA : I_BDCDATA TYPE STANDARD TABLE OF TYPE_BDCDATA,
I_DATA TYPE STANDARD TABLE OF TYPE_DATA,
I_MESSTAB TYPE STANDARD TABLE OF BDCMSGCOLL.
************************************************************************
*DATA DECLARATION *
************************************************************************
DATA WF_MESSAGE(100).
************************************************************************
*SELECTION-SCREEN DECLARATION *
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_FILE TYPE LOCALFILE OBLIGATORY,
P_MODE DEFAULT 'A'.
SELECTION-SCREEN END OF BLOCK A1.
************************************************************************
*AT SELECTION-SCREEN ON VALUE-REQUEST DECLARATION *
************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
FIELD_NAME = 'P_FILE'
CHANGING
FILE_NAME = P_FILE .
REFRESH I_DATA[].
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = WA_RAW
I_FILENAME = P_FILE
TABLES
I_TAB_CONVERTED_DATA = I_DATA
.
************************************************************************
*START-OF-SELECTION *
************************************************************************
START-OF-SELECTION.
LOOP AT I_DATA INTO WA_DATA.
***First Screen
PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0100'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RM63E-EQUNR'
WA_DATA-EQUNR.
***General
PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=T\07'.
PERFORM BDC_FIELD USING 'ITOB-SHTXT'
' '.
PERFORM BDC_FIELD USING 'ITOB-SHTXT'
WA_DATA-SHTXT.
PERFORM BDC_FIELD USING 'FLEET-FLEET_CAT'
WA_DATA-FLEET_CAT.
***ETM Data
PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=KL'.
PERFORM BDC_FIELD USING 'EQUZ-J_3GEIGNER'
' '.
PERFORM BDC_FIELD USING 'EQUZ-J_3GEIGNER'
WA_DATA-J_3GEIGNER.
PERFORM BDC_FIELD USING 'EQUZ-J_3GPMAUFE'
' '.
PERFORM BDC_FIELD USING 'EQUZ-J_3GPMAUFE'
WA_DATA-J_3GPMAUFE.
PERFORM BDC_FIELD USING 'EQUZ-J_3GVERWAL'
' '.
PERFORM BDC_FIELD USING 'EQUZ-J_3GVERWAL'
WA_DATA-J_3GVERWAL.
PERFORM BDC_FIELD USING 'EQUZ-J_3GPMAUFV'
' '.
PERFORM BDC_FIELD USING 'EQUZ-J_3GPMAUFV'
WA_DATA-J_3GPMAUFV.
PERFORM BDC_FIELD USING 'EQUZ-J_3GPACHT'
' '.
PERFORM BDC_FIELD USING 'EQUZ-J_3GPACHT'
WA_DATA-J_3GPACHT.
PERFORM BDC_FIELD USING 'EQUI-MEINS'
' '.
PERFORM BDC_FIELD USING 'EQUI-MEINS'
WA_DATA-MEINS.
PERFORM BDC_FIELD USING 'EQUI-J_3GKZMENG'
' '.
PERFORM BDC_FIELD USING 'EQUI-J_3GKZMENG'
WA_DATA-J_3GKZMENG.
PERFORM BDC_FIELD USING 'EQUI-J_3GEIFR'
' '.
PERFORM BDC_FIELD USING 'EQUI-J_3GEIFR'
WA_DATA-J_3GEIFR.
PERFORM BDC_FIELD USING 'EQUI-J_3GEQART'
' '.
PERFORM BDC_FIELD USING 'EQUI-J_3GEQART'
WA_DATA-J_3GEQART.
PERFORM BDC_FIELD USING 'EQUI-J_3GKONDE'
' '.
PERFORM BDC_FIELD USING 'EQUI-J_3GKONDE'
WA_DATA-J_3GKONDE.
PERFORM BDC_FIELD USING 'H_ZULBLTYP_VB'
' '.
PERFORM BDC_FIELD USING 'H_ZULBLTYP_VB'
'X'.
PERFORM BDC_FIELD USING 'EQUI-/SAPCEM/ABRECHLG'
' '.
PERFORM BDC_FIELD USING 'EQUI-/SAPCEM/ABRECHLG'
'X'.
PERFORM BDC_FIELD USING 'H_ZULBLTYP_LB'
' '.
PERFORM BDC_FIELD USING 'H_ZULBLTYP_LB'
'X'.
PERFORM BDC_FIELD USING 'EQUI-/SAPCEM/DISPOGR'
' '.
PERFORM BDC_FIELD USING 'EQUI-/SAPCEM/DISPOGR'
WA_DATA-/SAPCEM/DISPOGR.
PERFORM BDC_FIELD USING 'EQUI-J_3GZDEQUI'
' '.
PERFORM BDC_FIELD USING 'EQUI-J_3GZDEQUI'
WA_DATA-J_3GZDEQUI.
PERFORM BDC_DYNPRO USING 'SAPLCLCA' '0602'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTE'.
PERFORM BDC_FIELD USING 'RMCLF-KLART'
' '.
PERFORM BDC_FIELD USING 'RMCLF-KLART'
WA_DATA-KLART.
PERFORM BDC_DYNPRO USING 'SAPLCLFM' '0500'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RMCLF-CLASS(01)'
' '.
PERFORM BDC_FIELD USING 'RMCLF-CLASS(01)'
WA_DATA-CLASS.
PERFORM BDC_DYNPRO USING 'SAPLCTMS' '0109'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BACK'.
PERFORM BDC_FIELD USING 'RCTMS-MNAME(01)'
' '.
PERFORM BDC_FIELD USING 'RCTMS-MNAME(01)'
WA_DATA-MNAME.
PERFORM BDC_FIELD USING 'RCTMS-MWERT(01)'
' '.
PERFORM BDC_FIELD USING 'RCTMS-MWERT(01)'
WA_DATA-MWERT.
PERFORM BDC_DYNPRO USING 'SAPLCLFM' '0500'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENDE'.
PERFORM BDC_FIELD USING 'RMCLF-PAGPOS'
'1'.
PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
CALL TRANSACTION 'IE02' USING I_BDCDATA MODE P_MODE UPDATE 'A' MESSAGES INTO I_MESSTAB.
REFRESH I_BDCDATA[].
ENDLOOP.
************************************************************************
*START-OF-SELECTION *
************************************************************************
END-OF-SELECTION.
LOOP AT I_MESSTAB INTO WA_MESSTAB.
CLEAR WF_MESSAGE.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = WA_MESSTAB-MSGID
LANG = SY-LANGU
NO = WA_MESSTAB-MSGNR
V1 = WA_MESSTAB-MSGV1
V2 = WA_MESSTAB-MSGV2
V3 = WA_MESSTAB-MSGV3
V4 = WA_MESSTAB-MSGV4
IMPORTING
MSG = WF_MESSAGE
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
WRITE / WF_MESSAGE .
ENDLOOP.
ULINE.
*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM TYPE ANY
FVAL TYPE ANY.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = FNAM.
WA_BDCDATA-FVAL = FVAL.
APPEND WA_BDCDATA TO I_BDCDATA.
ENDFORM. " BDC_FIELD
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = PROGRAM.
WA_BDCDATA-DYNPRO = DYNPRO.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO I_BDCDATA.
ENDFORM. " BDC_DYNPRO
No comments:
Post a Comment