Function module to know file data.
Hello Experts,
Is there any function module available which can give me details of a file like no of rows and cols in a file?
My input file is EXCEL file and I want to know no of lines (i.e rows) present in file before reading it.
If there is no such FM then plz let me know any function module which will read an excel file line by line in internal table as follow :
types : begin of ty_itab,
Line type string,
End of ty_itab.
Data : gt_itab type standard table of ty_itab.
i want ot read excel file in above internal table which stores excel file dta line by line in it.
-Shweta
Hi,
You can use FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' to read excel to internal table. But you need to know begin row, begin column, end row, and end column. The internal table is SAP standard format, so you need to process it to your custom internal table.
Anyway, reading data from excel is a lot more time consuming compared to reading data from tab delimited file and using FM 'GUI_UPLOAD'. Changing the source data from excel to a tab delimited file is also an easy task for user (copy paste from excel to notepad). So I recommend to change the requirement and make tab delimited file as your input.
Regards,
Teddy Kurniawan
Similar Messages
-
Function Module to download Raw data as a PDF file
Hi,
Is there any function module which will allow to convert raw data to pdf and download in the local system.
The requirement is to download a payslip as a pdf format.
Function Module 'CONVERT_PAYSLIP_TO_PDF' converts the data into a raw format. The output of this FM is of type XSTRING.
Can this be downloaded as a pdf.Hi
Please below coding
REPORT ZSAP_PDF_VIEWER.
DATA: LT_PDF TYPE TABLE OF TLINE,
LS_PDF LIKE LINE OF LT_PDF,
LV_URL TYPE CHAR255,
PDF_FSIZE TYPE I,
LV_CONTENT TYPE XSTRING,
LT_DATA TYPE STANDARD TABLE OF X255.
DATA : L_JOB_OUTPUT_INFO TYPE SSFCRESCL.
DATA : LS_CONTROL_PARAM TYPE SSFCTRLOP.
DATA : G_HTML_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_HTML_CONTROL TYPE REF TO CL_GUI_HTML_VIEWER.
DATA: LO_DIALOG_CONTAINER TYPE REF TO CL_GUI_DIALOGBOX_CONTAINER.
DATA: LO_DOCKING_CONTAINER TYPE REF TO CL_GUI_DOCKING_CONTAINER.
DATA : P_VBELN TYPE VBELN_VL.
FIELD-SYMBOLS <FS_X> TYPE X.
INITIALIZATION.
LS_CONTROL_PARAM-GETOTF = 'X'.
LS_CONTROL_PARAM-NO_DIALOG = 'X'.
START-OF-SELECTION.
CALL FUNCTION '/1BCDWB/SF00000034'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = LS_CONTROL_PARAM
P_VBELN = P_VBELN
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO = L_DOCUMENT_OUTPUT_INFO
JOB_OUTPUT_INFO = L_JOB_OUTPUT_INFO
JOB_OUTPUT_OPTIONS = L_JOB_ OUTPUT_OPTIONS
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = PDF_FSIZE
TABLES
OTF = L_JOB_OUTPUT_INFO-OTFDATA
LINES = LT_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
convert pdf to xstring string
LOOP AT LT_PDF INTO LS_PDF.
ASSIGN LS_PDF TO <FS_X> CASTING.
CONCATENATE LV_CONTENT <FS_X> INTO LV_CONTENT IN BYTE MODE.
ENDLOOP.
CALL SCREEN 100.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '100'.
**CREATE OBJECT LO_DOCKING_CONTAINER
EXPORTING
REPID = SY-REPID
DYNNR = '100'"SY-DYNNR
SIDE = LO_DOCKING_CONTAINER->DOCK_AT_LEFT
EXTENSION = 1200.
CREATE OBJECT g_html_container
EXPORTING
container_name = 'HTML'.
*CREATE OBJECT G_HTML_CONTROL
EXPORTING
PARENT = LO_DOCKING_CONTAINER.
CREATE OBJECT G_HTML_CONTAINER
EXPORTING
CONTAINER_NAME = 'HTML'.
CREATE OBJECT G_HTML_CONTROL
EXPORTING
PARENT = G_HTML_CONTAINER.
Convert xstring to binary table to pass to the LOAD_DATA method
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = LV_CONTENT
TABLES
BINARY_TAB = LT_DATA.
*application/
Load the HTML
CALL METHOD G_HTML_CONTROL->LOAD_DATA(
EXPORTING
TYPE = 'application'
SUBTYPE = 'pdf' "
IMPORTING
ASSIGNED_URL = LV_URL
CHANGING
DATA_TABLE = LT_DATA
EXCEPTIONS
DP_INVALID_PARAMETER = 1
DP_ERROR_GENERAL = 2
CNTL_ERROR = 3
OTHERS = 4 ).
CALL METHOD G_HTML_CONTROL->show_url
EXPORTING url = lv_url
in_place = 'X'
EXCEPTIONS cntl_error = 1.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE user_command_0100 INPUT.
DATA ok_code LIKE sy-ucomm.
MOVE sy-ucomm TO ok_code.
CASE ok_code.
WHEN 'BACK' OR 'EXIT'.
CALL METHOD LO_DOCKING_CONTAINER->free.
CALL METHOD g_html_control->free.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USE -
Function module for access OM Data from infotype 1001
We had a function module for accessing OM data viz. Infotype 1001. Could you let me know.
Advanced thanks,
Dasaradh kosanaHi Dasaradh,
Do you want the fm which fetches the data from HRP1001 , if this is the case you can use this FM RH_READ_INFTY_1001.
Reward Points if it is helpful
Regards,
Kiran I -
Function module to verify if date is valid.
Anyone know a function module to verify if date is valid?thx
hiiii
This function module will be useful.check.
FM CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = pre_date
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE e002(0s) WITH pre_date.
ENDIF.
reward if useful
thx
twinkal -
Function Module to know the Acc doc no for a Material document.
Dear Friends,
What is the Function Module to know the Acc doc no for a Material document? Please help. Thanks in advance.
Regards,
RAMANHi Raman,
I am not sure about your requirement,
But i remember when i required the same like you i went to vrpma table to get the account document,
I just did like a blind fold,
as my company does all the billing accounts in the same month, my search criteria was blind.
Also try with MKPF-XBLNR with the VBRK-XBLNR and get VBRK-VBELN
from there goto BSEG.
Thansk & regards,
Dileep .C -
FUNCTION MODULE CREATION FOR GENERIC DATA SOURCE
Hi BI gurus,
I am creating function module for generic datasource. For that I followed below mentioned steps
Steps
1. Created s structure with the fields that needed.
2. Created FM by copying the standard Function module
" RSAX_BIW_GET_DATA_SIMPLE " and Give a New name starting With
Y or Z .
3. IN SE37 ->Your Function module name -> Change, In table tab given structure
name by deleting the associated type given in E_T_DATA .
And inserted the required code given below
PROGRAM 'ZHU_BALANCE'.
*& Report ZHU_BALANCE
TABLES: VEKP, VEPO.
DATA: BEGIN OF T_DISPLAY,
DATE LIKE SY-DATUM,
EXIDV LIKE VEKP-EXIDV,
LGORT LIKE VEPO-LGORT,
WERKS LIKE VEKP-WERKS,
END OF T_DISPLAY.
DATA: ITAB_DISPLAY LIKE TABLE OF T_DISPLAY.
DATA: WA_ITAB_DISPLAY LIKE LINE OF ITAB_DISPLAY.
SELECT VEKPEXIDV VEPOLGORT VEPO~WERKS
INTO CORRESPONDING FIELDS OF TABLE ITAB_DISPLAY
FROM VEKP AS VEKP INNER JOIN VEPO AS VEPO
ON VEKPVENUM = VEPOVENUM
AND VEKPWERKS = VEPOWERKS
WHERE VEKP~VSTEL = SPACE
AND VEKP~VEGR1 = '401'
AND VEKP~VPOBJ = '12'
AND VEKP~STATUS = '0020'
AND VEPO~VEPOS = '000001'.
LOOP AT ITAB_DISPLAY INTO WA_ITAB_DISPLAY.
WA_ITAB_DISPLAY-DATE = SY-DATUM.
MODIFY ITAB_DISPLAY FROM WA_ITAB_DISPLAY TRANSPORTING DATE.
ENDLOOP.
WRITE:/ 'DATE', 20 'EXIDV', 40 'LGORT', 60 'WERKS'.
ULINE.
LOOP AT ITAB_DISPLAY INTO WA_ITAB_DISPLAY.
WRITE:/ WA_ITAB_DISPLAY-DATE, 20 WA_ITAB_DISPLAY-EXIDV , 40 WA_ITAB_DISPLAY-LGORT, 60 WA_ITAB_DISPLAY-WERKS.
ENDLOOP.
While checking the function module its populating the syntax error as
THE TYPE SRSC_S_IF_SIMPLE IS UNKOWN. (Though this is commented in program)
So pls suggest
Regards,
prafulhi indira,
thanx for ur reply we have created the funcion module successfuly it is also showing the output correct. But when we put that function module in the generic data source and try to extract data in RSA3 it shows the correct output of function module but with the msg ' 0 entries found in customer enhancement' and therfore zero records in the display list.
is there any correction or steps to be followed in data extraction
pls suggest
regards,
praful -
Function Module to Delete ODS Data based on Request
Hi All,
Is there any specific function module to delete ODS data based on Request.
I found the program RS_DEL_ODS_1 which is using the FM RSAR_ODS_API_DEL.
But this FM is deleting the request at PSA level.
Is there any alternate FM?Or is there any ABAP Program or so?Hi,
Deletion of specific request is not perimitted for ODS objects. You can delete the most recent request, but if you delete any previous requests, all the requests up to that request will also be deleted.
You can do it by write an ABAP program to identify the specific requests to be deleted for ODS.
Regards
CSM Reddy -
Is there any function module to convert the date format
Dear ABAPers,
Is there any function module to convert the date format from dd.mm.yyyy to dd-mmm-yyyy.
I want to convert the date format from dd.mm.yyy to dd.mmm.yyy Eg.from 10.03.2008 to 10-mar-2009.
Thanks & Regards,
Ashok.hi,
create custom function module or copy the below code in the report ..and use it
the out put for below is :----Convert a DATE field into a full format date eg. March 23, 2000
FUNCTION Z_CONVERT_DATE_INTO_FULL_DATE.
""Local interface:
*" IMPORTING
*" VALUE(DATE) LIKE SY-DATUM
*" EXPORTING
*" VALUE(FORMATTED_DATE)
*" EXCEPTIONS
*" INVALID_DATE
TABLES: TTDTG.
DATA: BEGIN OF T_DATE,
YYYY(4) TYPE C,
MM(2) TYPE C,
DD(2) TYPE C,
END OF T_DATE.
DATA: DAY(3) TYPE N.
DATA: VARNAME LIKE TTDTG-VARNAME.
IF DATE IS INITIAL.
CLEAR FORMATTED_DATE.
EXIT.
ENDIF.
check document date format
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
DATE = DATE
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1.
IF SY-SUBRC NE 0.
RAISE INVALID_DATE.
ENDIF.
MOVE DATE TO T_DATE.
CONCATENATE '%%SAPSCRIPT_MMM_' T_DATE-MM INTO VARNAME.
SELECT SINGLE * FROM TTDTG WHERE SPRAS = 'EN' AND VARNAME = VARNAME.
WRITE T_DATE-DD TO DAY.
CONCATENATE DAY ',' INTO DAY.
CONCATENATE TTDTG-VARVALUE DAY T_DATE-YYYY INTO FORMATTED_DATE
SEPARATED BY SPACE.
ENDFUNCTION.
the output is :--Convert a DATE field into a full format date eg. March 23, 2000
Regards,
Prabhudas -
Function module to determine the date for the nth weekday of the mth month
Hey folks,
Is there a function module which determines the date for the mth weekday of the nth month in the pth year.
For instance, if I input 2nd thursday of the 4th month in 2008, it should return me, 04/10/2008 (MM/DD/YYYY).
Thanks and Best Regards,
Puja.Hi Ravi,
Hadn't been able to work on this lately...You solution was quite close, but did not work for a few scenarios....I tweaked the logic a bit to take care of them as well...
So here goes the code:
================================================
DATA first_day_of_month TYPE datum.
DATA day TYPE p.
CONCATENATE year month '01' INTO first_day_of_month.
CALL FUNCTION 'DAY_IN_WEEK'
EXPORTING
datum = first_day_of_month
IMPORTING
wotnr = day.
DATA day_number TYPE numc2.
IF day = weekday.
IF recur = 1.
DATA ls_date(10) TYPE c.
CONCATENATE month '/01/' year INTO ls_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = ls_date
IMPORTING
date_internal = date.
ELSE.
day_number = ( ( recur - 1 ) * 7 ) + 1.
ENDIF.
ELSEIF day < weekday.
day_number = ( ( recur - 1 ) * 7 ) + ( weekday - day ) + 1.
ELSE.
day_number = ( ( recur - 1 ) * 7 ) + ( 7 - day ) + weekday + 1.
ENDIF.
IF date IS INITIAL.
CONCATENATE year month day_number INTO date.
ENDIF.
====================================
There still could be some loopholes in this....am not sure....but it sure did seem to work for a couple of random checks that I performed.
Brownie points to you for giving me a direction.
Thanks,
Puja. -
Function Module to determine due date in BI form Payment Terms
Hi to all,
Can any one tell me what is the Function Module to determine due date in BI, form ZTERM ( Payment Terms ).
I am working on Accounts Receivable (AR). and need to calculate Due date.
I shall be thankful to you for this.
Regards
Pavneet RanaThanks For reply,
I have to do aging for Receivables and report format is like that.
1 - 10 11 - 30 31 - 60 61 - 90 > 90 Notoverdue Overdue
North
East
south
West
According to client requirement in first 5 bucket i need to display Receivables according to aging
and for Notoverdue Overdue bucket condition is like that.
if sy-datum - vbrk-fkdat > 0NETDUEDATE then it is under Overdue bucket
if sy-datum - vbrk-fkdat < 0NETDUEDATE then it is under notOverdue bucket
there i have created 2 DSO , one for sales which have North,East,south,West and vbrk-fkdat using 2LIS_13_VDHDR,2LIS_13_VDITM
and other DSO which will have 0NETDUEDATE from 0FI_AR_4 .
for Notoverdue Overdue how i will calculate aging at query level.
also is 0p_keydt is variable for 0CALDAY which will take user entery and should i applied offcet, to get firts 5 bucket Receivables data for aging.
i shall be thankful to you for this.
Regards
Pavneet Rana -
Function module to fine closest date among given date
Hi All,
Is there any function module to find closest date among given dates?
Thanks in advanceHi
I think there is no FM module available which will satisy this requirement...
But You can develope one ZFM or You can write a code for it...
Logic will be
Check out below code...
PARAMETERS : P_DATE TYPE SY-DATUM DEFAULT '20090909'.
DATA : BEGIN OF WA_ITAB,
DATE TYPE SY-DATUM,
END OF WA_ITAB.
DATA : ITAB LIKE STANDARD TABLE OF WA_ITAB.
DATA : IND TYPE SY-TABIX,
IND2 TYPE SY-TABIX,
IND3 TYPE SY-TABIX,
DATE1 TYPE SY-DATUM,
DATE2 TYPE SY-DATUM,
DIFF1 TYPE I,
DIFF2 TYPE I,
UTTER_CLOSE TYPE SY-DATUM.
CLEAR : WA_ITAB, ITAB[].
WA_ITAB-DATE = '20090824'.
APPEND WA_ITAB TO ITAB.
CLEAR : WA_ITAB.
WA_ITAB-DATE = '20090901'.
APPEND WA_ITAB TO ITAB.
CLEAR : WA_ITAB.
WA_ITAB-DATE = '20090912'.
APPEND WA_ITAB TO ITAB.
CLEAR : WA_ITAB.
WA_ITAB-DATE = '20090930'.
APPEND WA_ITAB TO ITAB.
CLEAR : WA_ITAB.
WA_ITAB-DATE = '20091011'.
APPEND WA_ITAB TO ITAB.
CLEAR : WA_ITAB.
WA_ITAB-DATE = P_DATE. " P_DATE ==> Your Key Date
APPEND WA_ITAB TO ITAB.
CLEAR : WA_ITAB.
SORT ITAB BY DATE.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING DATE.
READ TABLE ITAB INTO WA_ITAB WITH KEY DATE = P_DATE.
IF SY-SUBRC = 0.
IND = SY-TABIX.
ENDIF.
IND2 = IND - 1.
IND3 = IND + 1.
READ TABLE ITAB INTO WA_ITAB INDEX IND2.
IF SY-SUBRC = 0.
DATE1 = WA_ITAB-DATE.
ENDIF.
READ TABLE ITAB INTO WA_ITAB INDEX IND3.
IF SY-SUBRC = 0.
DATE2 = WA_ITAB-DATE.
ENDIF.
CLEAR : DIFF1 , DIFF2.
DIFF1 = P_DATE - DATE1.
DIFF2 = P_DATE - DATE2.
IF DIFF1 = DIFF2.
UTTER_CLOSE = DATE1. " or date2 either
ELSEIF DIFF1 > DIFF2.
UTTER_CLOSE = DATE2.
ELSEIF DIFF1 < DIFF2.
UTTER_CLOSE = DATE1.
ENDIF.
WRITE : / 'Key Date ' , P_DATE.
WRITE : / 'Lower Closest Date ' , DATE1.
WRITE : / 'Upper Closest Date ' , DATE2.
WRITE : / 'Utter Close Date based on key date ', P_DATE , ' is ' , UTTER_CLOSE.
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
ilesh Nandaniya
Edited by: ilesh 24x7 on Sep 19, 2009 3:54 PM -
Function module to predict the date for a given date
hi friends,
is there any function module to predict the date
means for example if i enter one date , what will be the date
after 4 months(say) to the given date.
my requirement is when a person is hired today (10.06.2008)
and if he is under probationary for 6 months, then on what date he comes into the permenant employee's list(predicted date after date 6 months)Date calculations
DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
DATE_IN_FUTURE Calculate a date N days in the future.
RP_CALC_DATE_IN_INTERVAL Add days/months to a date
RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from a date
SD_DATETIME_DIFFERENCE Give the difference in Days and Time for 2 dates
MONTH_PLUS_DETERMINE Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
DATE_CREATE Calculates a date from the input parameters:
Example: DATE_CREATE
CALL FUNCTION 'DATE_CREATE'
EXPORTING
anzahl_jahre = 1
anzahl_monate = 2
anzahl_tage = 3
datum_ein = '20010101'
IMPORTING
datum_aus = l_new_date.
Result:
l_new_date = 20020304
Example: MONTH_PLUS_DETERMINE
data: new_date type d.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -5 " Negative to subtract from old date, positive to add
olddate = sy-datum
IMPORTING
NEWDATE = new_date.
write: / new_date. -
Function module to change the date format
hi guys
is there any function module to change the date format
from 08/28/2007(mm/dd/yyyy)
to August 28, 2007.
regards
vamsihi vamsi.,
Use CONVERSION_EXIT_SDATE_OUTPUT to get the month name,
but it will give short form of the month name.
if you want <b>long description of the month</b>,
use this peice of code.
PARAMETERS: V_DATUM(07) TYPE C. "(example input:12-2007)
DATA: V_MON(2) TYPE C,
V_YEAR(4) TYPE C,
V_MONTHNAME(10) TYPE C,
V_FULLDATE(30) type c.
WRITE V_DATUM+0(2) TO V_MON.
SELECT SINGLE LTX FROM T247 INTO V_MONTHNAME
WHERE SPRAS = SY-LANGU
AND MNR = V_MON.
CONCATENATE V_MONTHNAME v_datum+3(4)
INTO V_FULLDATE SEPARATED BY SPACE. "(example output : December 2007)
write: v_fulldate.
<i><b>Reawrd points if useful</b></i>
Chandra -
Function module to get the dates from the year and the period
Is there a function Module to get the dates from the year and the period
Check with :
To get last day of period use .
LAST_DAY_IN_PERIOD_GET.
To get last of month Use :
RE_LAST_DAY_OF_MONTH
HRVE_LAST_DAY_OF_MONTH
LAST_DAY_OF_MONTHS
ISB_PREVIOUS_PERIOD_DATE_GET
Thanks
Seshu -
Function module to get md04 data
I need function module to get below data of the material as per the mrp area.
Thanks,
KiranHello Kiran and Kumar
As I have explained in the following thread, BAPI_MATERIAL_STOCK_REQ_LIST should be used instead of MD_STOCK_REQUIREMENTS_LIST_API.
Material shortage report after mrp run.
BR
Caetano
Maybe you are looking for
-
I have an E220R as a jumpstart server with 2 lan cards in it. Firstly I installed the machine and setup Jumpstart on solaris 8 and all was fine I could jumpstart all my machines with no problem. I then added a second lan card and put it on a seperate
-
Hi, I am running a Brand new MBP 2.4 duo 160gig When I try to connect to the wireless office network it times out instantly. Password is good (Hexidecimal 64 BIT) Tried it again with a character wrong and it immediately told me that the passkey was w
-
Hello All, Say, I have define a PL/SQL function. Is it posible to view its codes using SQLPlus and not SQL Developer? If it is posible how do I do that. Thanks a lot. Regards, Talifhani
-
I need an urgent help to set manually the context value of es ProxyService.
I have a proxyservice that has this context structucture: xmlns:ns20="http://skat.dk/etil/2011/02/11/"> <ns:Kontekst> <!--You may enter ANY elements at this point--> <AnyElement/> </ns:Kontekst> waht have to do is that when the proxyservice that has
-
Installing Codfusion Mx 7 on windows XP
Hello, I have install the trial version of Coldfusion Mx 7.0. There is no error in the installation log file. The only options available to lauch programs in "All Programs\Macromedia\Coldfusion Mx7\" are to: 1- Start the Administrator page 2- Getting