Z - SD - XD01 - P Heading: No Standard Page Line-Size
Z - SD - XD01 - P Heading: No Standard Page Line-Size
Z - SD - XD01 - P Heading: No Standard Page Line-Size
Z_SD_XD01_P
no standard page heading line-size 255.
*include bdcrecx1.
*
*parameters: dataset(132) lower case.
***
DO NOT CHANGE - the generated data section - DO NOT CHANGE
*
*
If it is nessesary to change the data section use the rules:
*
1.) Each definition of a field exists of two lines
*
2.) The first line shows exactly the comment
*
'* data element: ' followed with the data element
*
which describes the field.
*
If you don't have a data element use the
*
comment without a data element name
*
3.) The second line shows the fieldname of the
*
structure, the fieldname must consist of
*
a fieldname and optional the character '_' and
*
three numbers and the field length in brackets
*
4.) Each field must be type C.
*
*** Generated data section with specific formatting - DO NOT CHANGE
TYPES:begin of record,
* data element: BUKRS
BUKRS_001(004),
* data element: VKORG
VKORG_002(004),
* data element: VTWEG
VTWEG_003(002),
* data element: SPART
SPART_004(002),
* data element: KTOKD
KTOKD_005(004),
***
***
end of record.
*** End generated data section ***
*****************************************************************************
**
*&----------------------------------------------------------------------*
*&
I N T E R N A L T A B L E
D E C L A R A T I O N S
*&----------------------------------------------------------------------*
DATA : IT_FINAL
TYPE STANDARD TABLE OF record.
DATA : IT_INTRN
TYPE STANDARD TABLE OF ALSMEX_TABLINE.
*&----------------------------------------------------------------------*
*&
W O R K A R E A
D E C L A R A T I O N S
*&----------------------------------------------------------------------*
DATA: IS_INTRN
TYPE ALSMEX_TABLINE,
IS_FINAL
TYPE record,
record
TYPE record.
*&----------------------------------------------------------------------*
*&
V A R I A B L E
D E C L A R A T I O N S
*&----------------------------------------------------------------------*
DATA : W_FNAME TYPE RLGRAP-FILENAME
.
DATA : W_COUNT
TYPE I.
*&----------------------------------------------------------------------*
*&
C O N S T A N T S
D E C L A R A T I O N S
*&----------------------------------------------------------------------*
DATA: C_WAIT
LIKE BAPITAWAIT VALUE 'X'
,
" Using the command `COMMIT AND WAIT`
C_BCOL
TYPE I
VALUE 1
,
"START COLUM
N
C_BROW
TYPE I
VALUE 3
,
"START ROW
C_ECOL
TYPE I
VALUE 200
,
"Ending colu
mn
C_EROW
TYPE I
VALUE 40000
.
"ENDING ROW
*Used to stores error information from CALL TRANSACTION Function Module
DATA: BEGIN OF MESSTAB OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF MESSTAB.
*Used to store BDC data
DATA: BDCDATA
TYPE STANDARD TABLE OF BDCDATA INITIAL SIZE 1 WITH HEADER LIN
E.
DATA: W_TEXTOUT
LIKE T100-TEXT.
* This method of file download with check uses the latest techniques
* and achieves a very neat solution
DATA: LD_FILENAME TYPE STRING,
LD_PATH TYPE STRING,
*&----------------------------------------------------------------------*
*&
S E L E C T I O N
S C R E E N D E S I G N I N S
*&----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_FNAME TYPE RLGRAP-FILENAME OBLIGATORY
.
*PARAMETERS CTUMODE LIKE CTU_PARAMS-DISMODE DEFAULT 'E'.
DATA CTUMODE LIKE CTU_PARAMS-DISMODE VALUE 'A'.
"A: show all dynpros
"E: show dynpro on error only
"N: do not display dynpro
SELECTION-SCREEN END OF BLOCK B1
*&----------------------------------------------------------------------*
*&
AT - S E L E C T I O N
S C R E E N
*&----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = '(Z_SD_XD01_P)'
DYNPRO_NUMBER = '1000'
FIELD_NAME
= 'P_FNAME'
CHANGING
FILE_NAME
= P_FNAME.
IF NOT P_FNAME IS INITIAL.
W_FNAME = P_FNAME.
ENDIF.
PERFORM SUB_UPLOADEXCEL.
PERFORM PERFORM_BDC.
start-of-selection.
FORM PERFORM_BDC .
CLEAR:
BDCDATA[] .
*****************************************************************
*perform open_group.
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
record-LZONE_011.
using 'SAPMF02D' '0125'.
using 'BDC_CURSOR'
'KNA1-NIELS'.
using 'BDC_OKCODE'
'/00'.
using 'SAPMF02D' '0130'.
using 'BDC_CURSOR'
'KNBK-BANKS(01)'.
using 'BDC_OKCODE'
'=ENTR'.
using 'SAPMF02D' '0340'.
using 'BDC_CURSOR'
'RF02D-KUNNR'.
using 'BDC_OKCODE'
'=ENTR'.
using 'SAPMF02D' '0370'.
using 'BDC_CURSOR'
'RF02D-KUNNR'.
using 'BDC_OKCODE'
'=ENTR'.
using 'KNA1-CIVVE'
record-CIVVE_012.
using 'SAPMF02D' '0360'.
using 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
using 'BDC_OKCODE'
'=ENTR'.
using 'SAPMF02D' '0210'.
using 'BDC_CURSOR'
'KNB1-AKONT'.
using 'BDC_OKCODE'
'/00'.
using 'KNB1-AKONT'
record-AKONT_013.
using 'SAPMF02D' '0215'.
using 'BDC_CURSOR'
'KNB1-ZTERM'.
using 'BDC_OKCODE'
'/00'.
using 'SAPMF02D' '0220'.
using 'BDC_CURSOR'
'KNB5-MAHNA'.
using 'BDC_OKCODE'
'/00'.
using 'SAPMF02D' '0230'.
using 'BDC_CURSOR'
'KNB1-VRSNR'.
using 'BDC_OKCODE'
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
'/00'.
using 'SAPMF02D' '0610'.
using 'BDC_OKCODE'
'/00'.
using 'BDC_CURSOR'
'RF02D-KUNNR'.
using 'SAPMF02D' '0310'.
using 'BDC_CURSOR'
'KNVV-VERSG'.
using 'BDC_OKCODE'
'/00'.
using 'KNVV-AWAHR'
record-AWAHR_014.
using 'KNVV-VKBUR'
record-VKBUR_015.
using 'KNVV-WAERS'
record-WAERS_016.
using 'KNVV-KALKS'
record-KALKS_017.
using 'KNVV-VERSG'
record-VERSG_018.
using 'SAPMF02D' '0315'.
using 'BDC_CURSOR'
'KNVV-VWERK'.
using 'BDC_OKCODE'
'/00'.
using 'KNVV-LPRIO'
record-LPRIO_019.
using 'KNVV-KZAZU'
record-KZAZU_020.
using 'KNVV-VSBED'
record-VSBED_021.
using 'KNVV-VWERK'
record-VWERK_022.
using 'KNVV-ANTLF'
record-ANTLF_023.
using 'SAPMF02D' '0320'.
using 'BDC_CURSOR'
'KNVV-KTGRD'.
using 'BDC_OKCODE'
'/00'.
using 'KNVV-INCO1'
record-INCO1_024.
using 'KNVV-INCO2'
record-INCO2_025.
using 'KNVV-ZTERM'
record-ZTERM_026.
using 'KNVV-KKBER'
record-KKBER_027.
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
using 'KNVV-KTGRD'
record-KTGRD_028.
using 'SAPMF02D' '1350'.
using 'BDC_CURSOR'
'KNVI-TAXKD(01)'.
using 'BDC_OKCODE'
'=ENTR'.
using 'KNVI-TAXKD(01)'
record-TAXKD_01_029.
using 'SAPMF02D' '1350'.
using 'BDC_CURSOR'
'RF02D-KUNNR'.
using 'BDC_OKCODE'
'=UPDA'.
*ENDIF.
**************************>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>
CALL TRANSACTION 'XD01' USING BDCDATA
MODE CTUMODE
UPDATE 'A'.
CLEAR record.
*perform close_group.
**********************************************************************
*ENDIF.
*at LAST.
CLEAR:
record ,BDCDATA[] .
*ENDAT.
endloop.
ENDFORM.
FORM SUB_UPLOADEXCEL .
IF NOT W_FNAME IS INITIAL.
DATA : WL_INDEX TYPE I.
FIELD-SYMBOLS <FS>.
REFRESH: IT_INTRN,IT_FINAL.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME
= W_FNAME
I_BEGIN_COL = C_BCOL
I_BEGIN_ROW = C_BROW
I_END_COL
= C_ECOL
I_END_ROW
= C_EROW
TABLES
INTERN
= IT_INTRN.
*--- Sorting the internal table
SORT IT_INTRN BY ROW COL.
* CLEAR IT_INTERN.
LOOP AT IT_INTRN INTO IS_INTRN.
MOVE IS_INTRN-COL TO WL_INDEX.
*--- Assigning the each record to an internal table row
ASSIGN COMPONENT WL_INDEX OF STRUCTURE IS_FINAL TO <FS>.
IF SY-SUBRC = 0.
*--- Asigning the field value to a field symbol
CONDENSE IS_INTRN-VALUE.
MOVE IS_INTRN-VALUE TO <FS>.
ENDIF.
AT END OF ROW.
APPEND IS_FINAL TO IT_FINAL.
CLEAR IS_FINAL.
ENDAT.
ENDLOOP.
CLEAR : P_FNAME, W_FNAME.
ELSE.
MESSAGE I002(SY) WITH 'Select valid file'.
ENDIF.
ENDFORM.
" SUB_UPLOADEXCEL
*----------------------------------------------------------------------*
*
Start new screen
*
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO
= DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
"BDC_DYNPRO
*----------------------------------------------------------------------*
*
Insert field
*
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
"NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.