Read Data Base Table
Hi xMII gurus,
I would like to use the SAP Database Table not BAPI.. Can we use it?. If yeas please give me the procedure.
Thanks
Raghav
Raghav,
you can read the tables with the BAPI RFC_READ_TABLE. I don't know if is allowed to
connect to the Database directly. Why you will not use the BAPIs?
Regards
Pedro
Similar Messages
-
How to Read data base table at runtime
Hi,
i have an internal table with two fields they are
tablename and field name.
itab has some entries.
like :
itab-table name itab-fieldname
kna1 kunnr
mara matnr
vbuk vbeln
tvak auart
i want to read these tables with field names.
like :
loop at itab
select singe * from <itab-tablename> into <jtab>
where <itab-fieldname > = <dyanmic value from prog>.
endloop.
Is it possible to read the db table in the above scenario.
Please try to give me the solution.
Thanks,
srikHi, try this example program.
report zrich_0002 .
data: begin of itab occurs 0,
tabname(20) type c,
fldname(20) type c,
end of itab.
data: ref_descr type ref to cl_abap_structdescr.
data: where_clause(100) type c occurs 0 with header line.
data: it_details type abap_compdescr_tab,
wa_details type abap_compdescr.
data: new_table type ref to data,
new_line type ref to data,
it_fldcat type lvc_t_fcat,
wa_it_fldcat type lvc_s_fcat.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
start-of-selection.
itab-tabname = 'T000'.
itab-fldname = 'MANDT'.
append itab.
itab-tabname = 'T001'.
itab-fldname = 'BUKRS'.
append itab.
loop at itab.
* Get the structure of the table.
refresh it_fldcat.
refresh where_clause.
ref_descr ?= cl_abap_typedescr=>describe_by_name( itab-tabname ).
it_details[] = ref_descr->components[].
loop at it_details into wa_details.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = wa_details-name .
wa_it_fldcat-datatype = wa_details-type_kind.
wa_it_fldcat-inttype = wa_details-type_kind.
wa_it_fldcat-intlen = wa_details-length.
wa_it_fldcat-decimals = wa_details-decimals.
append wa_it_fldcat to it_fldcat .
endloop.
if <dyn_table> is assigned.
refresh <dyn_table>.
unassign <dyn_table>.
endif.
* Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
concatenate itab-fldname '<> ''' '''' into where_clause
separated by space.
append where_clause.
select * from (itab-tabname) into table <dyn_table>
where (where_clause).
endloop.
Regards,
Rich Heilman -
How to stored data after clicking checkbox in data base table
REPORT ZT .
TYPE-pools: slis.
tables:mkpf,mseg,mard,COWB_COMP,ZTABLE.
Types:BEGIN OF tp_data,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
lgpbe LIKE mard-lgpbe,
charg LIKE mseg-charg,
bwart LIKE mseg-bwart,
budat LIKE mkpf-budat,
menge LIKE mseg-menge,
meins LIKE mseg-meins,
kostl LIKE mseg-kostl,
aufnr LIKE mseg-aufnr,
rsnum LIKE mseg-rsnum,
endkz like COWB_COMP-endkz,
END OF tp_data,
tp_tbl_data TYPE STANDARD TABLE OF tp_data.
MODIFIED*******************
DATA: WA TYPE TP_DATA.
MODIFIED*******************
*data: t_data like Y00_MM_ISSUE_DAT occurs 0 with header line.
Constants
Data objects (variable declarations and definitions)
Report data to be shown.
DATA: it_data TYPE STANDARD TABLE OF tp_data.
MODIFIED*******************
DATA : V_REPID LIKE SY-REPID.
MODIFIED*******************
Heading of the report.
DATA: t_heading TYPE slis_t_listheader.
*========================== Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:smblnr FOR mseg-mblnr MODIF ID m1,
smatnr FOR mseg-matnr MODIF ID m2,
swerks FOR mard-werks MODIF ID m3,
slgort FOR mard-lgort MODIF ID m4,
slgpbe FOR mard-lgpbe MODIF ID m5,
scharg FOR mseg-charg MODIF ID m6,
sbwart FOR mseg-bwart MODIF ID m7,
skostl FOR mseg-kostl MODIF ID m8,
saufnr FOR mseg-aufnr MODIF ID m9,
srsnum FOR mseg-rsnum MODIF ID m10.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS:pre RADIOBUTTON GROUP radi USER-COMMAND ucomm DEFAULT 'X',
pse RADIOBUTTON GROUP radi,
bps RADIOBUTTON GROUP radi.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETER:layout TYPE i.
SELECTION-SCREEN END OF BLOCK b3.
MODIFIED*******************
INITIALIZATION.
V_REPID = sy-repid.
MODIFIED*******************
*=========================== Event Blocks
AT selection-SCREEN.
start-OF-selection.
PERFORM get_data USING it_data.
END-OF-selection.
PERFORM build_alv USING it_data t_heading.
*=========================== Subroutines
*& Form get_data
Gets the information to be shown in the report.
FORM get_data USING t_data TYPE tp_tbl_data.
SELECT msegmblnr msegmatnr mardwerks mardlgort mard~lgpbe
msegcharg msegbwart mkpf~budat
msegmenge msegmeins msegkostl msegaufnr mseg~rsnum
INTO CORRESPONDING FIELDS OF TABLE t_data
FROM mseg
JOIN mard ON mardmatnr EQ msegmatnr
JOIN mkpf ON msegmblnr EQ mkpfmblnr
WHERE mseg~matnr IN smatnr.
ENDFORM. " get_data
*& Form build_alv
Builds and display the ALV Grid.
FORM build_alv USING t_data TYPE tp_tbl_data
t_heading TYPE slis_t_listheader.
ALV required data objects.
DATA: w_title TYPE lvc_title,
w_comm TYPE slis_formname,
w_status TYPE slis_formname,
x_layout TYPE slis_layout_alv,
t_event TYPE slis_t_event,
t_fieldcat TYPE slis_t_fieldcat_alv,
t_sort TYPE slis_t_sortinfo_alv.
REFRESH t_fieldcat.
REFRESH t_event.
REFRESH t_sort.
CLEAR x_layout.
CLEAR w_title.
Field Catalog
PERFORM set_fieldcat2 USING:
1 'MBLNR' 'MBLNR' 'MSEG' space space space space space space
space space space space space space t_fieldcat ,
2 'MATNR' 'MATNR' 'MSEG' space space space space space space
space space space space space space t_fieldcat ,
3 'WERKS' 'WERKS' 'MARD' space space space space space space
space space space space space space t_fieldcat,
4 'LGORT' 'LGORT' 'MARD' space space space space space space
space space space space space space t_fieldcat ,
5 'LGPBE' 'LGPBE' 'MARD' space space space space space space
space space space space space space t_fieldcat ,
6 'CHARG' 'CHARG' 'MSEG' space space space space space space
space space space space space space t_fieldcat ,
7 'BWART' 'BWART' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
8 'BUDAT' 'BUDAT' 'MKPF' space space space space space space
space space space space space space t_fieldcat,
9 'MENGE' 'MENGE' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
10 'MEINS' 'MEINS' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
11 'KOSTL' 'KOSTL' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
12 'AUFNR' 'AUFNR' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
13 'RSNUM' 'RSNUM' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
14 'ENDKZ' 'ENDKZ' 'COWB_COMP' space space 'select' 'Select this row' 'Sel' 'Select this row' space space space 'X' 'X' space t_fieldcat.
Layout
x_layout-zebra = 'X'.
Top of page heading
PERFORM set_top_page_heading USING t_heading t_event.
Events
PERFORM set_events USING t_event.
GUI Status
w_status = ''.
User commands
w_comm = 'USER_COMMAND'.
Order
Example
PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
PERFORM set_order USING 'MBLNR' 'IT_DATA' 'X' space 'X' t_sort.
PERFORM set_order USING 'EBELN' 'IT_DATA' 'X' space 'X' t_sort.
PERFORM set_order USING 'EBELP' 'IT_DATA' 'X' space space t_sort.
Displays the ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = V_REPID
it_fieldcat = t_fieldcat
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
TABLES
t_outtab = t_data
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. " build_alv.
*& Form set_top_page_heading
Creates the report headings.
FORM set_top_page_heading USING t_heading TYPE slis_t_listheader
t_events TYPE slis_t_event.
DATA: x_heading TYPE slis_listheader,
x_event TYPE LINE OF slis_t_event.
Report title
CLEAR t_heading[].
CLEAR x_heading.
x_heading-typ = 'H'.
x_heading-info = 'Reporte Prueba'(001).
APPEND x_heading TO t_heading.
Program name
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Program: '.
x_heading-info = sy-repid.
APPEND x_heading TO t_heading.
User who is running the report
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'User: '.
x_heading-info = sy-uname.
APPEND x_heading TO t_heading.
Date of execution
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Date: '.
WRITE sy-datum TO x_heading-info.
APPEND x_heading TO t_heading.
Time of execution
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Time: '.
WRITE sy-uzeit TO x_heading-info.
APPEND x_heading TO t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-FORM = 'TOP_OF_PAGE'.
APPEND x_event TO t_events.
ENDFORM.
*& Form set_events
Sets the events for ALV.
The TOP_OF_PAGE event is alredy being registered in
the set_top_page_heading subroutine.
FORM set_events USING t_events TYPE slis_t_event.
DATA: x_event TYPE LINE OF slis_t_event.
Example
clear x_event.
x_event-name = .
x_event-form = .
append x_event to t_event.
ENDFORM.
*& Form set_order
Adds an entry to the order table.
FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
t_sort TYPE slis_t_sortinfo_alv.
DATA: x_sort TYPE slis_sortinfo_alv.
CLEAR x_sort.
x_sort-fieldname = p_fieldname.
x_sort-tabname = p_tabname.
x_sort-UP = p_up.
x_sort-down = p_down.
x_sort-subtot = p_subtot.
APPEND x_sort TO t_sort.
ENDFORM. "set_order
*& Form set_fieldcat2
Adds an entry to the field catalog.
FORM set_fieldcat2 USING p_colpos p_fieldname p_ref_fieldname
p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-HOTSPOT = p_hotspot.
wa_fieldcat-CHECKBOX = p_checkbox.
wa_fieldcat-ICON = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set reference fieldname, tablenam and rollname.
If p_ref_tabname is not given, the ref_fieldname given is a data
*element.
If p_ref_tabname is given, the ref_fieldname given is a field of a
*table. In case ref_fieldname is not given, it is copied from the
*fieldname.
IF p_ref_tabname IS INITIAL.
wa_fieldcat-rollname = p_ref_fieldname.
ELSE.
wa_fieldcat-ref_tabname = p_ref_tabname.
IF p_ref_fieldname EQ space.
wa_fieldcat-ref_fieldname = wa_fieldcat-fieldname.
ELSE.
wa_fieldcat-ref_fieldname = p_ref_fieldname.
ENDIF.
ENDIF.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
Set as editable or not.
IF NOT p_edit IS INITIAL.
wa_fieldcat-INPUT = 'X'.
wa_fieldcat-EDIT = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'TRVPICTURE04'
it_list_commentary = t_heading.
ENDFORM. " alv_top_of_page
*& Form user_command
Called on user_command ALV event.
Executes custom commands.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
case sy-ucomm.
WHEN '&DATA_SAVE'.
LOOP AT IT_DATA INTO WA WHERE ENDKZ = 'X'.
IF WA-ENDKZ = 'X'.
*******MODIFIED*********************************
U DELETE THIS CODE N USER UR INSERT CODE TO CHECK
SY-MSGV1 = WA-MBLNR. " U CAN DELETE
SY-MSGV2 = WA-MATNR. " U CAN DELETE
MESSAGE ID 'BC_BOR' TYPE 'I' NUMBER '888' " U CAN DELETE
WITH SY-MSGV1 SY-MSGV2. " U CAN DELETE
*******MODIFIED*********************************
INSERT ZTABLE.
ENDIF.
endloop.
ENDCASE.
ENDFORM. "user_command
this is my code, database will stored in fields only.data is empty,
how to slove that one,send any sugestion.Hi Lakshmi,
Can u explain briefly what is ur requirement. U mean to say that after clicking the checkbox in data base table or Screen?
Regards,
Jayaram... -
How to stored data after clicking check box save in data base table
TABLES:mseg,mard,mkpf.
TYPE-POOLS:slis.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:smblnr FOR mseg-mblnr MODIF ID m1,
smatnr FOR mseg-matnr MODIF ID m2,
swerks FOR mard-werks MODIF ID m3,
slgort FOR mard-lgort MODIF ID m4,
slgpbe FOR mard-lgpbe MODIF ID m5,
scharg FOR mseg-charg MODIF ID m6,
sbwart FOR mseg-bwart MODIF ID m7,
skostl FOR mseg-kostl MODIF ID m8,
saufnr FOR mseg-aufnr MODIF ID m9,
srsnum FOR mseg-rsnum MODIF ID m10.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS:pre RADIOBUTTON GROUP radi USER-COMMAND ucomm DEFAULT 'X',
pse RADIOBUTTON GROUP radi,
bps RADIOBUTTON GROUP radi.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETER:layout TYPE i.
SELECTION-SCREEN END OF BLOCK b3.
DATA:BEGIN OF itab OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
lgpbe LIKE mard-lgpbe,
charg LIKE mseg-charg,
bwart LIKE mseg-bwart,
budat LIKE mkpf-budat,
menge LIKE mseg-menge,
meins LIKE mseg-meins,
kostl LIKE mseg-kostl,
aufnr LIKE mseg-aufnr,
rsnum LIKE mseg-rsnum,
checkbox TYPE c,
END OF itab.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
gw_fieldcat TYPE slis_fieldcat_alv,
gt_layout TYPE slis_layout_alv.
START-OF-SELECTION.
SELECT msegmblnr msegmatnr mardwerks mardlgort mardlgpbe msegcharg msegbwart mkpfbudat
msegmenge msegmeins msegkostl msegaufnr mseg~rsnum
INTO TABLE itab FROM
mseg JOIN mard ON mardmatnr EQ msegmatnr
JOIN mkpf ON msegmblnr EQ mkpfmblnr
WHERE mseg~matnr IN smatnr.
IF sy-subrc EQ 0.
SORT itab BY matnr.
PERFORM display_alv_output.
ENDIF.
*& Form display_alv_output
text
--> p1 text
<-- p2 text
FORM display_alv_output.
REFRESH gt_fieldcat.
gw_fieldcat-fieldname = 'MBLNR'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 1.
gw_fieldcat-seltext_m = 'material document'.
gw_fieldcat-key = 'x'.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'MATNR'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 2.
gw_fieldcat-seltext_m = 'material'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'WERKS'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 3.
gw_fieldcat-seltext_m = 'plant'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'LGORT'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 4.
gw_fieldcat-seltext_m = 'storage location'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'LGPBE'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 5.
gw_fieldcat-seltext_m = 'storage bin'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'CHARG'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 6.
gw_fieldcat-seltext_m = 'Batch number'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'BWART'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 7.
gw_fieldcat-seltext_m = 'Movement Type (Inventory Management)'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'BUDAT'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 8.
gw_fieldcat-seltext_m = 'Posting Date in the Document'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'MENGE'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 9.
gw_fieldcat-seltext_m = 'QUANTITY'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'MEINS'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 10.
gw_fieldcat-seltext_m = 'Basic unit of measure'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'KOSTL'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 11.
gw_fieldcat-seltext_m = 'Cost center'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'AUFNR'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 12.
gw_fieldcat-seltext_m = 'Order Number'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-fieldname = 'RSNUM'.
gw_fieldcat-tabname = 'itab'.
gw_fieldcat-col_pos = 13.
gw_fieldcat-seltext_m = 'Number of Reservation / Depe'.
gw_fieldcat-key = ' '.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-col_pos = 14.
gw_fieldcat-fieldname = 'CHECKBOX'.
gw_fieldcat-seltext_m = 'Compltd'.
gw_fieldcat-checkbox = 'X'.
gw_fieldcat-edit = 'X'.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZREPORT'
IS_LAYOUT = gt_layout
IT_FIELDCAT = gt_fieldcat
TABLES
t_outtab = itab
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. " display_alv_output
this is mycode .
send me replay.Hi Lakshmi,
Can u explain briefly what is ur requirement. U mean to say that after clicking the checkbox in data base table or Screen?
Regards,
Jayaram... -
How to insert data from different internal table into a data base table
hi all,
I want to insert a particular field in an internal table to a field in a data base table.Note that the fields in the internal table and database table are not of the same name since i need to insert data from different internal tables.can some one tell me how to do this?
in short i want to do something like the foll:
INSERT INTO ZMIS_CODES-CODE VALUE '1'.
*INSERT INTO ZMIS_CODES-COL1 VALUE DATA_MTD-AUFNR .(zmis_codes is the db table and data_mtd is the int.table)REPORT ZINSERT.
tables kna1.
data: itab LIKE KNA1.
data lv_kUNAG LIKE KNA1-KUNNR.
lv_kuNAG = '0000010223'.
ITAB-kuNNR = lv_kuNAG.
ITAB-name1 = 'XYZ'.
INSERT INTO KNA1 VALUES ITAB.
IF SY-SUBRC = 0.
WRITE:/ 'SUCCESS'.
ELSE.
WRITE:/ 'FAILED'.
ENDIF.
Here lv_kunag is ref to kna1 kunnr passed in different name
In internal table .
Try and let me know if this logic dint work. -
Data Source for BSEG Data base table
Hi Every one,
I need to create a data source for the data base table BSEG (Function Module Extraction).
I have followed below steps.
I have created extarct structure which contains all the fields of BSEG Data base table.If I save the data source I am getting error.
If I remove all the currecy fields from extract structure, I am able to activate the data sorce.
So Could you please explain me how to extract currency fields.Hi,
Firstly, can you explain why you need a generic extractor for BSEG? There are already 2 datasources for BSEG, they are:
0FI_GL_4
http://help.sap.com/saphelp_nw70/helpdata/en/0c/b4973c115a6f3ae10000000a114084/frameset.htm
0FI_GL_14
http://help.sap.com/saphelp_nw70/helpdata/en/49/5700570223413085021a8b4ef1087a/frameset.htm
To use 0FI_GL_14, you should use the new GL in ECC side.
On the other hand, for your problem, your problem may occur if you did not give the reference unit field of your currency field in your extraction structure. when you double click the the currency field, you will see the ref. field, give the reference unit field in this area.
Regards. -
How to find data base tables for a particular trancation code
Dear All,
Is there any T.code for finding data base tables used in a particular transaction code(Eg.: MM01).
Regards,
SatyapalliHello Satya
There is a very useful function module available for your requirement:
<b>RS_PROGRAM_TABLES</b>
Call this function module using:
OBJECT_TYPE = 'TRAN' " transaction
OBJECT_NAME = 'VA01'
" PROGRAM -> not required
MONITOR_ACTIVATE = 'X'
The function module will list you all DB tables touched by the transaction and shows whether they are read or updated (unfortunately, on ECC 5.0 this seems to be no longer the case. All tables are displayed as READ).
Regards
Uwe -
Hello,
please help me to understand how the macros work. I am facing database inconsistency. The CRM-system retrieves a GUID of an opportunity’s item and checks its existence. However, this GUID (here it is es_info-ref_object) does not exist. As result, an exception is triggered.
I am trying to figure out which data base table is responsible for the inconsistent data. Instead of SELECT statement, I see in the debugger that a macro retrieves the “guilty” entry .
macro_execute macro_msg_data_read_rea.
My Question: How can I find a data base table containing a GUID, which is result of the macro’s execution?
Thanks a lot
AndrejWhen you save a PDF out of Distiller it doesn't just have different options, it's an entirely different program. It doesn't do things the same way, so it can't have the same options. Saving from Distiller is in many ways better, expecially in that transparency isn't flattened.
What specific options are you looking for? -
Need Information about TBD10 data base table
Hi Gurus,
Thanks in advance for looking at the issue.
I require information for the below questions ;
1.How is the data base table TBD10 populated i.e which transaction updates data
into this table.
2.How is this data base table used.
Please send your replies.
Thanks,
Bhanu.HI,
TBD10 --- Def., out of which IDOC fields a filter object is to be read
BD59 maintains that table
Rhea.
Edited by: rhea on Nov 4, 2008 2:09 PM -
How to control the name of custom field in data base table, added by AET
Hi,
I have added the one custom field by Application Enhancement Tool (AET).
The name of custom field has been added in the data base table as ZZFLD000004 by AET.
I need to add the some meaningful name like that ZMYPROB.
How can I control the name of custom field in the database field through AET?
Thanks,
AmitGot the answer.
Need to click on the Enable Expert mode, then custom field name will be editable. -
How to know who has created a particular record in the data base table
Hi All...
Can any one tell me how to track the information about who has entered the records in to the data base table....
Thanks in advance...You could check the Created By and Created On fields if your tables contains these fields.
OR
You could check the table DBTABLOG if table logging is enabled for the table
OR
You could check the Change document tables CDHDR and CDPOS.
-Kiran
Please mark useful answers -
Creation of field in data base table
Hi,
I want to create a field in data base table , which holds the float values but i don't want to use the FLTP data type, why bcoz if i use this data type in selection screen of the table the the field is not appeqring, i dont want to go for the option QUAN bcoz there i need to define the ref table and ref field.
please explain what is the way to create this field.
regards
KrishnaUse NUMC
Awrd POints if useful
Bhupal -
Sales order purchase order field is updated with dots in data base table
HI
we have problem in Production when sale order created
P O date is update with dots and these dots we are unable to see at screen and data base table
we go t change mode of the order and delete the P O field with back space (button) and saving the order
when we see the change log of the order
there it is sowing
Old value = " . . "
New Value = " 00.00.0000"
Can any one give the suggetions to come out of this problem
This is we have noticed with only two customers
Thanks and regards
Kishore
Edited by: DevarapalliKK on Oct 23, 2010 8:43 PM
Edited by: DevarapalliKK on Oct 23, 2010 8:44 PMHi Kishore,
Two things could have happened:
1) Since this is happening with only two customers - I am sure it has got to do with some custom code on your system which is causing this problem. I 'd suggest you to create a new order with all the fields
2) It could be a bug with SAP- might want to check relevant SAP Notes. ( But this could not be a reason, if yes should have had the same prob with all cusotmers)
regards
sadhu kishore -
How to modify a data base table ?
Hi,
i am working on a list output where if user is editing a field and that field need to be updated in the data base. table is a z table .
the table has 5 fields .
mandt key field
matnr key field
werks key field
charg key field
lgpla key field
usnam
edate
in the list output , the user will change the values in the lgpla field and that field need to be changed in the data base table.
i have used the stmt :
modify< table> from <internal table> ,
but a new record is added in the data base instead of overwriting the existing one.
but the record can be seen modified in the internal table.
kinldy let me know the method of updating or modifying the existing value in the data base.
thanks and regards,
vikram.Hi,
Its not possible to change Primary Key contents in the database.
it mention in documentation of MODIFY Statement,
a line is searched for in the database table that has the same content
in the primary key as the corresponding beginning part of the work area.
If such a line is not found,
a new line is inserted according to the same rules as for the INSERT statement.
If such a line is found,
this line is overwritten according to the same rules as for the UPDATE statement
if you want insert the modified line first Delete from database,Then Use Modify Statement
Regards,
Raghava Channooru -
Which data base tables contain SCM customer code
Friends,
I am writing an user exit for VA01/VA02/VA3/VA32.
I am getting the customer number from VBAK-KUNNR when I execute any of the above transactions.
According to functional sepecification, we can find SCM code in the data base table ADRC.
(we can fetch the data from ADRC table where ADRC-ADDRNR = KNA1-ADRNR; ( KNA1-KUNNR = VBAK-KUNNR))
I could not find SCM customer code in the table ADRC.
Please let me know the Data table and field to find the SCM customer code in SAP.Hi Reddy,
>> As in SCM the company codes exist in the table ' <b>T001</b> '.
Corresponding field for it is ' <b>BUKRS</b> '.
>> U can use ' <b>ADRNR</b> ' as a key field in ' <b>T001</b> ' table and
relate with your <b>KNA1- ADRNR</b> using Joins for user exits.
Feel Free to ask any questions regarding this...
Hope it Helps...
Regards,
Dhayanandh.S
Message was edited by:
DHAYANANDH SIVASANKARAN
Maybe you are looking for
-
HT1338 Can macbook mid 2010 mirror to Apple TV ?
Hi My Macbook Pro Mid 2010 with Mountain Lion OS X 10.8.2 can I be able to mirror wireless to Apple TV 3rd generation?
-
Hi All I am suffering from a mental block and need some assistance. We have just changed our trading name and I have changed everything except the default PO ship to address and I cannot find where to change it. I have checked every where that I can
-
How to get Supervisor/Managers name using SQ01...
Hi, I am stumped and need your help. I have defined an infoset ZZ_HR_DATA with logical database. In the Infotype 0001, under additional selections, I have the field "Name of superior (organizational assignment)" and it's technical name is SYHR_A_P000
-
Newbie to SJSC : Cannot drop component onto page NoClassDefFoundError
Hello, I recently downloaded and installed Sun Java Studio Creator 2 (SJSC) and was trying the tutorial to get myself familiarized with it. I cannot drop any JSF (not even standard or basic) onto the page1 JSP, i get this error: ********* Exception o
-
Setup Survey determination in WebUI
Hello, it is possible to create a survey in the WebUI, but for the steps "Define Determination Criteria for Questionnaires" and "Define Determination for Questionnaires" there is no WebUI functionality for this. Is this hidden in another function or