Data shuffling in itab
Hi experts,
Iam trying to display data in ALV.
Iam using this statemennt.
APPEND LINES OF T_EKKN TO T_DISP.
SORT T_DISP BY AUFNR EBELN.
In the output, data is shuffling.For example i have ebeln.
First 4 charecters are displaying in 2nd column.Actually it should display in 5th column....
What might be the reason?
reward guaranteed
thanks
kaki
Yes Rich,
t_ekkn is like this.
QMNUM EBELN EBELP AUFNR ELIKZ KNTTP
000200000141|4510003410|00001|EAF200000141| |F |
ETINT01 |4510003405|00001|ETINT01 | |F |
ETINT02 |<b>4510003406|00001|ETINT02</b> |X |F |
000200000140|4510003407|00001|EAE200000140|X |F |
000200000141|4510003408|00001|EAF200000141| |F |
ETINT02 |<b>4510003409|00001|ETINT02</b> |X |F |
000200000141|4510003410|00001|EAF200000141| |F |
t_disp is like this.
QMNUM MNCOD AUFNR XLOEK EBELN ELIKZ CONFR
000200000010| | | | | | |
000200000020|X | | | | | |
000200000140| |EAE200000140|X | | |X |
000200000141| |EAF200000141|X | | |X |
000200000142| |EAG200000142|X | | |X |
000200000143| |EAH200000143|X | | |X |
000200000144| |EAI200000144|X | | |X |
ETINT01 |X |ETINT01 |X | | |X |
ETINT02 | |ETINT02 |X | | |X |
ETINT03 | |ETINT03 |X | | |X |
ETINT04 | |ETINT04 | | | | |
ETINTXYZ001A| |ETINTXYZ001A|X | | | |
In the t_ekkn table Two EBELNs are there for each AUFNR.
Similar Messages
-
Searching for a possibility to send data of an itab vial email
Hello,
i want to send data from an itab to an external emailadress. Does anybody know a FM or something other?
Thanks for your helpBelow is the sample code for sending and email, just concatenate all the field line into one and pass that table to
CONTENTS_BIN as attachment.
DATA:
L_DATE(10).
DATA:
LI_RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE,
LI_OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE,
LI_OBJECT_CONT LIKE SOLI OCCURS 20 WITH HEADER LINE,
LI_OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE,
LI_OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE,
LS_DOC_CHNG LIKE SODOCCHGI1,
LV_LINES TYPE I,
GI_OUTPUT LIKE SOLISTI1 OCCURS 5 WITH HEADER LINE.
DO 10 TIMES.
GI_OUTPUT-LINE = 'Answerthink'.
APPEND GI_OUTPUT.
ENDDO.
WRITE SY-DATUM TO L_DATE.
LS_DOC_CHNG-OBJ_NAME = 'ANGEBOT'.
CONCATENATE 'ZMBIBC_CCMS_LOAD Error Report u2013'
L_DATE
INTO LS_DOC_CHNG-OBJ_DESCR.
LI_OBJTXT = 'Please find the attached document'.
APPEND LI_OBJTXT.
CLEAR LI_OBJTXT.
DESCRIBE TABLE LI_OBJTXT LINES LV_LINES.
READ TABLE LI_OBJTXT INDEX LV_LINES.
LS_DOC_CHNG-DOC_SIZE = ( LV_LINES - 1 ) * 255 + STRLEN( LI_OBJTXT ).
* Creation of the entry for the compressed document - body text
CLEAR LI_OBJPACK-TRANSF_BIN.
LI_OBJPACK-HEAD_START = 1.
LI_OBJPACK-HEAD_NUM = 0.
LI_OBJPACK-BODY_START = 1.
LI_OBJPACK-BODY_NUM = LV_LINES.
LI_OBJPACK-DOC_TYPE = 'RAW'.
APPEND LI_OBJPACK.
DESCRIBE TABLE GI_OUTPUT LINES LV_LINES.
LI_OBJHEAD = 'OUTPUT'.
APPEND LI_OBJHEAD.
LI_OBJPACK-TRANSF_BIN = 'X'.
LI_OBJPACK-HEAD_START = 1.
LI_OBJPACK-HEAD_NUM = 1.
LI_OBJPACK-BODY_START = 1.
LI_OBJPACK-BODY_NUM = LV_LINES.
LI_OBJPACK-DOC_TYPE = 'RAW'.
LI_OBJPACK-OBJ_NAME = 'ANLAGE'.
LI_OBJPACK-OBJ_DESCR = 'Output List'.
LI_OBJPACK-DOC_SIZE = LV_LINES * 255.
APPEND LI_OBJPACK.
LI_RECLIST-RECEIVER = 'give email address.
LI_RECLIST-REC_TYPE = 'U'.
LI_RECLIST-EXPRESS = 'X'.
APPEND LI_RECLIST.
CLEAR LI_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = LS_DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = LI_OBJPACK
OBJECT_HEADER = LI_OBJHEAD
CONTENTS_BIN = GI_OUTPUT
CONTENTS_TXT = LI_OBJTXT
RECEIVERS = LI_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
BREAK PANAKAPALLY.
SUBMIT RSCONN01 WITH MODE EQ 'INT'
WITH OUTPUT EQ SPACE
AND RETURN.
COMMIT WORK AND WAIT.
CASE SY-SUBRC.
WHEN 0.
LOOP AT LI_RECLIST.
IF LI_RECLIST-RETRN_CODE = 0.
MESSAGE S000(Z1) WITH 'The document was sent'.
ELSE.
MESSAGE S000(Z1) WITH 'The document could not be sent'.
ENDIF.
ENDLOOP.
WHEN 1.
MESSAGE S000(Z1) WITH 'No authorization for sending'
'to the specified number'
'of recipients'.
WHEN 2.
MESSAGE S000(Z1) WITH 'Document could not be'
'sent to any recipient'.
WHEN 4.
MESSAGE S000(Z1) WITH 'No send authorization'.
WHEN OTHERS.
MESSAGE S000(Z1) WITH 'Error occurred while sending'.
ENDCASE. -
I want to update the Custom table using the data available in ITAB.
Hi,
I want to updaste the Custom Table which is created by me (Ztable) using the data available in itab.(which i got from defferent standard tables)
I want to update the custom table using the itab data How is it possible?
Is any possible by using Modify ?
DPK.example here
modifying datbase table useing internal table
advises before updating this datbase table plz lock that table to avoid incosistency
write the logic for modifying
Modify the database table as per new dunning procedure
MODIFY fkkvkp FROM TABLE lt_fkkvkp .
and finally unlock the table
example
*To lock table for further operations
constants: lc_tabname TYPE rstable-tabname VALUE 'FKKVKP' . "FKKVKP
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = lc_tabname
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc EQ 0.
To fetch all the contract accounts for customers of the segment
Households/SME.
PERFORM fetch_contract_accounts using lc_tabname .
ENDIF. " IF sy-subrc EQ 0.
*wrote the logic
Modify the database table as per new dunning procedure from internal table
MODIFY fkkvkp FROM TABLE lt_fkkvkp .
*unlock the tbale
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
TABNAME = uc_tabname . -
How to define the DATE fields in itab for uploading the data?
Hi Experts,
Am uploading the data from Excel sheet to Z table via my_itab.
So, there r 3 Date fields in Z table, which are defined as DATS(8).
So, pls. let me know that, How I hv to define the itab-date_one, itab-date_second, itab-date_three, weather CHAR(10) or sy-datum or concatenation??
thanqHi Sri, follow like this.
First Move that Excel Sheet Data to Internal Table Using Function Module ALSM_EXCEL_TO_INTERNAL_TABLE.
And you can insert that internal table data to Database Table Using INSERT Command.
First upload Data From Excel Sheet to ITAB with Required Structure. Once the Data Comes...
And Declare another Internal Table (ITAB1) Type Database Table name.
And Use Insert Database Table From ITAB1.
Check this Example.
TABLES:MARA.
DATA:BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
MBRSH LIKE MARA-MBRSH,
MTART LIKE MARA-MTART,
MEINS LIKE MARA-MEINS,
END OF ITAB.
DATA:ITAB1 LIKE MARA OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
ITAB-MATNR = '123ABCDA'. .
ITAB-MBRSH = 'C'.
ITAB-MTART = 'FERT' .
ITAB-MEINS = 'KG' .
APPEND ITAB.
ITAB-MATNR = '123ABCDB'. .
ITAB-MBRSH = 'C'.
ITAB-MTART = 'FERT' .
ITAB-MEINS = 'KG' .
APPEND ITAB.
LOOP AT ITAB.
MOVE-CORRESPONDING ITAB TO ITAB1.
APPEND ITAB1.
ENDLOOP.
LOOP AT ITAB1.
INSERT MARA FROM ITAB1.
MODIFY MARA .
ENDLOOP.
or,
By using type pools TRUXS our problem my be solve.
Take one internal table like your standard data base table and
one internal table for truxs like
DATA: it_raw TYPE truxs_t_text_data.
DATA: itab like mara occurs 0 with header line.
Use FM
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
Now looping that and updated to data base table.
hope this helps.
kindly reward if found helpful.
cheers,
Hema. -
Excel Upload and moving the data to dynamic itab
Hi Folks,
I am building a fieldcatalog dynamically based on the table name and then creating a dynamic internal table based on the fieldcatalog.Now I have a excel sheet having the fields in the same structure as the fieldcatalog that I built.I want to upload the data in the excel to an internal table having the structure of the fieldcatalog I built.I am having a problem in moving the data from the excel to the itab (dynamic itab built based on the fieldcatalog)
1.Building the fieldcatalog.
data:gt_fieldcat TYPE lvc_t_fcat.
ls_fieldcat-tabname = p_tabname.
ls_fieldcat-fieldname = p_fieldname.
ls_fieldcat-inttype = 'C'.
ls_fieldcat-outputlen = wa_dfies-outputlen.
ls_fieldcat-coltext = wa_dfies-fieldtext.
APPEND: ls_fieldcat TO gt_fieldcat.
CLEAR : ls_fieldcat.
2.Building the dynamic itab
DATA:gp_table TYPE REF TO data.
FIELD-SYMBOLS: <gt_table> TYPE table,
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fieldcat
IMPORTING
ep_table = gp_table.
ASSIGN gp_table->* TO <gt_table>.
3.Now I have an excel with a similar structure with data.Uploading the excel data into itab.
DATA: g_t_xltab TYPE STANDARD TABLE OF ty_xltab,
it_rawdata TYPE truxs_t_text_data,
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_rawdata
i_filename = xls_filename
TABLES
i_tab_converted_data = g_t_xltab[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
Endif.
*Move the data that got uploaded from excel into
*respective internal tables.
LOOP AT g_t_xltab
here I want move the data into an internal table having the structure I built using
the fieldcatalog/dynamic itab ie <gt_table>.
Endloop.
I tried using ASSIGN COMPONENT sy-index of <gt_table> and move-corresponding but in vain as I am not that much familiar with dynamic itab using field symbols.Kindly let me know how the excel data can be moved to dynamic itab.
Thanks,
K.Kiran.Hi,
you can try some logic like this. Please note this is just an example
TYPE-POOLS:truxs.
TYPES:BEGIN OF ty_xltab,
field TYPE string,
END OF ty_xltab.
DATA:wa TYPE ty_xltab.
DATA:lv_len TYPE i.
DATA:startpos TYPE i.
FIELD-SYMBOLS:<fs_line> TYPE mara.
FIELD-SYMBOLS:<fs> TYPE ANY.
DATA: g_t_xltab TYPE STANDARD TABLE OF ty_xltab,
it_rawdata TYPE truxs_t_text_data.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_rawdata
i_filename = ' '
TABLES
i_tab_converted_data = g_t_xltab[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
startpos = 0.
LOOP AT g_t_xltab INTO wa.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <fs_line> TO <fs>.
IF sy-subrc = 0.
DESCRIBE FIELD <fs> OUTPUT-LENGTH lv_len.
IF lv_len > 0.
<fs> = wa-field+startpos(lv_len).
startpos = startpos + lv_len.
ENDIF.
ELSE.
append <fs_line> to <fs_tab>.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
Sorry my answer is not for you requirement..Please Ignore.
Your solution can be easily solved by looking at the concept Assign component . Please search
Edited by: Keshav.T on Nov 7, 2011 1:42 PM -
Filling data into same itab based on condition.
hi to all
my problem is that i have a itab which has matner and mtart now i want to post the stock in the same itab .my query is as below
data : begin of it5 occurs 0,
matnrfg like stpox-idnrk,
matnrsf like stpox-idnrk,
mtart like stpox-mtart,
labst like mard-labst,
lbkum like mbew-lbkum,
labst_final like mard-labst,
end of it5.
if t_stb1-mtart = 'HALB'.
move t_stb1-idnrk to it5-matnrsf.
append it5.
SELECT labst FROM mard INTO
corresponding fields of table it5
WHERE matnr = it5-matnrsf and
lgort = 'A400'.
SELECT lbkum FROM mbew INTO
corresponding fields of table it5
WHERE matnr = it5-matnrsf.
it5-labst_final = it5-lbkum - it5-labst.
but it is not working can anybody help ,it is urgent plz .pointe will be rewarded
Message was edited by:
sarabjit kaurHi,
Create a temperory table as same as IT5 as IT5_temp.
data : begin of it5 occurs 0,
matnrfg like stpox-idnrk,
matnrsf like stpox-idnrk,
mtart like stpox-mtart,
labst like mard-labst,
lbkum like mbew-lbkum,
labst_final like mard-labst,
end of it5.
data : begin of it5_temp occurs 0,
matnrfg like stpox-idnrk,
matnrsf like stpox-idnrk,
mtart like stpox-mtart,
labst like mard-labst,
lbkum like mbew-lbkum,
labst_final like mard-labst,
end of it5_temp.
if t_stb1-mtart = 'HALB'.
move t_stb1-idnrk to it5-matnrsf.
append it5.
data : v_labst like mard-labst.
data : v_lbkum like mbew-lbkum.
SELECT single labst FROM mard INTO v_labst
WHERE matnr = it5-matnrsf and
lgort = 'A400'.
it5-labst = v_labst.
SELECT single lbkum FROM mbew INTO v_lbkum
WHERE matnr = it5-matnrsf.
it5-lbkum = v_lbkum.
it5-labst_final = it5-lbkum - it5-labst.
move it5 to it5_temp.
append it5_temp.
clear it5. "<<<<<<<< clear it5
All further needs you can use it5_temp.
a® -
How to pass pdf data to ABAP itab
Hi,
I have a pdf form that I want to upload in SAP and retrieve the data from the pdf and generate necessary transaction.
I used the example in offline adobe form documentation:
I've encountered 2 problems:
1. error message: XSLT: No valid XML source,
The transformation is not possible since the XML source document cannot
be parsed.
2. when passing Xstring to string, how much data can it store?
if my form has all the information about vendor name, address, etc. on the top of the form, but indeed the data that I want is on the bottom half of the page. How do I retrieve the data in XML?
3. If someone can provide some sample codes, it would be much appreciated.
Here is my code
DATA: lv_xml_data TYPE xstring,
lt_xml_data TYPE STANDARD TABLE OF xstring,
lv_xml_data_string TYPE string.
APPEND lv_xml_data TO lt_xml_data.
go_pdfobj->get_data( IMPORTING formdata = lv_xml_data ).
Convert XML data from XSTRING format to STRING format
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = lv_xml_data
IMPORTING
ex_string = lv_xml_data_string.
Remove NEW-LINE character from XML data in STRING format
REPLACE ALL OCCURENCES OF cl_abap_char_utilities=>newline
IN lv_xml_data_string WITH ''.
replace '<?xml version="1.0" encoding="UTF-8"?><data>'
in lv_xml_data_string with ''.
"Make the XML envelope compliant with identity transform
REPLACE '<?xml version="1.0" encoding="UTF-8"?><data>'
IN lv_xml_data_string
WITH '<?xml version="1.0" encoding="iso-8859-1"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values>'.
REPLACE '</data>'
IN lv_xml_data_string
WITH '</asx:values></asx:abap>'.
Apply the identity transform and convert XML into ABAP in one step
DATA: ls_vndbnk TYPE ZVK_VNDBNK VALUE IS INITIAL.
CALL TRANSFORMATION id
SOURCE XML lv_xml_data_string
RESULT z_vndbnk = ls_vndbnk.Lily,
I observe that you have declared lv_xml_data as TYPE xstring & string and get_data method probably expects data of xstring type.
Have a look at the "Extract the Data" section from following [article.|https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c2567f2b-0b01-0010-b7b5-977cbf80665d&overridelayout=true]
Chintan -
Performance issue while transferring data from one itab to another itab
hi experts,
i have stored all the general material details in one internal table and description, valuation details of the meterial is stored in another internal table which is of standard table. now i need to tranfer all the data from these two internal tables into one final internal table but it is taking lot of time as it has to transfer lacs of data.
i have declared the output table as shown below
DATA:
t_output TYPE standard TABLE
OF type_output
INITIAL SIZE 0
WITH HEADER LINE.
(according to the standard i have to declare like this and the two internal tables are declared similar to the above one)
could somebody suggest me how shall I procced through this...
thanks in advance....
ragerds,
DeepuHave a look at the following article which you may find useful:
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40729734-3668-2910-deba-fa0e95e2c541">Improving performance in nested loops</a>
good luck, damian -
Data in itab does not show when using FM REUSE_ALV_POPUP_TO_SELECT
Hello Experts,
I am using the said FM to display some data when the user clicks on a
custom button I made. But no data is displayed in the popup window. I
debugged it and the itab I am passing has a value in it. Below is my code:
WRITE icon_green_light AS ICON TO wa_legend-legend.
wa_legend-column = text-t05.
wa_legend-description = text-d01.
APPEND wa_legend TO lt_legend.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DEFINE m_fill_fieldcat.
wa_fieldcat-fieldname = &1.
wa_fieldcat-tabname = &2.
wa_fieldcat-seltext_m = &3.
wa_fieldcat-icon = &4.
wa_fieldcat-outputlen = &5.
append wa_fieldcat to lt_fieldcat.
clear wa_fieldcat.
END-OF-DEFINITION.
m_fill_fieldcat 'LEGEND' 'ITAB' text-t04 'X' '14'.
m_fill_fieldcat 'COLUMN' 'ITAB' text-t11 '' '50'.
m_fill_fieldcat 'DESCRIPTION' 'ITAB' text-t12 '' '50'.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
* I_TITLE =
* I_SELECTION = 'X'
* I_ALLOW_NO_SELECTION =
i_zebra = 'X'
* I_SCREEN_START_COLUMN =
* I_SCREEN_START_LINE =
* I_SCREEN_END_COLUMN =
* I_SCREEN_END_LINE =
* I_CHECKBOX_FIELDNAME =
* I_LINEMARK_FIELDNAME =
* I_SCROLL_TO_SEL_LINE = 'X'
i_tabname = 'LT_LEGEND'
* I_STRUCTURE_NAME =
it_fieldcat = lt_fieldcat[]
* IT_EXCLUDING =
* I_CALLBACK_PROGRAM =
* I_CALLBACK_USER_COMMAND =
* IS_PRIVATE =
* IMPORTING
* ES_SELFIELD =
* E_EXIT =
TABLES
t_outtab = lt_legend[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Hope you can help me guys. Thank you and take care!Hi,
check this code and modify your FM accordingly then it'll work,
Q. i_checkbox_fieldname = 'CHECKBOX'
A. If the table output in the popup has checkboxes at the beginning of the rows (e.g. for multiple selection), the internal table must contain a field containing the value of the checkbox.
Assign the name of this field to the parameter I_CHECKBOX_FIELDNAME.
Q. i_tabname = 'TLINE'
A. This is the name of ur input help internal table
Q. it_fieldcat = fieldcat[]
A The table u gonna display has to have a fieldcat.
Q. it_excluding = extab[].
A. In case u wanna exclude some functions.
Below is a working example, paste it in se38 and activate.
!!! Warning SAVE IT AS A LOCAL OBJECT !!!
report ztests1.
type-pools: slis.
data: index type i.
data: l_kunnr like kna1-kunnr.
data: input(10) type c,
text(4) type c,
text1(5) type c.
data: begin of itab occurs 10,
kunnr like kna1-kunnr,
name1 like kna1-name1,
end of itab.
data: e_exit.
data: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
parameter: p_kunnr(10) type c.
at selection-screen on value-request for p_kunnr.
select kunnr name1 up to 10 rows
from kna1
into table itab.
fieldcat-tabname = 'ITAB'.
fieldcat-fieldname = 'KUNNR'.
fieldcat-seltext_m = 'Cust'.
fieldcat-ddictxt = 'M'.
fieldcat-outputlen = 10.
APPEND fieldcat.
CLEAR fieldcat.
fieldcat-tabname = 'ITAB'.
fieldcat-fieldname = 'NAME1'.
fieldcat-seltext_m = 'Cust Name'.
fieldcat-ddictxt = 'M'.
fieldcat-outputlen = 30.
APPEND fieldcat.
CLEAR fieldcat.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = 'Customer Selection'
I_SELECTION = 'X'
I_ALLOW_NO_SELECTION =
I_ZEBRA = ' '
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_CHECKBOX_FIELDNAME =
I_LINEMARK_FIELDNAME =
I_SCROLL_TO_SEL_LINE = 'X'
i_tabname = 'ITAB'
I_STRUCTURE_NAME =
IT_FIELDCAT = fieldcat[]
IT_EXCLUDING =
I_CALLBACK_PROGRAM =
I_CALLBACK_USER_COMMAND =
IS_PRIVATE =
IMPORTING
ES_SELFIELD =
E_EXIT = e_exit
tables
t_outtab = itab
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
seshu. -
In bdc while transfer data from itab to db .we get error how to handle ?
hi guys,
1.while uploading a data from flat file to internal table .
We get
Lifnr name1 ort01
123 # Eswar# in ##
But while transfer data from <b>itab to db</b> .we get error how to handle that?
pls coud u give the logic
i'm waiting for u r reply.
Ishwar.well without telling us WHAT error message you get noone will be able to help yah.
please help us to help you. thx -
"select distinct" from itab data?
Hi anyone know how to do a "select distinct" from itab data and do some calculation.
For example:
This is my itab result data:
Col1 | Col2 | Col3 | col4
123 |000010 |a | 10.00
123 |000010 |b | 2.00
123 |000010 |c | 3.00
123 |000020 |a | 10.50
123 |000020 |b | 2.50
123 |000020 |c | 3.50
123 |000030 |a | 50.00
123 |000030 |b | 6.00
123 |000030 |c | 7.00
I need to do some calculation of a value a - (b value + c value) = x value and x value update back to value a col where the value of a, b, c must be match of col2.
ideally return 000010: x value = 5.00
000020: x value = 4.50
000030: x value = 37.00
How can I able to differential the data from cols2?
aish.hi,
u can do this:
loop at itab.
loop at itab into wa_itab where col2 = itab-col2. " process all 10's, 20's
....do ur codition chk n calculations here " populate the data into new itab
endloop.
delete itab where col2 = itab-col2. " after processing delete them.
endloop.
do the calculations and populate into new internal table in the loop itself. -
How to modify changes of table control data in PAI
I have a table control where the columns are brought by dict fields.I am able to bring data into table control through an itab.
Now what i want is whenever user edits data in table control and clicks on save button the corresponding changes should be made in database.
For this according to my understanding we need to (in PAI) modify the changes in itab from the table control and then in SY-UCOMM of SAVE button we need to update in database table using itab.
For this , I am not able to write code for modifying the changes in itab from table control. Here is my code below.Please tell me how to do this.
PROCESS BEFORE OUTPUT.
MODULE FILL_DATA.
LOOP AT ITAB INTO ZEMPLOYEE_MASTER WITH CONTROL EMPTABLE CURSOR
EMPTABLE-CURRENT_LINE.
ENDLOOP.
MODULE STATUS_0001.
PROCESS AFTER INPUT.
LOOP AT ITAB.
MODULE MODIFY_ITAB.
ENDLOOP.
MODULE USER_COMMAND_0001.
REPORT ZDATA_FORM1.
TABLES: ZEMPLOYEE_MASTER.
CONTROLS EMPTABLE TYPE TABLEVIEW USING SCREEN 0001.
data: begin of itab occurs 0,
emp_no like zemployee_master-emp_no,
name like zemployee_master-name,
city like zemployee_master-city,
end of itab,
rowno TYPE I VALUE 1.
*& Module STATUS_0001 OUTPUT
* text
MODULE STATUS_0001 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0001 OUTPUT
*& Module USER_COMMAND_0001 INPUT
* text
MODULE USER_COMMAND_0001 INPUT.
MESSAGE 'Inside INPUT' TYPE 'I'.
CASE SY-UCOMM.
WHEN 'SAVE'.
UPDATE zemployee_master.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0001 INPUT
*& Module fill_data OUTPUT
* text
MODULE fill_data OUTPUT.
select emp_no name city from zemployee_master into TABLE itab ORDER BY emp_no.
Describe table itab lines EMPTABLE-LINES.
ENDMODULE. " fill_data OUTPUT
*& Module modify_itab INPUT
* text
MODULE modify_itab INPUT.
* MODIFY itab from zemployee_master index
* MESSAGE 'Inside modify_itab' TYPE 'I'.
ENDMODULE. " modify_itab INPUTHi
In the following module of your code
MODULE modify_itab INPUT.
MODIFY itab from zemployee_master index tc-current_line " Where TC is the name of the Table control on the Screen
ENDMODULE.
Table control data gets refreshed on *enter*
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/2165e990-0201-0010-5cbb-b5c2ad436140
Cheerz
Ramchander Rao.K -
Reg : data is not getting in the output
hi team,
data is not getting in the output, but it is getting in the debug mode
REPORT ZSAPP10 .
*tables : pernr.
TABLES : PA0001.
type-pools : slis.
types : begin of itab,
pernr type pernr,
orgeh type orgeh,
abkrs type abkrs,
end of itab,
begin of itab2,
pernr type pernr,
vorna type pad_vorna,
nachn type pad_nachn,
end of itab2.
parameter : p_pernr like pa0001-pernr.
*DATA: g_cprog tYPE SY-CPROG.
data : i_itab1 type table of itab initial size 0,
i_itab2 type table of itab2 initial size 0.
data : w_itab type itab,
w_itab2 type itab2.
data : t_fieldcat type slis_t_fieldcat_alv,
w_fieldcat type slis_fieldcat_alv.
data : t_event type slis_t_event,
w_event type slis_alv_event.
data : t_listheader type slis_t_listheader,
w_listheader type slis_listheader.
*get pernr.
w_event-form = 'TOP_OF_PAGE'.
w_event-form = 'sub1'.
append w_event to t_event.
w_listheader-typ = 'H'.
w_listheader-info = 'this is new top of page'.
append w_listheader to t_listheader.
select pernr
orgeh
abkrs from pa0001 into table i_itab1 where pernr = p_pernr.
w_fieldcat-col_pos = 1.
w_fieldcat-seltext_m = 'personnal no'.
w_fieldcat-fieldname = 'pernr'.
w_fieldcat-tabname = 'i_itab1'.
w_fieldcat-outputlen = '20'.
append w_fieldcat to t_fieldcat.
w_fieldcat-col_pos = 2.
w_fieldcat-seltext_m = 'org. unit'.
w_fieldcat-tabname = 'i_itab1'.
w_fieldcat-fieldname = 'orgeh'.
w_fieldcat-outputlen = '20'.
append w_fieldcat to t_fieldcat.
w_fieldcat-col_pos = 3.
w_fieldcat-seltext_m = 'payroll area'.
w_fieldcat-tabname = 'i_itab1'.
w_fieldcat-fieldname = 'abkrs'.
w_fieldcat-outputlen = '20'.
append w_fieldcat to t_fieldcat.
*g_cprog = SY-CPROG.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-CPROG
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = T_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = T_EVENT
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_ITAB1[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM sub1 *
FORM sub1.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = t_listheader
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM. " sub1write this way...
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = wa_layout
i_callback_user_command = 'USER_COMMAND_ACCT'
i_grid_title = 'Document Status Report'
it_fieldcat = it_fcat[]
IT_SORT = IT_SORT[]
it_events = it_events
TABLES
t_outtab = it_final_data[]
EXCEPTIONS
program_error = 1
OTHERS = 2. -
Upload data from excel file -URGENT
Hi All,
Advanced thanks to ur reply
How to upload data from excel sheet to itab
what are the functional modules we are using for that
Please help me
i look forward to ur reply
Regards
Raja Sekhar.THi,
TYPE-POOLS: truxs.
DATA: i_text_data TYPE truxs_t_text_data,
v_filename_string TYPE string.
DATA: BEGIN OF itab OCCURS 0,
Name(30),
Phone(15),
Fax(500).
DATA: END OF itab.
PARAMETERS: p_file LIKE rlgrap-filename.
START-OF-SELECTION.
v_filename_string = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename_string
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
dat_mode = ''
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = i_text_data
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
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 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
I_LINE_HEADER =
i_tab_raw_data = i_text_data
i_filename = p_file
TABLES
i_tab_converted_data = itab
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
I think this code will help u.
With Regards,
Ranganathan -
How to skip first record while inserting data from a flat file to BW system
Hi Experts,
In my project we have to upload flat file into a BW system. I have written a program and it is working fine.
Now we have got another requirement. The flat file will have a header record (first row). While uploading the flat file we have to skip this record. How I can do so?
The code is as below:
FORM upload1.
DATA : wf_title TYPE string,
lt_filetab TYPE filetable,
l_separator TYPE char01,
l_action TYPE i,
l_count TYPE i,
ls_filetab TYPE file_table,
wf_delemt TYPE rollname,
wa_fieldcat TYPE lvc_s_fcat,
tb_fieldcat TYPE lvc_t_fcat,
rows_read TYPE i,
p_error TYPE char01,
l_file TYPE string.
DATA: wf_object(30) TYPE c,
wf_tablnm TYPE rsdchkview.
wf_object = 'myprogram'.
DATA i TYPE i.
DATA:
lr_mdmt TYPE REF TO cl_rsdmd_mdmt,
lr_mdmtr TYPE REF TO cl_rsdmd_mdmtr,
lt_idocstate TYPE rsarr_t_idocstate,
lv_subrc TYPE sysubrc.
TYPES : BEGIN OF test_struc,
/bic/myprogram TYPE /bic/oimyprogram,
txtmd TYPE rstxtmd,
END OF test_struc.
DATA : tb_assum TYPE TABLE OF /bic/pmyprogram.
DATA: wa_ztext TYPE /bic/tmyprogram,
myprogram_temp TYPE ziott_assum,
wa_myprogram TYPE /bic/pmyprogram.
DATA : test_upload TYPE STANDARD TABLE OF test_struc,
wa2 TYPE test_struc.
DATA : wa_test_upload TYPE test_struc,
ztable_data TYPE TABLE OF /bic/pmyprogram,
ztable_text TYPE TABLE OF /bic/tmyprogram,
wa_upld_text TYPE /bic/tmyprogram,
wa_upld_data TYPE /bic/pmyprogram,
t_assum TYPE ziott_assum.
DATA : wa1 LIKE test_upload.
wf_title = text-026.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = wf_title
default_extension = 'txt'
file_filter = 'Tab delimited Text Files (*.txt)'
CHANGING
file_table = lt_filetab
rc = l_count
user_action = l_action
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
OTHERS = 3. "#EC NOTEXT
IF sy-subrc <> 0.
EXIT.
ENDIF.
LOOP AT lt_filetab INTO ls_filetab.
l_file = ls_filetab.
ENDLOOP.
CHECK l_action = 0.
IF l_file IS INITIAL.
EXIT.
ENDIF.
l_separator = 'X'.
wa_fieldcat-fieldname = 'test'.
wa_fieldcat-dd_roll = wf_delemt.
APPEND wa_fieldcat TO tb_fieldcat.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
CLEAR wa_test_upload.
Upload file from front-end (PC)
File format is tab-delimited ASCII
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
has_field_separator = l_separator
TABLES
data_tab = i_mara
data_tab = test_upload
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
EXIT.
ELSE.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
IF test_upload IS NOT INITIAL.
DESCRIBE TABLE test_upload LINES rows_read.
CLEAR : wa_test_upload,wa_upld_data.
LOOP AT test_upload INTO wa_test_upload.
CLEAR : p_error.
rows_read = sy-tabix.
IF wa_test_upload-/bic/myprogram IS INITIAL.
p_error = 'X'.
MESSAGE s153 WITH wa_test_upload-/bic/myprogram sy-tabix.
CONTINUE.
ELSE.
TRANSLATE wa_test_upload-/bic/myprogram TO UPPER CASE.
wa_upld_text-txtmd = wa_test_upload-txtmd.
wa_upld_text-txtsh = wa_test_upload-txtmd.
wa_upld_text-langu = sy-langu.
wa_upld_data-chrt_accts = 'xyz1'.
wa_upld_data-co_area = '12'.
wa_upld_data-/bic/zxyzbcsg = 'Iy'.
wa_upld_data-objvers = 'A'.
wa_upld_data-changed = 'I'.
wa_upld_data-/bic/zass_mdl = 'rrr'.
wa_upld_data-/bic/zass_typ = 'I'.
wa_upld_data-/bic/zdriver = 'yyy'.
wa_upld_text-langu = sy-langu.
MOVE-CORRESPONDING wa_test_upload TO wa_upld_data.
MOVE-CORRESPONDING wa_test_upload TO wa_upld_text.
APPEND wa_upld_data TO ztable_data.
APPEND wa_upld_text TO ztable_text.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM ztable_data.
DELETE ADJACENT DUPLICATES FROM ztable_text.
IF ztable_data IS NOT INITIAL.
CALL METHOD cl_rsdmd_mdmt=>factory
EXPORTING
i_chabasnm = 'myprogram'
IMPORTING
e_r_mdmt = lr_mdmt
EXCEPTIONS
invalid_iobjnm = 1
OTHERS = 2.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
**Lock the Infoobject to update
CALL FUNCTION 'RSDG_IOBJ_ENQUEUE'
EXPORTING
i_objnm = wf_object
i_scope = '1'
i_msgty = rs_c_error
EXCEPTIONS
foreign_lock = 1
sys_failure = 2.
IF sy-subrc = 1.
MESSAGE i107(zddd_rr) WITH wf_object sy-msgv2.
EXIT.
ELSEIF sy-subrc = 2.
MESSAGE i108(zddd_rr) WITH wf_object.
EXIT.
ENDIF.
*****Update Master Table
IF ztable_data IS NOT INITIAL.
CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
EXPORTING
i_iobjnm = 'myprogram'
i_tabclass = 'M'
I_T_ATTR = lt_attr
TABLES
i_t_table = ztable_data
EXCEPTIONS
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'E'
txtnr = '054'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
MESSAGE e054(zddd_rr) WITH 'myprogram'.
ELSE.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'S'
txtnr = '053'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
ENDIF.
*endif.
*****update Text Table
IF ztable_text IS NOT INITIAL.
CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
EXPORTING
i_iobjnm = 'myprogram'
i_tabclass = 'T'
TABLES
i_t_table = ztable_text
EXCEPTIONS
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'E'
txtnr = '055'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
ENDIF.
ENDIF.
ELSE.
MESSAGE s178(zddd_rr).
ENDIF.
ENDIF.
COMMIT WORK.
CALL FUNCTION 'RSD_CHKTAB_GET_FOR_CHA_BAS'
EXPORTING
i_chabasnm = 'myprogram'
IMPORTING
e_chktab = wf_tablnm
EXCEPTIONS
name_error = 1.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
****Release locks on Infoobject
CALL FUNCTION 'RSDG_IOBJ_DEQUEUE'
EXPORTING
i_objnm = 'myprogram'
i_scope = '1'.
ENDIF.
ENDIF.
PERFORM data_selection .
PERFORM update_alv_grid_display.
CALL FUNCTION 'MESSAGES_SHOW'.
ENDFORM.
Please let me know how I can skip first record of the flat file?
Regards,
Sgo through this hope u can get some idea
REPORT ztest no standard page heading line-size 255.
Declaration *
TYPES t_itab1 TYPE alsmex_tabline.
types: begin of t_csks,
kostl like csks-kostl,
end of t_csks.
types: begin of t_cska,
kstar like cska-kstar,
end of t_cska.
data: begin of t_flatfile,
docdate like COHEADER-BLDAT,
postdate like COHEADER-BUDAT,
doctext like COHEADER-BLTXT,
costele like RK23F-KSTAR,
amount like RK23F-WTGBTR,
scostctr like RK23F-SKOSTL,
rcostctr like RK23F-EKOSTL,
rintorder like RK23F-EAUFNR,
end of t_flatfile.
data: begin of t_flatfile1,
docdate like COHEADER-BLDAT,
postdate like COHEADER-BUDAT,
doctext like COHEADER-BLTXT,
costele like RK23F-KSTAR,
amount like RK23F-WTGBTR,
scostctr like RK23F-SKOSTL,
rcostctr like RK23F-EKOSTL,
rintorder like RK23F-EAUFNR,
NUM LIKE SY-INDEX,
end of t_flatfile1.
data: itab like table of t_flatfile with header line.
data: itab2 like table of t_flatfile1 with header line.
DATA: it_itab1 TYPE STANDARD TABLE OF t_itab1 WITH HEADER LINE,
MESSTAB1 LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE,
MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
data: begin of bdcdata occurs 0.
include structure bdcdata.
data: end of bdcdata.
data:t_lin type i VALUE '0',
u_rec type i VALUE '0',
s_rec type i VALUE '0'.
data: it_csks type standard table of t_csks,
wa_csks type t_csks.
data: it_cska type standard table of t_cska,
wa_cska type t_cska.
*Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
parameters: p_docdat LIKE COHEADER-BLDAT obligatory,
p_postda LIKE COHEADER-BUDAT obligatory,
p_doctxt LIKE COHEADER-BLTXT.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-011.
parameters: p_file LIKE RLGRAP-FILENAME obligatory,
DIS_MODE LIKE CTU_PARAMS-DISMODE DEFAULT 'N'.
SELECTION-SCREEN END OF BLOCK b2.
A T S E L E C T I O N S C R E E N *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM get_local_file_name USING p_file.
*Start of Selection
START-OF-SELECTION.
Perform get_Excel_data.
perform validate_data.
Perform Process_Data.
end-of-selection
end-of-selection.
perform display_data.
*& Form get_local_file_name
text
-->P_P_FILE text
FORM get_local_file_name USING P_P_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
file_name = p_file.
ENDFORM. " get_local_file_name
*& Form get_Excel_data
text
--> p1 text
<-- p2 text
FORM get_Excel_data .
FIELD-SYMBOLS : <FS>.
DATA : V_INDEX TYPE I.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 2
i_begin_row = 1
i_end_col = 256
i_end_row = 9999 "65536
TABLES
intern = it_itab1
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
Message text-013 type 'E'.
ENDIF.
IF IT_ITAB1[] IS INITIAL.
Message text-001 type 'E'.
else. "IF IT_ITAB1[] IS INITIAL.
data: itab2 like itab occurs 0 with header line.
SORT IT_ITAB1 BY ROW COL.
LOOP AT IT_ITAB1.
MOVE :IT_ITAB1-COL TO V_INDEX.
ASSIGN COMPONENT V_INDEX OF STRUCTURE itab2 TO <FS>.
MOVE : IT_ITAB1-VALUE TO <FS>.
AT END OF ROW.
MOVE-CORRESPONDING itab2 TO itab.
APPEND itab.
CLEAR:itab,itab2.
ENDAT.
endloop.
describe table itab lines t_lin.
endif. "IF IT_ITAB1[] IS INITIAL.
ENDFORM. " get_Excel_data
*& Form Process_Data
text
--> p1 text
<-- p2 text
FORM Process_Data .
data:l_tabix type sy-tabix.
data:l_periv like t001-periv,
l_monat like bkpf-monat,
l_gjahr like bkpf-gjahr,
l_amt(21) type c.
data: l_ddate(10),
l_pdate(10).
WRITE p_docdat TO l_ddate.
WRITE p_postda TO l_pdate.
clear: l_periv,l_monat,l_gjahr.
select single periv from t001 into l_periv where bukrs = '5000'. "P_bukrs
if sy-subrc eq 0.
l_gjahr = p_postda+0(4).
call function 'FI_PERIOD_DETERMINE'
EXPORTING
i_budat = p_postda
i_bukrs = '5000' "p_bukrs
i_periv = l_periv
i_gjahr = l_gjahr
IMPORTING
e_monat = l_monat.
clear:l_periv.
endif.
loop at itab2.
refresh:bdcdata.
clear:bdcdata.
l_tabix = sy-tabix.
perform bdc_dynpro using 'SAPLK23F1' '1200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'COHEADER-SEND_REC_REL'
'10SAP'.
perform bdc_field using 'RK23F-STATUS'
'S'.
perform bdc_field using 'COHEADER-BLDAT'
itab-docdate.
l_ddate.
perform bdc_field using 'COHEADER-BUDAT'
itab-postdate.
l_pdate.
perform bdc_field using 'COHEADER-PERIO'
l_monat. "'9'.
perform bdc_field using 'COHEADER-BLTXT'
itab-doctext.
p_doctxt.
perform bdc_field using 'RK23F-KSTAR'
itab2-costele.
WRITE itab2-amount TO l_amt.
l_amt = itab-amount.
condense l_amt no-gaps.
perform bdc_field using 'RK23F-WTGBTR'
l_amt.
itab-amount.
perform bdc_field using 'RK23F-WAERS'
'USD'.
*perform bdc_field using 'RK23F-SGTXT'
itab-doctext.
perform bdc_field using 'RK23F-SKOSTL'
itab2-scostctr.
perform bdc_field using 'BDC_CURSOR'
'RK23F-EAUFNR'.
perform bdc_field using 'RK23F-EKOSTL'
itab2-rcostctr.
perform bdc_field using 'RK23F-EAUFNR'
itab2-rintorder.
perform bdc_dynpro using 'SAPLK23F1' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=POST'.
perform bdc_field using 'COHEADER-SEND_REC_REL'
'10SAP'.
perform bdc_field using 'RK23F-STATUS'
'S'.
perform bdc_field using 'COHEADER-BLDAT'
itab-docdate.
l_ddate.
perform bdc_field using 'COHEADER-BUDAT'
itab-postdate.
l_pdate.
perform bdc_field using 'COHEADER-PERIO'
'9'.
l_monat.
perform bdc_field using 'COHEADER-BLTXT'
itab-doctext.
p_doctxt.
perform bdc_field using 'BDC_CURSOR'
'RK23F-KSTAR'.
perform bdc_field using 'RK23F-WAERS'
'USD'.
CALL TRANSACTION 'KB15N' USING BDCDATA MODE DIS_MODE MESSAGES INTO MESSTAB.
If sy-subrc = 0.
s_rec = s_rec + 1.
ELSE.
u_rec = u_rec + 1.
move ITAB2-NUM to messtab1-msgv1.
concatenate itab2-costele ' | ' itab2-scostctr ' | ' itab2-rcostctr ' | ' itab2-rintorder into messtab1-msgv2.
condense messtab1-msgv2.
condense messtab1-msgv1.
append messtab1.
endif.
clear:itab2.
endloop.
ENDFORM. " Process_Data
BDC_DYNPRO *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. "BDC_DYNPRO
BDC_FIELD *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> ''. "NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM. "BDC_FIELD
*& Form display_data
text
--> p1 text
<-- p2 text
FORM display_data .
skip 2.
write:/15 text-002.
skip 2.
write:/8 text-003.
SKIP.
write:/12 text-008,
25 P_DOCDAT.
SKIP.
write:/12 text-009,
25 P_POSTDA.
SKIP.
write:/12 text-012,
25 P_DOCTXT.
SKIP.
write:/12 text-004,
25 p_file.
skip 2.
write:/8 text-005,
60 t_lin.
skip.
write:/8 text-006,
60 s_rec.
skip.
write:/8 text-007,
60 u_rec.
skip.
write:/10 'row no',
20 'Information'.
skip.
loop at messtab1.
write:/10 messtab1-msgv1,
20 messtab1-msgv2.
clear:messtab1.
endloop.
ENDFORM. " display_data
*& Form validate_data
text
--> p1 text
<-- p2 text
FORM validate_data .
data: l_tabix1 type sy-tabix.
data: l_tabix2 type sy-tabix.
if not itab[] is initial.
select kostl from CSKS into table it_csks.
if sy-subrc eq 0.
sort it_csks by kostl.
endif.
select kstar from CSKA into table it_cska.
if sy-subrc eq 0.
sort it_cska by kstar.
endif.
loop at itab.
l_tabix1 = sy-tabix.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = itab-scostctr
IMPORTING
OUTPUT = itab-scostctr .
read table it_csks into wa_csks with key kostl = itab-scostctr.
if sy-subrc ne 0.
u_rec = u_rec + 1.
L_TABIX2 = l_tabix1 + 1.
move l_tabix2 to messtab1-msgv1.
move l_tabix1 to messtab1-msgv1.
move itab-rintorder to messtab1-msgv2.
concatenate itab-costele ' | ' itab-scostctr ' | ' itab-rcostctr ' | ' itab-rintorder into messtab1-msgv2.
condense messtab1-msgv2.
condense messtab1-msgv1.
append messtab1.
clear:wa_csks.
CLEAR:L_TABIX2.
continue.
endif.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = itab-rcostctr
IMPORTING
OUTPUT = itab-rcostctr .
read table it_csks into wa_csks with key kostl = itab-rcostctr.
if sy-subrc ne 0.
u_rec = u_rec + 1.
L_TABIX2 = l_tabix1 + 1.
move l_tabix2 to messtab1-msgv1.
move l_tabix1 to messtab1-msgv1.
concatenate itab-costele ' | ' itab-scostctr ' | ' itab-rcostctr ' | ' itab-rintorder into messtab1-msgv2.
condense messtab1-msgv2.
condense messtab1-msgv1.
append messtab1.
clear:wa_csks.
CLEAR:L_TABIX2.
continue.
endif.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = itab-costele
IMPORTING
OUTPUT = itab-costele .
read table it_cska into wa_cska with key kstar = itab-costele.
if sy-subrc ne 0.
u_rec = u_rec + 1.
L_TABIX2 = l_tabix1 + 1.
move l_tabix2 to messtab1-msgv1.
move l_tabix1 to messtab1-msgv1.
concatenate itab-costele ' | ' itab-scostctr ' | ' itab-rcostctr ' | ' itab-rintorder into messtab1-msgv2.
condense messtab1-msgv2.
condense messtab1-msgv1.
append messtab1.
clear:wa_csks.
CLEAR:L_TABIX2.
continue.
endif.
move-corresponding itab to itab2.
MOVE l_tabix1 TO ITAB2-NUM.
append itab2.
clear: itab2.
clear:itab.
endloop.
else.
message 'No records in File' type 'S'.
endif.
ENDFORM. " validate_data
Maybe you are looking for
-
Unable to get IP address DHCP-NAT
I bought this modem few days ago, the new airport extreme with the latest firmware 7.7.3 I think.(upgraded after it does not work). This router only works when I set it up in a bride mode connecting to anther router. It is not able to get an IP or dn
-
Win 8.1 Storage Pool not allowing "add drive" nor allow expand capacity
Have one Storage Space within one Storage Pool (Parity mode) containing 4 identical hard drives. Used for data storage, it appears to be functioning normally and has filled 88% of capacity (ie. 88% x 2/3 of physical capacity (parity mode)) The only o
-
I recently purchased a Surface Pro 3 (i7/256GB) for the main purpose of getting back into drawing. I wanted to run Photoshop CS6 (I'm not buying into Adobe's CC subscription crap) with N-trig's latest 64bit driver that is supposed to add pen pressur
-
I have been asking the question for years and have not got any answers on the Dock. I see people asking the same Question for years . Why can't you have 2-3 Docks. What ever , A small dock or big, you can size it to the size you like or at size with
-
Dial In Access not working using ASA5510
Can somebody help me using a US robotics modem with ASA 5510. I've tried following the instruction in this link http://www.cisco.com/en/US/products/ps6120/products_tech_note09186a00807955c1.shtml but it didn't work out. After applying the string "ATE