Z - SD - XD01 - P Heading: No Standard Page Line-Size

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

*&---------------------------------------------------------------------*

*& Report (Z------------)


*&
*&---------------------------------------------------------------------*
*&
*& PROGRAM
: (Z------------).
*& DESCRIPTION
: (------------)
*& AUTHOR
: DILIP VARMA .K
*& TRANSPORT REQUEST : (Z------------).
*& CREATED ON
: --/--/20--.
*&---------------------------------------------------------------------*
REPORT

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),

***

***

* data element: ANRED


ANRED_006(015),
* data element: NAME1_GP
NAME1_007(035),
* data element: LAND1_GP
LAND1_008(003),
* data element: REGIO
REGIO_009(003),
* data element: SPRAS
SPRAS_010(002),
* data element: LZONE
LZONE_011(010),
* data element: CIVVE
CIVVE_012(001),
* data element: AKONT
AKONT_013(010),
* data element: AWAHR
AWAHR_014(003),
* data element: VKBUR
VKBUR_015(004),
* data element: WAERS_V02D
WAERS_016(005),
* data element: KALKS
KALKS_017(001),
* data element: STGKU
VERSG_018(001),
* data element: LPRIO
LPRIO_019(002),
* data element: KZAZU_D
KZAZU_020(001),
* data element: VSBED
VSBED_021(002),
* data element: DWERK_EXT
VWERK_022(004),
* data element: ANTLF
ANTLF_023(001),
* data element: INCO1
INCO1_024(003),
* data element: INCO2
INCO2_025(028),
* data element: DZTERM
ZTERM_026(004),
* data element: KKBER
KKBER_027(004),
* data element: KTGRD
KTGRD_028(002),
* data element: TAKLD
TAXKD_01_029(001),

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,

LD_FULLPATH TYPE STRING,


LD_RESULT TYPE I.

*&----------------------------------------------------------------------*
*&
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 .

LOOP AT IT_FINAL INTO record.

CLEAR:

BDCDATA[] .

IF record-ACTION_001 <> ''.

*****************************************************************

*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

using 'SAPMF02D' '0100'.


using 'BDC_CURSOR'
'RF02D-KTOKD'.
using 'BDC_OKCODE'
'/00'.
using 'RF02D-BUKRS'
record-BUKRS_001.
using 'RF02D-VKORG'
record-VKORG_002.
using 'RF02D-VTWEG'
record-VTWEG_003.
using 'RF02D-SPART'
record-SPART_004.
using 'RF02D-KTOKD'
record-KTOKD_005.
using 'SAPMF02D' '0110'.
using 'BDC_CURSOR'
'KNA1-SPRAS'.
using 'BDC_OKCODE'
'/00'.
using 'KNA1-ANRED'
record-ANRED_006.
using 'KNA1-NAME1'
record-NAME1_007.
using 'KNA1-LAND1'
record-LAND1_008.
using 'KNA1-REGIO'
record-REGIO_009.
using 'KNA1-SPRAS'
record-SPRAS_010.
using 'SAPMF02D' '0120'.
using 'BDC_CURSOR'
'KNA1-LZONE'.
using 'BDC_OKCODE'
'/00'.
using 'KNA1-LZONE'

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.

You might also like