REPORT ZCOPA009_HO.
DATA : BEGIN OF BDCDATA OCCURS 0.
INCLUDE STRUCTURE BDCDATA.
DATA : END OF BDCDATA.
DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : REP_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF ITAB OCCURS 0,
VERSION(3),
PERIOD_FROM(3),
PERIOD_TO(3),
FISCAL_YEAR(4),
COST_CENTER(10),
ACTIVITY_TYPE(6),
COST_ELEMENT(10),
PERIOD1(15),
PERIOD2(15),
PERIOD3(15),
PERIOD4(15),
PERIOD5(15),
PERIOD6(15),
PERIOD7(15),
PERIOD8(15),
PERIOD9(15),
PERIOD10(15),
PERIOD11(15),
PERIOD12(15),
END OF ITAB.
data : ITAB1 like ITAB occurs 0 with header line.
"added by sunil gupta
DATA : MSG(100) , INDEX_A(2) , CONC1(200) , CONC2(200).
DATA : PERIOD_FROM(3) , PERIOD_TO(3).
DATA : LOOP_PERIOD(2) TYPE P , S_LOOP_PERIOD(2) , LOOP_RANGE(2) TYPE P.
DATA : LOOP_FROM(2) TYPE P.
DATA : FILE LIKE RLGRAP-FILENAME.
DATA : TYPE LIKE RLGRAP-FILETYPE VALUE 'DAT' , LENGTH(5).
DATA : AMT(15) TYPE P DECIMALS 2.
DATA : AMT1(15) , LIN TYPE P.
DATA : LOOP(1) VALUE 0.
*Parameters : scr_row(2) type p.
DATA : pagecount type i value 0,
i type i value 0,
count type i,
index(2),
CONCAT(50),
TOTALR TYPE I.
*data : CAREA LIKE SVALD-VALUE.
DATA : popup_ans . " added by krunal 18/06/2003
DATA : S_VERSION(3) , S_PERIOD_FROM(3) , S_PERIOD_TO(3),
S_FISCAL_YEAR(4), S_COST_CENTER(10).
*--------------------------------------------------ATL-001.
*-------ADDED FOR SETTING CONTROLING AREA BEFORE STARTING
*-------TRANSACTION KP06.
selection-screen begin of block b1 with frame title TEXT-001.
PARAMETERS: CAREA LIKE SVALD-VALUE
MEMORY ID CAC
VISIBLE LENGTH 6
OBLIGATORY,
row_scrn type i obligatory default 18.
SELECTION-SCREEN END OF BLOCK B1.
*--------------------------------------------------ATL-001.
START-OF-SELECTION.
*-Message to confirm SAP configuration seting and Computer Resolution
*-setting ....added by krunal 18/06/2003.
CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE'
EXPORTING
DEFAULTOPTION = 'N'
DIAGNOSETEXT1 = 'Does your PC have :'
DIAGNOSETEXT2 = '1. New SAP Config. tick ON ?'
DIAGNOSETEXT3 = '2. Desktop resolution setting 1024 X 768 ?'
TEXTLINE1 =
'Please do it before you process the session else BDC will give
error.'
* TEXTLINE2 = ' '
TITEL =
'Proper SAP Config & Desktop resolution settings ?'
START_COLUMN = 25
START_ROW = 6
CANCEL_DISPLAY = 'X'
IMPORTING
ANSWER = popup_ans
.
CHECK POPUP_ANS = 'J'.
*--end of confirmation pop up
* SET PARAMETER ID 'CAC' FIELD CAREA.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = FILE
FILETYPE = TYPE
IMPORTING
FILESIZE = LENGTH
TABLES
DATA_TAB = ITAB
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
OTHERS = 6.
*--------------------------------------------------ATL-001.
* added to remove blank lines from the internal table itab
loop at itab where cost_center = ''.
if itab is initial.
delete itab.
endif.
endloop.
*--------------------------------------------------ATL-001.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
* DEST = FILLER8
GROUP = 'COPABUDGET'
* HOLDDATE = FILLER8
KEEP = 'Y'
USER = SY-UNAME.
REFRESH BDCDATA.
INDEX_A = 1.
refresh itab1.
i = 1.
count = 1.
TOTALR = 0.
itab1[] = itab[].
delete itab1 where COST_CENTER = ''.
*DELETE adjacent duplicates from itab1 comparing COST_CENTER .
describe table itab lines TOTALR. "total no of records in
"itab
i = 1 .
LOOP AT ITAB1.
if count = 1.
read table itab index i. "getting the initial value of
i = i + 1 . "itab_data.
endif.
IF ITAB-VERSION IS INITIAL.
ITAB-VERSION = S_VERSION.
ITAB-PERIOD_FROM = S_PERIOD_FROM.
ITAB-PERIOD_TO = S_PERIOD_TO.
ITAB-FISCAL_YEAR = S_FISCAL_YEAR.
ITAB-COST_CENTER = S_COST_CENTER.
ENDIF.
* IF LOOP = 0.
* PERFORM BDC_SCREEN USING 'SAPLKPP0' '1000'.
* PERFORM BDC_FIELD USING 'BDC_OKCODE' '=KKKS'.
*
*
* PERFORM BDC_SCREEN USING 'SAPLSPO4' '0300'. "BY SUNIL (300
* "INSTEAD OF 100
* PERFORM BDC_FIELD USING 'SVALD-VALUE(01)' '54'.
* PERFORM BDC_FIELD USING 'BDC_OKCODE' '=FURT'.
* LOOP = 1.
* ENDIF.
PERFORM BDC_SCREEN USING 'SAPLKPP0' '1000'.
PERFORM BDC_FIELD USING 'KPP0B-VALUE(01)' ITAB1-VERSION.
PERFORM BDC_FIELD USING 'KPP0B-VALUE(02)' ITAB1-PERIOD_FROM.
PERFORM BDC_FIELD USING 'KPP0B-VALUE(03)' ITAB1-PERIOD_TO.
PERFORM BDC_FIELD USING 'KPP0B-VALUE(04)' ITAB1-FISCAL_YEAR.
PERFORM BDC_FIELD USING 'KPP0B-VALUE(06)' ITAB1-COST_CENTER.
PERFORM BDC_FIELD USING 'KPP0B-VALUE(07)' SPACE.
PERFORM BDC_FIELD USING 'KPP0B-VALUE(08)' SPACE.
PERFORM BDC_FIELD USING 'KPP0B-VALUE(09)' '*'.
PERFORM BDC_FIELD USING 'KPP0B-VALUE(10)' SPACE.
PERFORM BDC_FIELD USING 'KPP0B-VALUE(11)' SPACE.
* PERFORM BDC_FIELD USING 'KPP0B-VALUE(12)' ITAB1-COST_ELEMENT .
"nmg
*
PERFORM BDC_FIELD USING 'KPP0B-VALUE(12)' '*'. "sunil
* PERFORM BDC_FIELD USING 'KPP0B-VALUE(13)' SPACE.
* PERFORM BDC_FIELD USING 'KPP0B-VALUE(14)' SPACE.
IF LOOP = 0.
* PERFORM BDC_SCREEN USING 'SAPLKPP0' '1000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=KKKS'.
PERFORM BDC_SCREEN USING 'SAPLSPO4' '0300'. "BY SUNIL (300
"INSTEAD OF 100
*--------------------------------------------------ATL-001.
* CHANGED TO ENABLE THE PROGRAM TO RUN FOR DIFFERRENT
* CONTROLING AREAS
PERFORM BDC_FIELD USING 'SVALD-VALUE(01)' '54'.
* PERFORM BDC_FIELD USING 'SVALD-VALUE(01)' CAREA.
*--------------------------------------------------ATL-001.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=FURT'.
LOOP = 1.
PERFORM BDC_SCREEN USING 'SAPLKPP0' '1000'.
ENDIF.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=CSUB'.
PERIOD_FROM = ITAB-PERIOD_FROM.
PERIOD_TO = ITAB-PERIOD_TO.
pagecount = 0.
INDEX_A = 1.
while ( itab1-cost_center = itab-COST_CENTER )
or itab-cost_center = ' '.
"start of loop.
count = 2.
PERFORM BDC_SCREEN USING 'SAPLKPP2' '112'.
CLEAR CONC1.
CONCATENATE 'BDC02(' INDEX_A ')' INTO CONC1.
PERFORM BDC_FIELD USING 'BDC_CURSOR' CONC1.
PERFORM BDC_FIELD USING CONC1 ITAB-COST_ELEMENT.
"BELOW LINE ADDED ---SUNIL
CONCATENATE 'MARK_ROW_CONTROL(' INDEX_A ')' INTO CONCAT.
PERFORM BDC_FIELD USING CONCAT 'X'. "SUNIL
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=CSPB'.
clear CONCAT.
clear CONC1.
if pagecount = 0 and INDEX_A = 1.
INDEX_A = INDEX_A + 2.
else.
INDEX_A = INDEX_A + 1.
endif.
PERFORM BDC_SCREEN USING 'SAPLKPP2' '115'.
index = 1.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(01)'.
PERFORM BDC_FIELD USING 'BDC03(01)' itab-period1.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(02)'.
PERFORM BDC_FIELD USING 'BDC03(02)' itab-period2.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(03)'.
PERFORM BDC_FIELD USING 'BDC03(03)' itab-period3.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(04)'.
PERFORM BDC_FIELD USING 'BDC03(04)' itab-period4.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(05)'.
PERFORM BDC_FIELD USING 'BDC03(05)' itab-period5.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(06)'.
PERFORM BDC_FIELD USING 'BDC03(06)' itab-period6.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(07)'.
PERFORM BDC_FIELD USING 'BDC03(07)' itab-period7.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(08)'.
PERFORM BDC_FIELD USING 'BDC03(08)' itab-period8.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(09)'.
PERFORM BDC_FIELD USING 'BDC03(09)' itab-period9.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(10)'.
PERFORM BDC_FIELD USING 'BDC03(10)' itab-period10.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(11)'.
PERFORM BDC_FIELD USING 'BDC03(11)' itab-period11.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC03(12)'.
PERFORM BDC_FIELD USING 'BDC03(12)' itab-period12.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=CZUR'.
*--------------------------------------------------ATL-001.
*changed to change the page when rowcount exceeds 12
* IF INDEX_A > 13. " no of rows on the screen
IF INDEX_A > row_scrn. "Added by Krunal 18/06/03, no of rows on the
"screen
PAGECOUNT = PAGECOUNT + 1.
PERFORM BDC_SCREEN USING 'SAPLKPP2' '112'.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'BDC02(13)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=CP+'.
INDEX_A = 1.
ENDIF.
IF I <= TOTALR. read table itab index i . i = i + 1. else. exit. ENDIF. ENDWHILE. * PERFORM BDC_FIELD USING 'BDC_OKCODE' '=CZUR'. * PERFORM BDC_SCREEN USING 'SAPLKPP2' '112'. * PERFORM BDC_FIELD USING CONCAT 'X' PERFORM BDC_SCREEN USING 'SAPLKPP2' '112'. PERFORM BDC_FIELD USING 'BDC_OKCODE' '=CBUC'. * CALL TRANSACTION 'KP06' USING BDCDATA * MODE 'A' * UPDATE 'S'. CALL FUNCTION 'BDC_INSERT' EXPORTING TCODE = 'KP06' TABLES DYNPROTAB = BDCDATA EXCEPTIONS INTERNAL_ERROR = 1 NOT_OPEN = 2 QUEUE_ERROR = 3 TCODE_INVALID = 4 OTHERS = 5. S_VERSION = ITAB-VERSION. S_PERIOD_FROM = ITAB-PERIOD_FROM. S_PERIOD_TO = ITAB-PERIOD_TO. S_FISCAL_YEAR = ITAB-FISCAL_YEAR. S_COST_CENTER = ITAB-COST_CENTER. REFRESH BDCDATA.clear bdcdata. ENDLOOP. CALL FUNCTION 'BDC_CLOSE_GROUP' EXCEPTIONS NOT_OPEN = 1 QUEUE_ERROR = 2 OTHERS = 3. *&--------------------------------------------------------------------- *& Form BDC_FIELD *&--------------------------------------------------------------------- * text *---------------------------------------------------------------------- * --> p1 text
* <-- p2 text *---------------------------------------------------------------------- FORM BDC_FIELD USING FNAM FVAL. CLEAR BDCDATA. BDCDATA-FNAM = FNAM. BDCDATA-FVAL = FVAL. APPEND BDCDATA. ENDFORM. " BDC_FIELD *&--------------------------------------------------------------------- *& Form BDC_SCREEN *&--------------------------------------------------------------------- * text *---------------------------------------------------------------------- * --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
FORM BDC_SCREEN USING FPROG FDYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = FPROG .
BDCDATA-DYNPRO = FDYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. " BDC_SCREEN
Friday, November 23, 2007
bdc session program
Labels:
bdc session program
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2007
(952)
-
▼
November
(716)
- SAP Paper Documents
- SAP Repository
- SAP R/3 Implementation and Maintenance Tips
- ABAP/4 programming language overview
- The interactive eLearning system for ABAP™
- Helpful System Administration ABAPS
- free download abap programmin pdf book
- examples of real time objects in sap abap(1)
- examples of real time objects in sap abap
- work flow example2
- Workflow tips
- Miscellaneous sap abap faq
- BDC , LSMW, Conversions faq in abap
- Sap Scripts & Smart forms faqs in abap
- performance tuning in abap faqs
- Real Time BDC & LSMW faqs
- Real Time ABAP Internal Tables faqs
- Real Time ABAP Reports faqs
- Real Time questions ..in sap ABAP
- SAP ABAP FAQ (Technical)
- ABAP and Unicode
- ABAP and JavaScript
- ABAP Objects
- ABAP Database Access
- Running ABAP Programs
- ABAP User Dialogs
- The ABAP Programming Language
- Creating and Changing ABAP Programs
- Overview of the Components of Application Programs
- Introduction to ABAP
- ABAP Programming Documentation
- FREE DOWNLOAD ALE, EDI & IDOCS
- Conversion of IDOCs to XML.pdf
- FREE DOWNLOAD IDOC Interface Technology
- FREE DOWNLOAD EDI, IDOC Interface
- FREE DOWNLOAD IDOC BOOK
- FREE DOWNLOAD LSMW - Idoc Inbound Processing
- FREE DOWNLOAD SAP ABAP Idoc Interface
- FREE DOWNLOAD Java for SAP
- FREE DOWNLOAD Java for ABAP Programmers
- FREE DOWNLOAD Java and BAPI technology for EP
- free download Building Web Services with Java and ...
- free download Enable SAP with the power of Javascript
- FREE DOWNLOAD ABAP Training Simulator
- FREE DOWNLOAD SAP Accounting Training Simulators
- free download SAPScripts Made Easy
- CONDENSE
- CONSTANTS
- ABAP Quick Viewer
- sap abap XXL (EXtended Export of Lists)
- Some ABAP/4 Query header line variable
- Understanding SAP Query
- ABAP/4 Query
- ABAP/4 Query Hints and Tips
- SAP Website Links Exchange for ABAP, Basis or Cons...
- sap abap Program for Generate IDoc
- sap abap program for Reads an existing Idoc and di...
- List of ABAP Function modules
- sap abap FTP programming
- sap abap program for Issuing an Unix Command from ...
- sap abap program for RFC call to get Server List
- sap abap program for A SAP Pop-out Calculator
- sap ABAP program for Timers and Auto-refresh
- sap abap program for WS_EXECUTE to called External...
- sap abap programming Execute DOS Command from ABAP...
- To execute a dos command from ABAP
- sap abap program for Make your SAPGUI Disappear an...
- sap abap program for Using Function Modules F4_FIL...
- abp program for How to Restrict the Select Options
- sap abap program for Take Values from Selection-Sc...
- sap abap program for Change Text Into Password
- sap abap program for Function Module for Encryptio...
- sap abap program for FM VRM_SET_VALUE To List Box
- sap abap program for Value Request For Parameter
- sap abap program for Pop a Message to specific SAP...
- ABAP Pop-out box for user confirmation
- sap ABAP program for POP-UP Window
- sap abap program Sample XML Source Code For SAP
- sap abap XML file to word document through SAP
- sap abap program for How to Write Web Reports in SAP
- sap abap conversion Program to Test Line Selection...
- sap abap program for String Handling in ABAP - Rem...
- sap abap program for Split String into two parts a...
- sap abap conversion Program For Printing Prime Number
- sap abap program for How can I get Ascii value of ...
- sap abap program for Figure to Words for India but...
- sap abap conversion program for Print Number Value...
- sap abap conversion program for Insert a special T...
- sap abap program for String Handling in ABAP - Rem...
- sap abap program for Split String into two parts a...
- sap abap conversion Program For Printing Prime Number
- sap abap program for How can I get Ascii value of ...
- sap abap program for Figure to Words for India but...
- sap abap conversion program for Print Number Value...
- sap abap conversion program for Insert a special T...
- sap abap program for Convert SAP Spool List to HTML
- sap program for Convert Month to Word in ABAP
- ABAP function to convert Number to Words
- sap abap program for How to Create Tree Control
- sap abap A sample Tree Programming
-
▼
November
(716)
No comments:
Post a Comment