Вы находитесь на странице: 1из 35

For BDC

1) Selection-screen : Proper Fields


File format...
2) POP Up : Upload confirmation
Most Importatant thing to validate each and every field and populate error me
ssage in final log table if needed.
3) Show OOALV ( use data change ) same as it is how screen is displayed.
4) Popup : Confirmation
5) Then Go...
note : impt thing is data type convertion. ex char to int, char to numc etc....
*&---------------------------------------------------------------------*
*& Report Z_FI_POSTING
*
*&
*
*&---------------------------------------------------------------------*
*&
*
*&
*
*&---------------------------------------------------------------------*
*
TABLES
*
************************************************************************
************************************************************************
*
SELECTION SCREEN
*
************************************************************************
*SELECTION-SCREEN BEGIN OF BLOCK sc1 WITH FRAME TITLE text-001.
*PARAMETERS :
pa_month LIKE t549m-pcmth OBLIGATORY,
*
pa_year(4) OBLIGATORY.
*SELECTION-SCREEN END OF BLOCK sc1.
************************************************************************
*
Internal table
*
************************************************************************
DATA: BEGIN OF record OCCURS 0,
bldat(010), "Document Date in Document
blart(002), "Document type
bukrs(004), "Company Code
waers(005), "Currency Key
xblnr(016), "Reference Document Number
newbs(002), "Posting Key
newko(015), "Account Number for the Account To Be Posted
newum(001), "Special G/L Indicator for the Next Line Item
wrbtr(016), "Amount in document currency
gsber(004), "Business Area
zfbdt(010), "Baseline date for due date calculation
kostl(010), "Cost Center
zuonr(018), "Assignment number
sgtxt(050), "Item Text
secco(004), "Bussiness Place
matnr(018), "Material number
"added by t.v.l.narayana
on 15.10.2008
name1(035), "Customer name
ort01(035), "City
xref1(012), "Business Partner Reference Key " Added By Narendra Patel
As On 18.12.2014 Requested By Meenakshi Narag
xref2(012), "Business Partner Reference Key " Added By Narendra Patel
As On 18.12.2014 Requested By Meenakshi Narag
END OF record.

TYPES: BEGIN OF ty_recordback,


bldat(010), "Document Date in Document
blart(002), "Document type
bukrs(004), "Company Code
waers(005), "Currency Key
xblnr(016), "Reference Document Number
newbs(002), "Posting Key
newko(015), "Account Number for the Account To Be Posted
newum(001), "Special G/L Indicator for the Next Line Item
wrbtr(016), "Amount in document currency
gsber(004), "Business Area
zfbdt(010), "Baseline date for due date calculation
kostl(010), "Cost Center
zuonr(018), "Assignment number
sgtxt(050), "Item Text
secco(004), "Bussiness Place
matnr(018), "Material number
"added by t.v.l.narayana
on 15.10.2008
name1(035), "Customer name
ort01(035), "City
xref1(012), "Business Partner Reference Key " Added By Narendra Patel
As On 18.12.2014 Requested By Meenakshi Narag
xref2(012), "Business Partner Reference Key " Added By Narendra Patel
As On 18.12.2014 Requested By Meenakshi Narag
END OF ty_recordback.
DATA : wa_record LIKE record,
last_record LIKE record,
kunnr TYPE kna1-kunnr.
DATA : i_output TYPE STANDARD TABLE OF string,
wa_data
TYPE string.
DATA : lv_newbs(002). "Posting Key
DATA : lv_bldat(010).
************************************************************************
*
Variables
*
************************************************************************
************************************************************************
*
I N I T I A L I Z A T I O N
*
* Intialization of program
*
************************************************************************
************************************************************************
*
A T S E L E C T I O N S C R E E N
*
* Validation on selection screen, if any
*
************************************************************************
************************************************************************
*AT SELECTION-SCREEN.
*
************************************************************************
************************************************************************
*
S T A R T
O F
S E L E C T I O N
*
* Actual Program execution starts here
*
************************************************************************
START-OF-SELECTION.

PERFORM upload.
START-OF-SELECTION.
DATA: i_recordback
wa_backrec
wa_recordback
l_index

TYPE
TYPE
TYPE
TYPE

STANDARD TABLE OF ty_recordback,


ty_recordback,
ty_recordback,
sy-tabix VALUE 0.

PERFORM open_group.
" BREAK NHBABAP.
i_recordback[] = record[].
REFRESH record.
CLEAR record.
LOOP AT i_recordback INTO wa_recordback.
l_index = sy-tabix.
AT FIRST.
READ TABLE i_recordback INTO wa_backrec INDEX 1.
IF sy-subrc EQ 0.
MOVE wa_backrec TO record.
APPEND record.
CONTINUE.
ENDIF.
ENDAT.
READ TABLE i_recordback INTO wa_backrec INDEX sy-tabix.
IF sy-subrc EQ 0.
AT LAST.
READ TABLE i_recordback INTO wa_backrec INDEX sy-tabix.
IF sy-subrc EQ 0.
MOVE wa_backrec TO record.
APPEND record.
ENDIF.
wa_backrec-bldat = sy-datum.
*
CONCATENATE WA_BACKREC-BLDAT+6(2) '.' WA_BACKREC-BLDAT+4(2) '.' WA_BACK
REC-BLDAT+0(4) INTO LV_BLDAT .
ENDAT.
IF NOT wa_backrec-bldat IS INITIAL.
READ TABLE record INDEX 1.
wa_record = record.
LOOP AT record.
last_record = record.
*
wa_record = record.
AT FIRST.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0100'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'BKPF-WAERS'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BKPF-BLDAT'
wa_record-bldat.
lv_bldat = wa_record-bldat.
PERFORM bdc_field
USING 'BKPF-BLART'
wa_record-blart.
PERFORM bdc_field
USING 'BKPF-BUKRS'
wa_record-bukrs.
PERFORM bdc_field
USING 'BKPF-WAERS'

wa_record-waers.
USING 'BKPF-XBLNR'
wa_record-xblnr.
USING 'RF05A-NEWBS'
wa_record-newbs.
USING 'RF05A-NEWKO'
wa_record-newko.
USING 'RF05A-NEWUM'
wa_record-newum.

PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
CONTINUE.
ENDAT.
*

perform update_posting_para.
IF wa_record-newbs = '29'.

*** for pskty = '29' ...


IF ( wa_record-newum EQ 'X' OR wa_record-newum = 'T' ). "or 'L'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0303'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'RF05A-NEWUM'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr.
*
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
*
WA_RECORD-SECCO.
PERFORM bdc_field
USING 'BSEG-GSBER'
wa_record-gsber.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
wa_record-zfbdt.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
wa_record-sgtxt.
PERFORM bdc_field
USING 'RF05A-NEWBS'
record-newbs.
PERFORM bdc_field
USING 'RF05A-NEWKO'
record-newko.
PERFORM bdc_field
USING 'RF05A-NEWUM'
record-newum.
ELSE.
PERFORM posting_y.
ENDIF.
*** for pskty = '39' ...
ENDIF.
IF wa_record-newbs = '39'.
IF ( wa_record-newum EQ 'X' OR wa_record-newum = 'T' ).

*
*

*
*

PERFORM bdc_dynpro
USING 'SAPMF05A' '0303'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'RF05V-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr.
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
WA_RECORD-SECCO.

PERFORM bdc_field

USING 'BSEG-GSBER'
wa_record-gsber.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
wa_record-zfbdt.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
wa_record-sgtxt.
* Begin of code change, BY - 'Narendra Patel', TR - DS1K929791 Date-#18.12.201
4 16:59:19# Requested By - Meenakshi Narag
*
To Add Referance key field
PERFORM more_data USING wa_record.
*
End of code change, BY - 'Narendra Patel', TR - DS1K929791 Date
-#18.12.2014 16:59:41#
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field

USING 'RF05A-NEWBS'
record-newbs.
USING 'RF05A-NEWKO'
record-newko.
USING 'RF05A-NEWUM'
record-newum.

ELSE.
PERFORM posting_y.
ENDIF.
ENDIF.
*** for pskty = '21' ...
IF wa_record-newbs = '21'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr.
PERFORM bdc_field
USING 'BSEG-SECCO'
wa_record-secco.
PERFORM bdc_field
USING 'BSEG-GSBER'
wa_record-gsber.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
wa_record-zfbdt.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
wa_record-sgtxt.
PERFORM bdc_field
USING 'RF05A-NEWBS'
record-newbs.
PERFORM bdc_field
USING 'RF05A-NEWKO'
record-newko.
PERFORM bdc_field
USING 'RF05A-NEWUM'
record-newum.
ENDIF.
*

------------>>>>>>>>> code insert by Nishant for posting key 25 as per


meenakshi dated 11/11/2013
IF wa_record-newbs = '25'.
lv_newbs = wa_record-newbs.

IF record-newbs EQ '25'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr. "'1000'.
PERFORM bdc_field
USING 'BSEG-GSBER'
wa_record-gsber. "'1000'.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
lv_bldat . "WA_RECORD-BLDAT. "'11.11

.2013'.
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

USING 'BSEG-SGTXT'
wa_record-sgtxt.
USING 'RF05A-NEWBS'
record-newbs. "'50'.
USING 'RF05A-NEWKO'
record-newko.
USING 'SAPMF05A' '0302'.
USING 'BDC_CURSOR'
'BSEG-GSBER'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
wa_record-wrbtr. "'1000'.
USING 'BSEG-GSBER'
wa_record-gsber. "'1000'.
USING 'BSEG-ZFBDT'
lv_bldat. "WA_RECORD-BLDAT . "'11.11

.2013'.
IF wa_record-zuonr IS NOT INITIAL.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.

" 11.11

.2014
ENDIF.
*
ELSEif record-newbs EQ '50'.
*
*
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
*
PERFORM bdc_field
USING 'BDC_CURSOR'
*
'RF05A-NEWKO'.
*
PERFORM bdc_field
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM bdc_field
USING 'BSEG-WRBTR'
*
wa_record-wrbtr. "'1000'.
*
PERFORM bdc_field
USING 'BSEG-GSBER'
*
wa_record-gsber. "'1000'.
*
PERFORM bdc_field
USING 'BSEG-ZFBDT'
*
lv_bldat . " WA_RECORD-BLDAT. "'
11.11.2013'.
*
PERFORM bdc_field
USING 'RF05A-NEWBS'
*
record-newbs. "'50'.
*
PERFORM bdc_field
USING 'RF05A-NEWKO'
*
record-newko. "'152020'.
*
**
PERFORM bdc_dynpro
USING 'SAPMF05A' '0300'.
**
PERFORM bdc_field
USING 'BDC_CURSOR'

**
**
PERFORM bdc_field
**
**
PERFORM bdc_field
**
**
PERFORM bdc_field
**
ORD-BLDAT. "'11.11.2013'.
**
PERFORM bdc_field
**
*
*
PERFORM bdc_dynpro
*
PERFORM bdc_field
*
*
PERFORM bdc_field
*
*
PERFORM bdc_field
*
*
*
*
*
*
***
***
***
***
***
*
*

'BSEG-BUPLA'.
USING 'BDC_OKCODE'
'=BS'.
USING 'BSEG-WRBTR'
'*'. " WA_RECORD-WRBTR'. "'1000'.
USING 'BSEG-VALUT'
lv_bldat . "'11.11.2013'. "WA_REC
USING 'DKACB-FMORE'
'X'.
USING 'SAPLKACB' '0002'.
USING 'BDC_CURSOR'
'COBL-GSBER'.
USING 'BDC_OKCODE'
'=ENTE'.
USING 'COBL-GSBER'
wa_record-gsber. "'1000'.

PERFORM bdc_dynpro
PERFORM bdc_field

USING 'SAPMF05A' '0700'.


USING 'BDC_CURSOR'
'RF05A-NEWBS'.
USING 'BDC_OKCODE'
'=BU'.
USING 'BKPF-XBLNR'
'REFERENCE'.
USING 'BKPF-BKTXT'
'doc header txt'.

PERFORM bdc_field
PERFORM BDC_FIELD
PERFORM BDC_FIELD
ENDIF.

ENDIF.
ENDIF.
------------>>>>>>>>> code ended by Nishant

------------>>>>>>>>> code insert by Nishant for posting key 25 as per


meenakshi dated 11/11/2013
* Begin of code change, BY - 'Narendra Patel', TR -DS1K929404 Date-#05.11.2014
12:01:30# Requested By - Meenakshi Narang
* To Add Code For Posting Key 35

IF wa_record-newbs = '35'.
lv_newbs = wa_record-newbs.
*

IF record-newbs EQ '25'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr. "'1000'.
PERFORM bdc_field
USING 'BSEG-GSBER'
wa_record-gsber. "'1000'.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
lv_bldat . "WA_RECORD-BLDAT. "'11.11

.2013'.
PERFORM bdc_field

USING 'BSEG-SGTXT'

wa_record-sgtxt.
USING 'RF05A-NEWBS'
record-newbs. "'50'.
PERFORM bdc_field
USING 'RF05A-NEWKO'
record-newko.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr. "'1000'.
PERFORM bdc_field
USING 'BSEG-GSBER'
wa_record-gsber. "'1000'.
IF wa_record-zuonr IS NOT INITIAL.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
" 11.11.2014
ENDIF.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
lv_bldat. "WA_RECORD-BLDAT . "'11.11
PERFORM bdc_field

.2013'.
*
* Begin of code change, BY - 'Narendra Patel', TR - DS1K929791 Date-#2
2.01.2015 12:30:19# Requested By - Meenakshi Narang
*
To Manp Referance Field 1
PERFORM more_data
USING wa_record.
*
End of code change, BY - 'Narendra Patel', TR - DS1K929791 Date-#2
2.01.2015 #
ENDIF.
* End of code change, BY - 'Narendra Patel', TR - DS1K929404 Date-#05.11.2014 12
:01:52#
*** for pskty = '04' ...
IF wa_record-newbs = '04'.
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field

USING 'SAPMF05A' '0301'.


USING 'BDC_CURSOR'
'RF05A-NEWKO'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
wa_record-wrbtr.
USING 'BSEG-GSBER' " added by meiyappan.
wa_record-gsber.
USING 'BSEG-ZTERM'
wa_record-kostl.
USING 'BSEG-ZUONR'
wa_record-zuonr.
USING 'BSEG-SGTXT'
wa_record-sgtxt.
USING 'RF05A-NEWBS'
record-newbs.
USING 'RF05A-NEWKO'
record-newko.
USING 'RF05A-NEWUM'
record-newum.

PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
ENDIF.
*** for pskty = '31' ...
IF wa_record-newbs = '31'.
PERFORM bdc_dynpro
PERFORM bdc_field

USING 'SAPMF05A' '0302'.


USING 'BDC_CURSOR'

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_field
PERFORM bdc_field

'RF05A-NEWKO'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
wa_record-wrbtr.
USING 'BSEG-SECCO'
wa_record-secco.
USING 'BSEG-GSBER'
wa_record-gsber.
USING 'BSEG-ZFBDT'
wa_record-zfbdt.
USING 'BSEG-ZUONR'
wa_record-zuonr.
USING 'BSEG-SGTXT'
wa_record-sgtxt.
USING 'RF05A-NEWBS'
record-newbs.
USING 'RF05A-NEWKO'
record-newko.
USING 'RF05A-NEWUM'
record-newum.

ENDIF.
*** for pskty = '40' ...
IF wa_record-newbs = '40'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0300'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr.
*
PERFORM bdc_field
USING 'RF05A-NEWBS'
*
wa_record-newbs.
*
PERFORM bdc_field
USING 'RF05A-NEWKO'
*
wa_record-newko.
"145820'.
*
PERFORM bdc_field
USING 'DKACB-FMORE'
*
'X'.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
wa_record-sgtxt.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'RF05A-NEWBS'
record-newbs.
PERFORM bdc_field
USING 'RF05A-NEWKO'
record-newko.
PERFORM bdc_field
USING 'RF05A-NEWUM'
record-newum.
PERFORM bdc_dynpro
PERFORM bdc_field

USING 'SAPLKACB' '0002'.


USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field
USING 'COBL-GSBER'
wa_record-gsber.
IF wa_record-kostl IS NOT INITIAL.
PERFORM bdc_field
USING 'COBL-KOSTL'
wa_record-kostl.

ENDIF.
IF wa_record-matnr IS NOT INITIAL.
PERFORM bdc_field
USING 'COBL-MATNR'
wa_record-matnr.
added by t.v.l.narayana on 15.10.2008
ENDIF.
IF wa_record-xref1 IS NOT INITIAL.
PERFORM more_data USING wa_record.
ENDIF.
" Added by Narendra
ENDIF.
*** for pskty = '50' ...
IF wa_record-newbs = '50'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0300'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr.
*
PERFORM bdc_field
USING 'RF05A-NEWBS'
*
record-newbs.
*
PERFORM bdc_field
USING 'RF05A-NEWKO'
*
record-newko.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
wa_record-sgtxt.
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field

USING 'RF05A-NEWBS'
record-newbs.
USING 'RF05A-NEWKO'
record-newko.
USING 'RF05A-NEWUM'
record-newum.
USING 'SAPLKACB' '0002'.
USING 'BDC_CURSOR'
'COBL-GSBER'.
USING 'BDC_OKCODE'
'=ENTE'.
USING 'COBL-GSBER'
wa_record-gsber.

IF wa_record-kostl IS NOT INITIAL.


PERFORM bdc_field

USING 'COBL-KOSTL'
wa_record-kostl.

ENDIF.
IF wa_record-matnr IS NOT INITIAL.
PERFORM bdc_field
USING 'COBL-MATNR'
wa_record-matnr.
"added by t.v.l.narayana on 15.10.2008
ENDIF.
IF wa_record-xref1 IS NOT INITIAL.
PERFORM more_data USING wa_record.
ENDIF.
ENDIF.
*** for pskty = '01' ...
IF wa_record-newbs = '01'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0301'.

"

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_field
PERFORM bdc_field
PERFORM bdc_field

USING 'BDC_CURSOR'
'RF05A-NEWKO'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
wa_record-wrbtr.
USING 'BSEG-SECCO'
wa_record-secco.
USING 'BSEG-GSBER'
wa_record-gsber.
USING 'BSEG-ZFBDT'
wa_record-zfbdt.
USING 'BSEG-ZUONR'
wa_record-zuonr.
USING 'BSEG-SGTXT'
wa_record-sgtxt.
USING 'RF05A-NEWBS'
record-newbs.
USING 'RF05A-NEWKO'
record-newko.
USING 'RF05A-NEWUM'
record-newum.

ENDIF.
*** for pskty = '11' ...
IF wa_record-newbs = '11'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0301'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr.
PERFORM bdc_field
USING 'BSEG-SECCO'
wa_record-secco.
PERFORM bdc_field
USING 'BSEG-GSBER'
wa_record-gsber.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
wa_record-zfbdt.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
wa_record-sgtxt.
PERFORM bdc_field
USING 'RF05A-NEWBS'
record-newbs.
PERFORM bdc_field
USING 'RF05A-NEWKO'
record-newko.
PERFORM bdc_field
USING 'RF05A-NEWUM'
record-newum.
ENDIF.
IF wa_record-newbs = '15'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0301'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr.
PERFORM bdc_field
USING 'BSEG-SECCO'

wa_record-secco.
USING 'BSEG-GSBER'
wa_record-gsber.

PERFORM bdc_field
*
*
*
*
*
*
*
*
*

IF WA_RECORD-ZFBDT = ' '.


PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
WA_RECORD-ZFBDT.
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
WA_RECORD-BLDAT.
ELSE.
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
WA_RECORD-ZFBDT.
ENDIF.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
wa_record-sgtxt.
PERFORM bdc_field
USING 'RF05A-NEWBS'
record-newbs.
PERFORM bdc_field
USING 'RF05A-NEWKO'
record-newko.
PERFORM bdc_field
USING 'RF05A-NEWUM'
record-newum.
ENDIF.
IF wa_record-newbs = '14'.
kunnr = wa_record-newko.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = kunnr
IMPORTING
output = kunnr.
SELECT SINGLE * FROM kna1
WHERE kunnr = kunnr.
IF kna1-xcpdk = 'X'.
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field

USING 'SAPLFCPD' '0100'.


USING 'BDC_CURSOR'
'BSEC-ORT01'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEC-NAME1'
wa_record-name1.
USING 'BSEC-ORT01'
wa_record-ort01.

ENDIF.
CLEAR kna1.
CLEAR kunnr.
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field

USING 'SAPMF05A' '0301'.


USING 'BDC_CURSOR'
'RF05A-NEWKO'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
wa_record-wrbtr.
USING 'BSEG-SGTXT'
wa_record-sgtxt.
USING 'BSEG-SECCO'

PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field

wa_record-secco.
USING 'BSEG-GSBER'
wa_record-gsber.
USING 'BSEG-ZUONR'
wa_record-zuonr.
USING 'RF05A-NEWBS'
record-newbs.
USING 'RF05A-NEWKO'
record-newko.
USING 'RF05A-NEWUM'
record-newum.

ENDIF.
wa_record = record.
AT LAST.
PERFORM update_posting_para.
IF NOT session IS INITIAL.
PERFORM bdc_transaction USING 'F-02'.
ELSE.
PERFORM call_transaction USING 'F-02'.
ENDIF.
REFRESH: bdcdata,
record.
CLEAR: wa_record.
MOVE wa_recordback TO record.
APPEND record.
ENDAT.
*
last_record = record.
ENDLOOP.
ELSE.
MOVE wa_recordback TO record.
APPEND record.
ENDIF.
ENDIF.
ENDLOOP.
PERFORM close_group.
IF NOT i_output IS INITIAL.
LOOP AT i_output INTO wa_data.
WRITE: / wa_data.
ENDLOOP.
ENDIF.
*&---------------------------------------------------------------------*
*&
Form upload
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM upload .
CALL FUNCTION 'UPLOAD'
EXPORTING
* CODEPAGE
= ' '
filename
= 'C:\f02_gen.TXT'
filetype
= 'DAT'
* ITEM
= ' '

* FILEMASK_MASK
= ' '
* FILEMASK_TEXT
= ' '
* FILETYPE_NO_CHANGE
= ' '
* FILEMASK_ALL
= ' '
* FILETYPE_NO_SHOW
= ' '
* LINE_EXIT
= ' '
* USER_FORM
= ' '
* USER_PROG
= ' '
* SILENT
= 'S'
* IMPORTING
* FILESIZE
=
* CANCEL
=
* ACT_FILENAME
=
* ACT_FILETYPE
=
TABLES
data_tab
= record
EXCEPTIONS
conversion_error
= 1
invalid_table_width
= 2
invalid_type
= 3
no_batch
= 4
unknown_error
= 5
gui_refuse_filetransfer
= 6
OTHERS
= 7
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
" upload
*&---------------------------------------------------------------------*
*&
Form update_posting_para
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM update_posting_para .
*
last_record = wa_record.
IF wa_record-newbs = '29'.
*** for pskty = '29' ...
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' '0304'.


USING 'BDC_CURSOR'
'RF05A-NEWUM'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
last_record-wrbtr.
USING 'BSEG-GSBER'
last_record-gsber.
USING 'BSEG-ZFBDT'
last_record-zfbdt.
USING 'BSEG-ZUONR'
wa_record-zuonr.
USING 'BSEG-SGTXT'

last_record-sgtxt.
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field

USING 'SAPMF05A' '0304'.


USING 'BDC_CURSOR'
'BSEG-SGTXT'.
USING 'BDC_OKCODE'
'=BU'.

*** for pskty = '39' ...


ENDIF.

IF wa_record-newbs = '39'.
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

USING 'SAPMF05A' '0304'.


USING 'BDC_CURSOR'
'RF05A-NEWKO'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
last_record-wrbtr.
USING 'BSEG-SECCO'
last_record-secco.
USING 'BSEG-GSBER'
last_record-gsber.
USING 'BSEG-ZFBDT'
last_record-zfbdt.
USING 'BSEG-ZUONR'
wa_record-zuonr.
USING 'BSEG-SGTXT'
last_record-sgtxt.
USING 'SAPMF05A' '0304'.
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
USING 'BDC_OKCODE'
'=BU'.

ENDIF.
*** for pskty = '21' ...
IF wa_record-newbs EQ '25'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
last_record-wrbtr. "'1000'.
PERFORM bdc_field
USING 'BSEG-GSBER'
last_record-gsber. "'1000'.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
lv_bldat .
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'

'BSEG-GSBER'.
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
last_record-wrbtr. "'1000'.
PERFORM bdc_field
USING 'BSEG-GSBER'
last_record-gsber. "'1000'.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
lv_bldat. "WA_RECORD-BLDAT . "'11.11.2013'.
PERFORM more_data USING wa_record.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field
USING 'BSEG-SGTXT'
last_record-sgtxt.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0700'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWBS'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=BU'.
ENDIF.
PERFORM bdc_field

IF wa_record-newbs = '35'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
last_record-wrbtr. "'1000'.
PERFORM bdc_field
USING 'BSEG-GSBER'
last_record-gsber. "'1000'.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
lv_bldat .
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'BSEG-GSBER'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
last_record-wrbtr. "'1000'.
PERFORM bdc_field
USING 'BSEG-GSBER'
last_record-gsber. "'1000'.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
lv_bldat. "WA_RECORD-BLDAT . "'11.11.2013'.
PERFORM more_data USING wa_record.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field
USING 'BSEG-SGTXT'
last_record-sgtxt.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0700'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWBS'.

PERFORM bdc_field

USING 'BDC_OKCODE'
'=BU'.

ENDIF.
IF wa_record-newbs = '21'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
last_record-wrbtr.
PERFORM bdc_field
USING 'BSEG-SECCO'
last_record-secco.
PERFORM bdc_field
USING 'BSEG-GSBER'
last_record-gsber.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
last_record-zfbdt.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
last_record-sgtxt.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0302'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=BU'.
ENDIF.
*** for pskty = '31' ...
IF wa_record-newbs = '31'.
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
ENDIF.

USING 'SAPMF05A' '0302'.


USING 'BDC_CURSOR'
'RF05A-NEWKO'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
last_record-wrbtr.
USING 'BSEG-SECCO'
last_record-secco.
USING 'BSEG-GSBER'
last_record-gsber.
USING 'BSEG-ZFBDT'
last_record-zfbdt.
USING 'BSEG-ZUONR'
wa_record-zuonr.
USING 'BSEG-SGTXT'
last_record-sgtxt.
USING 'SAPMF05A' '0302'.
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
USING 'BDC_OKCODE'
'=BU'.

*** for pskty = '40' ...


IF wa_record-newbs = '40'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0300'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
last_record-wrbtr.
*
PERFORM bdc_field
USING 'RF05A-NEWBS'
*
last_record-newbs.
*
PERFORM bdc_field
USING 'RF05A-NEWKO'
*
last_record-newko.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
last_record-sgtxt.
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field

"145820'.

USING 'SAPLKACB' '0002'.


USING 'BDC_CURSOR'
'COBL-GSBER'.
USING 'BDC_OKCODE'
'=ENTE'.
USING 'COBL-GSBER'
last_record-gsber.

IF last_record-kostl IS NOT INITIAL.


PERFORM bdc_field
USING 'COBL-KOSTL'
last_record-kostl.
ENDIF.
IF wa_record-matnr IS NOT INITIAL.
PERFORM bdc_field
USING 'COBL-MATNR'
wa_record-matnr.
d by t.v.l.narayana on 15.10.2008
ENDIF.
IF last_record-xref1 IS NOT INITIAL.
PERFORM more_data USING last_record.
ENDIF.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0300'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field

USING 'BDC_OKCODE'
'=BU'.

ENDIF.
*** for pskty = '50' ...
IF wa_record-newbs = '50' .
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field

USING 'SAPMF05A' '0300'.


USING 'BSEG-WRBTR'
last_record-wrbtr.
USING 'BSEG-ZUONR'

"adde

PERFORM bdc_field

wa_record-zuonr.
USING 'BSEG-SGTXT'
last_record-sgtxt.

PERFORM bdc_dynpro
PERFORM bdc_field

USING 'SAPLKACB' '0002'.


USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field
USING 'COBL-GSBER'
last_record-gsber.
IF last_record-kostl IS NOT INITIAL.
PERFORM bdc_field
USING 'COBL-KOSTL'
last_record-kostl.
ENDIF.
IF wa_record-matnr IS NOT INITIAL.
PERFORM bdc_field
USING 'COBL-MATNR'
dded by t.v.l.narayana on 15.10.2008
wa_record-matnr.
ENDIF.
IF last_record-xref1 IS NOT INITIAL.
PERFORM more_data USING last_record.
ENDIF.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0300'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=BU'.
ENDIF.
*** for pskty = '01' ...
IF wa_record-newbs = '01'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0301'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
last_record-wrbtr.
PERFORM bdc_field
USING 'BSEG-SECCO'
last_record-secco.
PERFORM bdc_field
USING 'BSEG-GSBER'
last_record-gsber.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
last_record-zfbdt.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
last_record-sgtxt.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0301'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'=BU'.
ENDIF.
*** for pskty = '11' ...
IF wa_record-newbs = '11'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0301'.
PERFORM bdc_field
USING 'BDC_CURSOR'

"a

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

'BSEG-SGTXT'.
USING 'BDC_OKCODE'
'=BU'.
USING 'BSEG-WRBTR'
last_record-wrbtr.
USING 'BSEG-SECCO'
last_record-secco.
USING 'BSEG-GSBER'
last_record-gsber.
USING 'BSEG-ZFBDT'
last_record-zfbdt.
USING 'BSEG-ZUONR'
wa_record-zuonr.
USING 'BSEG-SGTXT'
last_record-sgtxt.
USING 'SAPMF05A' '0301'.
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
USING 'BDC_OKCODE'
'=BU'.

ENDIF.

*
*

*
*
*
*
*
*

IF wa_record-newbs = '15'.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0301'.
PERFORM bdc_field
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr.
PERFORM bdc_field
USING 'BSEG-SECCO'
wa_record-secco.
PERFORM bdc_field
USING 'BSEG-GSBER'
wa_record-gsber.
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
WA_RECORD-ZFBDT.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
wa_record-sgtxt.
PERFORM BDC_FIELD
USING 'RF05A-NEWBS'
WA_RECORD-NEWBS.
PERFORM BDC_FIELD
USING 'RF05A-NEWKO'
WA_RECORD-NEWKO.
PERFORM BDC_FIELD
USING 'RF05A-NEWUM'
WA_RECORD-NEWUM.
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field

USING 'SAPMF05A' '0301'.


USING 'BDC_CURSOR'
'BSEG-SGTXT'.
USING 'BDC_OKCODE'
'=BU'.

ENDIF.
ENDFORM.

"UPDATE_POSTING_PARA

*&---------------------------------------------------------------------*
*&
Form posting_y
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM posting_y.
PERFORM bdc_dynpro
USING 'SAPMF05A' '0304'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'RF05A-NEWUM'.
PERFORM bdc_field
USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field
USING 'BSEG-WRBTR'
wa_record-wrbtr.
*
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
*
WA_RECORD-SECCO.
PERFORM bdc_field
USING 'BSEG-GSBER'
wa_record-gsber.
PERFORM bdc_field
USING 'BSEG-ZFBDT'
wa_record-zfbdt.
PERFORM bdc_field
USING 'BSEG-ZUONR'
wa_record-zuonr.
PERFORM bdc_field
USING 'BSEG-SGTXT'
wa_record-sgtxt.
PERFORM bdc_field
USING 'RF05A-NEWBS'
record-newbs.
PERFORM bdc_field
USING 'RF05A-NEWKO'
record-newko.
PERFORM bdc_field
USING 'RF05A-NEWUM'
record-newum.
*
*

ENDFORM.

"posting_y

**& Report Z_FI_POSTING


*
**&
*
**&---------------------------------------------------------------------*
**&
*
**&
*
**&---------------------------------------------------------------------*
*
**REPORT Z_FI_POSTING
.
*
*
*REPORT Z_FI_POSTING
*
NO STANDARD PAGE HEADING LINE-SIZE 255.
*
*INCLUDE BDCRECX1.
*************************************************************************
** VERSION
** PROGRAM
: Z_FI_POSTING " ZFI004_F02_GEN
** TYPE
: BDC
** Run Frequency
:
** Description
: F-02 POSTING ENTRY FOR GENERAL
**
:
**
:

**
:
**
:
**
:
** Development Class
: ZDEV
** Author
: Mandeep Singh
** Location
: National Housing Bank
** Requirement Reference :
*
*************************************************************************
** CHANGE HISTORY
*
** Date
Author
Description
*************************************************************************
**
TABLES
*
*************************************************************************
*
*
*************************************************************************
**
SELECTION SCREEN
*
*************************************************************************
**SELECTION-SCREEN BEGIN OF BLOCK sc1 WITH FRAME TITLE text-001.
**PARAMETERS :
pa_month LIKE t549m-pcmth OBLIGATORY,
**
pa_year(4) OBLIGATORY.
**SELECTION-SCREEN END OF BLOCK sc1.
*
*************************************************************************
**
Internal table
*
*************************************************************************
*DATA: BEGIN OF RECORD OCCURS 0,
*
BLDAT(010), "Document Date in Document
*
BLART(002), "Document type
*
BUKRS(004), "Company Code
*
WAERS(005), "Currency Key
*
XBLNR(016), "Reference Document Number
*
NEWBS(002), "Posting Key
*
NEWKO(015), "Account Number for the Account To Be Posted
*
NEWUM(001), "Special G/L Indicator for the Next Line Item
*
WRBTR(016), "Amount in document currency
*
GSBER(004), "Business Area
*
ZFBDT(010), "Baseline date for due date calculation
*
KOSTL(010), "Cost Center
*
ZUONR(018), "Assignment number
*
SGTXT(050), "Item Text
*
SECCO(004), "Bussiness Place
*
MATNR(018), "Material number
"added by t.v.l.narayana
on 15.10.2008
*
END OF RECORD.
*DATA : WA_RECORD LIKE RECORD,
*
LAST_RECORD LIKE RECORD.
*************************************************************************
**
Variables
*
*************************************************************************
*
*************************************************************************
**
I N I T I A L I Z A T I O N
*
** Intialization of program
*
*************************************************************************
*
*************************************************************************
**
A T S E L E C T I O N S C R E E N
*
** Validation on selection screen, if any
*
*************************************************************************

*
*************************************************************************
**AT SELECTION-SCREEN.
*
*************************************************************************
*
*
*************************************************************************
**
S T A R T
O F
S E L E C T I O N
*
** Actual Program execution starts here
*
*************************************************************************
*START-OF-SELECTION.
*
* PERFORM UPLOAD.
*
*START-OF-SELECTION.
*
* PERFORM OPEN_GROUP.
* BREAK NHBABAP.
* READ TABLE RECORD INDEX 1.
* WA_RECORD = RECORD.
*
* LOOP AT RECORD.
*
LAST_RECORD = RECORD.
**
wa_record = record.
*
AT FIRST.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0100'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BKPF-WAERS'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM BDC_FIELD
USING 'BKPF-BLDAT'
*
WA_RECORD-BLDAT.
*
PERFORM BDC_FIELD
USING 'BKPF-BLART'
*
WA_RECORD-BLART.
*
PERFORM BDC_FIELD
USING 'BKPF-BUKRS'
*
WA_RECORD-BUKRS.
*
PERFORM BDC_FIELD
USING 'BKPF-WAERS'
*
WA_RECORD-WAERS.
*
PERFORM BDC_FIELD
USING 'BKPF-XBLNR'
*
WA_RECORD-XBLNR.
*
PERFORM BDC_FIELD
USING 'RF05A-NEWBS'
*
WA_RECORD-NEWBS.
*
PERFORM BDC_FIELD
USING 'RF05A-NEWKO'
*
WA_RECORD-NEWKO.
*
PERFORM BDC_FIELD
USING 'RF05A-NEWUM'
*
WA_RECORD-NEWUM.
*
CONTINUE.
*
ENDAT.
*
** perform update_posting_para.
*
*
IF WA_RECORD-NEWBS = '29'.
*
**** for pskty = '29' ...
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0304'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'RF05A-NEWUM'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'

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

WA_RECORD-WRBTR.
USING 'BSEG-SECCO'
WA_RECORD-SECCO.
USING 'BSEG-GSBER'
WA_RECORD-GSBER.
USING 'BSEG-ZFBDT'
WA_RECORD-ZFBDT.
USING 'BSEG-ZUONR'
WA_RECORD-ZUONR.
USING 'BSEG-SGTXT'
WA_RECORD-SGTXT.
USING 'RF05A-NEWBS'
RECORD-NEWBS.
USING 'RF05A-NEWKO'
RECORD-NEWKO.
USING 'RF05A-NEWUM'
RECORD-NEWUM.

PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
for pskty = '39' ...
ENDIF.
IF WA_RECORD-NEWBS = '39'.
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_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD

USING 'SAPMF05A' '0304'.


USING 'BDC_CURSOR'
'RF05A-NEWKO'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
WA_RECORD-WRBTR.
USING 'BSEG-SECCO'
WA_RECORD-SECCO.
USING 'BSEG-GSBER'
WA_RECORD-GSBER.
USING 'BSEG-ZFBDT'
WA_RECORD-ZFBDT.
USING 'BSEG-ZUONR'
WA_RECORD-ZUONR.
USING 'BSEG-SGTXT'
WA_RECORD-SGTXT.
USING 'RF05A-NEWBS'
RECORD-NEWBS.
USING 'RF05A-NEWKO'
RECORD-NEWKO.
USING 'RF05A-NEWUM'
RECORD-NEWUM.

ENDIF.
for pskty = '21' ...
IF WA_RECORD-NEWBS = '21'.
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0302'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
WA_RECORD-WRBTR.
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
WA_RECORD-SECCO.

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

PERFORM BDC_FIELD
PERFORM BDC_FIELD

USING 'BSEG-GSBER'
WA_RECORD-GSBER.
USING 'BSEG-ZFBDT'
WA_RECORD-ZFBDT.
USING 'BSEG-ZUONR'
WA_RECORD-ZUONR.
USING 'BSEG-SGTXT'
WA_RECORD-SGTXT.
USING 'RF05A-NEWBS'
RECORD-NEWBS.
USING 'RF05A-NEWKO'
RECORD-NEWKO.
USING 'RF05A-NEWUM'
RECORD-NEWUM.

PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD
ENDIF.
for pskty = '31' ...
IF WA_RECORD-NEWBS = '31'.
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_FIELD
PERFORM BDC_FIELD
PERFORM BDC_FIELD

USING 'SAPMF05A' '0302'.


USING 'BDC_CURSOR'
'RF05A-NEWKO'.
USING 'BDC_OKCODE'
'/00'.
USING 'BSEG-WRBTR'
WA_RECORD-WRBTR.
USING 'BSEG-SECCO'
WA_RECORD-SECCO.
USING 'BSEG-GSBER'
WA_RECORD-GSBER.
USING 'BSEG-ZFBDT'
WA_RECORD-ZFBDT.
USING 'BSEG-ZUONR'
WA_RECORD-ZUONR.
USING 'BSEG-SGTXT'
WA_RECORD-SGTXT.
USING 'RF05A-NEWBS'
RECORD-NEWBS.
USING 'RF05A-NEWKO'
RECORD-NEWKO.
USING 'RF05A-NEWUM'
RECORD-NEWUM.

ENDIF.
for pskty = '40' ...
IF WA_RECORD-NEWBS = '40'.
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0300'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
WA_RECORD-WRBTR.
PERFORM bdc_field
USING 'RF05A-NEWBS'
wa_record-newbs.
PERFORM bdc_field
USING 'RF05A-NEWKO'
wa_record-newko.
PERFORM bdc_field
USING 'DKACB-FMORE'

"145820'.

**
'X'.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
WA_RECORD-SGTXT.
*
*
PERFORM BDC_FIELD
USING 'RF05A-NEWBS'
*
RECORD-NEWBS.
*
PERFORM BDC_FIELD
USING 'RF05A-NEWKO'
*
RECORD-NEWKO.
*
PERFORM BDC_FIELD
USING 'RF05A-NEWUM'
*
RECORD-NEWUM.
*
*
PERFORM BDC_DYNPRO
USING 'SAPLKACB' '0002'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'COBL-GSBER'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=ENTE'.
*
PERFORM BDC_FIELD
USING 'COBL-GSBER'
*
WA_RECORD-GSBER.
*
PERFORM BDC_FIELD
USING 'COBL-KOSTL'
*
WA_RECORD-KOSTL.
*
PERFORM BDC_FIELD
USING 'COBL-MATNR'
*
WA_RECORD-MATNR.
y t.v.l.narayana on 15.10.2008
*
ENDIF.
*
**** for pskty = '50' ...
*
IF WA_RECORD-NEWBS = '50'.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0300'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
WA_RECORD-WRBTR.
**
PERFORM bdc_field
USING 'RF05A-NEWBS'
**
record-newbs.
**
PERFORM bdc_field
USING 'RF05A-NEWKO'
**
record-newko.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
WA_RECORD-SGTXT.
*
*
PERFORM BDC_FIELD
USING 'RF05A-NEWBS'
*
RECORD-NEWBS.
*
PERFORM BDC_FIELD
USING 'RF05A-NEWKO'
*
RECORD-NEWKO.
*
PERFORM BDC_FIELD
USING 'RF05A-NEWUM'
*
RECORD-NEWUM.
*
*
PERFORM BDC_DYNPRO
USING 'SAPLKACB' '0002'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'COBL-GSBER'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=ENTE'.
*
PERFORM BDC_FIELD
USING 'COBL-GSBER'
*
WA_RECORD-GSBER.
*
PERFORM BDC_FIELD
USING 'COBL-KOSTL'
*
WA_RECORD-KOSTL.
*
PERFORM BDC_FIELD
USING 'COBL-MATNR'
*
WA_RECORD-MATNR.
d by t.v.l.narayana on 15.10.2008

"added b

"adde

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

ENDIF.
for pskty = '01' ...
IF WA_RECORD-NEWBS = '01'.
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0301'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
WA_RECORD-WRBTR.
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
WA_RECORD-SECCO.
PERFORM BDC_FIELD
USING 'BSEG-GSBER'
WA_RECORD-GSBER.
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
WA_RECORD-ZFBDT.
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
WA_RECORD-ZUONR.
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
WA_RECORD-SGTXT.
PERFORM BDC_FIELD
USING 'RF05A-NEWBS'
RECORD-NEWBS.
PERFORM BDC_FIELD
USING 'RF05A-NEWKO'
RECORD-NEWKO.
PERFORM BDC_FIELD
USING 'RF05A-NEWUM'
RECORD-NEWUM.
ENDIF.
for pskty = '11' ...
IF WA_RECORD-NEWBS = '11'.
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0301'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
'=BU'.
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
WA_RECORD-WRBTR.
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
WA_RECORD-SECCO.
PERFORM BDC_FIELD
USING 'BSEG-GSBER'
WA_RECORD-GSBER.
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
WA_RECORD-ZFBDT.
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
WA_RECORD-ZUONR.
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
WA_RECORD-SGTXT.
PERFORM BDC_FIELD
USING 'RF05A-NEWBS'
RECORD-NEWBS.
PERFORM BDC_FIELD
USING 'RF05A-NEWKO'
RECORD-NEWKO.
PERFORM BDC_FIELD
USING 'RF05A-NEWUM'
RECORD-NEWUM.
ENDIF.
IF WA_RECORD-NEWBS = '15'.
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0301'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR'

*
'RF05A-NEWKO'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
WA_RECORD-WRBTR.
*
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
*
WA_RECORD-SECCO.
*
PERFORM BDC_FIELD
USING 'BSEG-GSBER'
*
WA_RECORD-GSBER.
**
IF WA_RECORD-ZFBDT = ' '.
**
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
**
WA_RECORD-ZFBDT.
**
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
**
WA_RECORD-BLDAT.
**
ELSE.
**
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
**
WA_RECORD-ZFBDT.
**
ENDIF.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
WA_RECORD-SGTXT.
*
PERFORM BDC_FIELD
USING 'RF05A-NEWBS'
*
RECORD-NEWBS.
*
PERFORM BDC_FIELD
USING 'RF05A-NEWKO'
*
RECORD-NEWKO.
*
PERFORM BDC_FIELD
USING 'RF05A-NEWUM'
*
RECORD-NEWUM.
*
ENDIF.
*
*
WA_RECORD = RECORD.
*
AT LAST.
*
PERFORM UPDATE_POSTING_PARA.
*
PERFORM BDC_TRANSACTION USING 'F-02'.
*
ENDAT.
**
last_record = record.
* ENDLOOP.
*
* PERFORM CLOSE_GROUP.
**&---------------------------------------------------------------------*
**&
Form upload
**&---------------------------------------------------------------------*
**
text
**----------------------------------------------------------------------*
** --> p1
text
** <-- p2
text
**----------------------------------------------------------------------*
*FORM UPLOAD .
* CALL FUNCTION 'UPLOAD'
* EXPORTING
** CODEPAGE
= ' '
*
FILENAME
= 'C:\f02_gen.TXT'
*
FILETYPE
= 'DAT'
** ITEM
= ' '
** FILEMASK_MASK
= ' '
** FILEMASK_TEXT
= ' '
** FILETYPE_NO_CHANGE
= ' '
** FILEMASK_ALL
= ' '
** FILETYPE_NO_SHOW
= ' '
** LINE_EXIT
= ' '

** USER_FORM
= ' '
** USER_PROG
= ' '
** SILENT
= 'S'
** IMPORTING
** FILESIZE
=
** CANCEL
=
** ACT_FILENAME
=
** ACT_FILETYPE
=
*
TABLES
*
DATA_TAB
= RECORD
* EXCEPTIONS
*
CONVERSION_ERROR
= 1
*
INVALID_TABLE_WIDTH
= 2
*
INVALID_TYPE
= 3
*
NO_BATCH
= 4
*
UNKNOWN_ERROR
= 5
*
GUI_REFUSE_FILETRANSFER
= 6
*
OTHERS
= 7
*
.
* IF SY-SUBRC <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
**
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
*
*ENDFORM.
" upload
**&---------------------------------------------------------------------*
**&
Form update_posting_para
**&---------------------------------------------------------------------*
**
text
**----------------------------------------------------------------------*
** --> p1
text
** <-- p2
text
**----------------------------------------------------------------------*
*FORM UPDATE_POSTING_PARA .
**
last_record = wa_record.
* IF WA_RECORD-NEWBS = '29'.
*
**** for pskty = '29' ...
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0304'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'RF05A-NEWUM'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
LAST_RECORD-WRBTR.
*
PERFORM BDC_FIELD
USING 'BSEG-GSBER'
*
LAST_RECORD-GSBER.
*
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
*
LAST_RECORD-ZFBDT.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
LAST_RECORD-SGTXT.
*
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0304'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BSEG-SGTXT'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=BU'.
*

*
**** for pskty = '39' ...
* ENDIF.
*
* IF WA_RECORD-NEWBS = '39'.
*
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0304'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'RF05A-NEWKO'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
LAST_RECORD-WRBTR.
*
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
*
LAST_RECORD-SECCO.
*
PERFORM BDC_FIELD
USING 'BSEG-GSBER'
*
LAST_RECORD-GSBER.
*
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
*
LAST_RECORD-ZFBDT.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
LAST_RECORD-SGTXT.
*
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0304'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BSEG-SGTXT'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=BU'.
*
*
* ENDIF.
*
**** for pskty = '21' ...
*
* IF WA_RECORD-NEWBS = '21'.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0302'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'RF05A-NEWKO'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
LAST_RECORD-WRBTR.
*
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
*
LAST_RECORD-SECCO.
*
PERFORM BDC_FIELD
USING 'BSEG-GSBER'
*
LAST_RECORD-GSBER.
*
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
*
LAST_RECORD-ZFBDT.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
LAST_RECORD-SGTXT.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0302'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BSEG-SGTXT'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=BU'.
* ENDIF.
*

**** for pskty = '31' ...


*
* IF WA_RECORD-NEWBS = '31'.
*
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0302'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'RF05A-NEWKO'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
LAST_RECORD-WRBTR.
*
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
*
LAST_RECORD-SECCO.
*
PERFORM BDC_FIELD
USING 'BSEG-GSBER'
*
LAST_RECORD-GSBER.
*
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
*
LAST_RECORD-ZFBDT.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
LAST_RECORD-SGTXT.
*
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0302'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BSEG-SGTXT'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=BU'.
* ENDIF.
*
*
**** for pskty = '40' ...
* IF WA_RECORD-NEWBS = '40'.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0300'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'RF05A-NEWKO'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
LAST_RECORD-WRBTR.
**
PERFORM bdc_field
USING 'RF05A-NEWBS'
**
last_record-newbs.
**
PERFORM bdc_field
USING 'RF05A-NEWKO'
**
last_record-newko.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
LAST_RECORD-SGTXT.
*
*
*
PERFORM BDC_DYNPRO
USING 'SAPLKACB' '0002'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'COBL-GSBER'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=ENTE'.
*
PERFORM BDC_FIELD
USING 'COBL-GSBER'
*
LAST_RECORD-GSBER.
*
PERFORM BDC_FIELD
USING 'COBL-KOSTL'
*
LAST_RECORD-KOSTL.
*
PERFORM BDC_FIELD
USING 'COBL-MATNR'
*
WA_RECORD-MATNR.

"145820'.

"added

by t.v.l.narayana on 15.10.2008
*
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0300'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BSEG-SGTXT'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=BU'.
*
* ENDIF.
*
**** for pskty = '50' ...
* IF WA_RECORD-NEWBS = '50'.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0300'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
LAST_RECORD-WRBTR.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
LAST_RECORD-SGTXT.
*
*
PERFORM BDC_DYNPRO
USING 'SAPLKACB' '0002'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'COBL-GSBER'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=ENTE'.
*
PERFORM BDC_FIELD
USING 'COBL-GSBER'
*
LAST_RECORD-GSBER.
*
PERFORM BDC_FIELD
USING 'COBL-KOSTL'
*
LAST_RECORD-KOSTL.
*
PERFORM BDC_FIELD
USING 'COBL-MATNR'
ded by t.v.l.narayana on 15.10.2008
*
WA_RECORD-MATNR.
*
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0300'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BSEG-SGTXT'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=BU'.
*
* ENDIF.
*
**** for pskty = '01' ...
*
* IF WA_RECORD-NEWBS = '01'.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0301'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'RF05A-NEWKO'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
LAST_RECORD-WRBTR.
*
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
*
LAST_RECORD-SECCO.
*
PERFORM BDC_FIELD
USING 'BSEG-GSBER'
*
LAST_RECORD-GSBER.
*
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
*
LAST_RECORD-ZFBDT.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'

"ad

*
LAST_RECORD-SGTXT.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0301'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BSEG-SGTXT'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=BU'.
*
* ENDIF.
*
**** for pskty = '11' ...
* IF WA_RECORD-NEWBS = '11'.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0301'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BSEG-SGTXT'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=BU'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
LAST_RECORD-WRBTR.
*
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
*
LAST_RECORD-SECCO.
*
PERFORM BDC_FIELD
USING 'BSEG-GSBER'
*
LAST_RECORD-GSBER.
*
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
*
LAST_RECORD-ZFBDT.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
LAST_RECORD-SGTXT.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0301'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BSEG-SGTXT'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=BU'.
*
* ENDIF.
*
*
* IF WA_RECORD-NEWBS = '15'.
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0301'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'RF05A-NEWKO'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'/00'.
*
PERFORM BDC_FIELD
USING 'BSEG-WRBTR'
*
WA_RECORD-WRBTR.
*
PERFORM BDC_FIELD
USING 'BSEG-SECCO'
*
WA_RECORD-SECCO.
*
PERFORM BDC_FIELD
USING 'BSEG-GSBER'
*
WA_RECORD-GSBER.
**
PERFORM BDC_FIELD
USING 'BSEG-ZFBDT'
**
WA_RECORD-ZFBDT.
*
PERFORM BDC_FIELD
USING 'BSEG-ZUONR'
*
WA_RECORD-ZUONR.
*
PERFORM BDC_FIELD
USING 'BSEG-SGTXT'
*
WA_RECORD-SGTXT.
**
PERFORM BDC_FIELD
USING 'RF05A-NEWBS'
**
WA_RECORD-NEWBS.
**
PERFORM BDC_FIELD
USING 'RF05A-NEWKO'
**
WA_RECORD-NEWKO.
**
PERFORM BDC_FIELD
USING 'RF05A-NEWUM'

**
WA_RECORD-NEWUM.
*
*
PERFORM BDC_DYNPRO
USING 'SAPMF05A' '0301'.
*
PERFORM BDC_FIELD
USING 'BDC_CURSOR'
*
'BSEG-SGTXT'.
*
PERFORM BDC_FIELD
USING 'BDC_OKCODE'
*
'=BU'.
* ENDIF.
*
*ENDFORM.
" update_posting_para
*&---------------------------------------------------------------------*
*&
Form CALL_TRANSACTION
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_1065 text
*----------------------------------------------------------------------*
FORM call_transaction USING tcode.
REFRESH messtab.
CALL TRANSACTION tcode USING bdcdata
MODE ctumode
UPDATE cupdate
MESSAGES INTO messtab.
READ TABLE messtab WITH KEY msgtyp
msgid
msgnr
IF sy-subrc EQ 0.
CONCATENATE 'Document Number : '
ARATED BY space.
APPEND wa_data
TO i_output.
CLEAR wa_data.
ENDIF.

= 'S'
= 'F5'
= '312'.
messtab-msgv1 'generated.' INTO wa_data SEP

ENDFORM.
" CALL_TRANSACTION
*&---------------------------------------------------------------------*
*&
Form MORE_DATA
*&---------------------------------------------------------------------*
*
This subroutine performs mapping for Business Referance Key
*----------------------------------------------------------------------*
*
-->P_WA_RECORD_NEWBS
*----------------------------------------------------------------------*
FORM more_data USING
value(pv_wa_record) LIKE wa_record.
IF pv_wa_record-newbs = '35' OR pv_wa_record-newbs = '25' .
PERFORM bdc_dynpro
PERFORM bdc_field
PERFORM bdc_field
PERFORM bdc_field
"

PERFORM bdc_field

*
PERFORM bdc_field
ENDIF.

USING 'SAPMF05A' '0332'.


USING 'BDC_OKCODE' '=ZK'.
USING 'BDC_CURSOR'
'BSEG-RSTGR'.
USING 'BSEG-XREF1'
pv_wa_record-xref1.
USING 'BSEG-XREF2'
PV_WA_RECORD-XREF2.
USING 'BDC_OKCODE' '=ZK'.

IF pv_wa_record-newbs = '40' OR pv_wa_record-newbs = '50' .


PERFORM bdc_dynpro
USING 'SAPMF05A'
'0300'.

PERFORM bdc_field
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
ENDIF.
CLEAR pv_wa_record.
ENDFORM.

USING 'BDC_OKCODE' '=ZK'.


USING 'BSEG-WRBTR'
pv_wa_record-wrbtr.
USING 'BSEG-ZUONR'
pv_wa_record-zuonr.
USING 'BSEG-SGTXT'
pv_wa_record-sgtxt.
USING 'SAPLKACB' '0002'.
USING 'COBL-GSBER'
pv_wa_record-gsber.
USING 'BDC_OKCODE' '=ENTE'.
USING 'SAPMF05A' '0330'.
USING 'BSEG-XREF1'
pv_wa_record-xref1.
USING 'BDC_OKCODE' '/00'.
USING 'BSEG-XREF2'
PV_WA_RECORD-XREF2.
USING 'SAPMF05A' '0330'.
USING 'BDC_OKCODE' '=ZK'.
" MORE_DATA