You are on page 1of 3

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

*& Report ZDEMO_BDCDATA


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZDEMO_BDCDATA.
DATA: BEGIN OF WA,
BLDAT TYPE CHAR10,
BUKRS TYPE CHAR04,
BLART TYPE CHAR02,
BUDAT TYPE CHAR10,
MONAT TYPE CHAR02,
WAERS TYPE CHAR05,
NEWBS TYPE CHAR02,
NEWKO TYPE CHAR17,
WRBTR
TYPE CHAR16,
VALUT
TYPE CHAR10,
SGTXT TYPE CHAR50,
GSBER TYPE CHAR04,
NEWBS1 TYPE CHAR02,
NEWKO1 TYPE CHAR17,
END OF WA.
DATA: IT LIKE TABLE OF WA.
DATA: OPT TYPE CTU_PARAMS.
DATA:BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.
WA-BLDAT = '25.09.2015'. WA-BUKRS = 'jm00'. WA-BLART = 'SA'. WA-BUDAT = '25.09.
2015'.
WA-MONAT = '06'. WA-WAERS = 'INR'. WA-NEWBS = '40'. WA-NEWKO = '300010'. WA-WRB
TR = '9000'.
WA-VALUT = '25.09.2015'. WA-SGTXT = 'BEING RENT PAID'. WA-GSBER = 'JM00'.
WA-NEWBS1 = '50'.
WA-NEWKO1 = '100000'. WA-VALUT = '25.09.2015'.
APPEND WA TO IT.
CLEAR WA.
OPT-DISMODE = 'A'.
OPT-DEFSIZE = 'X'.
LOOP AT IT INTO WA.
REFRESH BDCDATA[].
PERFORM BDC_DYNPRO
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD

USING 'SAPMF05A' '0100'.


USING 'BDC_CURSOR'
'RF05A-NEWKO'.
USING 'BDC_OKCODE'
'/00'.
USING 'BKPF-BLDAT'
WA-BLDAT.
USING 'BKPF-BLART'
WA-BLART.
USING 'BKPF-BUKRS'
WA-BUKRS.
USING 'BKPF-BUDAT'
WA-BUDAT.
USING 'BKPF-MONAT'
WA-MONAT.

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_FIELD
*
PERFORM BDC_DYNPRO
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_DYNPRO
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_DYNPRO
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD

USING 'BKPF-WAERS'
WA-WAERS.
USING 'FS006-DOCID'
'*'.
USING 'RF05A-NEWBS'
WA-NEWBS.
USING 'RF05A-NEWKO'
WA-NEWKO.
USING 'SAPMF05A' '0300'.
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
WA-WRBTR.
USING 'BSEG-VALUT'
WA-VALUT.
USING 'BSEG-SGTXT'
WA-SGTXT.
USING 'RF05A-NEWBS'
WA-NEWBS1.
USING 'RF05A-NEWKO'
WA-NEWKO1.
USING 'DKACB-FMORE'
'X'.
USING 'SAPLKACB' '0002'.
USING 'BDC_CURSOR'
'COBL-GSBER'.
USING 'BDC_OKCODE'
'=ENTE'.
USING 'COBL-GSBER'
WA-GSBER.
USING 'SAPMF05A' '0300'.
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
'*'.
USING 'BSEG-VALUT'
WA-VALUT.
USING 'BSEG-SGTXT'
'+'.
USING 'SAPLKACB' '0002'.
USING 'BDC_CURSOR'
'COBL-GSBER'.
USING 'BDC_OKCODE'
'=ENTE'.
USING 'COBL-GSBER'
WA-GSBER.
USING 'SAPMF05A' '0300'.
USING 'BDC_CURSOR'
'BSEG-WRBTR'.
USING 'BDC_OKCODE'
'=BU'.
USING 'BSEG-WRBTR'
WA-WRBTR.
USING 'BSEG-SGTXT'
WA-SGTXT.

* PERFORM BDC_FIELD
*
PERFORM BDC_DYNPRO
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD

USING 'DKACB-FMORE'
'X'.
USING 'SAPLKACB' '0002'.
USING 'BDC_CURSOR'
'COBL-GSBER'.
USING 'BDC_OKCODE'
'=ENTE'.
USING 'COBL-GSBER'
WA-GSBER.

CALL TRANSACTION 'F-02' USING BDCDATA OPTIONS FROM OPT.


ENDLOOP.
*&---------------------------------------------------------------------*
*&
Form BDC_DYNPRO
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->PROGRAM
text
*
-->DYNPRO
text
*----------------------------------------------------------------------*
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.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDFORM.

"BDC_FIELD