Intenal tables
Hi Guys,
I am having two internal tables.I have to mov the data from one Internal table to another internale table.I have to transfer the second internal table data into a file
It_bkpf------all columns.
DATA: BEGIN OF wa_bkpf_temp,
lineno(7) TYPE n,
prog_space TYPE c VALUE ' ',
data_rec(712) TYPE c ,
END OF wa_bkpf_temp.
I wrote the logic like this
LOOP AT il_bkpf_header into wa_bkpf_header_out. "Load data to SAP Server.
got_cha_cnt = got_cha_cnt + 1.
MOVE got_cha_cnt TO wa_bkpf_temp-lineno.
MOVE wa_bkpf_header_out TO wa_bkpf_temp-data_rec.-----Syntax Error
TRANSFER wa_bseg_temp TO wa_acntdoc_header_file.
ENDLOOP.
I wrote the abap Statement like this
MOVE wa_bkpf_header_out TO wa_bkpf_temp-data_rec.
But i am getting syntax error.can anybody tell me how to move the data from BKPF intenal table to wa_bkpf_temp.
Very urgent.
Thanks,
Gopi.
Below is the code for capturing data fromt he table to internal table then to FILE.
just copy the code and try .... and change the table which ever you wasnt and fields also...
REPORT ZREPORT_CAPTURE no standard page heading.
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
DATA: BEGIN OF it_report OCCURS 0,
line(300),
END OF it_report.
*START-OF-SELECTION.
START-OF-SELECTION.
* retrieve data
PERFORM data_retrieval.
*END-OF-SELECTION.
END-OF-SELECTION.
* display date on screen
write: sy-uline(27).
LOOP AT it_ekko INTO wa_ekko.
WRITE:/ sy-vline,
(10)wa_ekko-ebeln, sy-vline,
(10)wa_ekko-ebelp, sy-vline.
ENDLOOP.
write:/ sy-uline(27).
* capture report to internal table, does not work for ALV reports
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = 0
TABLES
listasci = it_report.
* download report to file
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = 'C:tempreport.txt'
filetype = 'ASC'
TABLES
data_tab = it_report.
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
ENDFORM. " DATA_RETRIEVAL
Reward Poitns if it is usefull ...
Girish
Similar Messages
-
Error while transferin intenal table data to application server
*& Report YGL_BALANCES
REPORT YGL_BALANCES.
TABLES:BAPI1028_0,BAPI1028_4,faglflext.
data: f_glacc(10) type c value 'flgl.text' .
DATA: BALANCE LIKE BAPI1028_4-BALANCE,
RETUR LIKE BAPIRETURN,
FISC_YEAR LIKE BAPI1028_4-FISC_YEAR,
FIS_PERIOD LIKE BAPI1028_4-FIS_PERIOD,
DEBITS_PER LIKE BAPI1028_4-DEBITS_PER,
CREDIT_PER LIKE BAPI1028_4-CREDIT_PER,
PER_SALES LIKE BAPI1028_4-PER_SALES.
data:prctr like faglflext-prctr,
racct like faglflext-racct,
rbukrs like faglflext-rbukrs.
types: begin of st_i ,
COMP_CODE LIKE BAPI1028_4-COMP_CODE,
GL_ACCOUNT LIKE BAPI1028_4-GL_ACCOUNT,
FISC_YEAR(4),
FIS_PERIOD(2),
DEBITS_PER(23),
CREDIT_PER(23),
PER_SALES(23),
BALANCE(23),
CURRENCY LIKE BAPI1028_4-CURRENCY,
CURRENCY_ISO(3),
END OF st_i.
DATA: ITAB like BAPI1028_4 OCCURS 10 WITH HEADER LINE.
***********************************************************************jtab like faglflext occurs 0 with header line.
PARAMETERS: COMPCODE LIKE BAPI1028_0-COMP_CODE,
CURRENCY LIKE BAPI1028_5-CURR_TYPE,
YEAR LIKE BAPI1028_4-FISC_YEAR,
ACCOUNT LIKE BAPI1028_0-GL_ACCOUNT.
CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
EXPORTING
COMPANYCODE = COMPCODE
GLACCT = ACCOUNT
FISCALYEAR = YEAR
CURRENCYTYPE = CURRENCY
IMPORTING
BALANCE_CARRIED_FORWARD = BALANCE
RETURN = RETUR
TABLES
ACCOUNT_BALANCES = ITAB.
open dataset f_glacc for output in text mode encoding default.
loop at itab .
transfer itab to f_glacc.
endloop.
close dataset f_glacc.
iam getting error like this
Runtime Errors UC_OBJECTS_NOT_CHARLIKE
Date and Time 01/16/2006 07:09:51
ShrtText
The current statement is defined for character-type data objects only.
What happened?
Error in ABAP application program.
The current ABAP program "YGL_BALANCES" had to be terminated because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
Error analysis
Only character-type data objects are supported at the argument
position "f" for the statement
"TRANSFER f TO ...".
In this case, the operand "f" has the non-character-type "BAPI1028_4". The
current program is flagged as a Unicode program. In the Unicode context,
type X fields are seen as non-character-type, as are structures that
contain non-character-type components.
Trigger Location of Runtime Error
Program YGL_BALANCES
Include YGL_BALANCES
Row 48
Module Name START-OF-SELECTION
Source Code Extract
Line
SourceCde
18
FIS_PERIOD LIKE BAPI1028_4-FIS_PERIOD,
19
DEBITS_PER LIKE BAPI1028_4-DEBITS_PER,
20
CREDIT_PER LIKE BAPI1028_4-CREDIT_PER,
21
PER_SALES LIKE BAPI1028_4-PER_SALES,
22
23
ITAB LIKE BAPI1028_4 OCCURS 10 WITH HEADER LINE.
24
*data : wa like itab.
25
26
PARAMETERS: COMPCODE LIKE BAPI1028_0-COMP_CODE,
27
CURRENCY LIKE BAPI1028_5-CURR_TYPE,
28
YEAR LIKE BAPI1028_4-FISC_YEAR,
29
ACCOUNT LIKE BAPI1028_0-GL_ACCOUNT.
30
31
CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
32
EXPORTING
33
COMPANYCODE = COMPCODE
34
GLACCT = ACCOUNT
35
FISCALYEAR = YEAR
36
CURRENCYTYPE = CURRENCY
37
IMPORTING
38
BALANCE_CARRIED_FORWARD = BALANCE
39
RETURN = RETUR
40
TABLES
41
ACCOUNT_BALANCES = ITAB.
42
43
*OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
44
*TRANSFER `1234567890` TO file.
45
46
open dataset f_glacc for output in text mode encoding default.
47
loop at itab .
>>>>>
transfer itab to f_glacc.
49
endloop.
50
close dataset f_glacc.
51
52
53
54
*CALL FUNCTION 'WS_DOWNLOAD'
55
EXPORTING
56
BIN_FILESIZE = ' '
57
CODEPAGE = ' '
58
FILENAME = 'C:\KLN.TXT'
59
FILETYPE = 'DAT'
60
MODE = ' '
61
WK1_N_FORMAT = ' '
62
WK1_N_SIZE = ' '
63
WK1_T_FORMAT = ' '
64
WK1_T_SIZE = ' '
65
COL_SELECT = ' '
66
COL_SELECTMASK = ' '
67
NO_AUTH_CHECK = ' 'Hi ,
what is that file type .text ...?
there is some problem as i understand from ur code ...
There actually u have to mention application server path
with file name...
go thru this code ..I hope it will be helpful for u
ELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001
PARAMETERS : p_afile LIKE filename-fileintern LOWER CASE.
SELECTION-SCREEN END OF BLOCK a.
OPEN DATASET p_afile FOR OUTPUT IN TEXT MODE.
*Display this message if the file is not opened successfully
IF sy-subrc NE 0.
MESSAGE e006 WITH 'Error in opening Server file'.
ELSE.
LOOP AT it_display.
TRANSFER it_display TO p_afile.
ENDLOOP.
IF sy-subrc EQ 0.
WRITE : /'File posted successfully'.
ENDIF.
*Close dataset
CLOSE DATASET p_afile.
*Display this message if the file is not closed
IF sy-subrc NE 0.
MESSAGE e006 WITH 'Error in closing Server file'.
ENDIF.
ENDIF. -
Intenal table as container variable in the alert category
Hi
Is it possible to create internal table as Container Variable in the alert category. If it is possible how can we pass the data to this internal table in the Run time to the funtion module SALRT_CREATE_API.I have tried this to pass the data to the container parameter
it_container ,but i was unable to achive it .If anyone has come across this please guide me .
Thanks and Regards,
VenkatYou can use the Forms "From Clause Query" as the datasource for the data block. Then you can change the QUERY_DATA_SOURCE_NAME using set_block_property, so you can use any SQL statement you like. Of course you must name/alias the columns in a consistent manner so that the number of database items on the block matches those being queried.
-
Transfer intenal table to file
Hi abaers,
i need to transfer the internal table data to file,,this file to create in application server.
internal table lineitems contains 100 fields...
i tried in the following method: but 100 fields i have to move each and evry field to t_output-data.. so it is becoming complex.
data: begin of t_output occurs 0,
data(800),
end of t_output.
loop at lineitems.
t_output-data(4) = lineitems-COMP_CODE.
t_output-data+4(10) = lineitems-VENDOR.
append t_output.
clear t_output.
endloop.
open dataset filename for output in text mode encoding default.
loop at t_output.
transfer t_output-data to filename.
clear t_outpu-data.
endloop.
close dataset filename.
endif.
is there any other method to do direct transfer from internal table to file..Hi,
I think FM: GET_COMPONENT_LIST would be very useful to u.
i have attached the complete code and it's working absolutely fine with me.
Code **********
types: begin of type_item,
f1(3),
f2(3),
f3(3),
f4(3),
end of type_item.
types: begin of type_data,
data(800),
end of type_data.
data : lineitems type table of type_item with header line,
t_output type table of type_data with header line,
fieldlist type table of RSTRUCINFO with header line.
lineitems-f1 = 'a1'.
lineitems-f2 = 'a2'.
lineitems-f3 = 'a3'.
lineitems-f4 = 'a4'.
append lineitems.
lineitems-f1 = 'b1'.
lineitems-f2 = 'b2'.
lineitems-f3 = 'b3'.
lineitems-f4 = 'b4'.
append lineitems.
lineitems-f1 = 'c1'.
lineitems-f2 = 'c2'.
lineitems-f3 = 'c3'.
lineitems-f4 = 'c4'.
append lineitems.
lineitems-f1 = 'd1'.
lineitems-f2 = 'd2'.
lineitems-f3 = 'd3'.
lineitems-f4 = 'd4'.
append lineitems.
field-symbols : <fs> type any.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
PROGRAM = sy-repid
FIELDNAME = 'lineitems'
TABLES
COMPONENTS = fieldlist.
data : fieldname like fieldlist-compname,data_line type type_data,dref
type ref to data.
format color 3.
loop at lineitems REFERENCE INTO dref. .
loop at fieldlist.
fieldname = fieldlist-compname .
assign dref->(fieldname) to <fs>.
concatenate data_line <fs> into data_line .
endloop.
append data_line to t_output.
clear data_line.
endloop.
loop at t_output.
write:/ t_output.
endloop.
Code *************
If u still have any issues please revert back.
Hope it'll help u.
Regards,
Ankur -
How to dynamic field insert into intenal table?
hi friends
this is my urgent requirements .... how to dynamic field insert into internal table if it possible please tell me
thanks & regards
pauldharmaHi,
Go through this
REPORT yusmm_text1 NO STANDARD PAGE HEADING
LINE-SIZE 199.
T A B L E S
TABLES: MARA,
MAKT,
THEAD.
GLOBAL TYPE-POOLS
TYPE-POOLS : SLIS.
GLOBAL TYPES
TYPES : BEGIN OF TP_FINAL,
MATNR TYPE MARA-MATNR,
BEGRU TYPE MARA-BEGRU,
MTART TYPE MARA-MTART,
MAKTX TYPE MAKT-MAKTX,
SPRAS TYPE MAKT-SPRAS,
LTXT(2000) TYPE C ,
SRNO TYPE N ,
END OF TP_FINAL.
TYPES : BEGIN OF TP_T002,
SPRAS TYPE T002-SPRAS,
LAISO TYPE T002-LAISO,
SRNO TYPE N ,
END OF TP_T002.
TYPES : BEGIN OF TP_MARA_MAKT,
MATNR TYPE MARA-MATNR,
BEGRU TYPE MARA-BEGRU,
MTART TYPE MARA-MTART,
SPRAS TYPE MAKT-SPRAS,
MAKTX TYPE MAKT-MAKTX,
END OF TP_MARA_MAKT.
Types: BEGIN OF tp_matnr,
matnr TYPE mara-matnr,
END OF tp_matnr.
GLOBAL ELEMENTARY VARIABLES
DATA : gv_date TYPE sy-datum.
DATA : gv_repid TYPE sy-repid.
DATA : g_var1(10) TYPE C.
DATA : gv_index TYPE sy-tabix.
DATA: gv_strg TYPE string,
gv_strg1(2000) TYPE C.
DATA : gv_lang TYPE sy-langu.
DATA : g_v(3) TYPE N .
DATA : gv_lines(3) TYPE N .
DATA : gv_var(3) TYPE N .
DATA : gv_var1(3) TYPE N.
DATA: gv_str TYPE STRING.
DATA: gv_str1 TYPE STRING.
DATA : gv_li TYPE I,
gv_lit TYPE I,
gv_lin TYPE I.
DATA: g_var11(3) TYPE N,
gv_li1(3) TYPE N,
g_var2(3) TYPE N.
DATA : gv_i1 TYPE I.
DATA : gv_i TYPE I.
DATA: gl_lenght TYPE I.
GLOBAL STRUCTURES
DATA: T_NEWTABLE TYPE REF TO DATA,
T_NEWLINE TYPE REF TO DATA,
T_FLDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
T_FLDCAT TYPE LVC_T_FCAT,
WA_IT_FLDCAT TYPE LVC_S_FCAT,
WA_IT_FLDCAT1 TYPE SLIS_FIELDCAT_ALV,
WA_COLNO(2) TYPE N,
WA_FLNAME(5) TYPE C,
L_LT TYPE SLIS_LAYOUT_ALV.
GLOBAL INTERNAL TABLES (WITH INCLUDE STRUCTURE)
DATA : IG_MARA_MAKT TYPE STANDARD TABLE OF TP_MARA_MAKT,
WG_MARA_MAKT TYPE TP_MARA_MAKT.
DATA : IG_T002 TYPE STANDARD TABLE OF TP_T002,
WG_T002 TYPE TP_T002.
DATA : IG_FINAL TYPE STANDARD TABLE OF TP_FINAL,
WG_FINAL TYPE TP_FINAL.
data : IG_MATNR TYPE STANDARD TABLE OF TP_MATNR WITH HEADER LINE,
WG_MATNR TYPE TP_MATNR.
DATA:BEGIN OF IG_THEAD OCCURS 0.
INCLUDE STRUCTURE THEAD .
DATA: END OF IG_THEAD.
DATA:BEGIN OF IG_TLINE OCCURS 0.
INCLUDE STRUCTURE TLINE .
DATA:END OF IG_TLINE.
FIELD-SYMBOLS
FIELD-SYMBOLS: <T_DYNTABLE> TYPE STANDARD TABLE,"Dynamic internal
"tablename
<FS_DYNTABLE>, "Field symbol to create work area
<FS_FLDVAL> TYPE ANY. " Field symbol to assign values
COMPULSORY
FIELD-SYMBOLS: <FS_DATA> TYPE REF TO DATA,
<FS_DATA1> TYPE REF TO DATA,
<FS_2> TYPE STANDARD TABLE,
<FS_22> TYPE STANDARD TABLE,
<FS_1>,
<FS_11>,
<F>,
<FA>,
<LWA_LINE_WA>,
<LWA_LINE_WA1>.
------- Create Dyn Table From FC
DATA: LT_DATA TYPE REF TO DATA,
LT_DATA1 TYPE REF TO DATA,
LWA_LINE TYPE REF TO DATA,
LWA_LINE1 TYPE REF TO DATA,
LI_FIELD_CAT TYPE LVC_T_FCAT,
LWA_FIELD_CAT TYPE LVC_S_FCAT.
PARAMETERS & SELECT-OPTIONS
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_SPRAS FOR MAKT-SPRAS NO INTERVALS DEFAULT 'EN'
OBLIGATORY ,
S_MATNR FOR MARA-MATNR,
S_MTART FOR MARA-MTART.
PARAMETERS: GP_SIZE TYPE I DEFAULT '200'.
SELECTION-SCREEN : END OF BLOCK B1.
INITIALIZATION
INITIALIZATION.
gv_repid = sy-repid.
gv_date = sy-datum.
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
IF GP_SIZE < 0.
MESSAGE E002(00).
ENDIF.
IF GP_SIZE > 50000.
MESSAGE W130(26) WITH TEXT-004.
SET CURSOR FIELD 'gp_size'.
ENDIF.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM FIELDCAT.
PERFORM LAYOUT.
PERFORM DATA_FETCH.
PERFORM READ_DATA_TO_FINAL.
SORT ig_final BY matnr spras.
gv_lin = gv_li.
gv_li = gv_li - 2.
LOOP AT ig_final INTO wg_final.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'Material Number'.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'Authorization Group'.
g_VAR11 = wg_final-srno + 2.
gv_li1 = gv_li1 + 2.
MOVE : g_var11 TO gv_i1.
ASSIGN COMPONENT g_var11 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'MatDesc'.
g_var2 = g_var11 + gv_lines.
ASSIGN COMPONENT g_var2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'BasicData'.
APPEND <LWA_LINE_WA1> TO <FS_22>.
EXIT.
ENDLOOP.
LOOP AT ig_final INTO wg_final.
AT NEW matnr.
gv_index = sy-tabix.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-matnr.
ENDAT.
AT NEW MATNR.
GV_INDEX = SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-matnr.
ENDAT.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-begru.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-begru.
gv_var = wg_final-srno + 2.
gv_li = gv_li + 2.
MOVE : gv_var TO gv_i.
ASSIGN COMPONENT gv_var OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-maktx.
ASSIGN COMPONENT gv_var OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-maktx.
gv_var1 = gv_var + gv_lines .
ASSIGN COMPONENT gv_var1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-ltxt.
ASSIGN COMPONENT gv_var1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-ltxt.
AT END OF matnr.
APPEND <LWA_LINE_WA> TO <FS_2>.
CLEAR <LWA_LINE_WA>.
ENDAT.
AT END OF matnr.
APPEND <LWA_LINE_WA1> TO <FS_22>.
CLEAR <LWA_LINE_WA1>.
ENDAT.
ENDLOOP.
PERFORM display..
*& Form data_fetch
text
--> p1 text
<-- p2 text
FORM DATA_FETCH .
SELECT matnr
from mara up to gp_size rows
appending corresponding fields of table ig_matnr
where matnr in s_matnr
and mtart in s_mtart.
loop at ig_matnr.
SELECT MARA~MATNR
MARA~BEGRU
MARA~MTART
MAKT~SPRAS
MAKT~MAKTX FROM MARA INNER JOIN MAKT
ON MARAMATNR = MAKTMATNR
appending corresponding fields of TABLE ig_mara_makt UP TO GP_SIZE
ROWS
WHERE makt~spras IN s_spras
AND mara~matnr IN s_matnr
AND mara~mtart IN s_mtart
AND mara~matnr EQ ig_matnr-matnr.
endloop.
IF sy-subrc = 0.
SORT ig_mara_makt.
ENDIF.
ENDFORM. " data_fetch
*& Form read_data_to_final
text
--> p1 text
<-- p2 text
FORM READ_DATA_TO_FINAL .
LOOP AT ig_mara_makt INTO wg_mara_makt .
wg_final-MATNR = wg_mara_makt-MATNR.
wg_final-BEGRU = wg_mara_makt-BEGRU.
wg_final-MTART = wg_mara_makt-MTART.
wg_final-SPRAS = wg_mara_makt-SPRAS.
wg_final-MAKTX = wg_mara_makt-MAKTX.
READ TABLE ig_t002 INTO wg_t002 WITH KEY spras = wg_final-spras.
IF sy-subrc = 0.
wg_final-srno = wg_t002-srno.
ENDIF.
CLEAR ig_thead[].
ig_thead-TDOBJECT = 'MATERIAL'.
ig_thead-TDNAME = wg_final-matnr.
ig_thead-TDID = 'GRUN'.
ig_thead-TDSPRAS = wg_final-spras.
CALL FUNCTION 'TEXT_READ'
EXPORTING
I_HEADER = IG_THEAD
I_READONLY = 'X'
IMPORTING
E_HEADER = IG_THEAD
TABLES
T_LINES = IG_TLINE[]
EXCEPTIONS
NOTFOUND = 1.
IF sy-subrc EQ 0.
LOOP AT ig_tline.
gv_strg = ig_tline-tdline.
IF gv_strg1 <> ' '.
CONCATENATE gv_strg1 ';' gv_strg INTO gv_strg1.
ELSE.
gv_strg1 = gv_strg.
ENDIF.
ENDLOOP.
wg_final-ltxt = gv_strg1.
APPEND wg_final TO ig_final.
CLEAR wg_final.
gv_strg1 = ' '.
ELSE.
APPEND wg_final TO ig_final.
ENDIF.
ENDLOOP.
ENDFORM. " read_data_to_final
" read_data_to_final
*& Form layout
text
--> p1 text
<-- p2 text
FORM LAYOUT .
CLEAR L_LT.
L_LT-ZEBRA = 'X'.
L_LT-COLWIDTH_OPTIMIZE = 'X'.
L_LT-WINDOW_TITLEBAR = 'MATERIAL DETAILS'.
ENDFORM. " layout
*& Form fieldcat
text
--> p1 text
<-- p2 text
FORM FIELDCAT .
SELECT SPRAS
LAISO FROM t002 INTO CORRESPONDING FIELDS OF TABLE ig_t002
WHERE spras IN s_spras.
DESCRIBE TABLE ig_t002 LINES gv_lines.
LOOP AT ig_t002 INTO wg_t002.
g_v = g_v + 1.
Wg_t002-srno = g_v.
MODIFY ig_t002 FROM wg_t002 TRANSPORTING SRNO.
ENDLOOP.
LOOP AT ig_t002 INTO wg_t002.
CLEAR WA_IT_FLDCAT.
MOVE SY-INDEX TO WA_COLNO.
CONCATENATE 'MD-' wg_t002-LAISO
WA_COLNO
INTO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = WA_FLNAME.
WA_IT_FLDCAT-INTLEN = 250.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO T_FLDCAT.
CLEAR wg_t002.
ENDLOOP.
LOOP AT ig_t002 INTO wg_t002.
CLEAR WA_IT_FLDCAT.
MOVE SY-INDEX TO WA_COLNO.
CONCATENATE 'BD-' wg_t002-LAISO
WA_COLNO
INTO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = WA_FLNAME.
WA_IT_FLDCAT-INTLEN = 250.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO T_FLDCAT.
CLEAR wg_t002.
ENDLOOP.
MOVE 'MATNR' TO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Material No'.
WA_IT_FLDCAT-INTLEN = 18.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO T_FLDCAT INDEX 1.
MOVE 'BEGRU' TO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Authorization Group'.
WA_IT_FLDCAT-INTLEN = 4.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO T_FLDCAT INDEX 2.
DESCRIBE TABLE T_FLDCAT LINES gv_li.
ASSIGN LT_DATA TO <FS_DATA>.
Creating the Dynamic Internal Table
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA> " Dynamic Internal Table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA>->* TO <FS_1>.
Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_1> TO <FS_2>.
Creating a Workarea
CREATE DATA LWA_LINE LIKE LINE OF <FS_2> .
Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE->* TO <LWA_LINE_WA>.
LOOP AT T_FLDCAT INTO WA_IT_FLDCAT.
WA_IT_FLDCAT1-FIELDNAME = WA_IT_FLDCAT-FIELDNAME.
WA_IT_FLDCAT1-TABNAME = WA_IT_FLDCAT-TABNAME.
WA_IT_FLDCAT1-SELTEXT_L = WA_IT_FLDCAT-SELTEXT.
WA_IT_FLDCAT1-REF_TABNAME = 'MARC'.
APPEND WA_IT_FLDCAT1 TO T_FLDCAT1.
CLEAR : WA_IT_FLDCAT,WA_IT_FLDCAT1.
ENDLOOP.
ASSIGN LT_DATA1 TO <FS_DATA1>.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA1> " Dynamic Internal table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA1>->* TO <FS_11>.
Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_11> TO <FS_22>.
Creating a Workarea
CREATE DATA LWA_LINE1 LIKE LINE OF <FS_22> .
Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE1->* TO <LWA_LINE_WA1>.
ENDFORM. " fieldcat
*& Form show
text
--> p1 text
<-- p2 text
FORM Display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GV_REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
I_CALLBACK_USER_COMMAND = '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 = L_LT
IT_FIELDCAT = T_FLDCAT1[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = <FS_2>
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.
ENDFORM. " display
FORM PF_STATUS_SET USING RS_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'DISPLAY' .
ENDFORM. "PF_STATUS_SET
*& Form Name: user_command *
*& Form Desc: For Handling USER_COMMAND *
FORM USER_COMMAND USING IF_UCOMM TYPE SY-UCOMM
IS_SELFIELD TYPE SLIS_SELFIELD.
CASE IF_UCOMM.
WHEN 'DOWNLOAD'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = ' '
DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = 'Data download to excel'
TEXT_BUTTON_1 = 'Ja'(001)
ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'Nein'(002)
ICON_BUTTON_2 = ' '
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
USERDEFINED_F1_HELP = ' '
START_COLUMN = 25
START_ROW = 6
POPUP_TYPE =
IMPORTING
ANSWER =
TABLES
PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 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.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\Material-Text.xls'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = 'X'
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = 'X'
IMPORTING
FILELENGTH = GL_LENGHT
TABLES
DATA_TAB = <FS_22>
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
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF GL_LENGHT NE 0.
MESSAGE S398(00) WITH 'DATA downloaded to EXCEL'.
ENDIF.
Thanks
ENDCASE.
ENDFORM. "user_command -
I want to make entry in table from intenal table
hi
i have a data in a internal table i want to enter in a database table
which is having theree keys
customer number
date
status
not the scenerio is like that
there may or may not be record existing in the table
corresponding to the internal table record
so what statment i should use modify or update or insert?
please give me the code to enter in table from the internal table i had considering the fact that there might be already that record in that database table or also there may not be?
regards
aroraHi,
Loop at itab.
modify ztable from itab.
endloop.
modify statement will insert line into dbtable or changes if a record with same key already exists.
Regards,
Lakshmi. -
Intenal table with out headerline
hi,
i have a doubt,please clarify.
data:itab like <databse table> occurs 0 with header line.
or
data:itab like <databse table>occurs 0,
wa like line type of itab.
in above two cases , in my view no difference.
in first case there will be one workarea will be created with same name itab,
in second case we are explicitly creating work area.
ok.
here my doubt is in what cases it is madatory to create internal table with explicitly work area?
thanks in advance.
venuhi,
abap object oriented programming in higher versions doesn't allow internal table with header line, so we can create internal table with out header line.
for that one we follow two approches...
1)
TYPES: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA : ITAB TYPE STANDARD TABLE OF LINE,
WA TYPE LINE.
2) In second case create line type(structure) and row type by using SE11.
SE11->select DATA ELEMENT object> here select STRUCTURE object and provide required fields>now select ROW TYPE object here provide LINE TYPE( STRCTURE which is created in previous)-> SAVE and activate.
IN the above case STRCTURE acts as WORK-AREA AND ROW TYPE acts as body.
object oriented programming doesn't support to using LIKE key word.
regards,
Ashok -
Hi Friends,
I need a logic for the below mentioned thing,
for all entries in i_tab i need to check makt table with makt-matnr = i_tab-matnr.
if subrc = 0.
need to determine eknam
Join tables marc and t024 . fill the i_tab-eknam field with the value T024-eknam where MARC-MATNR = I_TAB-MATNR and MARC-WERKS = '0001' and MARC-EKGRP = TO24-EKGRP
endif.
Thanks in advancedata: records type i.
records = lines( i_tab ).
Check records GT 0.
Select matnr from makt into i_makt for all entries in i_tab where matnr = i_tab-matnr.
Check sy-subrc EQ 0.
Select amatnr beknam into i_t024
from marc as A inner join t024 as B ON aekgrp = bekgrp
for all entries in i_makt
where a~matnr = i_makt-matnr
and a~werks = 0001.
Check sy-subrc EQ 0.
field-symbols: <fs_tab> type any.
Loop at i_tab assigninig <fs_tab>.
Read table i_t024 with key matnr = <fs_tab>-matnr binary search.
if sy-subrc eq 0.
<fs-tab>-eknam = i_t024-eknam.
endif.
Endloop. -
To modify a field in a database table based record identification by primar
hi
i want to to modify a field in a database table based record identification by primary key filed and two more fields
ie customer (primary key
i want to modify record from intenal table the record existing with primary key field customer
the status field needs to be mofied as " value rolled"
the below code is happening
loop at it_record into wa_Record
wa_inv-customer (primary key) = wa_Record=custome
wa_inv-date = wa_Record-date
...so one
append wa_inv to it_invest
clear wa_inv
endloop.
if not it_invest is initial
modify TABle1 ( this table is data base table which needs to be mofified) based on the primary key field
and also date field and status field which is not primary key.
regards
aroraHi there.
Your requirement is to update a Z Database table from your internal table, right? You have several options:
LOOP AT it_invest INTO wa_inv.
UPDATE dbtable
SET date = wa_inv-date
WHERE prim_key = wa_inv-prim_key
AND any_field = wa_inv-any_field.
ENDLOOP.
or
LOOP AT it_invest INTO wa_inv.
UPDATE dbtable FROM wa_inv. "if wa_inv of same type of dbtable
ENDLOOP.
In the first example, I wrote any field because you can update dbase table, filtering for fields that don't belong to the primary key. However, remember that you will change all records that respect the key you used (so, in your case, use the primary key).
Regards.
Valter Oliveira. -
How to pass internal table data from model to BSP page.
Hi Experts,
I have requirement where I have got data from deep structure in Model.
The structure has two fields > 1. normal data tyoe + the other one is of table type.
Thanks and Regards,if you have defined the attribute then you can ABAP coding to use it in BSP.
for eg, here i am looping the intenal table and passing the data to list item box.
<%
LOOP AT lt_dyn_uom INTO wa_dyn_uom.
%>
<htmlb:listBoxItem key = "<%= wa_dyn_uom-name %>"
value = "<%= wa_dyn_uom-value %>" />
<%
ENDLOOP.
%>
Thanks,
Chandra -
How to get the field name of an internal table during runtime?
How to get the field name of an internal table during runtime?
Hi Sudhir,
Declare and Use Get Cursor Field in Your Prm to get the field Name of the Intenal Table
Example Code:
<b> DATA: v_field(60). " Insert this code.
GET CURSOR FIELD v_field. " Insert this code.</b>
<b>CHECK v_field = 'ITAB-KUNNR'. " Insert this code. (or)
Write: v_field.</b>
Regards,
Ramganesan K. -
How can we improve the performance while fetching data from RESB table.
Hi All,
Can any bosy suggest me the right way to improve the performance while fetching data from RESB table. Below is the select statement.
SELECT aufnr posnr roms1 roanz
INTO (itab-aufnr, itab-pposnr, itab-roms1, itab-roanz)
FROM resb
WHERE kdauf = p_vbeln
AND ablad = itab-sposnr+2.
Here I am using 'KDAUF' & 'ABLAD' in condition. Can we use secondary index for improving the performance in this case.
Regards,
HimanshuHi ,
Declare intenal table with only those four fields.
and try the beloe code....
SELECT aufnr posnr roms1 roanz
INTO table itab
FROM resb
WHERE kdauf = p_vbeln
AND ablad = itab-sposnr+2.
yes, you can also use secondary index for improving the performance in this case.
Regards,
Anand .
Reward if it is useful.... -
Delete records from internal table
hi all,
i want to delete records from intenal table which are starting with a particular starting number .
eg internal table
10000
20000
90000
91000
92000
88880
i want delete the records starting with 9 i.e. 90000 91000 92000.
Thanks in Adv
RAJYou can test this piece of code.
DATA:
i_tab TYPE STANDARD TABLE OF mara,
wa_tab TYPE mara.
wa_tab-matnr = '1000'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '1001'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '1002'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '1003'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '2001'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '3001'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '4010'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Aug 8, 2008 4:49 PM -
Memory full for Internal table
Hi all,
I have an intenal table where I need to pass millions of records. I am getting short dump due to the memory full. The message is 'the maximum no of bytes passed is exceeded'.
To avoid this, I have used the Hash table, but still got the same error. If I execute the same program with less period, the program is getting exected, because the no.of records which we are passing is less. the problem comes during selecting many millions of records from the database table to internal table.
Please advice ASAP.
Thanks,
VenuHi Venu,
In this case you could use the PACKAGE SIZE addition in the SELECT query to process in limited amount of data, thus avoiding the memory overloads.
Eg:
SELECT *
FROM &table&;
INTO TABLE itab
PACKAGE SIZE <n>.
IF sy-subrc EQ 0.
*" Process the n records
ENDIF.
ENDSELECT.
regards,
Prabhu
Reward if helpful -
Field-symbols and internal table
Hello,
How do I declare a field-symbol as an intenal table?
I have a internal table declared, but i need to declare a field symbols as my internal table´s type. How do I do it?
What I wrote was this:
DATA: BEGIN OF IT_INTE OCCURS 0,
FIELD(3) TYPE C,
END OF IT_INTE.
FIELD-SYMBOLS: isn´t defined as an internal table, how do I fix it.
Thanks!!!
Gabriel.It is very much possible to have a field symbol point to a internal table. Here is some sample code.
report zrich_0001.
data: begin of itab1 occurs 0,
fld1(10) type c,
fld3(10) type c,
fld5(10) type c,
end of itab1.
data: wa1 like line of itab1.
field-symbols: <fs_table> type table.
field-symbols: <fs_wa>.
field-SYMBOLS: <fs_field>.
* Setup the data
itab1-fld1 = '0000000001'.
itab1-fld3 = '0000000002'.
itab1-fld5 = '0000000003'.
append itab1.
itab1-fld1 = '0000000004'.
itab1-fld3 = '0000000005'.
itab1-fld5 = '0000000006'.
append itab1.
assign itab1[] to <fs_table>.
assign wa1 to <fs_wa>.
loop at <fs_table> into <fs_wa>.
* Write out each field of the line
do.
assign COMPONENT sy-index of structure <fs_wa> to <fs_field>.
if sy-subrc <> 0.
exit.
endif.
write:/ <fs_field>.
enddo.
skip 2.
endloop.
Regards,
Rich Heilman
Maybe you are looking for
-
Conditional Breaks on subnodes/item level
Hello experts, We have a requirement for a new Adobe Form, which has a header table and an item table. We have to print multiple documents in 1 printout. Our Adobe Form context layout is as follows: - Context node for the Header (1 record for each do
-
How to change the name of a clone?
I cloned in order to upgrade to Tiger. How do I change the name of the clone? I was told this: change the computer's name from the Sharing pane of System Preferences. I went into the hard drive with the clone, opened system folder>library>preferencep
-
CUCM 10 publisher & subscriber.
Dears, I have a publisher and subscriber CUCM 10.5 with 2 voice gateway within a single site, instead of subscriber sleeping always i want to make it work also, so i have thought that i will split the 1000 phones on pub and sub with 2 no's cucm grou
-
JVM 1.5.0_11 and libumem -- need stack trace help for memory leak
I'm trying to track down the cause of some memory growth in a java application. In my tests, the java heap appears to remain stable, but the overall memory footprint of the jvm process continues to grow (observed with pmap). I've run my application w
-
Hi all , Today we observed that all the queries are not displaying except 5-6 queries in SQ01 List.. what may the be problem.