Hai, sap gurus
what is the advantage of next payment date in app?
plz, clear me.
Moderator: You were already 'cleared' last time: stop violating SDN rules
Hi,
Business process will flow like this
Determination of requirement.
Find and assign source of supply
Request for quotation
Puchase order
Goods receipt
Invoice receipt.
Nagarajan
Similar Messages
-
Hi sap gurus can u plz improve the performance of my code --sneha
// for the below program i have performance issue can any sap gurus can modify my code to improve the performance ,its very urgent plz help me -
sneha
REPORT ZFIR_GRIR_IPV
NO STANDARD PAGE HEADING
LINE-SIZE 120
MESSAGE-ID ZFI02.
TABLES: BSEG,BKPF.
TYPES: BEGIN OF A_FINAL,
BUKRS TYPE CHAR12,
HKONT_P TYPE CHAR18,
GJAHR TYPE CHAR11,
BELNR TYPE CHAR19,
BUDAT TYPE CHAR12,
WAERS TYPE CHAR8,
XBLNR TYPE CHAR20,
BLART TYPE CHAR13,
MONAT TYPE CHAR13,
DMBTR_P TYPE CHAR13,
KOSTL TYPE CHAR11,
PRCTR_P TYPE CHAR13,
HKONT_G TYPE CHAR18,
DMBTR_G TYPE CHAR13,
PRCTR_G TYPE CHAR13,
BUZID_G TYPE CHAR15,
END OF A_FINAL.
changes on 30 th may by dileep
TYPES: BEGIN OF IT_FINAL,
BUKRS TYPE BUKRS ,
HKONT TYPE HKONT,
BELNR TYPE BELNR_D,
DMBTR TYPE DMBTR ,
KOSTL TYPE KOSTL,
PRCTR TYPE PRCTR,
END OF IT_FINAL.
TYPES: BEGIN OF IT_FINAL1,
BUKRS TYPE BUKRS,
HKONT TYPE HKONT,
GJAHR TYPE GJAHR ,
BELNR TYPE BELNR_D,
BUDAT TYPE BUDAT,
WAERS TYPE WAERS ,
XBLNR TYPE XBLNR1,
BLART TYPE BLART,
MONAT TYPE MONAT,
DMBTR TYPE DMBTR,
KOSTL TYPE KOSTL,
PRCTR TYPE PRCTR,
END OF IT_FINAL1.
end of changes on 30 th may by dileep
TYPES: BEGIN OF P_FINAL,
BUKRS TYPE CHAR12,
DELIMITER_1 TYPE CHAR1,
HKONT_P TYPE CHAR18,
DELIMITER_2 TYPE CHAR1,
GJAHR TYPE CHAR11,
DELIMITER_3 TYPE CHAR1,
BELNR TYPE CHAR19,
DELIMITER_4 TYPE CHAR1,
BUDAT TYPE CHAR12,
DELIMITER_5 TYPE CHAR1,
WAERS TYPE CHAR8,
DELIMITER_6 TYPE CHAR1,
XBLNR TYPE CHAR20,
DELIMITER_7 TYPE CHAR1,
BLART TYPE CHAR13,
DELIMITER_8 TYPE CHAR1,
MONAT TYPE CHAR13,
DELIMITER_9 TYPE CHAR1,
DMBTR_P TYPE CHAR13,
DELIMITER_10 TYPE CHAR1,
KOSTL TYPE CHAR11,
DELIMITER_11 TYPE CHAR1,
PRCTR_P TYPE CHAR13,
DELIMITER_12 TYPE CHAR1,
HKONT_G TYPE CHAR18,
DELIMITER_13 TYPE CHAR1,
DMBTR_G TYPE CHAR13,
DELIMITER_14 TYPE CHAR1,
PRCTR_G TYPE CHAR13,
DELIMITER_15 TYPE CHAR1,
BUZID_G TYPE CHAR15,
END OF P_FINAL.
DATA: IT_BSEG TYPE STANDARD TABLE OF IT_FINAL INITIAL SIZE 0,
I_BSEG TYPE STANDARD TABLE OF IT_FINAL1 INITIAL SIZE 0,
I_FINAL TYPE STANDARD TABLE OF A_FINAL INITIAL SIZE 0 WITH HEADER LINE,
I_FINAL_P TYPE STANDARD TABLE OF P_FINAL INITIAL SIZE 0 WITH HEADER LINE,
W_FINAL_P TYPE P_FINAL,
W_BSEG1 TYPE BSEG,
WA_BSEG TYPE IT_FINAL OCCURS 0 WITH HEADER LINE,
W_BSEG TYPE IT_FINAL1 OCCURS 0 WITH HEADER LINE,
T_BSEG TYPE STANDARD TABLE OF BSEG INITIAL SIZE 0 WITH HEADER LINE,
W_FINAL TYPE A_FINAL,
F_YEAR TYPE BAPI0002_4-FISCAL_YEAR,
F_PERIOD TYPE BAPI0002_4-FISCAL_PERIOD,
RETURN1 TYPE BAPIRETURN1,
V_DATE TYPE CHAR8, " Date in YYYYMMDD format
V_PRESPATH TYPE STRING, " Path
V_APPPATH TYPE STRING, " Path
V_FILENAME(25) TYPE C, " File Name
V_PERIOD TYPE CHAR3, " Date for Posting Period
V_FSYEAR TYPE BDATJ, " Fiscal Year
L_TEXT TYPE CHAR1. " Hypen
CONSTANTS: C_TXT TYPE CHAR4 VALUE '.txt', " File Extension
C_TXT1 TYPE STRING VALUE 'txt', " File Type
C_FLAG_X TYPE CHAR1 VALUE 'X', " Flag
C_ASC TYPE FILETYPE VALUE 'ASC', " File type
C_DAT TYPE CHAR4 VALUE '.dat', " File Type
C_FLAG_1 TYPE CHAR1 VALUE '1', " Constant value
C_ZERO TYPE CHAR1 VALUE '0', " Constant
C_GLD(10) TYPE C VALUE 'GRIR021S', " Constant in file Path
C_DIR TYPE CHAR3 VALUE 'C:\', " Presentation Server path
C_FLAG_12 TYPE CHAR2 VALUE '12', " Constant value
C_PCFILE TYPE STRING VALUE 'PC File',
C_DELIMITER TYPE C VALUE '|'.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
*--- Selection Criteria
SELECT-OPTIONS: S_BUKRS FOR BSEG-BUKRS DEFAULT '012T', " Company Code
S_HKONT FOR BSEG-HKONT OBLIGATORY DEFAULT '4505001',
S_GJAHR FOR BKPF-GJAHR DEFAULT SY-DATUM+0(4),
S_MONAT FOR BKPF-MONAT DEFAULT SY-DATUM+4(2),
S_BELNR FOR BSEG-BELNR ,
S_BUDAT FOR BKPF-BUDAT ,
S_PRCTR FOR BSEG-PRCTR OBLIGATORY DEFAULT '12TOTH00',
S_BLART FOR BKPF-BLART OBLIGATORY DEFAULT 'RE'.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
*--- Radio Buttons for chose the PC Path or App.. Server Path
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:
RB_PFILE RADIOBUTTON GROUP RAD2 DEFAULT 'X' USER-COMMAND UCOMM1.
SELECTION-SCREEN COMMENT 5(27) TEXT-002 FOR FIELD RB_PFILE.
PARAMETERS:
P_PFILE LIKE RLGRAP-FILENAME LOWER CASE.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:
RB_AFILE RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 5(27) TEXT-003 FOR FIELD RB_AFILE.
PARAMETERS:
P_AFILE LIKE RLGRAP-FILENAME LOWER CASE. " Path for AS
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PFILE.
*-- Select File name with Dialog Box
PERFORM SUB_GET_FILENAME CHANGING P_PFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_AFILE.
*--- Attach F4 HELP CORRESPONDING TO THE FIELD
PERFORM SUB_AP_F4.
AT SELECTION-SCREEN OUTPUT.
*--Modify screen parameters
PERFORM SUB_MODIFY_SCREEN.
AT SELECTION-SCREEN.
*--- Selection Screen validations for Company Code
PERFORM SUB_VALIDATION_BUKRS.
*--- Selection Screen validations for Chart of Accounts
PERFORM SUB_VALIDATION_HKONT.
*--- Selection Screen validations Fiscal Year
PERFORM SUB_VALIDATION_GJAHR.
*--- Selection Screen validations for Peiod
PERFORM SUB_VALIDATION_MONAT.
*--- Selection Screen validations for Company Code
PERFORM SUB_VALIDATION_BELNR.
*--- Selection Screen validations for Chart of Accounts
PERFORM SUB_VALIDATION_BUDAT.
*--- Selection Screen validations Fiscal Year
PERFORM SUB_VALIDATION_PRCTR.
*--- Selection Screen validations for Peiod
PERFORM SUB_VALIDATION_BLART.
START-OF-SELECTION
START-OF-SELECTION.
*--- Check whether filepath/name have been entered in the sel screen
PERFORM SUB_CHECK_FILEPATH.
*--- Prepare Final Internal Table.
PERFORM SUB_PREPARE_FINAL.
*--- Download data.
PERFORM SUB_DOWNLOAD_DATA .
*& Form sub_get_filename
text
<--P_PFILE Presentation server File name
FORM SUB_GET_FILENAME CHANGING P_FILE TYPE C.
DATA : L_FILENAME TYPE STRING, " For File Name
L_PATH TYPE STRING, " For Directory
L_FULLPATH TYPE STRING. " Full path
*--- For File Open Dialog Box
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = C_PCFILE " Window Title
DEFAULT_EXTENSION = C_TXT1 " File Extn
PROMPT_ON_OVERWRITE = C_FLAG_X " Over write
CHANGING
FILENAME = L_FILENAME " File Name
PATH = L_PATH " File Path
FULLPATH = L_FULLPATH " Full Path
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF SY-SUBRC NE 0.
*--- Error in opening the file
MESSAGE E000.
ELSE.
CONCATENATE L_PATH
L_FILENAME
INTO P_FILE.
V_PRESPATH = L_PATH.
ENDIF.
ENDFORM. " sub_get_filename
*& Form sub_ap_f4
f4 help attched with application server
FORM SUB_AP_F4 .
*--- FM for to get the Application Server Path
IF RB_AFILE = C_FLAG_X.
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
DIRECTORY =
FILEMASK = C_ASC " File Extn
IMPORTING
SERVERFILE = P_AFILE " File Path
EXCEPTIONS
CANCELED_BY_USER = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
*--- Error in opening the file
MESSAGE E000.
ENDIF.
ENDIF.
ENDFORM. " sub_ap_f4
*& Form sub_modify_screen
text
--> p1 text
<-- p2 text
FORM SUB_MODIFY_SCREEN .
*--- Selection screen Modifications
IF RB_PFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE' OR
SCREEN-NAME = '%_P_PFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_FLAG_1.
CONCATENATE C_DIR C_GLD V_DATE SY-UZEIT(4) C_TXT INTO P_PFILE.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE' OR
SCREEN-NAME = '%_P_PFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_ZERO.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF RB_AFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_AFILE' OR
SCREEN-NAME = '%_P_AFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_FLAG_1.
CONCATENATE '/Solectron/Data/' C_GLD V_DATE SY-UZEIT(4) C_DAT
INTO P_AFILE.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_AFILE' OR
SCREEN-NAME = '%_P_AFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_ZERO.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF RB_PFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE'.
SCREEN-ACTIVE = C_FLAG_1.
ENDIF.
IF SCREEN-NAME = 'P_AFILE'.
SCREEN-ACTIVE = C_ZERO.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF RB_AFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE'.
SCREEN-ACTIVE = C_ZERO.
ENDIF.
IF SCREEN-NAME = 'P_AFILE'.
SCREEN-ACTIVE = C_FLAG_1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDFORM. " sub_modify_screen
*& Form sub_validation_bukrs
Validation For Company Code
FORM SUB_VALIDATION_BUKRS .
DATA: L_BUKRS TYPE BUKRS. " Company Code
IF S_BUKRS IS NOT INITIAL.
IF S_BUKRS-HIGH IS NOT INITIAL AND S_BUKRS-LOW IS INITIAL.
MESSAGE E006.
ELSE.
*--- Validation for chart of accounts
SELECT BUKRS " Company Code
FROM T001 UP TO 1 ROWS
INTO L_BUKRS
WHERE BUKRS IN S_BUKRS.
ENDSELECT.
IF SY-SUBRC NE 0.
*--- Invalid Company code
MESSAGE E001.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_bukrs
*& Form sub_validation_hkont
Validation For General Ledger Account
FORM SUB_VALIDATION_HKONT .
DATA: L_HKONT TYPE HKONT. " General Ledger Account
IF S_HKONT IS INITIAL.
MESSAGE E002.
ELSE.
IF S_HKONT-HIGH IS NOT INITIAL AND S_HKONT-LOW IS INITIAL.
MESSAGE E006.
ELSE.
*--- Validation for chart of accounts
SELECT SAKNR " General Ledger Account
FROM SKA1 UP TO 1 ROWS
INTO L_HKONT
WHERE SAKNR IN S_HKONT AND KTOPL = '1SLR'.
ENDSELECT.
IF SY-SUBRC NE 0.
*--- Invalid General Ledger Account
MESSAGE E003.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_hkont
*& Form sub_validation_gjahr
Validation For Fiscal Year
FORM SUB_VALIDATION_GJAHR .
DATA: L_GJAHR TYPE GJAHR. " Fiscal Year
IF S_GJAHR IS NOT INITIAL.
IF S_GJAHR-HIGH IS NOT INITIAL AND S_GJAHR-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_gjahr
*& Form sub_validation_monat
Validation For Fiscal period
FORM SUB_VALIDATION_MONAT .
DATA: L_MONAT TYPE MONAT. " Fiscal period
IF S_MONAT IS NOT INITIAL.
IF S_MONAT-LOW LE C_ZERO.
*--- Invalid Fiscal Period
MESSAGE E006.
ENDIF.
IF S_MONAT-HIGH GT C_FLAG_12.
*--- Invalid Fiscal Period
MESSAGE E007.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_monat
*& Form sub_validation_belnr
Validation For Accounting Document Number
FORM SUB_VALIDATION_BELNR .
DATA: L_BELNR TYPE BELNR_D. " Accounting Document Number
IF S_BELNR IS NOT INITIAL.
IF S_BELNR-HIGH IS NOT INITIAL AND S_BELNR-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_belnr
*& Form sub_validation_budat
Validation For Posting Date
FORM SUB_VALIDATION_BUDAT .
DATA: L_BUDAT TYPE BUDAT. " Posting Date
IF S_BUDAT IS NOT INITIAL.
IF S_BUDAT-HIGH IS NOT INITIAL AND S_BUDAT-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_budat
*& Form sub_validation_prctr
Validation For Profit Center
FORM SUB_VALIDATION_PRCTR .
DATA: L_PRCTR TYPE PRCTR. " Profit Center
IF S_PRCTR IS INITIAL.
MESSAGE E010.
ELSE.
IF S_PRCTR-HIGH IS NOT INITIAL AND S_PRCTR-LOW IS INITIAL.
MESSAGE E006.
ELSE.
*--- Validation for chart of accounts
SELECT PRCTR " Profit Center
FROM CEPC UP TO 1 ROWS
INTO L_PRCTR
WHERE PRCTR IN S_PRCTR.
ENDSELECT.
IF SY-SUBRC NE 0.
*--- Invalid Profit Center
MESSAGE E011.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_prctr
*& Form sub_validation_blart
Validation For Document type
FORM SUB_VALIDATION_BLART .
DATA: L_BLART TYPE BLART. " Document type
IF S_BLART IS INITIAL.
MESSAGE E012.
ELSE.
IF S_BLART-HIGH IS NOT INITIAL AND S_BLART-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_blart
*& Form sub_check_filepath
Check user input for initial filename
FORM SUB_CHECK_FILEPATH .
IF RB_PFILE = C_FLAG_X.
IF P_PFILE IS INITIAL.
*--- The Local File Path can not be Empty
MESSAGE I014.
LEAVE LIST-PROCESSING.
ENDIF.
ELSEIF RB_AFILE = C_FLAG_X.
IF P_AFILE IS INITIAL.
*--- The App Server File Path can not be Empty
MESSAGE I015.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ENDFORM. " sub_check_filepath
*& Form sub_prepare_final
append the required output data in to the internal table.
FORM SUB_PREPARE_FINAL.
changes on 30 th may by dileep
SELECT * FROM BSEG INTO TABLE I_BSEG WHERE HKONT IN S_HKONT AND "G/L Account
GJAHR IN S_GJAHR AND
PRCTR IN S_PRCTR AND "Profit Center
BLART IN S_BLART . "Document Type
SELECT BUKRS
HKONT
BELNR
DMBTR
KOSTL
PRCTR
FROM BSEG INTO TABLE IT_BSEG WHERE HKONT IN S_HKONT AND "G/L Account
PRCTR IN S_PRCTR. "Profit Center
LOOP AT IT_BSEG INTO WA_BSEG.
SELECT SINGLE GJAHR
BUDAT
WAERS
XBLNR
BLART
MONAT
INTO (W_BSEG-GJAHR,W_BSEG-BUDAT,W_BSEG-WAERS,W_BSEG-XBLNR,W_BSEG-BLART,W_BSEG-MONAT)
FROM BKPF WHERE BELNR = W_BSEG-BELNR AND
GJAHR IN S_GJAHR AND
BLART IN S_BLART . "Document Type
MOVE WA_BSEG-BUKRS TO W_BSEG-BUKRS.
MOVE WA_BSEG-HKONT TO W_BSEG-HKONT.
MOVE WA_BSEG-BELNR TO W_BSEG-BELNR.
MOVE WA_BSEG-DMBTR TO W_BSEG-DMBTR.
MOVE WA_BSEG-KOSTL TO W_BSEG-KOSTL.
MOVE WA_BSEG-PRCTR TO W_BSEG-PRCTR.
APPEND W_BSEG TO I_BSEG.
ENDLOOP.
changes on 30 th may by dileep
IF S_BUKRS IS NOT INITIAL.
SORT I_BSEG BY BUKRS ASCENDING.
DELETE I_BSEG WHERE NOT BUKRS IN S_BUKRS.
ENDIF.
IF S_MONAT IS NOT INITIAL.
SORT I_BSEG BY GJAHR MONAT ASCENDING.
IF S_MONAT-HIGH IS NOT INITIAL AND S_MONAT-LOW IS NOT INITIAL.
DELETE I_BSEG WHERE MONAT < S_MONAT-LOW OR MONAT > S_MONAT-HIGH.
ENDIF.
IF S_MONAT-HIGH IS INITIAL AND S_MONAT-LOW IS NOT INITIAL.
DELETE I_BSEG WHERE MONAT NE S_MONAT-LOW.
ENDIF.
ENDIF.
IF S_BELNR IS NOT INITIAL.
SORT I_BSEG BY BELNR ASCENDING.
DELETE I_BSEG WHERE NOT BELNR IN S_BELNR.
ENDIF.
IF S_BUDAT IS NOT INITIAL.
SORT I_BSEG BY BUDAT ASCENDING.
DELETE I_BSEG WHERE NOT BUDAT IN S_BUDAT.
ENDIF.
LOOP AT I_BSEG INTO W_BSEG.
MOVE W_BSEG-BUKRS TO W_FINAL-BUKRS.
MOVE W_BSEG-HKONT TO W_FINAL-HKONT_P.
MOVE W_BSEG-GJAHR TO W_FINAL-GJAHR.
MOVE W_BSEG-BELNR TO W_FINAL-BELNR.
MOVE W_BSEG-BUDAT TO W_FINAL-BUDAT.
MOVE W_BSEG-WAERS TO W_FINAL-WAERS.
MOVE W_BSEG-XBLNR TO W_FINAL-XBLNR.
MOVE W_BSEG-BLART TO W_FINAL-BLART.
MOVE W_BSEG-MONAT TO W_FINAL-MONAT.
MOVE W_BSEG-DMBTR TO W_FINAL-DMBTR_P.
MOVE W_BSEG-KOSTL TO W_FINAL-KOSTL.
MOVE W_BSEG-PRCTR TO W_FINAL-PRCTR_P.
SELECT SINGLE * FROM BSEG INTO W_BSEG1 WHERE BELNR = W_BSEG-BELNR AND "Document Type
BUZID = 'W' .
IF SY-SUBRC = 0.
MOVE W_BSEG1-HKONT TO W_FINAL-HKONT_G.
MOVE W_BSEG1-DMBTR TO W_FINAL-DMBTR_G.
MOVE W_BSEG1-PRCTR TO W_FINAL-PRCTR_G.
MOVE W_BSEG1-BUZID TO W_FINAL-BUZID_G.
ELSE.
EXIT.
ENDIF.
APPEND W_FINAL TO I_FINAL.
SORT I_FINAL BY BELNR ASCENDING.
ENDLOOP.
ENDFORM. " sub_prepare_final
*& Form sub_download_data
Download data
FORM SUB_DOWNLOAD_DATA .
DATA : V_PRD(2) TYPE N.
IF RB_PFILE = C_FLAG_X.
*--- Downloading To presentation server
V_PRESPATH = P_PFILE.
PERFORM SUB_DOWNLOAD_PRESSERVER.
ELSEIF RB_AFILE = C_FLAG_X.
*--- Downloading To Application server in Auto Mode
V_APPPATH = P_AFILE.
PERFORM SUB_DOWNLOAD_APPSERVER.
ENDIF.
ENDFORM. " sub_download_data
*& Form sub_download_presserver
text
FORM SUB_DOWNLOAD_PRESSERVER.
DATA: MESSAGE TYPE STRING.
IF I_FINAL[] IS INITIAL.
MESSAGE I016.
EXIT.
ELSE.
W_FINAL_P-BUKRS = 'Company Code'.
W_FINAL_P-DELIMITER_1 = '|'.
W_FINAL_P-HKONT_P = 'G/L Account Number'.
W_FINAL_P-DELIMITER_2 = '|'.
W_FINAL_P-GJAHR = 'Fiscal Year'.
W_FINAL_P-DELIMITER_3 = '|'.
W_FINAL_P-BELNR = 'A/c Document Number'.
W_FINAL_P-DELIMITER_4 = '|'.
W_FINAL_P-BUDAT = 'Posting Date' .
W_FINAL_P-DELIMITER_5 = '|'.
W_FINAL_P-WAERS = 'Currency'.
W_FINAL_P-DELIMITER_6 = '|'.
W_FINAL_P-XBLNR = 'Ref. Document Number'.
W_FINAL_P-DELIMITER_7 = '|'.
W_FINAL_P-BLART = 'Document Type'.
W_FINAL_P-DELIMITER_8 = '|'.
W_FINAL_P-MONAT = 'Fiscal Period'.
W_FINAL_P-DELIMITER_9 = '|'.
W_FINAL_P-DMBTR_P = 'Amount'.
W_FINAL_P-DELIMITER_10 = '|'.
W_FINAL_P-KOSTL = 'Cost Center'.
W_FINAL_P-DELIMITER_11 = '|'.
W_FINAL_P-PRCTR_P = 'Profit Center'.
W_FINAL_P-DELIMITER_12 = '|'.
W_FINAL_P-HKONT_G = 'G/L Account Number'.
W_FINAL_P-DELIMITER_13 = '|'.
W_FINAL_P-DMBTR_G = 'Amount'.
W_FINAL_P-DELIMITER_14 = '|'.
W_FINAL_P-PRCTR_G = 'Profit Center'.
W_FINAL_P-DELIMITER_15 = '|'.
W_FINAL_P-BUZID_G = 'Line Item Id'.
APPEND W_FINAL_P TO I_FINAL_P.
LOOP AT I_FINAL INTO W_FINAL.
W_FINAL_P-BUKRS = W_FINAL-BUKRS.
W_FINAL_P-DELIMITER_1 = '|'.
W_FINAL_P-HKONT_P = W_FINAL-HKONT_P.
W_FINAL_P-DELIMITER_2 = '|'.
W_FINAL_P-GJAHR = W_FINAL-GJAHR.
W_FINAL_P-DELIMITER_3 = '|'.
W_FINAL_P-BELNR = W_FINAL-BELNR.
W_FINAL_P-DELIMITER_4 = '|'.
W_FINAL_P-BUDAT = W_FINAL-BUDAT .
W_FINAL_P-DELIMITER_5 = '|'.
W_FINAL_P-WAERS = W_FINAL-WAERS.
W_FINAL_P-DELIMITER_6 = '|'.
W_FINAL_P-XBLNR = W_FINAL-XBLNR.
W_FINAL_P-DELIMITER_7 = '|'.
W_FINAL_P-BLART = W_FINAL-BLART.
W_FINAL_P-DELIMITER_8 = '|'.
W_FINAL_P-MONAT = W_FINAL-MONAT.
W_FINAL_P-DELIMITER_9 = '|'.
W_FINAL_P-DMBTR_P = W_FINAL-DMBTR_P.
W_FINAL_P-DELIMITER_10 = '|'.
W_FINAL_P-KOSTL = W_FINAL-KOSTL.
W_FINAL_P-DELIMITER_11 = '|'.
W_FINAL_P-PRCTR_P = W_FINAL-PRCTR_P.
W_FINAL_P-DELIMITER_12 = '|'.
W_FINAL_P-HKONT_G = W_FINAL-HKONT_G.
W_FINAL_P-DELIMITER_13 = '|'.
W_FINAL_P-DMBTR_G = W_FINAL-DMBTR_G.
W_FINAL_P-DELIMITER_14 = '|'.
W_FINAL_P-PRCTR_G = W_FINAL-PRCTR_G.
W_FINAL_P-DELIMITER_15 = '|'.
W_FINAL_P-BUZID_G = W_FINAL-BUZID_G.
APPEND W_FINAL_P TO I_FINAL_P.
CLEAR : W_FINAL_P, W_FINAL.
ENDLOOP.
ENDIF.
*---Downloading data to file on Presentation Server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = V_PRESPATH
FILETYPE = 'ASC'
TABLES
DATA_TAB = I_FINAL_P
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
*-- File can not be opened successfully
IF SY-SUBRC NE 0.
IF SY-BATCH EQ C_FLAG_X. " Stop Processing
MESSAGE E017. " File could not be opened
ELSE.
MESSAGE I017. " File could not be opened
LEAVE LIST-PROCESSING.
ENDIF.
ELSE.
CONCATENATE 'Data Successfully downloaded to the Specified Location' V_PRESPATH INTO MESSAGE SEPARATED BY SPACE.
MESSAGE MESSAGE TYPE 'S'.
ENDIF.
MODIFY SCREEN.
ENDFORM. " sub_download_presserver
*& Form sub_download_appserver
text
FORM SUB_DOWNLOAD_APPSERVER .
DATA: V_FILE TYPE STRING, " String
P_DMBTR TYPE CHAR20,
G_DMBTR TYPE CHAR20,
MESSAGE1 TYPE STRING.
IF I_FINAL[] IS INITIAL.
IF SY-BATCH EQ C_FLAG_X.
*--- File contains no data
MESSAGE E016 .
ELSE.
*--- File contains no data
MESSAGE I016 .
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
*--- To Open The file in Application Server
OPEN DATASET V_APPPATH FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
*--- Display error message: "Could not open file"
IF SY-BATCH EQ C_FLAG_X.
*--- File contains no data
MESSAGE E016 .
ELSE.
*--- File contains no data
MESSAGE I016 .
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
*--- Perform for building the Report header
CONCATENATE
'COMPANY_CODE'
'G/L_ACCOUNT_NUMBER'
'FISCAL_YEAR'
'A/C_DOCUMENT_NUMBER'
'POSTING_DATE'
'CURRENCY'
'REF_DOCUMENT_NUMBER'
'DOCUMENT_TYPE'
'FISCAL_PERIOD'
'AMOUNT'
'COSTCENTER'
'PROFIT_CENTER'
'G/L_ACCOUNT_NUMBER'
'AMOUNT'
'PROFIT_CENTER'
'LINE_ITEM_ID'
INTO V_FILE SEPARATED BY C_DELIMITER.
TRANSFER V_FILE TO V_APPPATH.
*--- Transfer the data to application Server
LOOP AT I_FINAL INTO W_FINAL.
P_DMBTR = W_FINAL-DMBTR_P.
G_DMBTR = W_FINAL-DMBTR_G.
CONCATENATE
W_FINAL-BUKRS
W_FINAL-HKONT_P
W_FINAL-GJAHR
W_FINAL-BELNR
W_FINAL-BUDAT
W_FINAL-WAERS
W_FINAL-XBLNR
W_FINAL-BLART
W_FINAL-MONAT
P_DMBTR
W_FINAL-KOSTL
W_FINAL-PRCTR_P
W_FINAL-HKONT_G
G_DMBTR
W_FINAL-PRCTR_G
W_FINAL-BUZID_G
INTO V_FILE SEPARATED BY C_DELIMITER.
TRANSFER V_FILE TO V_APPPATH.
IF SY-SUBRC NE 0.
Display error message: "Data could not be written at the location"
MESSAGE 'Data could not be written at the location' TYPE 'I'.
EXIT.
ENDIF.
CLEAR V_FILE.
ENDLOOP.
CLOSE DATASET V_APPPATH.
IF SY-SUBRC NE 0.
Display error message: "File could not be closed"
MESSAGE 'File could not be closed' TYPE 'I'.
EXIT.
ELSE.
CONCATENATE 'Data Successfully downloaded to the Specified Location' V_APPPATH INTO MESSAGE1 SEPARATED BY SPACE.
MESSAGE MESSAGE1 TYPE 'S'.
ENDIF.
ENDFORM. " sub_download_appserverhi,
here is improved code.
REPORT ZFIR_GRIR_IPV
NO STANDARD PAGE HEADING
LINE-SIZE 120
MESSAGE-ID ZFI02.
TABLES: BSEG,BKPF.
TYPES: BEGIN OF A_FINAL,
BUKRS TYPE CHAR12,
HKONT_P TYPE CHAR18,
GJAHR TYPE CHAR11,
BELNR TYPE CHAR19,
BUDAT TYPE CHAR12,
WAERS TYPE CHAR8,
XBLNR TYPE CHAR20,
BLART TYPE CHAR13,
MONAT TYPE CHAR13,
DMBTR_P TYPE CHAR13,
KOSTL TYPE CHAR11,
PRCTR_P TYPE CHAR13,
HKONT_G TYPE CHAR18,
DMBTR_G TYPE CHAR13,
PRCTR_G TYPE CHAR13,
BUZID_G TYPE CHAR15,
END OF A_FINAL.
changes on 30 th may by dileep
TYPES: BEGIN OF IT_FINAL,
BUKRS TYPE BUKRS ,
HKONT TYPE HKONT,
BELNR TYPE BELNR_D,
DMBTR TYPE DMBTR ,
KOSTL TYPE KOSTL,
PRCTR TYPE PRCTR,
END OF IT_FINAL.
TYPES: BEGIN OF IT_FINAL1,
BUKRS TYPE BUKRS,
HKONT TYPE HKONT,
GJAHR TYPE GJAHR ,
BELNR TYPE BELNR_D,
BUDAT TYPE BUDAT,
WAERS TYPE WAERS ,
XBLNR TYPE XBLNR1,
BLART TYPE BLART,
MONAT TYPE MONAT,
DMBTR TYPE DMBTR,
KOSTL TYPE KOSTL,
PRCTR TYPE PRCTR,
END OF IT_FINAL1.
end of changes on 30 th may by dileep
TYPES: BEGIN OF P_FINAL,
BUKRS TYPE CHAR12,
DELIMITER_1 TYPE CHAR1,
HKONT_P TYPE CHAR18,
DELIMITER_2 TYPE CHAR1,
GJAHR TYPE CHAR11,
DELIMITER_3 TYPE CHAR1,
BELNR TYPE CHAR19,
DELIMITER_4 TYPE CHAR1,
BUDAT TYPE CHAR12,
DELIMITER_5 TYPE CHAR1,
WAERS TYPE CHAR8,
DELIMITER_6 TYPE CHAR1,
XBLNR TYPE CHAR20,
DELIMITER_7 TYPE CHAR1,
BLART TYPE CHAR13,
DELIMITER_8 TYPE CHAR1,
MONAT TYPE CHAR13,
DELIMITER_9 TYPE CHAR1,
DMBTR_P TYPE CHAR13,
DELIMITER_10 TYPE CHAR1,
KOSTL TYPE CHAR11,
DELIMITER_11 TYPE CHAR1,
PRCTR_P TYPE CHAR13,
DELIMITER_12 TYPE CHAR1,
HKONT_G TYPE CHAR18,
DELIMITER_13 TYPE CHAR1,
DMBTR_G TYPE CHAR13,
DELIMITER_14 TYPE CHAR1,
PRCTR_G TYPE CHAR13,
DELIMITER_15 TYPE CHAR1,
BUZID_G TYPE CHAR15,
END OF P_FINAL.
DATA: IT_BSEG TYPE STANDARD TABLE OF IT_FINAL INITIAL SIZE 0,
I_BSEG TYPE STANDARD TABLE OF IT_FINAL1 INITIAL SIZE 0,
I_FINAL TYPE STANDARD TABLE OF A_FINAL INITIAL SIZE 0 WITH HEADER LINE,
I_FINAL_P TYPE STANDARD TABLE OF P_FINAL INITIAL SIZE 0 WITH HEADER LINE,
W_FINAL_P TYPE P_FINAL,
W_BSEG1 TYPE BSEG,
WA_BSEG TYPE IT_FINAL OCCURS 0 WITH HEADER LINE,
W_BSEG TYPE IT_FINAL1 OCCURS 0 WITH HEADER LINE,
T_BSEG TYPE STANDARD TABLE OF BSEG INITIAL SIZE 0 WITH HEADER LINE,
W_FINAL TYPE A_FINAL,
F_YEAR TYPE BAPI0002_4-FISCAL_YEAR,
F_PERIOD TYPE BAPI0002_4-FISCAL_PERIOD,
RETURN1 TYPE BAPIRETURN1,
V_DATE TYPE CHAR8, " Date in YYYYMMDD format
V_PRESPATH TYPE STRING, " Path
V_APPPATH TYPE STRING, " Path
V_FILENAME(25) TYPE C, " File Name
V_PERIOD TYPE CHAR3, " Date for Posting Period
V_FSYEAR TYPE BDATJ, " Fiscal Year
L_TEXT TYPE CHAR1. " Hypen
CONSTANTS: C_TXT TYPE CHAR4 VALUE '.txt', " File Extension
C_TXT1 TYPE STRING VALUE 'txt', " File Type
C_FLAG_X TYPE CHAR1 VALUE 'X', " Flag
C_ASC TYPE FILETYPE VALUE 'ASC', " File type
C_DAT TYPE CHAR4 VALUE '.dat', " File Type
C_FLAG_1 TYPE CHAR1 VALUE '1', " Constant value
C_ZERO TYPE CHAR1 VALUE '0', " Constant
C_GLD(10) TYPE C VALUE 'GRIR021S', " Constant in file Path
C_DIR TYPE CHAR3 VALUE 'C:\', " Presentation Server path
C_FLAG_12 TYPE CHAR2 VALUE '12', " Constant value
C_PCFILE TYPE STRING VALUE 'PC File',
C_DELIMITER TYPE C VALUE '|'.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
o
+
Selection Criteria
SELECT-OPTIONS: S_BUKRS FOR BSEG-BUKRS DEFAULT '012T', " Company Code
S_HKONT FOR BSEG-HKONT OBLIGATORY DEFAULT '4505001',
S_GJAHR FOR BKPF-GJAHR DEFAULT SY-DATUM+0(4),
S_MONAT FOR BKPF-MONAT DEFAULT SY-DATUM+4(2),
S_BELNR FOR BSEG-BELNR ,
S_BUDAT FOR BKPF-BUDAT ,
S_PRCTR FOR BSEG-PRCTR OBLIGATORY DEFAULT '12TOTH00',
S_BLART FOR BKPF-BLART OBLIGATORY DEFAULT 'RE'.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
o
+
Radio Buttons for chose the PC Path or App.. Server Path
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:
RB_PFILE RADIOBUTTON GROUP RAD2 DEFAULT 'X' USER-COMMAND UCOMM1.
SELECTION-SCREEN COMMENT 5(27) TEXT-002 FOR FIELD RB_PFILE.
PARAMETERS:
P_PFILE LIKE RLGRAP-FILENAME LOWER CASE.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:
RB_AFILE RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 5(27) TEXT-003 FOR FIELD RB_AFILE.
PARAMETERS:
P_AFILE LIKE RLGRAP-FILENAME LOWER CASE. " Path for AS
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PFILE.
o
+ Select File name with Dialog Box
PERFORM SUB_GET_FILENAME CHANGING P_PFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_AFILE.
o
+
Attach F4 HELP CORRESPONDING TO THE FIELD
PERFORM SUB_AP_F4.
AT SELECTION-SCREEN OUTPUT.
*--Modify screen parameters
PERFORM SUB_MODIFY_SCREEN.
AT SELECTION-SCREEN.
o
+
Selection Screen validations for Company Code
PERFORM SUB_VALIDATION_BUKRS.
o
+
Selection Screen validations for Chart of Accounts
PERFORM SUB_VALIDATION_HKONT.
o
+
Selection Screen validations Fiscal Year
PERFORM SUB_VALIDATION_GJAHR.
o
+
Selection Screen validations for Peiod
PERFORM SUB_VALIDATION_MONAT.
o
+
Selection Screen validations for Company Code
PERFORM SUB_VALIDATION_BELNR.
o
+
Selection Screen validations for Chart of Accounts
PERFORM SUB_VALIDATION_BUDAT.
o
+
Selection Screen validations Fiscal Year
PERFORM SUB_VALIDATION_PRCTR.
o
+
Selection Screen validations for Peiod
PERFORM SUB_VALIDATION_BLART.
START-OF-SELECTION
START-OF-SELECTION.
o
+
Check whether filepath/name have been entered in the sel screen
PERFORM SUB_CHECK_FILEPATH.
o
+
Prepare Final Internal Table.
PERFORM SUB_PREPARE_FINAL.
o
+
Download data.
PERFORM SUB_DOWNLOAD_DATA .
*& Form sub_get_filename
text
<--P_PFILE Presentation server File name
FORM SUB_GET_FILENAME CHANGING P_FILE TYPE C.
DATA : L_FILENAME TYPE STRING, " For File Name
L_PATH TYPE STRING, " For Directory
L_FULLPATH TYPE STRING. " Full path
o
+
For File Open Dialog Box
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = C_PCFILE " Window Title
DEFAULT_EXTENSION = C_TXT1 " File Extn
PROMPT_ON_OVERWRITE = C_FLAG_X " Over write
CHANGING
FILENAME = L_FILENAME " File Name
PATH = L_PATH " File Path
FULLPATH = L_FULLPATH " Full Path
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF SY-SUBRC NE 0.
o
+
Error in opening the file
MESSAGE E000.
ELSE.
CONCATENATE L_PATH
L_FILENAME
INTO P_FILE.
V_PRESPATH = L_PATH.
ENDIF.
ENDFORM. " sub_get_filename
*& Form sub_ap_f4
f4 help attched with application server
FORM SUB_AP_F4 .
o
+
FM for to get the Application Server Path
IF RB_AFILE = C_FLAG_X.
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
DIRECTORY =
FILEMASK = C_ASC " File Extn
IMPORTING
SERVERFILE = P_AFILE " File Path
EXCEPTIONS
CANCELED_BY_USER = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
o
+
Error in opening the file
MESSAGE E000.
ENDIF.
ENDIF.
ENDFORM. " sub_ap_f4
*& Form sub_modify_screen
text
--> p1 text
<-- p2 text
FORM SUB_MODIFY_SCREEN .
o
+
Selection screen Modifications
IF RB_PFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE' OR
SCREEN-NAME = '%_P_PFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_FLAG_1.
CONCATENATE C_DIR C_GLD V_DATE SY-UZEIT(4) C_TXT INTO P_PFILE.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE' OR
SCREEN-NAME = '%_P_PFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_ZERO.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF RB_AFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_AFILE' OR
SCREEN-NAME = '%_P_AFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_FLAG_1.
CONCATENATE '/Solectron/Data/' C_GLD V_DATE SY-UZEIT(4) C_DAT
INTO P_AFILE.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_AFILE' OR
SCREEN-NAME = '%_P_AFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_ZERO.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF RB_PFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE'.
SCREEN-ACTIVE = C_FLAG_1.
ENDIF.
IF SCREEN-NAME = 'P_AFILE'.
SCREEN-ACTIVE = C_ZERO.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF RB_AFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE'.
SCREEN-ACTIVE = C_ZERO.
ENDIF.
IF SCREEN-NAME = 'P_AFILE'.
SCREEN-ACTIVE = C_FLAG_1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDFORM. " sub_modify_screen
*& Form sub_validation_bukrs
Validation For Company Code
FORM SUB_VALIDATION_BUKRS .
DATA: L_BUKRS TYPE BUKRS. " Company Code
IF S_BUKRS IS NOT INITIAL.
IF S_BUKRS-HIGH IS NOT INITIAL AND S_BUKRS-LOW IS INITIAL.
MESSAGE E006.
ELSE.
o
+
Validation for chart of accounts
SELECT BUKRS " Company Code
FROM T001 UP TO 1 ROWS
INTO L_BUKRS
WHERE BUKRS IN S_BUKRS.
ENDSELECT.
IF SY-SUBRC NE 0.
o
+
Invalid Company code
MESSAGE E001.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_bukrs
*& Form sub_validation_hkont
Validation For General Ledger Account
FORM SUB_VALIDATION_HKONT .
DATA: L_HKONT TYPE HKONT. " General Ledger Account
IF S_HKONT IS INITIAL.
MESSAGE E002.
ELSE.
IF S_HKONT-HIGH IS NOT INITIAL AND S_HKONT-LOW IS INITIAL.
MESSAGE E006.
ELSE.
o
+
Validation for chart of accounts
SELECT SAKNR " General Ledger Account
FROM SKA1 UP TO 1 ROWS
INTO L_HKONT
WHERE SAKNR IN S_HKONT AND KTOPL = '1SLR'.
ENDSELECT.
IF SY-SUBRC NE 0.
o
+
Invalid General Ledger Account
MESSAGE E003.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_hkont
*& Form sub_validation_gjahr
Validation For Fiscal Year
FORM SUB_VALIDATION_GJAHR .
DATA: L_GJAHR TYPE GJAHR. " Fiscal Year
IF S_GJAHR IS NOT INITIAL.
IF S_GJAHR-HIGH IS NOT INITIAL AND S_GJAHR-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_gjahr
*& Form sub_validation_monat
Validation For Fiscal period
FORM SUB_VALIDATION_MONAT .
DATA: L_MONAT TYPE MONAT. " Fiscal period
IF S_MONAT IS NOT INITIAL.
IF S_MONAT-LOW LE C_ZERO.
o
+
Invalid Fiscal Period
MESSAGE E006.
ENDIF.
IF S_MONAT-HIGH GT C_FLAG_12.
o
+
Invalid Fiscal Period
MESSAGE E007.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_monat
*& Form sub_validation_belnr
Validation For Accounting Document Number
FORM SUB_VALIDATION_BELNR .
DATA: L_BELNR TYPE BELNR_D. " Accounting Document Number
IF S_BELNR IS NOT INITIAL.
IF S_BELNR-HIGH IS NOT INITIAL AND S_BELNR-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_belnr
*& Form sub_validation_budat
Validation For Posting Date
FORM SUB_VALIDATION_BUDAT .
DATA: L_BUDAT TYPE BUDAT. " Posting Date
IF S_BUDAT IS NOT INITIAL.
IF S_BUDAT-HIGH IS NOT INITIAL AND S_BUDAT-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_budat
*& Form sub_validation_prctr
Validation For Profit Center
FORM SUB_VALIDATION_PRCTR .
DATA: L_PRCTR TYPE PRCTR. " Profit Center
IF S_PRCTR IS INITIAL.
MESSAGE E010.
ELSE.
IF S_PRCTR-HIGH IS NOT INITIAL AND S_PRCTR-LOW IS INITIAL.
MESSAGE E006.
ELSE.
o
+
Validation for chart of accounts
SELECT PRCTR " Profit Center
FROM CEPC UP TO 1 ROWS
INTO L_PRCTR
WHERE PRCTR IN S_PRCTR.
ENDSELECT.
IF SY-SUBRC NE 0.
o
+
Invalid Profit Center
MESSAGE E011.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_prctr
*& Form sub_validation_blart
Validation For Document type
FORM SUB_VALIDATION_BLART .
DATA: L_BLART TYPE BLART. " Document type
IF S_BLART IS INITIAL.
MESSAGE E012.
ELSE.
IF S_BLART-HIGH IS NOT INITIAL AND S_BLART-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_blart
*& Form sub_check_filepath
Check user input for initial filename
FORM SUB_CHECK_FILEPATH .
IF RB_PFILE = C_FLAG_X.
IF P_PFILE IS INITIAL.
o
+
The Local File Path can not be Empty
MESSAGE I014.
LEAVE LIST-PROCESSING.
ENDIF.
ELSEIF RB_AFILE = C_FLAG_X.
IF P_AFILE IS INITIAL.
o
+
The App Server File Path can not be Empty
MESSAGE I015.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ENDFORM. " sub_check_filepath
*& Form sub_prepare_final
append the required output data in to the internal table.
FORM SUB_PREPARE_FINAL.
changes on 30 th may by dileep
SELECT * FROM BSEG INTO TABLE I_BSEG WHERE HKONT IN S_HKONT AND "G/L Account
GJAHR IN S_GJAHR AND
PRCTR IN S_PRCTR AND "Profit Center
BLART IN S_BLART . "Document Type
SELECT BUKRS
HKONT
BELNR
DMBTR
KOSTL
PRCTR
FROM BSEG INTO TABLE IT_BSEG WHERE HKONT IN S_HKONT AND "G/L Account
PRCTR IN S_PRCTR. "Profit Center
LOOP AT IT_BSEG INTO WA_BSEG.
SELECT SINGLE GJAHR
BUDAT
WAERS
XBLNR
BLART
MONAT
INTO (W_BSEG-GJAHR,W_BSEG-BUDAT,W_BSEG-WAERS,W_BSEG-XBLNR,W_BSEG-BLART,W_BSEG-MONAT)
FROM BKPF WHERE BELNR = W_BSEG-BELNR AND
GJAHR IN S_GJAHR AND
BLART IN S_BLART . "Document Type
MOVE WA_BSEG-BUKRS TO W_BSEG-BUKRS.
MOVE WA_BSEG-HKONT TO W_BSEG-HKONT.
MOVE WA_BSEG-BELNR TO W_BSEG-BELNR.
MOVE WA_BSEG-DMBTR TO W_BSEG-DMBTR.
MOVE WA_BSEG-KOSTL TO W_BSEG-KOSTL.
MOVE WA_BSEG-PRCTR TO W_BSEG-PRCTR.
APPEND W_BSEG TO I_BSEG.
ENDLOOP.
changes on 30 th may by dileep
IF S_BUKRS IS NOT INITIAL.
SORT I_BSEG BY BUKRS ASCENDING.
DELETE I_BSEG WHERE NOT BUKRS IN S_BUKRS.
ENDIF.
IF S_MONAT IS NOT INITIAL.
SORT I_BSEG BY GJAHR MONAT ASCENDING.
IF S_MONAT-HIGH IS NOT INITIAL AND S_MONAT-LOW IS NOT INITIAL.
DELETE I_BSEG WHERE MONAT < S_MONAT-LOW OR MONAT > S_MONAT-HIGH.
ENDIF.
IF S_MONAT-HIGH IS INITIAL AND S_MONAT-LOW IS NOT INITIAL.
DELETE I_BSEG WHERE MONAT NE S_MONAT-LOW.
ENDIF.
ENDIF.
IF S_BELNR IS NOT INITIAL.
SORT I_BSEG BY BELNR ASCENDING.
DELETE I_BSEG WHERE NOT BELNR IN S_BELNR.
ENDIF.
IF S_BUDAT IS NOT INITIAL.
SORT I_BSEG BY BUDAT ASCENDING.
DELETE I_BSEG WHERE NOT BUDAT IN S_BUDAT.
ENDIF.
LOOP AT I_BSEG INTO W_BSEG.
MOVE W_BSEG-BUKRS TO W_FINAL-BUKRS.
MOVE W_BSEG-HKONT TO W_FINAL-HKONT_P.
MOVE W_BSEG-GJAHR TO W_FINAL-GJAHR.
MOVE W_BSEG-BELNR TO W_FINAL-BELNR.
MOVE W_BSEG-BUDAT TO W_FINAL-BUDAT.
MOVE W_BSEG-WAERS TO W_FINAL-WAERS.
MOVE W_BSEG-XBLNR TO W_FINAL-XBLNR.
MOVE W_BSEG-BLART TO W_FINAL-BLART.
MOVE W_BSEG-MONAT TO W_FINAL-MONAT.
MOVE W_BSEG-DMBTR TO W_FINAL-DMBTR_P.
MOVE W_BSEG-KOSTL TO W_FINAL-KOSTL.
MOVE W_BSEG-PRCTR TO W_FINAL-PRCTR_P.
SELECT SINGLE * FROM BSEG INTO W_BSEG1 WHERE BELNR = W_BSEG-BELNR AND "Document Type
BUZID = 'W' .
IF SY-SUBRC = 0.
MOVE W_BSEG1-HKONT TO W_FINAL-HKONT_G.
MOVE W_BSEG1-DMBTR TO W_FINAL-DMBTR_G.
MOVE W_BSEG1-PRCTR TO W_FINAL-PRCTR_G.
MOVE W_BSEG1-BUZID TO W_FINAL-BUZID_G.
ELSE.
EXIT.
ENDIF.
APPEND W_FINAL TO I_FINAL.
SORT I_FINAL BY BELNR ASCENDING.
ENDLOOP.
ENDFORM. " sub_prepare_final
*& Form sub_download_data
Download data
FORM SUB_DOWNLOAD_DATA .
DATA : V_PRD(2) TYPE N.
IF RB_PFILE = C_FLAG_X.
o
+
Downloading To presentation server
V_PRESPATH = P_PFILE.
PERFORM SUB_DOWNLOAD_PRESSERVER.
ELSEIF RB_AFILE = C_FLAG_X.
o
+
Downloading To Application server in Auto Mode
V_APPPATH = P_AFILE.
PERFORM SUB_DOWNLOAD_APPSERVER.
ENDIF.
ENDFORM. " sub_download_data
*& Form sub_download_presserver
text
FORM SUB_DOWNLOAD_PRESSERVER.
DATA: MESSAGE TYPE STRING.
IF I_FINAL[] IS INITIAL.
MESSAGE I016.
EXIT.
ELSE.
W_FINAL_P-BUKRS = 'Company Code'.
W_FINAL_P-DELIMITER_1 = '|'.
W_FINAL_P-HKONT_P = 'G/L Account Number'.
W_FINAL_P-DELIMITER_2 = '|'.
W_FINAL_P-GJAHR = 'Fiscal Year'.
W_FINAL_P-DELIMITER_3 = '|'.
W_FINAL_P-BELNR = 'A/c Document Number'.
W_FINAL_P-DELIMITER_4 = '|'.
W_FINAL_P-BUDAT = 'Posting Date' .
W_FINAL_P-DELIMITER_5 = '|'.
W_FINAL_P-WAERS = 'Currency'.
W_FINAL_P-DELIMITER_6 = '|'.
W_FINAL_P-XBLNR = 'Ref. Document Number'.
W_FINAL_P-DELIMITER_7 = '|'.
W_FINAL_P-BLART = 'Document Type'.
W_FINAL_P-DELIMITER_8 = '|'.
W_FINAL_P-MONAT = 'Fiscal Period'.
W_FINAL_P-DELIMITER_9 = '|'.
W_FINAL_P-DMBTR_P = 'Amount'.
W_FINAL_P-DELIMITER_10 = '|'.
W_FINAL_P-KOSTL = 'Cost Center'.
W_FINAL_P-DELIMITER_11 = '|'.
W_FINAL_P-PRCTR_P = 'Profit Center'.
W_FINAL_P-DELIMITER_12 = '|'.
W_FINAL_P-HKONT_G = 'G/L Account Number'.
W_FINAL_P-DELIMITER_13 = '|'.
W_FINAL_P-DMBTR_G = 'Amount'.
W_FINAL_P-DELIMITER_14 = '|'.
W_FINAL_P-PRCTR_G = 'Profit Center'.
W_FINAL_P-DELIMITER_15 = '|'.
W_FINAL_P-BUZID_G = 'Line Item Id'.
APPEND W_FINAL_P TO I_FINAL_P.
LOOP AT I_FINAL INTO W_FINAL.
W_FINAL_P-BUKRS = W_FINAL-BUKRS.
W_FINAL_P-DELIMITER_1 = '|'.
W_FINAL_P-HKONT_P = W_FINAL-HKONT_P.
W_FINAL_P-DELIMITER_2 = '|'.
W_FINAL_P-GJAHR = W_FINAL-GJAHR.
W_FINAL_P-DELIMITER_3 = '|'.
W_FINAL_P-BELNR = W_FINAL-BELNR.
W_FINAL_P-DELIMITER_4 = '|'.
W_FINAL_P-BUDAT = W_FINAL-BUDAT .
W_FINAL_P-DELIMITER_5 = '|'.
W_FINAL_P-WAERS = W_FINAL-WAERS.
W_FINAL_P-DELIMITER_6 = '|'.
W_FINAL_P-XBLNR = W_FINAL-XBLNR.
W_FINAL_P-DELIMITER_7 = '|'.
W_FINAL_P-BLART = W_FINAL-BLART.
W_FINAL_P-DELIMITER_8 = '|'.
W_FINAL_P-MONAT = W_FINAL-MONAT.
W_FINAL_P-DELIMITER_9 = '|'.
W_FINAL_P-DMBTR_P = W_FINAL-DMBTR_P.
W_FINAL_P-DELIMITER_10 = '|'.
W_FINAL_P-KOSTL = W_FINAL-KOSTL.
W_FINAL_P-DELIMITER_11 = '|'.
W_FINAL_P-PRCTR_P = W_FINAL-PRCTR_P.
W_FINAL_P-DELIMITER_12 = '|'.
W_FINAL_P-HKONT_G = W_FINAL-HKONT_G.
W_FINAL_P-DELIMITER_13 = '|'.
W_FINAL_P-DMBTR_G = W_FINAL-DMBTR_G.
W_FINAL_P-DELIMITER_14 = '|'.
W_FINAL_P-PRCTR_G = W_FINAL-PRCTR_G.
W_FINAL_P-DELIMITER_15 = '|'.
W_FINAL_P-BUZID_G = W_FINAL-BUZID_G.
APPEND W_FINAL_P TO I_FINAL_P.
CLEAR : W_FINAL_P, W_FINAL.
ENDLOOP.
ENDIF.
*---Downloading data to file on Presentation Server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = V_PRESPATH
FILETYPE = 'ASC'
TABLES
DATA_TAB = I_FINAL_P
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
o
+ File can not be opened successfully
IF SY-SUBRC NE 0.
IF SY-BATCH EQ C_FLAG_X. " Stop Processing
MESSAGE E017. " File could not be opened
ELSE.
MESSAGE I017. " File could not be opened
LEAVE LIST-PROCESSING.
ENDIF.
ELSE.
CONCATENATE 'Data Successfully downloaded to the Specified Location' V_PRESPATH INTO MESSAGE SEPARATED BY SPACE.
MESSAGE MESSAGE TYPE 'S'.
ENDIF.
MODIFY SCREEN.
ENDFORM. " sub_download_presserver
*& Form sub_download_appserver
text
FORM SUB_DOWNLOAD_APPSERVER .
DATA: V_FILE TYPE STRING, " String
P_DMBTR TYPE CHAR20,
G_DMBTR TYPE CHAR20,
MESSAGE1 TYPE STRING.
IF I_FINAL[] IS INITIAL.
IF SY-BATCH EQ C_FLAG_X.
o
+
File contains no data
MESSAGE E016 .
ELSE.
o
+
File contains no data
MESSAGE I016 .
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
o
+
To Open The file in Application Server
OPEN DATASET V_APPPATH FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
o
+
Display error message: "Could not open file"
IF SY-BATCH EQ C_FLAG_X.
o
+
File contains no data
MESSAGE E016 .
ELSE.
o
+
File contains no data
MESSAGE I016 .
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
o
+
Perform for building the Report header
CONCATENATE
'COMPANY_CODE'
'G/L_ACCOUNT_NUMBER'
'FISCAL_YEAR'
'A/C_DOCUMENT_NUMBER'
'POSTING_DATE'
'CURRENCY'
'REF_DOCUMENT_NUMBER'
'DOCUMENT_TYPE'
'FISCAL_PERIOD'
'AMOUNT'
'COSTCENTER'
'PROFIT_CENTER'
'G/L_ACCOUNT_NUMBER'
'AMOUNT'
'PROFIT_CENTER'
'LINE_ITEM_ID'
INTO V_FILE SEPARATED BY C_DELIMITER.
TRANSFER V_FILE TO V_APPPATH.
o
+
Transfer the data to application Server
LOOP AT I_FINAL INTO W_FINAL.
P_DMBTR = W_FINAL-DMBTR_P.
G_DMBTR = W_FINAL-DMBTR_G.
CONCATENATE
W_FINAL-BUKRS
W_FINAL-HKONT_P
W_FINAL-GJAHR
W_FINAL-BELNR
W_FINAL-BUDAT
W_FINAL-WAERS
W_FINAL-XBLNR
W_FINAL-BLART
W_FINAL-MONAT
P_DMBTR
W_FINAL-KOSTL
W_FINAL-PRCTR_P
W_FINAL-HKONT_G
G_DMBTR
W_FINAL-PRCTR_G
W_FINAL-BUZID_G
INTO V_FILE SEPARATED BY C_DELIMITER.
TRANSFER V_FILE TO V_APPPATH.
IF SY-SUBRC NE 0.
Display error message: "Data could not be written at the location"
MESSAGE 'Data could not be written at the location' TYPE 'I'.
EXIT.
ENDIF.
CLEAR V_FILE.
ENDLOOP.
CLOSE DATASET V_APPPATH.
IF SY-SUBRC NE 0.
Display error message: "File could not be closed"
MESSAGE 'File could not be closed' TYPE 'I'.
EXIT.
ELSE.
CONCATENATE 'Data Successfully downloaded to the Specified Location' V_APPPATH INTO MESSAGE1 SEPARATED BY SPACE.
MESSAGE MESSAGE1 TYPE 'S'.
ENDIF.
ENDFORM. " sub_download_appserver
regards,
Vipul -
Hi SAP Gurus
this is kanna from Banglore
i got one interview question yesterday i.e.,
they are asking me.
Tell what is your system land scape ?
i want Explanation for this question how to transport one server to another serve and how to transport with in development server. like in development ( golden client to sand box or golden to rice gold )Hi SAP Gurus
i want some Explanation about work list and wrap tool and write up -
Hi sap gurus can anyone help to sort my Problem
hi sap gurus
i have a scenario
1) sales order should allow the BOM subitems which drives the <b>demand</b>. can u anybody tell me how to configure step by step. in addition to that , i need <b>subitems </b>should not be <b>displayed</b> on the customer invoice. how can i do that?
<b>maximum points will be rewarded.
</b>
thanksin advance
sam sdHi
Not displaying the subitems in the invoice can be controlled in the program which is linked to your output type. If you inform your reqmts to the ABAPer, he should be able to code accordingly.
For demand planning, you may either have to use Sales Operations Planning or Transfer of Reqmts in SD. You can talk to somebody who knows either of these good and they can help you. Alternatively, you can post this specific question in PP also. May be you will get immediate answer for this.
Pls reward if this is helpful to you -
hi SAP gurus,
Can any body explain me about ASAP. What is the significance of this in SAP implementation.
what is the meaning of "Tickets" in SAP?
with regards,
Sourav BhaumikThe following R the diff phases of ABAP programming.
Phase 1 : Project Preperation.
Phase 2 : Business Blueprint.
Phase 3 : Realization.
Phase 4 : Final Preperation.
Phase 5 : Go live and Support.
Realization is the most important phase where a ABAPer enters,All the beginers(ABAP) enter into SAP world in this phase.
Phase 1 : Project Preperation : In this phase of the ASAP Roadmap,desicion makers define clear project objectives and an efficient decision-making process. A project charter is issued,an implemetation stratergy is outlined and the project team as well as its working environment r established.
The first step is for the project managers(not for ABAPers) to set up the implementation project(s).They draw up a road draft of the project,appoint the project team and hold a kickoff meeting.The kickoff meeting is critical, since at this time the project team and process owners become aware of the project charter and objectives and are allocated their responsibilities,lasting thriughout the project.
Phase 2 : Business Blueprint
In this phase,The scope of R/3 is defined(to solve the task) the documentation of R/3 implementation is done.The final document prepared is called "Business Blueprint".This is done by project team under the project manager.Here the exact step by step procedure in which the task has 2 be carried out is defined.
The Business Blue print serves as the conceptual master plan & is assembled into a detailed written document.This document summarizes and documents business requirements in detail and serves as the basis for organisation,configuration and if necessary,development activities.
The business Process Master List (BPML) is the primary activity-tracking & control mechanism used by project management team during the realization phase. The BPML is first created at the end of the Business Blue print phase from the Q&Adb in order to create the Baseline Scope Document and ten used during the next phase for monitoring and controlling the R/3 configuration and testing activities.
Phase 3:
Realization:This is the moost important phase,because,this is where maximm number of Techincal people will be at work.Especially people having experience less than 4-5 yrs.
The purpose of Phase 3 is to configure the R/3 System,in ordr 2 have an integrated and documented solution that fulfills Ur client's business process requiremnts.
In this phase,configuration of the system is carried out in 2 steps:
(1)Baseline and
(2)Final Configuration.
(1)Base line
The Base line Configuration is designed 2 configure abt 80% of ur clint's daily business transactions & all of the master data,& organize structur.The remaining configuration is done in process-oriented cycles.The Businessss Blue print is used as D guide 4r D system config,done using D mplementation guide.which will be describd in detail in tihs forum.
After this process,data transfer pograms as wella s interfcaceds ,ned 2 be tested.
Phase 4:
Final Preperation
The purpose of this phase,as name suggests, is 2 complete the final preperation of the R/3 systm 4r going live.This includes testing, user training, system managment & cutover activities,2 finalize ur radiness 2 go live.This final preperation phse also serves 2 resolve all crucial open issues. On successful completion of this phase, U r ready 2 run the business in ur productive R/3 system.
In this phase,the end users go thru comprehensive training.
Phase 5:
Go Live and support
Now U r ready to go live with ur productive system ! Afterwards, the project team focuses on supporting the end users,4r which training may not be completed.It is also necessay 2 establish preocedures & measurements 2 review D benefits of ur investments in R/3 on an ongoing basis . Key SAP Services 2 support U in this phase include
The onlin Sevrvices System (OSS)
REMOTE Consulting
EarlyWatch Services.
In this phase the implementation project is concerned with supporting & optimizing the operative R/3 system,both the technical infrastructure & load distribution as well as the business process. -
Hi sap gurus can any body help me
REPORT ZFIR_GRIR_IPV
NO STANDARD PAGE HEADING
LINE-SIZE 120
MESSAGE-ID ZFI02.
TABLES: BSEG,BKPF.
TYPES: BEGIN OF A_FINAL,
BUKRS TYPE CHAR12,
HKONT_P TYPE CHAR18,
GJAHR TYPE CHAR11,
BELNR TYPE CHAR19,
BUDAT TYPE CHAR12,
WAERS TYPE CHAR8,
XBLNR TYPE CHAR20,
BLART TYPE CHAR13,
MONAT TYPE CHAR13,
DMBTR_P TYPE CHAR13,
KOSTL TYPE CHAR11,
PRCTR_P TYPE CHAR13,
HKONT_G TYPE CHAR18,
DMBTR_G TYPE CHAR13,
PRCTR_G TYPE CHAR13,
BUZID_G TYPE CHAR15,
END OF A_FINAL.
changes on 30 th may by dileep
TYPES: BEGIN OF IT_FINAL,
BUKRS TYPE BUKRS ,
HKONT TYPE HKONT,
BELNR TYPE BELNR_D,
DMBTR TYPE DMBTR ,
KOSTL TYPE KOSTL,
PRCTR TYPE PRCTR,
END OF IT_FINAL.
TYPES: BEGIN OF IT_FINAL1,
BUKRS TYPE BUKRS,
HKONT TYPE HKONT,
GJAHR TYPE GJAHR ,
BELNR TYPE BELNR_D,
BUDAT TYPE BUDAT,
WAERS TYPE WAERS ,
XBLNR TYPE XBLNR1,
BLART TYPE BLART,
MONAT TYPE MONAT,
DMBTR TYPE DMBTR,
KOSTL TYPE KOSTL,
PRCTR TYPE PRCTR,
END OF IT_FINAL1.
end of changes on 30 th may by dileep
TYPES: BEGIN OF P_FINAL,
BUKRS TYPE CHAR12,
DELIMITER_1 TYPE CHAR1,
HKONT_P TYPE CHAR18,
DELIMITER_2 TYPE CHAR1,
GJAHR TYPE CHAR11,
DELIMITER_3 TYPE CHAR1,
BELNR TYPE CHAR19,
DELIMITER_4 TYPE CHAR1,
BUDAT TYPE CHAR12,
DELIMITER_5 TYPE CHAR1,
WAERS TYPE CHAR8,
DELIMITER_6 TYPE CHAR1,
XBLNR TYPE CHAR20,
DELIMITER_7 TYPE CHAR1,
BLART TYPE CHAR13,
DELIMITER_8 TYPE CHAR1,
MONAT TYPE CHAR13,
DELIMITER_9 TYPE CHAR1,
DMBTR_P TYPE CHAR13,
DELIMITER_10 TYPE CHAR1,
KOSTL TYPE CHAR11,
DELIMITER_11 TYPE CHAR1,
PRCTR_P TYPE CHAR13,
DELIMITER_12 TYPE CHAR1,
HKONT_G TYPE CHAR18,
DELIMITER_13 TYPE CHAR1,
DMBTR_G TYPE CHAR13,
DELIMITER_14 TYPE CHAR1,
PRCTR_G TYPE CHAR13,
DELIMITER_15 TYPE CHAR1,
BUZID_G TYPE CHAR15,
END OF P_FINAL.
DATA: IT_BSEG TYPE STANDARD TABLE OF IT_FINAL INITIAL SIZE 0,
I_BSEG TYPE STANDARD TABLE OF IT_FINAL1 INITIAL SIZE 0,
I_FINAL TYPE STANDARD TABLE OF A_FINAL INITIAL SIZE 0 WITH HEADER LINE,
I_FINAL_P TYPE STANDARD TABLE OF P_FINAL INITIAL SIZE 0 WITH HEADER LINE,
W_FINAL_P TYPE P_FINAL,
W_BSEG1 TYPE BSEG,
WA_BSEG TYPE IT_FINAL OCCURS 0 WITH HEADER LINE,
W_BSEG TYPE IT_FINAL1 OCCURS 0 WITH HEADER LINE,
T_BSEG TYPE STANDARD TABLE OF BSEG INITIAL SIZE 0 WITH HEADER LINE,
W_FINAL TYPE A_FINAL,
F_YEAR TYPE BAPI0002_4-FISCAL_YEAR,
F_PERIOD TYPE BAPI0002_4-FISCAL_PERIOD,
RETURN1 TYPE BAPIRETURN1,
V_DATE TYPE CHAR8, " Date in YYYYMMDD format
V_PRESPATH TYPE STRING, " Path
V_APPPATH TYPE STRING, " Path
V_FILENAME(25) TYPE C, " File Name
V_PERIOD TYPE CHAR3, " Date for Posting Period
V_FSYEAR TYPE BDATJ, " Fiscal Year
L_TEXT TYPE CHAR1. " Hypen
CONSTANTS: C_TXT TYPE CHAR4 VALUE '.txt', " File Extension
C_TXT1 TYPE STRING VALUE 'txt', " File Type
C_FLAG_X TYPE CHAR1 VALUE 'X', " Flag
C_ASC TYPE FILETYPE VALUE 'ASC', " File type
C_DAT TYPE CHAR4 VALUE '.dat', " File Type
C_FLAG_1 TYPE CHAR1 VALUE '1', " Constant value
C_ZERO TYPE CHAR1 VALUE '0', " Constant
C_GLD(10) TYPE C VALUE 'GRIR021S', " Constant in file Path
C_DIR TYPE CHAR3 VALUE 'C:\', " Presentation Server path
C_FLAG_12 TYPE CHAR2 VALUE '12', " Constant value
C_PCFILE TYPE STRING VALUE 'PC File',
C_DELIMITER TYPE C VALUE '|'.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
*--- Selection Criteria
SELECT-OPTIONS: S_BUKRS FOR BSEG-BUKRS DEFAULT '012T', " Company Code
S_HKONT FOR BSEG-HKONT OBLIGATORY DEFAULT '4505001',
S_GJAHR FOR BKPF-GJAHR DEFAULT SY-DATUM+0(4),
S_MONAT FOR BKPF-MONAT DEFAULT SY-DATUM+4(2),
S_BELNR FOR BSEG-BELNR ,
S_BUDAT FOR BKPF-BUDAT ,
S_PRCTR FOR BSEG-PRCTR OBLIGATORY DEFAULT '12TOTH00',
S_BLART FOR BKPF-BLART OBLIGATORY DEFAULT 'RE'.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
*--- Radio Buttons for chose the PC Path or App.. Server Path
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:
RB_PFILE RADIOBUTTON GROUP RAD2 DEFAULT 'X' USER-COMMAND UCOMM1.
SELECTION-SCREEN COMMENT 5(27) TEXT-002 FOR FIELD RB_PFILE.
PARAMETERS:
P_PFILE LIKE RLGRAP-FILENAME LOWER CASE.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:
RB_AFILE RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 5(27) TEXT-003 FOR FIELD RB_AFILE.
PARAMETERS:
P_AFILE LIKE RLGRAP-FILENAME LOWER CASE. " Path for AS
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PFILE.
*-- Select File name with Dialog Box
PERFORM SUB_GET_FILENAME CHANGING P_PFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_AFILE.
*--- Attach F4 HELP CORRESPONDING TO THE FIELD
PERFORM SUB_AP_F4.
AT SELECTION-SCREEN OUTPUT.
*--Modify screen parameters
PERFORM SUB_MODIFY_SCREEN.
AT SELECTION-SCREEN.
*--- Selection Screen validations for Company Code
PERFORM SUB_VALIDATION_BUKRS.
*--- Selection Screen validations for Chart of Accounts
PERFORM SUB_VALIDATION_HKONT.
*--- Selection Screen validations Fiscal Year
PERFORM SUB_VALIDATION_GJAHR.
*--- Selection Screen validations for Peiod
PERFORM SUB_VALIDATION_MONAT.
*--- Selection Screen validations for Company Code
PERFORM SUB_VALIDATION_BELNR.
*--- Selection Screen validations for Chart of Accounts
PERFORM SUB_VALIDATION_BUDAT.
*--- Selection Screen validations Fiscal Year
PERFORM SUB_VALIDATION_PRCTR.
*--- Selection Screen validations for Peiod
PERFORM SUB_VALIDATION_BLART.
START-OF-SELECTION
START-OF-SELECTION.
*--- Check whether filepath/name have been entered in the sel screen
PERFORM SUB_CHECK_FILEPATH.
*--- Prepare Final Internal Table.
PERFORM SUB_PREPARE_FINAL.
*--- Download data.
PERFORM SUB_DOWNLOAD_DATA .
*& Form sub_get_filename
text
<--P_PFILE Presentation server File name
FORM SUB_GET_FILENAME CHANGING P_FILE TYPE C.
DATA : L_FILENAME TYPE STRING, " For File Name
L_PATH TYPE STRING, " For Directory
L_FULLPATH TYPE STRING. " Full path
*--- For File Open Dialog Box
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = C_PCFILE " Window Title
DEFAULT_EXTENSION = C_TXT1 " File Extn
PROMPT_ON_OVERWRITE = C_FLAG_X " Over write
CHANGING
FILENAME = L_FILENAME " File Name
PATH = L_PATH " File Path
FULLPATH = L_FULLPATH " Full Path
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF SY-SUBRC NE 0.
*--- Error in opening the file
MESSAGE E000.
ELSE.
CONCATENATE L_PATH
L_FILENAME
INTO P_FILE.
V_PRESPATH = L_PATH.
ENDIF.
ENDFORM. " sub_get_filename
*& Form sub_ap_f4
f4 help attched with application server
FORM SUB_AP_F4 .
*--- FM for to get the Application Server Path
IF RB_AFILE = C_FLAG_X.
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
DIRECTORY =
FILEMASK = C_ASC " File Extn
IMPORTING
SERVERFILE = P_AFILE " File Path
EXCEPTIONS
CANCELED_BY_USER = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
*--- Error in opening the file
MESSAGE E000.
ENDIF.
ENDIF.
ENDFORM. " sub_ap_f4
*& Form sub_modify_screen
text
--> p1 text
<-- p2 text
FORM SUB_MODIFY_SCREEN .
*--- Selection screen Modifications
IF RB_PFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE' OR
SCREEN-NAME = '%_P_PFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_FLAG_1.
CONCATENATE C_DIR C_GLD V_DATE SY-UZEIT(4) C_TXT INTO P_PFILE.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE' OR
SCREEN-NAME = '%_P_PFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_ZERO.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF RB_AFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_AFILE' OR
SCREEN-NAME = '%_P_AFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_FLAG_1.
CONCATENATE '/Solectron/Data/' C_GLD V_DATE SY-UZEIT(4) C_DAT
INTO P_AFILE.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_AFILE' OR
SCREEN-NAME = '%_P_AFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_ZERO.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF RB_PFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE'.
SCREEN-ACTIVE = C_FLAG_1.
ENDIF.
IF SCREEN-NAME = 'P_AFILE'.
SCREEN-ACTIVE = C_ZERO.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF RB_AFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE'.
SCREEN-ACTIVE = C_ZERO.
ENDIF.
IF SCREEN-NAME = 'P_AFILE'.
SCREEN-ACTIVE = C_FLAG_1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDFORM. " sub_modify_screen
*& Form sub_validation_bukrs
Validation For Company Code
FORM SUB_VALIDATION_BUKRS .
DATA: L_BUKRS TYPE BUKRS. " Company Code
IF S_BUKRS IS NOT INITIAL.
IF S_BUKRS-HIGH IS NOT INITIAL AND S_BUKRS-LOW IS INITIAL.
MESSAGE E006.
ELSE.
*--- Validation for chart of accounts
SELECT BUKRS " Company Code
FROM T001 UP TO 1 ROWS
INTO L_BUKRS
WHERE BUKRS IN S_BUKRS.
ENDSELECT.
IF SY-SUBRC NE 0.
*--- Invalid Company code
MESSAGE E001.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_bukrs
*& Form sub_validation_hkont
Validation For General Ledger Account
FORM SUB_VALIDATION_HKONT .
DATA: L_HKONT TYPE HKONT. " General Ledger Account
IF S_HKONT IS INITIAL.
MESSAGE E002.
ELSE.
IF S_HKONT-HIGH IS NOT INITIAL AND S_HKONT-LOW IS INITIAL.
MESSAGE E006.
ELSE.
*--- Validation for chart of accounts
SELECT SAKNR " General Ledger Account
FROM SKA1 UP TO 1 ROWS
INTO L_HKONT
WHERE SAKNR IN S_HKONT AND KTOPL = '1SLR'.
ENDSELECT.
IF SY-SUBRC NE 0.
*--- Invalid General Ledger Account
MESSAGE E003.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_hkont
*& Form sub_validation_gjahr
Validation For Fiscal Year
FORM SUB_VALIDATION_GJAHR .
DATA: L_GJAHR TYPE GJAHR. " Fiscal Year
IF S_GJAHR IS NOT INITIAL.
IF S_GJAHR-HIGH IS NOT INITIAL AND S_GJAHR-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_gjahr
*& Form sub_validation_monat
Validation For Fiscal period
FORM SUB_VALIDATION_MONAT .
DATA: L_MONAT TYPE MONAT. " Fiscal period
IF S_MONAT IS NOT INITIAL.
IF S_MONAT-LOW LE C_ZERO.
*--- Invalid Fiscal Period
MESSAGE E006.
ENDIF.
IF S_MONAT-HIGH GT C_FLAG_12.
*--- Invalid Fiscal Period
MESSAGE E007.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_monat
*& Form sub_validation_belnr
Validation For Accounting Document Number
FORM SUB_VALIDATION_BELNR .
DATA: L_BELNR TYPE BELNR_D. " Accounting Document Number
IF S_BELNR IS NOT INITIAL.
IF S_BELNR-HIGH IS NOT INITIAL AND S_BELNR-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_belnr
*& Form sub_validation_budat
Validation For Posting Date
FORM SUB_VALIDATION_BUDAT .
DATA: L_BUDAT TYPE BUDAT. " Posting Date
IF S_BUDAT IS NOT INITIAL.
IF S_BUDAT-HIGH IS NOT INITIAL AND S_BUDAT-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_budat
*& Form sub_validation_prctr
Validation For Profit Center
FORM SUB_VALIDATION_PRCTR .
DATA: L_PRCTR TYPE PRCTR. " Profit Center
IF S_PRCTR IS INITIAL.
MESSAGE E010.
ELSE.
IF S_PRCTR-HIGH IS NOT INITIAL AND S_PRCTR-LOW IS INITIAL.
MESSAGE E006.
ELSE.
*--- Validation for chart of accounts
SELECT PRCTR " Profit Center
FROM CEPC UP TO 1 ROWS
INTO L_PRCTR
WHERE PRCTR IN S_PRCTR.
ENDSELECT.
IF SY-SUBRC NE 0.
*--- Invalid Profit Center
MESSAGE E011.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_prctr
*& Form sub_validation_blart
Validation For Document type
FORM SUB_VALIDATION_BLART .
DATA: L_BLART TYPE BLART. " Document type
IF S_BLART IS INITIAL.
MESSAGE E012.
ELSE.
IF S_BLART-HIGH IS NOT INITIAL AND S_BLART-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_blart
*& Form sub_check_filepath
Check user input for initial filename
FORM SUB_CHECK_FILEPATH .
IF RB_PFILE = C_FLAG_X.
IF P_PFILE IS INITIAL.
*--- The Local File Path can not be Empty
MESSAGE I014.
LEAVE LIST-PROCESSING.
ENDIF.
ELSEIF RB_AFILE = C_FLAG_X.
IF P_AFILE IS INITIAL.
*--- The App Server File Path can not be Empty
MESSAGE I015.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ENDFORM. " sub_check_filepath
*& Form sub_prepare_final
append the required output data in to the internal table.
FORM SUB_PREPARE_FINAL.
changes on 30 th may by dileep
SELECT * FROM BSEG INTO TABLE I_BSEG WHERE HKONT IN S_HKONT AND "G/L Account
GJAHR IN S_GJAHR AND
PRCTR IN S_PRCTR AND "Profit Center
BLART IN S_BLART . "Document Type
SELECT BUKRS
HKONT
BELNR
DMBTR
KOSTL
PRCTR
FROM BSEG INTO TABLE IT_BSEG WHERE HKONT IN S_HKONT AND "G/L Account
PRCTR IN S_PRCTR. "Profit Center
LOOP AT IT_BSEG INTO WA_BSEG.
SELECT SINGLE GJAHR
BUDAT
WAERS
XBLNR
BLART
MONAT
INTO (W_BSEG-GJAHR,W_BSEG-BUDAT,W_BSEG-WAERS,W_BSEG-XBLNR,W_BSEG-BLART,W_BSEG-MONAT)
FROM BKPF WHERE BELNR = W_BSEG-BELNR AND
GJAHR IN S_GJAHR AND
BLART IN S_BLART . "Document Type
MOVE WA_BSEG-BUKRS TO W_BSEG-BUKRS.
MOVE WA_BSEG-HKONT TO W_BSEG-HKONT.
MOVE WA_BSEG-BELNR TO W_BSEG-BELNR.
MOVE WA_BSEG-DMBTR TO W_BSEG-DMBTR.
MOVE WA_BSEG-KOSTL TO W_BSEG-KOSTL.
MOVE WA_BSEG-PRCTR TO W_BSEG-PRCTR.
APPEND W_BSEG TO I_BSEG.
ENDLOOP.
changes on 30 th may by dileep
IF S_BUKRS IS NOT INITIAL.
SORT I_BSEG BY BUKRS ASCENDING.
DELETE I_BSEG WHERE NOT BUKRS IN S_BUKRS.
ENDIF.
IF S_MONAT IS NOT INITIAL.
SORT I_BSEG BY GJAHR MONAT ASCENDING.
IF S_MONAT-HIGH IS NOT INITIAL AND S_MONAT-LOW IS NOT INITIAL.
DELETE I_BSEG WHERE MONAT < S_MONAT-LOW OR MONAT > S_MONAT-HIGH.
ENDIF.
IF S_MONAT-HIGH IS INITIAL AND S_MONAT-LOW IS NOT INITIAL.
DELETE I_BSEG WHERE MONAT NE S_MONAT-LOW.
ENDIF.
ENDIF.
IF S_BELNR IS NOT INITIAL.
SORT I_BSEG BY BELNR ASCENDING.
DELETE I_BSEG WHERE NOT BELNR IN S_BELNR.
ENDIF.
IF S_BUDAT IS NOT INITIAL.
SORT I_BSEG BY BUDAT ASCENDING.
DELETE I_BSEG WHERE NOT BUDAT IN S_BUDAT.
ENDIF.
LOOP AT I_BSEG INTO W_BSEG.
MOVE W_BSEG-BUKRS TO W_FINAL-BUKRS.
MOVE W_BSEG-HKONT TO W_FINAL-HKONT_P.
MOVE W_BSEG-GJAHR TO W_FINAL-GJAHR.
MOVE W_BSEG-BELNR TO W_FINAL-BELNR.
MOVE W_BSEG-BUDAT TO W_FINAL-BUDAT.
MOVE W_BSEG-WAERS TO W_FINAL-WAERS.
MOVE W_BSEG-XBLNR TO W_FINAL-XBLNR.
MOVE W_BSEG-BLART TO W_FINAL-BLART.
MOVE W_BSEG-MONAT TO W_FINAL-MONAT.
MOVE W_BSEG-DMBTR TO W_FINAL-DMBTR_P.
MOVE W_BSEG-KOSTL TO W_FINAL-KOSTL.
MOVE W_BSEG-PRCTR TO W_FINAL-PRCTR_P.
SELECT SINGLE * FROM BSEG INTO W_BSEG1 WHERE BELNR = W_BSEG-BELNR AND "Document Type
BUZID = 'W' .
IF SY-SUBRC = 0.
MOVE W_BSEG1-HKONT TO W_FINAL-HKONT_G.
MOVE W_BSEG1-DMBTR TO W_FINAL-DMBTR_G.
MOVE W_BSEG1-PRCTR TO W_FINAL-PRCTR_G.
MOVE W_BSEG1-BUZID TO W_FINAL-BUZID_G.
ELSE.
EXIT.
ENDIF.
APPEND W_FINAL TO I_FINAL.
SORT I_FINAL BY BELNR ASCENDING.
ENDLOOP.
ENDFORM. " sub_prepare_final
*& Form sub_download_data
Download data
FORM SUB_DOWNLOAD_DATA .
DATA : V_PRD(2) TYPE N.
IF RB_PFILE = C_FLAG_X.
*--- Downloading To presentation server
V_PRESPATH = P_PFILE.
PERFORM SUB_DOWNLOAD_PRESSERVER.
ELSEIF RB_AFILE = C_FLAG_X.
*--- Downloading To Application server in Auto Mode
V_APPPATH = P_AFILE.
PERFORM SUB_DOWNLOAD_APPSERVER.
ENDIF.
ENDFORM. " sub_download_data
*& Form sub_download_presserver
text
FORM SUB_DOWNLOAD_PRESSERVER.
DATA: MESSAGE TYPE STRING.
IF I_FINAL[] IS INITIAL.
MESSAGE I016.
EXIT.
ELSE.
W_FINAL_P-BUKRS = 'Company Code'.
W_FINAL_P-DELIMITER_1 = '|'.
W_FINAL_P-HKONT_P = 'G/L Account Number'.
W_FINAL_P-DELIMITER_2 = '|'.
W_FINAL_P-GJAHR = 'Fiscal Year'.
W_FINAL_P-DELIMITER_3 = '|'.
W_FINAL_P-BELNR = 'A/c Document Number'.
W_FINAL_P-DELIMITER_4 = '|'.
W_FINAL_P-BUDAT = 'Posting Date' .
W_FINAL_P-DELIMITER_5 = '|'.
W_FINAL_P-WAERS = 'Currency'.
W_FINAL_P-DELIMITER_6 = '|'.
W_FINAL_P-XBLNR = 'Ref. Document Number'.
W_FINAL_P-DELIMITER_7 = '|'.
W_FINAL_P-BLART = 'Document Type'.
W_FINAL_P-DELIMITER_8 = '|'.
W_FINAL_P-MONAT = 'Fiscal Period'.
W_FINAL_P-DELIMITER_9 = '|'.
W_FINAL_P-DMBTR_P = 'Amount'.
W_FINAL_P-DELIMITER_10 = '|'.
W_FINAL_P-KOSTL = 'Cost Center'.
W_FINAL_P-DELIMITER_11 = '|'.
W_FINAL_P-PRCTR_P = 'Profit Center'.
W_FINAL_P-DELIMITER_12 = '|'.
W_FINAL_P-HKONT_G = 'G/L Account Number'.
W_FINAL_P-DELIMITER_13 = '|'.
W_FINAL_P-DMBTR_G = 'Amount'.
W_FINAL_P-DELIMITER_14 = '|'.
W_FINAL_P-PRCTR_G = 'Profit Center'.
W_FINAL_P-DELIMITER_15 = '|'.
W_FINAL_P-BUZID_G = 'Line Item Id'.
APPEND W_FINAL_P TO I_FINAL_P.
LOOP AT I_FINAL INTO W_FINAL.
W_FINAL_P-BUKRS = W_FINAL-BUKRS.
W_FINAL_P-DELIMITER_1 = '|'.
W_FINAL_P-HKONT_P = W_FINAL-HKONT_P.
W_FINAL_P-DELIMITER_2 = '|'.
W_FINAL_P-GJAHR = W_FINAL-GJAHR.
W_FINAL_P-DELIMITER_3 = '|'.
W_FINAL_P-BELNR = W_FINAL-BELNR.
W_FINAL_P-DELIMITER_4 = '|'.
W_FINAL_P-BUDAT = W_FINAL-BUDAT .
W_FINAL_P-DELIMITER_5 = '|'.
W_FINAL_P-WAERS = W_FINAL-WAERS.
W_FINAL_P-DELIMITER_6 = '|'.
W_FINAL_P-XBLNR = W_FINAL-XBLNR.
W_FINAL_P-DELIMITER_7 = '|'.
W_FINAL_P-BLART = W_FINAL-BLART.
W_FINAL_P-DELIMITER_8 = '|'.
W_FINAL_P-MONAT = W_FINAL-MONAT.
W_FINAL_P-DELIMITER_9 = '|'.
W_FINAL_P-DMBTR_P = W_FINAL-DMBTR_P.
W_FINAL_P-DELIMITER_10 = '|'.
W_FINAL_P-KOSTL = W_FINAL-KOSTL.
W_FINAL_P-DELIMITER_11 = '|'.
W_FINAL_P-PRCTR_P = W_FINAL-PRCTR_P.
W_FINAL_P-DELIMITER_12 = '|'.
W_FINAL_P-HKONT_G = W_FINAL-HKONT_G.
W_FINAL_P-DELIMITER_13 = '|'.
W_FINAL_P-DMBTR_G = W_FINAL-DMBTR_G.
W_FINAL_P-DELIMITER_14 = '|'.
W_FINAL_P-PRCTR_G = W_FINAL-PRCTR_G.
W_FINAL_P-DELIMITER_15 = '|'.
W_FINAL_P-BUZID_G = W_FINAL-BUZID_G.
APPEND W_FINAL_P TO I_FINAL_P.
CLEAR : W_FINAL_P, W_FINAL.
ENDLOOP.
ENDIF.
*---Downloading data to file on Presentation Server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = V_PRESPATH
FILETYPE = 'ASC'
TABLES
DATA_TAB = I_FINAL_P
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
*-- File can not be opened successfully
IF SY-SUBRC NE 0.
IF SY-BATCH EQ C_FLAG_X. " Stop Processing
MESSAGE E017. " File could not be opened
ELSE.
MESSAGE I017. " File could not be opened
LEAVE LIST-PROCESSING.
ENDIF.
ELSE.
CONCATENATE 'Data Successfully downloaded to the Specified Location' V_PRESPATH INTO MESSAGE SEPARATED BY SPACE.
MESSAGE MESSAGE TYPE 'S'.
ENDIF.
MODIFY SCREEN.
ENDFORM. " sub_download_presserver
*& Form sub_download_appserver
text
FORM SUB_DOWNLOAD_APPSERVER .
DATA: V_FILE TYPE STRING, " String
P_DMBTR TYPE CHAR20,
G_DMBTR TYPE CHAR20,
MESSAGE1 TYPE STRING.
IF I_FINAL[] IS INITIAL.
IF SY-BATCH EQ C_FLAG_X.
*--- File contains no data
MESSAGE E016 .
ELSE.
*--- File contains no data
MESSAGE I016 .
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
*--- To Open The file in Application Server
OPEN DATASET V_APPPATH FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
*--- Display error message: "Could not open file"
IF SY-BATCH EQ C_FLAG_X.
*--- File contains no data
MESSAGE E016 .
ELSE.
*--- File contains no data
MESSAGE I016 .
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
*--- Perform for building the Report header
CONCATENATE
'COMPANY_CODE'
'G/L_ACCOUNT_NUMBER'
'FISCAL_YEAR'
'A/C_DOCUMENT_NUMBER'
'POSTING_DATE'
'CURRENCY'
'REF_DOCUMENT_NUMBER'
'DOCUMENT_TYPE'
'FISCAL_PERIOD'
'AMOUNT'
'COSTCENTER'
'PROFIT_CENTER'
'G/L_ACCOUNT_NUMBER'
'AMOUNT'
'PROFIT_CENTER'
'LINE_ITEM_ID'
INTO V_FILE SEPARATED BY C_DELIMITER.
TRANSFER V_FILE TO V_APPPATH.
*--- Transfer the data to application Server
LOOP AT I_FINAL INTO W_FINAL.
P_DMBTR = W_FINAL-DMBTR_P.
G_DMBTR = W_FINAL-DMBTR_G.
CONCATENATE
W_FINAL-BUKRS
W_FINAL-HKONT_P
W_FINAL-GJAHR
W_FINAL-BELNR
W_FINAL-BUDAT
W_FINAL-WAERS
W_FINAL-XBLNR
W_FINAL-BLART
W_FINAL-MONAT
P_DMBTR
W_FINAL-KOSTL
W_FINAL-PRCTR_P
W_FINAL-HKONT_G
G_DMBTR
W_FINAL-PRCTR_G
W_FINAL-BUZID_G
INTO V_FILE SEPARATED BY C_DELIMITER.
TRANSFER V_FILE TO V_APPPATH.
IF SY-SUBRC NE 0.
Display error message: "Data could not be written at the location"
MESSAGE 'Data could not be written at the location' TYPE 'I'.
EXIT.
ENDIF.
CLEAR V_FILE.
ENDLOOP.
CLOSE DATASET V_APPPATH.
IF SY-SUBRC NE 0.
Display error message: "File could not be closed"
MESSAGE 'File could not be closed' TYPE 'I'.
EXIT.
ELSE.
CONCATENATE 'Data Successfully downloaded to the Specified Location' V_APPPATH INTO MESSAGE1 SEPARATED BY SPACE.
MESSAGE MESSAGE1 TYPE 'S'.
ENDIF.
ENDFORM. " sub_download_appserverHi sneha,
The report seems not belongs to SAP standard, And if would have belonged also, the ABAP community people can help you better, so it's gender suggestion to post this thread to ABAP community may with bit more details?
Best Of Luck!!
Update us to help you more, Reward points to help you better!!
Regards,
Shyamal -
Different role types. Was: "Hi sap gurus"
define and differentiate the following types of roles
1.single role
2.composite role
3.derived role
4.child role
5.parent role
Message was edited by: Moderator
Please use meaningfull thread subject titles.Hi
There are 5 types of Roles:
1) Single Role.
2) Composite Role. (Max 164 Single Roles can be attached to one Composite Role)
3) Derived Roles.
4) Orphans Role.
5) Reference Roles.
<b>Composite roles </b>
A composite role is a container with several different roles. For reasons of clarity, it does not make sense and is therefore not allowed to add composite roles to composite roles. Composite roles are also called roles.
Composite roles do not contain authorization data. If you want to change the authorizations (that are represented by a composite role), you must maintain the data for each role of the composite role. Creating composite roles makes sense if some of your employees need authorizations from several roles. Instead of adding each user separately to each role required, you can set up a composite role and assign the users to that group. The users assigned to a composite role are automatically assigned to the corresponding (elementary) roles during comparison.
The menu tree of a composite role is, in the simplest case, a combination of the menus of the roles contained. When you create a new composite role, the initial menu tree is empty at first. You can set up the menu tree by choosing Read menu to add the menus of all roles included. This merging may lead to certain menu items being listed more than once. For example, a transaction or path contained in role 1 and role 2 would appear twice. If the set of roles contained in a composite role changes, the menu tree is also affected. In such a case, you can completely rebuild the menu tree or process only the changes. If you choose the latter option, the Profile Generator removes all items from the menu, which are not contained in any of the roles referenced. It is possible (and often necessary) to change the menu of a composite role at any time. You adjust these menus in the same way as the menus for roles.
<b>Derived roles </b>
Derived roles refer to roles that already exist. The derived roles inherit the menu structure and the functions included (transactions, reports, Web links, and so on) from the role referenced. A role can only inherit menus and functions if no transaction codes have been assigned to it before.
The higher-level role passes on its authorizations to the derived role as default values, which can be changed afterwards. Organizational level definitions are not passed on. They must be created anew in the inheriting role. User assignments are not passed on either. Derived roles are an elegant way of maintaining roles that do not differ in their functionality (identical menus and identical transactions) but have different characteristics with regard to the organizational level.
The menus passed on cannot be changed in the derived roles. Menu maintenance takes place exclusively in the role that passes on its values. Any changes immediately affect all inheriting roles. You can remove the inheritance relationship, but afterwards the inheriting role is treated like any other normal role. Once a relationship is removed, it cannot be established again.
In real time scenario Roles and Authorizations are primarily based on Company codes in many cases and in some scenarios are also based on Cost centers or divisions etc. IN such scenario, a Master role is created and many child roles are created with relevant Organizational levels added to the same. So any change to the master role would be drilled down to Child roles and hence it would avoid a lot of Maintenance overhead.
E.g.: Master Role -- Z_SAP_FI_BUYER_000
Child Role1 -- Z_SAP_FI_BUYER_CC1
Child Role 2 -- Z_SAP_FI_BUYER_CC2
Child Role 3 -- Z_SAP_FI_BUYER_CC3
<b>Orphans Role</b>
Orphans Roles are Stand-alone roles and are many a times required for IS uses/. So a System Admin role, a Security Auditor role and many other special roles mainly not used in Business side are created as ORPHANS. This role limits the user to a particular organization.
<b>Reference Role</b>
They are SAP standard Roles.
Reward points if helpful -
Hi sap gurus I have few questions
1. Which table do we store the characteristics in sap bw extended star schema
2. how does dimension-sid tables and sid-master data tables joined
with wht keys (sid id,dim id or characteristics)
3. Is it possible to have characteristics have no masterdata
4. what is dimension attribute and describied attribute in star schema
Thnks
mananHi,
In order understand these questions u should be clear with BW star schema
1.We store characteristics in master data tables
2.for earch and every dimid system will generate a sid in the sid table which is uniquely identified by system through this sid concept it links up dimid with master data table.
3.yes it is possible to have characteristics with no master data.(EG line item dimension)
4.dimension attribute is nothing but the characteristics infoobject,
but i am not sure about described attribute as i've not heard of it.
Regards
Madhavi -
Hi sap gurus can anyone help to sort out problem on credit memo
hi sapgurus
my scenerio is like this
1) some people are creating the credit memo for the invoice which has been cancelled. my question is that if u cancel a invoice sap will allow u to create the credit memo?
2)second quesstion is that how can i restrict some one from creating the credit memo for the invoice which has been cancelled? if i how to do it?
thanks in advance
sam sdHi
Not displaying the subitems in the invoice can be controlled in the program which is linked to your output type. If you inform your reqmts to the ABAPer, he should be able to code accordingly.
For demand planning, you may either have to use Sales Operations Planning or Transfer of Reqmts in SD. You can talk to somebody who knows either of these good and they can help you. Alternatively, you can post this specific question in PP also. May be you will get immediate answer for this.
Pls reward if this is helpful to you -
i want to do client copy (EXPORT AND IMPORT) in operating system level from dev client 120 to pro 500. can tell me procedure ....
i wil give u good mark
thanks & regards
sathish nagarajan .Hi
client administration SCC4
client export SCC8
client imoport scc7
Client export:
Up to 3 requests are created, depending on the data selected and
available:
1. "IDEKO01068" for transporting cross-client data, if you have
selected this
2. "IDEKT01068" for transporting client-specific data
3. "IDEKX01068" for transporting client-specific texts, provided texts
are available in this client
When the transport requests have been created successfully, the data is
exported asynchronously by starting the transport program tp at operating
system level, and can take several hours, depending on the data volume.
The status of the export can be found using either Transaction SCC3 or
Transaction SE01 and specifying the transport request.
Wait until the data has been successfully exported before you start
another client copy or transport involving the source client.
Client import:
Choose one of the above-named requests to import, in the Transport
Management System (transaction STMS) import overview. Its other
transport requests are then selected automatically.
You must post-process with the transaction SCC7 after the import.
When you call the transaction SCC7 in the target system an analysis
procedure first determines the associated transport request and displays
its ID "IDEKT01068" with the parameters of this export. Verify that the
correct transport request was selected for import.
If the transport requests are not yet in the import queue in the target
system, use the following commands:
If the transport requests are not yet in the import queue in the target
system, use the following commands:
./tp pf=TPPARAM addtobuffer <commfile name> <target sys id> u18
Example:
cd /usr/sap/trans/bin
./tp pf=TPPARAM addtobuffer "IDEKT01068" P11 u18
You can also still import the transport requests directly with the tp.
Do so in the sequence "IDEKO01068", "IDEKT01068", "IDEKX01068".
Example:
./tp pf=TPPARAM import "IDEKT01068" P11 client005 u18
Regards
George Varghese -
Hi everybody...GM....
Please clarify the following doubts....
1.System automatically dun the every 15 days for overdue bills and automatically creates notices to customers, How?
2.What is the meaning of Offset in clearing accounts?
3.What are the pre requisites in automatic clearing and what r the steps?
adv thanks
venkatHello Venkata,
Below are the point wise reply on your queries.
System automatically dun the every 15 days for overdue bills and automatically creates notices to customers, How?=== This is because it has been defined in dunning procedure in IMG settings. Dunning procedures are company code independent. They determine the dunning interval, the grace periods for the due date determination, and the number of dunning levels. You can also set the dunning level at which you want to list all due items from an account in the dunning notice.
To view this you need to go to SPRO-> Financial Accounting->Accouts Receivable & Payables->Business Transactions->Dunning->Dunning Procedures->Define Dunning Procedures.
2.What is the meaning of Offset in clearing accounts?==== Open items reflect unfinished transactions. For example, a vendor invoice that has not been settled remains in the vendor account as an open item until it is paid.The open items of an account can only be cleared once you post an identical offsetting amount to the account. In other words, the balance of the items assigned to each other must equal zero.
3.What are the pre requisites in automatic clearing and what r the steps?===
You can use the clearing program to clear open items from customer, vendor, and G/L accounts. This program uses predefined criteria to group together open items per account. If the balance of the group of open items equals zero in local, foreign, and where applicable, the parallel currency, the items are marked as cleared.
The clearing program has particular advantages over manual account clearing for clearing general ledger clearing accounts.
Features
During clearing, the program enters a clearing document number and a clearing date in the line items. It uses the document number and posting date from the most recent document (with the highest document number) that is part of the clearing process.
The program groups together those items from an account that have the same:
Business area
Trading partner ID
Reconciliation account number
Currency in which the general ledger is updated
Up to four criteria that you define
You can specify criteria for each account type based on a single account or an interval of accounts. You use these criteria to restrict the number of items that are considered together. This ensures that only those items that are based on a specific business transaction are cleared together.
To have the system post these items automatically, you have to define the accounts that should be posted to.
The clearing program carries out automatic clearing within the SAP System. However, all prerequisites for clearing open items in the SAP System must be fulfilled.
Customer and vendor accounts are always managed on an open item basis. For G/L accounts, however, you have to set the open item management option in their master record yourself. Open item management is recommended for the following G/L accounts:
Check clearing accounts (bank clearing accounts)
Goods receipt/invoice receipt.
Payroll clearing accounts.
During clearing, the system enters a clearing document number and the clearing date in these items. In this way, invoices in a vendor account are indicated as paid, and items in a bank clearing account are indicated as cleared.
Hope this helps. Please assign points.
How to give points: Mark your thread as a question while creating it. In the answers you get, you can assign the points by clicking on the stars to the left. You also get a point yourself for rewarding (one per thread).
Rgds
Manish -
Hi all, This is my first post to expert Forums and i am very much exicited to meet all the experts in one place. many thanks to SAP COMMUNITY NETWORK.
Pls let me know, what are the significant changes in FI/CO modules from 4.6c/4.7ee to the latest version of 6.0?? and pls send me, if any documentation is available.
Pls mail me at [email protected]
thanks in advance to all the experts,
laxmi prodduturi.hi murali,
thanks once again.
is ther any change in Dunning process in EC 6.0.?? and what r the changes in
CEA, CCA, IO's , Statistical Orders? I know well, it is not possible to answer in one post. pls let me know how can i approach with the link which you have given me in the earlier post?? It will be very handy to me, if any one can give me the integration with FI-MM and FI-SD & as well as Product costing scnario's with screen shots.
thanks and regards
laxmi.
laxmi. -
Hi sap gurus can u please improve the performance ,its very urgent :-sneha
REPORT ZFIR_GRIR_IPV
NO STANDARD PAGE HEADING
LINE-SIZE 120
MESSAGE-ID ZFI02.
TABLES: BSEG,BKPF.
TYPES: BEGIN OF A_FINAL,
BUKRS TYPE CHAR12,
HKONT_P TYPE CHAR18,
GJAHR TYPE CHAR11,
BELNR TYPE CHAR19,
BUDAT TYPE CHAR12,
WAERS TYPE CHAR8,
XBLNR TYPE CHAR20,
BLART TYPE CHAR13,
MONAT TYPE CHAR13,
DMBTR_P TYPE CHAR13,
KOSTL TYPE CHAR11,
PRCTR_P TYPE CHAR13,
HKONT_G TYPE CHAR18,
DMBTR_G TYPE CHAR13,
PRCTR_G TYPE CHAR13,
BUZID_G TYPE CHAR15,
END OF A_FINAL.
changes on 30 th may by dileep
TYPES: BEGIN OF IT_FINAL,
BUKRS TYPE BUKRS ,
HKONT TYPE HKONT,
BELNR TYPE BELNR_D,
DMBTR TYPE DMBTR ,
KOSTL TYPE KOSTL,
PRCTR TYPE PRCTR,
END OF IT_FINAL.
TYPES: BEGIN OF IT_FINAL1,
BUKRS TYPE BUKRS,
HKONT TYPE HKONT,
GJAHR TYPE GJAHR ,
BELNR TYPE BELNR_D,
BUDAT TYPE BUDAT,
WAERS TYPE WAERS ,
XBLNR TYPE XBLNR1,
BLART TYPE BLART,
MONAT TYPE MONAT,
DMBTR TYPE DMBTR,
KOSTL TYPE KOSTL,
PRCTR TYPE PRCTR,
END OF IT_FINAL1.
end of changes on 30 th may by dileep
TYPES: BEGIN OF P_FINAL,
BUKRS TYPE CHAR12,
DELIMITER_1 TYPE CHAR1,
HKONT_P TYPE CHAR18,
DELIMITER_2 TYPE CHAR1,
GJAHR TYPE CHAR11,
DELIMITER_3 TYPE CHAR1,
BELNR TYPE CHAR19,
DELIMITER_4 TYPE CHAR1,
BUDAT TYPE CHAR12,
DELIMITER_5 TYPE CHAR1,
WAERS TYPE CHAR8,
DELIMITER_6 TYPE CHAR1,
XBLNR TYPE CHAR20,
DELIMITER_7 TYPE CHAR1,
BLART TYPE CHAR13,
DELIMITER_8 TYPE CHAR1,
MONAT TYPE CHAR13,
DELIMITER_9 TYPE CHAR1,
DMBTR_P TYPE CHAR13,
DELIMITER_10 TYPE CHAR1,
KOSTL TYPE CHAR11,
DELIMITER_11 TYPE CHAR1,
PRCTR_P TYPE CHAR13,
DELIMITER_12 TYPE CHAR1,
HKONT_G TYPE CHAR18,
DELIMITER_13 TYPE CHAR1,
DMBTR_G TYPE CHAR13,
DELIMITER_14 TYPE CHAR1,
PRCTR_G TYPE CHAR13,
DELIMITER_15 TYPE CHAR1,
BUZID_G TYPE CHAR15,
END OF P_FINAL.
DATA: IT_BSEG TYPE STANDARD TABLE OF IT_FINAL INITIAL SIZE 0,
I_BSEG TYPE STANDARD TABLE OF IT_FINAL1 INITIAL SIZE 0,
I_FINAL TYPE STANDARD TABLE OF A_FINAL INITIAL SIZE 0 WITH HEADER LINE,
I_FINAL_P TYPE STANDARD TABLE OF P_FINAL INITIAL SIZE 0 WITH HEADER LINE,
W_FINAL_P TYPE P_FINAL,
W_BSEG1 TYPE BSEG,
WA_BSEG TYPE IT_FINAL OCCURS 0 WITH HEADER LINE,
W_BSEG TYPE IT_FINAL1 OCCURS 0 WITH HEADER LINE,
T_BSEG TYPE STANDARD TABLE OF BSEG INITIAL SIZE 0 WITH HEADER LINE,
W_FINAL TYPE A_FINAL,
F_YEAR TYPE BAPI0002_4-FISCAL_YEAR,
F_PERIOD TYPE BAPI0002_4-FISCAL_PERIOD,
RETURN1 TYPE BAPIRETURN1,
V_DATE TYPE CHAR8, " Date in YYYYMMDD format
V_PRESPATH TYPE STRING, " Path
V_APPPATH TYPE STRING, " Path
V_FILENAME(25) TYPE C, " File Name
V_PERIOD TYPE CHAR3, " Date for Posting Period
V_FSYEAR TYPE BDATJ, " Fiscal Year
L_TEXT TYPE CHAR1. " Hypen
CONSTANTS: C_TXT TYPE CHAR4 VALUE '.txt', " File Extension
C_TXT1 TYPE STRING VALUE 'txt', " File Type
C_FLAG_X TYPE CHAR1 VALUE 'X', " Flag
C_ASC TYPE FILETYPE VALUE 'ASC', " File type
C_DAT TYPE CHAR4 VALUE '.dat', " File Type
C_FLAG_1 TYPE CHAR1 VALUE '1', " Constant value
C_ZERO TYPE CHAR1 VALUE '0', " Constant
C_GLD(10) TYPE C VALUE 'GRIR021S', " Constant in file Path
C_DIR TYPE CHAR3 VALUE 'C:\', " Presentation Server path
C_FLAG_12 TYPE CHAR2 VALUE '12', " Constant value
C_PCFILE TYPE STRING VALUE 'PC File',
C_DELIMITER TYPE C VALUE '|'.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
*--- Selection Criteria
SELECT-OPTIONS: S_BUKRS FOR BSEG-BUKRS DEFAULT '012T', " Company Code
S_HKONT FOR BSEG-HKONT OBLIGATORY DEFAULT '4505001',
S_GJAHR FOR BKPF-GJAHR DEFAULT SY-DATUM+0(4),
S_MONAT FOR BKPF-MONAT DEFAULT SY-DATUM+4(2),
S_BELNR FOR BSEG-BELNR ,
S_BUDAT FOR BKPF-BUDAT ,
S_PRCTR FOR BSEG-PRCTR OBLIGATORY DEFAULT '12TOTH00',
S_BLART FOR BKPF-BLART OBLIGATORY DEFAULT 'RE'.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
*--- Radio Buttons for chose the PC Path or App.. Server Path
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:
RB_PFILE RADIOBUTTON GROUP RAD2 DEFAULT 'X' USER-COMMAND UCOMM1.
SELECTION-SCREEN COMMENT 5(27) TEXT-002 FOR FIELD RB_PFILE.
PARAMETERS:
P_PFILE LIKE RLGRAP-FILENAME LOWER CASE.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:
RB_AFILE RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 5(27) TEXT-003 FOR FIELD RB_AFILE.
PARAMETERS:
P_AFILE LIKE RLGRAP-FILENAME LOWER CASE. " Path for AS
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PFILE.
*-- Select File name with Dialog Box
PERFORM SUB_GET_FILENAME CHANGING P_PFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_AFILE.
*--- Attach F4 HELP CORRESPONDING TO THE FIELD
PERFORM SUB_AP_F4.
AT SELECTION-SCREEN OUTPUT.
*--Modify screen parameters
PERFORM SUB_MODIFY_SCREEN.
AT SELECTION-SCREEN.
*--- Selection Screen validations for Company Code
PERFORM SUB_VALIDATION_BUKRS.
*--- Selection Screen validations for Chart of Accounts
PERFORM SUB_VALIDATION_HKONT.
*--- Selection Screen validations Fiscal Year
PERFORM SUB_VALIDATION_GJAHR.
*--- Selection Screen validations for Peiod
PERFORM SUB_VALIDATION_MONAT.
*--- Selection Screen validations for Company Code
PERFORM SUB_VALIDATION_BELNR.
*--- Selection Screen validations for Chart of Accounts
PERFORM SUB_VALIDATION_BUDAT.
*--- Selection Screen validations Fiscal Year
PERFORM SUB_VALIDATION_PRCTR.
*--- Selection Screen validations for Peiod
PERFORM SUB_VALIDATION_BLART.
START-OF-SELECTION
START-OF-SELECTION.
*--- Check whether filepath/name have been entered in the sel screen
PERFORM SUB_CHECK_FILEPATH.
*--- Prepare Final Internal Table.
PERFORM SUB_PREPARE_FINAL.
*--- Download data.
PERFORM SUB_DOWNLOAD_DATA .
*& Form sub_get_filename
text
<--P_PFILE Presentation server File name
FORM SUB_GET_FILENAME CHANGING P_FILE TYPE C.
DATA : L_FILENAME TYPE STRING, " For File Name
L_PATH TYPE STRING, " For Directory
L_FULLPATH TYPE STRING. " Full path
*--- For File Open Dialog Box
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = C_PCFILE " Window Title
DEFAULT_EXTENSION = C_TXT1 " File Extn
PROMPT_ON_OVERWRITE = C_FLAG_X " Over write
CHANGING
FILENAME = L_FILENAME " File Name
PATH = L_PATH " File Path
FULLPATH = L_FULLPATH " Full Path
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF SY-SUBRC NE 0.
*--- Error in opening the file
MESSAGE E000.
ELSE.
CONCATENATE L_PATH
L_FILENAME
INTO P_FILE.
V_PRESPATH = L_PATH.
ENDIF.
ENDFORM. " sub_get_filename
*& Form sub_ap_f4
f4 help attched with application server
FORM SUB_AP_F4 .
*--- FM for to get the Application Server Path
IF RB_AFILE = C_FLAG_X.
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
DIRECTORY =
FILEMASK = C_ASC " File Extn
IMPORTING
SERVERFILE = P_AFILE " File Path
EXCEPTIONS
CANCELED_BY_USER = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
*--- Error in opening the file
MESSAGE E000.
ENDIF.
ENDIF.
ENDFORM. " sub_ap_f4
*& Form sub_modify_screen
text
--> p1 text
<-- p2 text
FORM SUB_MODIFY_SCREEN .
*--- Selection screen Modifications
IF RB_PFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE' OR
SCREEN-NAME = '%_P_PFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_FLAG_1.
CONCATENATE C_DIR C_GLD V_DATE SY-UZEIT(4) C_TXT INTO P_PFILE.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE' OR
SCREEN-NAME = '%_P_PFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_ZERO.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF RB_AFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_AFILE' OR
SCREEN-NAME = '%_P_AFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_FLAG_1.
CONCATENATE '/Solectron/Data/' C_GLD V_DATE SY-UZEIT(4) C_DAT
INTO P_AFILE.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_AFILE' OR
SCREEN-NAME = '%_P_AFILE_%_APP_%-TEXT'.
SCREEN-ACTIVE = C_ZERO.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF RB_PFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE'.
SCREEN-ACTIVE = C_FLAG_1.
ENDIF.
IF SCREEN-NAME = 'P_AFILE'.
SCREEN-ACTIVE = C_ZERO.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF RB_AFILE = C_FLAG_X.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_PFILE'.
SCREEN-ACTIVE = C_ZERO.
ENDIF.
IF SCREEN-NAME = 'P_AFILE'.
SCREEN-ACTIVE = C_FLAG_1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDFORM. " sub_modify_screen
*& Form sub_validation_bukrs
Validation For Company Code
FORM SUB_VALIDATION_BUKRS .
DATA: L_BUKRS TYPE BUKRS. " Company Code
IF S_BUKRS IS NOT INITIAL.
IF S_BUKRS-HIGH IS NOT INITIAL AND S_BUKRS-LOW IS INITIAL.
MESSAGE E006.
ELSE.
*--- Validation for chart of accounts
SELECT BUKRS " Company Code
FROM T001 UP TO 1 ROWS
INTO L_BUKRS
WHERE BUKRS IN S_BUKRS.
ENDSELECT.
IF SY-SUBRC NE 0.
*--- Invalid Company code
MESSAGE E001.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_bukrs
*& Form sub_validation_hkont
Validation For General Ledger Account
FORM SUB_VALIDATION_HKONT .
DATA: L_HKONT TYPE HKONT. " General Ledger Account
IF S_HKONT IS INITIAL.
MESSAGE E002.
ELSE.
IF S_HKONT-HIGH IS NOT INITIAL AND S_HKONT-LOW IS INITIAL.
MESSAGE E006.
ELSE.
*--- Validation for chart of accounts
SELECT SAKNR " General Ledger Account
FROM SKA1 UP TO 1 ROWS
INTO L_HKONT
WHERE SAKNR IN S_HKONT AND KTOPL = '1SLR'.
ENDSELECT.
IF SY-SUBRC NE 0.
*--- Invalid General Ledger Account
MESSAGE E003.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_hkont
*& Form sub_validation_gjahr
Validation For Fiscal Year
FORM SUB_VALIDATION_GJAHR .
DATA: L_GJAHR TYPE GJAHR. " Fiscal Year
IF S_GJAHR IS NOT INITIAL.
IF S_GJAHR-HIGH IS NOT INITIAL AND S_GJAHR-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_gjahr
*& Form sub_validation_monat
Validation For Fiscal period
FORM SUB_VALIDATION_MONAT .
DATA: L_MONAT TYPE MONAT. " Fiscal period
IF S_MONAT IS NOT INITIAL.
IF S_MONAT-LOW LE C_ZERO.
*--- Invalid Fiscal Period
MESSAGE E006.
ENDIF.
IF S_MONAT-HIGH GT C_FLAG_12.
*--- Invalid Fiscal Period
MESSAGE E007.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_monat
*& Form sub_validation_belnr
Validation For Accounting Document Number
FORM SUB_VALIDATION_BELNR .
DATA: L_BELNR TYPE BELNR_D. " Accounting Document Number
IF S_BELNR IS NOT INITIAL.
IF S_BELNR-HIGH IS NOT INITIAL AND S_BELNR-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_belnr
*& Form sub_validation_budat
Validation For Posting Date
FORM SUB_VALIDATION_BUDAT .
DATA: L_BUDAT TYPE BUDAT. " Posting Date
IF S_BUDAT IS NOT INITIAL.
IF S_BUDAT-HIGH IS NOT INITIAL AND S_BUDAT-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_budat
*& Form sub_validation_prctr
Validation For Profit Center
FORM SUB_VALIDATION_PRCTR .
DATA: L_PRCTR TYPE PRCTR. " Profit Center
IF S_PRCTR IS INITIAL.
MESSAGE E010.
ELSE.
IF S_PRCTR-HIGH IS NOT INITIAL AND S_PRCTR-LOW IS INITIAL.
MESSAGE E006.
ELSE.
*--- Validation for chart of accounts
SELECT PRCTR " Profit Center
FROM CEPC UP TO 1 ROWS
INTO L_PRCTR
WHERE PRCTR IN S_PRCTR.
ENDSELECT.
IF SY-SUBRC NE 0.
*--- Invalid Profit Center
MESSAGE E011.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_prctr
*& Form sub_validation_blart
Validation For Document type
FORM SUB_VALIDATION_BLART .
DATA: L_BLART TYPE BLART. " Document type
IF S_BLART IS INITIAL.
MESSAGE E012.
ELSE.
IF S_BLART-HIGH IS NOT INITIAL AND S_BLART-LOW IS INITIAL.
MESSAGE E006.
ENDIF.
ENDIF.
ENDFORM. " sub_validation_blart
*& Form sub_check_filepath
Check user input for initial filename
FORM SUB_CHECK_FILEPATH .
IF RB_PFILE = C_FLAG_X.
IF P_PFILE IS INITIAL.
*--- The Local File Path can not be Empty
MESSAGE I014.
LEAVE LIST-PROCESSING.
ENDIF.
ELSEIF RB_AFILE = C_FLAG_X.
IF P_AFILE IS INITIAL.
*--- The App Server File Path can not be Empty
MESSAGE I015.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ENDFORM. " sub_check_filepath
*& Form sub_prepare_final
append the required output data in to the internal table.
FORM SUB_PREPARE_FINAL.
changes on 30 th may by dileep
SELECT * FROM BSEG INTO TABLE I_BSEG WHERE HKONT IN S_HKONT AND "G/L Account
GJAHR IN S_GJAHR AND
PRCTR IN S_PRCTR AND "Profit Center
BLART IN S_BLART . "Document Type
SELECT BUKRS
HKONT
BELNR
DMBTR
KOSTL
PRCTR
FROM BSEG INTO TABLE IT_BSEG WHERE HKONT IN S_HKONT AND "G/L Account
PRCTR IN S_PRCTR. "Profit Center
LOOP AT IT_BSEG INTO WA_BSEG.
SELECT SINGLE GJAHR
BUDAT
WAERS
XBLNR
BLART
MONAT
INTO (W_BSEG-GJAHR,W_BSEG-BUDAT,W_BSEG-WAERS,W_BSEG-XBLNR,W_BSEG-BLART,W_BSEG-MONAT)
FROM BKPF WHERE BELNR = W_BSEG-BELNR AND
GJAHR IN S_GJAHR AND
BLART IN S_BLART . "Document Type
MOVE WA_BSEG-BUKRS TO W_BSEG-BUKRS.
MOVE WA_BSEG-HKONT TO W_BSEG-HKONT.
MOVE WA_BSEG-BELNR TO W_BSEG-BELNR.
MOVE WA_BSEG-DMBTR TO W_BSEG-DMBTR.
MOVE WA_BSEG-KOSTL TO W_BSEG-KOSTL.
MOVE WA_BSEG-PRCTR TO W_BSEG-PRCTR.
APPEND W_BSEG TO I_BSEG.
ENDLOOP.
changes on 30 th may by dileep
IF S_BUKRS IS NOT INITIAL.
SORT I_BSEG BY BUKRS ASCENDING.
DELETE I_BSEG WHERE NOT BUKRS IN S_BUKRS.
ENDIF.
IF S_MONAT IS NOT INITIAL.
SORT I_BSEG BY GJAHR MONAT ASCENDING.
IF S_MONAT-HIGH IS NOT INITIAL AND S_MONAT-LOW IS NOT INITIAL.
DELETE I_BSEG WHERE MONAT < S_MONAT-LOW OR MONAT > S_MONAT-HIGH.
ENDIF.
IF S_MONAT-HIGH IS INITIAL AND S_MONAT-LOW IS NOT INITIAL.
DELETE I_BSEG WHERE MONAT NE S_MONAT-LOW.
ENDIF.
ENDIF.
IF S_BELNR IS NOT INITIAL.
SORT I_BSEG BY BELNR ASCENDING.
DELETE I_BSEG WHERE NOT BELNR IN S_BELNR.
ENDIF.
IF S_BUDAT IS NOT INITIAL.
SORT I_BSEG BY BUDAT ASCENDING.
DELETE I_BSEG WHERE NOT BUDAT IN S_BUDAT.
ENDIF.
LOOP AT I_BSEG INTO W_BSEG.
MOVE W_BSEG-BUKRS TO W_FINAL-BUKRS.
MOVE W_BSEG-HKONT TO W_FINAL-HKONT_P.
MOVE W_BSEG-GJAHR TO W_FINAL-GJAHR.
MOVE W_BSEG-BELNR TO W_FINAL-BELNR.
MOVE W_BSEG-BUDAT TO W_FINAL-BUDAT.
MOVE W_BSEG-WAERS TO W_FINAL-WAERS.
MOVE W_BSEG-XBLNR TO W_FINAL-XBLNR.
MOVE W_BSEG-BLART TO W_FINAL-BLART.
MOVE W_BSEG-MONAT TO W_FINAL-MONAT.
MOVE W_BSEG-DMBTR TO W_FINAL-DMBTR_P.
MOVE W_BSEG-KOSTL TO W_FINAL-KOSTL.
MOVE W_BSEG-PRCTR TO W_FINAL-PRCTR_P.
SELECT SINGLE * FROM BSEG INTO W_BSEG1 WHERE BELNR = W_BSEG-BELNR AND "Document Type
BUZID = 'W' .
IF SY-SUBRC = 0.
MOVE W_BSEG1-HKONT TO W_FINAL-HKONT_G.
MOVE W_BSEG1-DMBTR TO W_FINAL-DMBTR_G.
MOVE W_BSEG1-PRCTR TO W_FINAL-PRCTR_G.
MOVE W_BSEG1-BUZID TO W_FINAL-BUZID_G.
ELSE.
EXIT.
ENDIF.
APPEND W_FINAL TO I_FINAL.
SORT I_FINAL BY BELNR ASCENDING.
ENDLOOP.
ENDFORM. " sub_prepare_final
*& Form sub_download_data
Download data
FORM SUB_DOWNLOAD_DATA .
DATA : V_PRD(2) TYPE N.
IF RB_PFILE = C_FLAG_X.
*--- Downloading To presentation server
V_PRESPATH = P_PFILE.
PERFORM SUB_DOWNLOAD_PRESSERVER.
ELSEIF RB_AFILE = C_FLAG_X.
*--- Downloading To Application server in Auto Mode
V_APPPATH = P_AFILE.
PERFORM SUB_DOWNLOAD_APPSERVER.
ENDIF.
ENDFORM. " sub_download_data
*& Form sub_download_presserver
text
FORM SUB_DOWNLOAD_PRESSERVER.
DATA: MESSAGE TYPE STRING.
IF I_FINAL[] IS INITIAL.
MESSAGE I016.
EXIT.
ELSE.
W_FINAL_P-BUKRS = 'Company Code'.
W_FINAL_P-DELIMITER_1 = '|'.
W_FINAL_P-HKONT_P = 'G/L Account Number'.
W_FINAL_P-DELIMITER_2 = '|'.
W_FINAL_P-GJAHR = 'Fiscal Year'.
W_FINAL_P-DELIMITER_3 = '|'.
W_FINAL_P-BELNR = 'A/c Document Number'.
W_FINAL_P-DELIMITER_4 = '|'.
W_FINAL_P-BUDAT = 'Posting Date' .
W_FINAL_P-DELIMITER_5 = '|'.
W_FINAL_P-WAERS = 'Currency'.
W_FINAL_P-DELIMITER_6 = '|'.
W_FINAL_P-XBLNR = 'Ref. Document Number'.
W_FINAL_P-DELIMITER_7 = '|'.
W_FINAL_P-BLART = 'Document Type'.
W_FINAL_P-DELIMITER_8 = '|'.
W_FINAL_P-MONAT = 'Fiscal Period'.
W_FINAL_P-DELIMITER_9 = '|'.
W_FINAL_P-DMBTR_P = 'Amount'.
W_FINAL_P-DELIMITER_10 = '|'.
W_FINAL_P-KOSTL = 'Cost Center'.
W_FINAL_P-DELIMITER_11 = '|'.
W_FINAL_P-PRCTR_P = 'Profit Center'.
W_FINAL_P-DELIMITER_12 = '|'.
W_FINAL_P-HKONT_G = 'G/L Account Number'.
W_FINAL_P-DELIMITER_13 = '|'.
W_FINAL_P-DMBTR_G = 'Amount'.
W_FINAL_P-DELIMITER_14 = '|'.
W_FINAL_P-PRCTR_G = 'Profit Center'.
W_FINAL_P-DELIMITER_15 = '|'.
W_FINAL_P-BUZID_G = 'Line Item Id'.
APPEND W_FINAL_P TO I_FINAL_P.
LOOP AT I_FINAL INTO W_FINAL.
W_FINAL_P-BUKRS = W_FINAL-BUKRS.
W_FINAL_P-DELIMITER_1 = '|'.
W_FINAL_P-HKONT_P = W_FINAL-HKONT_P.
W_FINAL_P-DELIMITER_2 = '|'.
W_FINAL_P-GJAHR = W_FINAL-GJAHR.
W_FINAL_P-DELIMITER_3 = '|'.
W_FINAL_P-BELNR = W_FINAL-BELNR.
W_FINAL_P-DELIMITER_4 = '|'.
W_FINAL_P-BUDAT = W_FINAL-BUDAT .
W_FINAL_P-DELIMITER_5 = '|'.
W_FINAL_P-WAERS = W_FINAL-WAERS.
W_FINAL_P-DELIMITER_6 = '|'.
W_FINAL_P-XBLNR = W_FINAL-XBLNR.
W_FINAL_P-DELIMITER_7 = '|'.
W_FINAL_P-BLART = W_FINAL-BLART.
W_FINAL_P-DELIMITER_8 = '|'.
W_FINAL_P-MONAT = W_FINAL-MONAT.
W_FINAL_P-DELIMITER_9 = '|'.
W_FINAL_P-DMBTR_P = W_FINAL-DMBTR_P.
W_FINAL_P-DELIMITER_10 = '|'.
W_FINAL_P-KOSTL = W_FINAL-KOSTL.
W_FINAL_P-DELIMITER_11 = '|'.
W_FINAL_P-PRCTR_P = W_FINAL-PRCTR_P.
W_FINAL_P-DELIMITER_12 = '|'.
W_FINAL_P-HKONT_G = W_FINAL-HKONT_G.
W_FINAL_P-DELIMITER_13 = '|'.
W_FINAL_P-DMBTR_G = W_FINAL-DMBTR_G.
W_FINAL_P-DELIMITER_14 = '|'.
W_FINAL_P-PRCTR_G = W_FINAL-PRCTR_G.
W_FINAL_P-DELIMITER_15 = '|'.
W_FINAL_P-BUZID_G = W_FINAL-BUZID_G.
APPEND W_FINAL_P TO I_FINAL_P.
CLEAR : W_FINAL_P, W_FINAL.
ENDLOOP.
ENDIF.
*---Downloading data to file on Presentation Server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = V_PRESPATH
FILETYPE = 'ASC'
TABLES
DATA_TAB = I_FINAL_P
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
*-- File can not be opened successfully
IF SY-SUBRC NE 0.
IF SY-BATCH EQ C_FLAG_X. " Stop Processing
MESSAGE E017. " File could not be opened
ELSE.
MESSAGE I017. " File could not be opened
LEAVE LIST-PROCESSING.
ENDIF.
ELSE.
CONCATENATE 'Data Successfully downloaded to the Specified Location' V_PRESPATH INTO MESSAGE SEPARATED BY SPACE.
MESSAGE MESSAGE TYPE 'S'.
ENDIF.
MODIFY SCREEN.
ENDFORM. " sub_download_presserver
*& Form sub_download_appserver
text
FORM SUB_DOWNLOAD_APPSERVER .
DATA: V_FILE TYPE STRING, " String
P_DMBTR TYPE CHAR20,
G_DMBTR TYPE CHAR20,
MESSAGE1 TYPE STRING.
IF I_FINAL[] IS INITIAL.
IF SY-BATCH EQ C_FLAG_X.
*--- File contains no data
MESSAGE E016 .
ELSE.
*--- File contains no data
MESSAGE I016 .
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
*--- To Open The file in Application Server
OPEN DATASET V_APPPATH FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
*--- Display error message: "Could not open file"
IF SY-BATCH EQ C_FLAG_X.
*--- File contains no data
MESSAGE E016 .
ELSE.
*--- File contains no data
MESSAGE I016 .
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
*--- Perform for building the Report header
CONCATENATE
'COMPANY_CODE'
'G/L_ACCOUNT_NUMBER'
'FISCAL_YEAR'
'A/C_DOCUMENT_NUMBER'
'POSTING_DATE'
'CURRENCY'
'REF_DOCUMENT_NUMBER'
'DOCUMENT_TYPE'
'FISCAL_PERIOD'
'AMOUNT'
'COSTCENTER'
'PROFIT_CENTER'
'G/L_ACCOUNT_NUMBER'
'AMOUNT'
'PROFIT_CENTER'
'LINE_ITEM_ID'
INTO V_FILE SEPARATED BY C_DELIMITER.
TRANSFER V_FILE TO V_APPPATH.
*--- Transfer the data to application Server
LOOP AT I_FINAL INTO W_FINAL.
P_DMBTR = W_FINAL-DMBTR_P.
G_DMBTR = W_FINAL-DMBTR_G.
CONCATENATE
W_FINAL-BUKRS
W_FINAL-HKONT_P
W_FINAL-GJAHR
W_FINAL-BELNR
W_FINAL-BUDAT
W_FINAL-WAERS
W_FINAL-XBLNR
W_FINAL-BLART
W_FINAL-MONAT
P_DMBTR
W_FINAL-KOSTL
W_FINAL-PRCTR_P
W_FINAL-HKONT_G
G_DMBTR
W_FINAL-PRCTR_G
W_FINAL-BUZID_G
INTO V_FILE SEPARATED BY C_DELIMITER.
TRANSFER V_FILE TO V_APPPATH.
IF SY-SUBRC NE 0.
Display error message: "Data could not be written at the location"
MESSAGE 'Data could not be written at the location' TYPE 'I'.
EXIT.
ENDIF.
CLEAR V_FILE.
ENDLOOP.
CLOSE DATASET V_APPPATH.
IF SY-SUBRC NE 0.
Display error message: "File could not be closed"
MESSAGE 'File could not be closed' TYPE 'I'.
EXIT.
ELSE.
CONCATENATE 'Data Successfully downloaded to the Specified Location' V_APPPATH INTO MESSAGE1 SEPARATED BY SPACE.
MESSAGE MESSAGE1 TYPE 'S'.
ENDIF.
ENDFORM. " sub_download_appserverIt may be better to summarize what you do in the steps, thereby avoiding such a long coding posted here.
This may be helping experts to pick the wrong spot to fix it. -
Can any one please tell me the details about investment order,
my question here are
i have an internal order (investment order)
i am purchasing some material related to AUC so in purchase order what sort of account assignment type i need to use "F" or "K" or any other ?
if i use type 'F' then i need to give Internal order reference and if i use 'K' i need to cost center reference in account assignment tab of purchase order
my question here is what are all accounting transactions that take place at the time of GR and IV in accounting point of view and costing point of view in both scenarios 'F' & 'K' ?
in normal cases of GR
material account Debit
and GR/IR Account Credit
in case IR
GR/IR Debit
Vendor Credit
what sort of entries it will generate for GR and IV for purchases made with reference to investment order ???
what this material goes to add the quantity in material master and material GL when we do GR and later on used to issue to AUC (Consumption) with reference to investment order ?
when we settle the investment order the debit entry will be AUC Debit and what is credit here ?
Thanks & Regards,
PhaniHello Arun,
To change the firmed planned order you have to go for transaction MD12 or from MD04 also you can select the change mode of planne order.
After entering the planned order number and then inside planned order, you have the option to deselect the "firmed" indicator check box (bottom right side). once you deselect this planned order will be unfirmed planned order.
Regards
TAJUDDIN -
Hai abap gurus...
difference bet'n simple and interactive reports?
what are the events in interactive reports?
what is the first event that will be triggered in a report?
what is the use of Initialization event? give one example.
what is the use of start-of-selection event?
what is the difference betn end-of-page and end-of-selection?
if you write a write statement after end-of-selection, will that be
triggered?
how to create a button in selection screen?
how to add a gui status in a selection screen?
what is at-line-selection event?Hi,
1> A simple report is a standard report where as Interactive report is a Drilled down report.A Simple report is one where we get the data from a single table n display it as a single output...Where as in Interactive report we can get the data from different tables n display it on different output screens......once if we click on any field on the basic list then we get its details on the next secondary list.
2> The events in Interactive reports are...
Initialization, At selection-screen, Start-of-selection, top-of-page, end-of-page, end-of-selection, At User-command, Set pf-status and top-of-page during Line selection, At line-selection.
3> The event that will be triggered in a report is Initialization if only the debugging is done from the Abap-Editor.....If the debugging is done from the program then Start-of--selection gets triggered.
4>Initialization - It is a process that takes place after the seelction screen could display.
eg;
select-option matnr for mara-matnr.
matnr-low = '00'.
matnr-high = '1000'.
matnr-sign = 'i'.
matnr-option = 'bt'.
Append matnr.
5> Start-of-selection is a default event.....
All the statements under start-of-selection must be executed before it goes for the next statement.
6> End-of-page id used to display all the statements on the last line of the page. where as end-of-selection triggers at the end of the program.....
Eg;
End-of-page.
write:/10 'System date:', sy-datum, 30 'page no:', sy-pagno.
End-of-selection.
write :/ "end of the program".
7>If u write a write statement after end-of-selection it will trigger......as it starts from initialization and then goes to Start-of-selection n then to end-of selection so if u write it will get triggered.
8> To create a Push Button just use this statement Selection-screen Pushbutton
/30(30) text-001 user-command enter(anything u can give).
double click on the text-001 and give the respective name.
9> At line-selection is used to view a detailed list of a report....For example if u had created a report on material n if u want to get the details from marc n mard tables then display them on the next list then we use at Line-selection...So that when we click on a specific field on the basic list it will display the secondary list with marc details........so thats why its called as drilled down report....as we can have 21 list..
In which the first list is the Basic List and the other 20 lists are the secondary lists.
When u try to click on a field to get the details in the next secondary list that field should be kept in Hide.
Hide is a statement that temporarily stores the contents of the clicked field in the 'Hide Area'.
Hide statement is always followed by the write statement.
eg; start-of-selection.
select * from mara into table itab where matnr in matnr.
loop at itab.
write:/ itab-matnr, itab-ernam, itab-ersda.
hide itab-matnr.
endloop.
Maybe you are looking for
-
How to get row number in the fetch row itself in Sql Query ?
Hi, i am fetching some rows from a sql query . Is there any way to get row number as well in each row while all rows are fetched ? like this : RowNum data1 data2 1 abc ere 2 bnh ioi
-
HOw To Identify The JAR File Name
Hi, In an already developed java code how can we identify which jar file has been used? Does it depend on what packages are included? In a java code which I have the following packages are included, so please tell me what will be the name of the corr
-
At one of my client side, sales is done before purchase.. in that case gross profit shown will be 100%. but that is not correct and also the inventory level goes in negative.. Is there any way to handle this sceneario?
-
Current Period" attribute for Variants not working correctly
Hi Expert, Pls i need your advice on the issue screenshot below. When creating variants, a dynamic screen selection can be chosen for "Current Period" that will pre-populate begin and end dates. The problem is that, this attribute gives calendar mont
-
SharePoint Bug: SharePoint Permissions
I've a collaboration portal for intranet needs. I've defined a custom SharePoint Security Group called "ABC" with the following permissions a)Add Items b)it Items c)View Items d)Open Items e)View Versions f)View Application pages g)Add and Customize