Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

WHEN I IMPORT FROM DATABASE a DATA IT CAN'T GET IT.

lichenxi
Explorer
0 Kudos
494

I HAVA a table like this.

AND I HAD EXPORT SOME DATA INTO THIS TABLE.

AND IT LIKE THIS .

and i need to get the data from here and write a test programe it like this

*&---------------------------------------------------------------------*
*& Report YTEST011
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YTEST011.
FIELD-SYMBOLS: <LS_PARA> TYPE RSFBPARA,
<LV_PARAFLD> TYPE ANY,
<LV_PARAVAL> TYPE ANY,
<LT_PARAFLD> TYPE ANY,
<LT_PARAVAL> TYPE ANY.
" <LT_DATADIR> TYPE LTYP_DATADIR_GD_TAB.

DATA:LV_NUMC TYPE NUM9.
DATA:LS_KEY TYPE ZCL_FM_LOG_SERVICE=>TY_KEY.
DATA:LV_DATAID TYPE EU_NAME.

DATA: LV_PARA_GD TYPE XUVALUE,
LV_MODE_GD(1) TYPE C,
" LS_GENDAT TYPE LTYP_GENDAT,
" LT_GENDAT TYPE STANDARD TABLE OF LTYP_GENDAT,
LV_PNAME_GD TYPE TFDIR-PNAME,
LS_HEADER_GD TYPE HEADER_FB,
LT_TABLES_GD TYPE RSFB_PARA,
LT_IMPORT_GD TYPE RSFB_PARA,
LT_EXPORT_GD TYPE RSFB_PARA,
LT_CHANGE_GD TYPE RSFB_PARA,
LV_PROGNAME_GD TYPE TRDIR-NAME,
LV_PARANAME_GD(100),
" LS_DATADIR_GD TYPE LTYP_DATADIR_GD,
LV_DATAID_GD TYPE EUFUNC-NUMMER,
LV_EXIT_GD TYPE XFELD.


LS_HEADER_GD-NAME = 'ZFI_IF_CREATE_VENDOR_BPM'.

SELECT SINGLE PNAME
FROM TFDIR
INTO LV_PNAME_GD
WHERE FUNCNAME = LS_HEADER_GD-NAME ."'ZFI_IF_CREATE_VENDOR_BPM'.




CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
PROGRAM = LV_PNAME_GD
IMPORTING
GROUP = LS_HEADER_GD-AREA
NAMESPACE = LS_HEADER_GD-NAMESPACE.
* insert namespace (e.g. /AFS/)
CONCATENATE LS_HEADER_GD-NAMESPACE LS_HEADER_GD-AREA
INTO LS_HEADER_GD-AREA.
* read parameter of function module
CALL METHOD CL_FB_PARAMETER_DB=>READ
IMPORTING
TABLES = LT_TABLES_GD[]
IMPORT = LT_IMPORT_GD[]
EXPORT = LT_EXPORT_GD[]
CHANGE = LT_CHANGE_GD[]
CHANGING
HEADER = LS_HEADER_GD.

LV_PROGNAME_GD = LS_HEADER_GD-NAME.
TRANSLATE LV_PROGNAME_GD USING ' ='.
LV_PROGNAME_GD+30 = 'FT'.
PERFORM (SPACE) IN PROGRAM (LV_PROGNAME_GD) IF FOUND.


LS_KEY-INDX = '100000000000000023'.
LS_KEY-NAME = 'ZFI_IF_CREATE_VENDOR_BPM'.
LS_KEY-ERDAT = '20200714' .
LS_KEY-ZEIT = '160749' .
LS_KEY-SRTF2 = '0' .

BREAK-POINT.

LOOP AT LT_TABLES_GD ASSIGNING <LS_PARA>.
CONCATENATE '(' LV_PROGNAME_GD ')%_I' <LS_PARA>-PARAMETER '[]'
INTO LV_PARANAME_GD.
ASSIGN (LV_PARANAME_GD) TO <LV_PARAFLD>.
CHECK SY-SUBRC = 0.
LS_KEY-FDNAME = <LS_PARA>-PARAMETER.
TRY .
IMPORT DATA = <LV_PARAFLD> FROM DATABASE ZLOGDATA(FL) ID LS_KEY .
CATCH CX_SY_IMPORT_MISMATCH_ERROR.
MESSAGE '参数有变更' TYPE 'S'.
ENDTRY.
ENDLOOP.

and the ty_key is like this

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

BEGIN OF TY_KEY,
" RELID TYPE ZLOGDATA-RELID,
NAME TYPE RS38L_FNAM,
ERDAT TYPE ERDAT,
ZEIT TYPE UZEIT,
INDX TYPE ZLOGDATA-INDX,
FDNAME TYPE RS38L_PAR_,
SRTF2 TYPE char10,
* GUID TYPE ZLOGDATA-GUID, "36位GUID
* AREA TYPE RS38L_AREA,
* ERNAM TYPE UNAME,
* RTYPE TYPE BAPI_MTYPE,
* RTMSG TYPE ZLOGDATA-RTMSG,
END OF TY_KEY .

AND NOW , I CAN'T GET THE DATA USEING IMPORT .who can help me .

2 REPLIES 2

ziolkowskib
Active Contributor
278

Hi lichenxi,
Would you be so kind as to use Insert Code button when pasting your ABAP code into question?
It might be also extremely useful to include the information about the actual error you are encountering.
Have you recently changed the structure of the TY_KEY?
Regards,
Bartosz

Sandra_Rossi
Active Contributor
278

And it's important that the data exported with EXPORT had the same definition as the one of IMPORT. But you don't tell us anything about EXPORT. And for the rest of missing information, see Bartosz comment.

Eventually, if you want to analyze the current situation, you may use CL_ABAP_EXPIMP_UTILITIES=>DBUF_IMPORT_CREATE_DATA to analyze easily what's compressed inside CLUSTD... (or run program RSINDX00)