on 2013 Mar 05 7:27 AM
Hi All,
I have created a datasource to extract data through Function module.When i run the Function module independandtly in Tcode SE37 it is giving me the exact result.But when i check the data in RSA3 extract checker i can find that the data is totally not matching.
For ex in se37 when i executed the function module i could get the output as 32 entries.
But in RSA3 i get it as 320 . i.e 10 datapackets with 32 entries.
RSA3 output.
DataPa Record
1 32
2 32
3 32
4 32
5 32
6 32
7 32
8 32
9 32
10 32
* Tota 320
Can someone tell me whether i am doing something wrong.What do i need to do to get the same ouput in RSA3 as SE37 output.
Thanks in advance for you valuable suggestions.
Regards,
kumar
Request clarification before answering.
Hi harish
That because you forgot to raise No more data ( code statement. RAISE NO_MORE_DATA).
When all of the process is end, this statement must be do.
If not the function module will be run again. when you debug using SE37 you can see function module run several time.
Example code:
rasie nomore data at end of FM:
RAISE NO_MORE_DATA.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDFUNCTION.
at the begining of FM:
IF NOT ( l_last_data_flag IS INITIAL ). " after all selection are finished change value of flag
RAISE no_more_data.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nguyen,
Please find my code i have added it in my function module.Let me know if anything is wrong here.
Function
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR
*" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
*" TABLES
*" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*" E_T_DATA STRUCTURE ZBWS_PRICE OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------
* Variables
DATA : lv_cnt TYPE i.
*TYPES
TYPES: BEGIN OF tp_a005,
vkorg TYPE vkorg, "Sales Organization
vtweg TYPE vtweg, "Distribution Channel
vtweg1(50) TYPE c, "Distribution Channel
matnr TYPE matnr, "Material Number
kunnr TYPE kunnr_v, "Customer number
kschl TYPE kscha, "Condition type
knumh TYPE knumh, "Condition record number
datab TYPE kodatab, "Validity start date of the condition record
datbi TYPE kodatbi, "Validity end date of the condition record
no1 TYPE i, "indicator
END OF tp_a005.
TYPES: BEGIN OF tp_pos,
knumh TYPE knumh, "Condition record number
kopos TYPE kopos, "Sequential number of the condition
zaehk_ind TYPE dzaehk_ind, "Condition item index
kschl TYPE kscha, "Condition type
kschl1(50) TYPE c, "Condition type
kschl2(12) TYPE c, "Condition type
kunnr TYPE kunnr, "Customer number
kunnr1(60) TYPE c, "Customer number
kunnr2 TYPE kunnr, "Customer number
matnr TYPE matnr, "Material number
tmatnr(60) TYPE c, "Material number
matnr1 TYPE matnr, "Material number
mwsk1 TYPE mwskz, "Sales Tax Code
stfkz TYPE stfkz, "Scale Type
stfkz1(5) TYPE c, "Scale Type
klfn1 TYPE klfn1, "Current number of the line scale
sba1(20) TYPE c, "indicator
sun1(5) TYPE c, "indicator
kstbm TYPE kstbm, "Condition scale quantity
konms TYPE konms, "Condition scale unit of measure
kstbw TYPE kstbw, "Scale value
konws TYPE konws, "Scale currency
konwa1 TYPE konwa, "Rate unit (currency or percentage)
kbetr TYPE kbetr_kond, "Rate (condition amount or percentage) where no scale exists
konwa TYPE konwa, "Rate unit (currency or percentage)
kpein TYPE kpein, "Condition pricing unit
kmein TYPE kmein, "Condition unit
datab TYPE kodatab, "Validity start date of the condition record
datbi1 TYPE kodatab, "Validity start date of the condition record
datbi TYPE kodatbi, "Validity end date of the condition record
mxwrt TYPE mxwrt, "Lower limit of the condition rate/amount
gkwrt TYPE gkwrt, "Upper limit for the condition rate
pkwrt TYPE pkwrt, "Planned condition value
fkwrt TYPE fkwrt, "Cumulative guaranteed discount
rswrt TYPE rswrt, "Accumulated accruals values
komxwrt TYPE komxwrt, "Maximum condition value
kwaeh TYPE kwaeh, "Condition currency (for cumulation fields)
loevm_ko TYPE loevm_ko, "Deletion Indicator for Condition Item
no2 TYPE i, "Indicator
END OF tp_pos.
TYPES: BEGIN OF tp_vkrange,
sign(1) TYPE c ,
option(2) TYPE c ,
low TYPE vkorg,
high TYPE vkorg,
END OF tp_vkrange.
TYPES: BEGIN OF tp_dtrange,
sign TYPE c LENGTH 1,
option TYPE c LENGTH 2,
low TYPE vkorg,
high TYPE vkorg,
END OF tp_dtrange.
CONSTANTS: c_vkorg(5) TYPE c VALUE 'VKORG',
c_vtweg1(6) TYPE c VALUE 'VTWEG1',
c_no1(6) TYPE c VALUE 'NO1',
c_datab(5) TYPE c VALUE 'DATAB',
c_kind_s(1) TYPE c VALUE 'S',
c_kind_p(1) TYPE c VALUE 'P',
c_sign(1) TYPE c VALUE 'I',
c_option(2) TYPE c VALUE 'EQ',
c_x(1) TYPE c VALUE 'X',
c_param(3) TYPE c VALUE 'P_1',
c_datum(5) TYPE c VALUE 'DATUM',
c_par_staf(8) TYPE c VALUE 'PAR_STAF',
c_par_dat(7) TYPE c VALUE 'PAR_DAT',
c_par_pos(7) TYPE c VALUE 'PAR_POS',
c_par_l(5) TYPE c VALUE 'PAR_L',
c_par_excl(8) TYPE c VALUE 'PAR_EXCL',
c_kschl1(6) TYPE c VALUE 'KSCHL1',
c_kschl2(6) TYPE c VALUE 'KSCHL2',
c_kunnr1(6) TYPE c VALUE 'KUNNR1',
c_kunnr2(6) TYPE c VALUE 'KUNNR2',
c_kunnr3(6) TYPE c VALUE 'KUNNR3',
c_matnr1(6) TYPE c VALUE 'MATNR1',
c_stfkz1(6) TYPE c VALUE 'STFKZ1',
c_sba1(4) TYPE c VALUE 'SBA1',
c_sun1(4) TYPE c VALUE 'SUN1',
c_konwa1(6) TYPE c VALUE 'KONWA1 ',
c_datbi1(6) TYPE c VALUE 'DATBI1',
c_no2(3) TYPE c VALUE 'NO2'.
*INTERNAL TABLE
DATA: t_a005 TYPE STANDARD TABLE OF tp_a005,
t_rspar TYPE STANDARD TABLE OF rsparams,
t_component1 TYPE if_salv_bs_t_data=>t_type_component,
t_pos TYPE STANDARD TABLE OF tp_pos,
r_Vkorg TYPE RANGE OF tp_vkrange,
r_datab TYPE RANGE OF tp_dtrange.
DATA : wa_a005 TYPE tp_a005,
wa_pos TYPE tp_pos,
wa_component TYPE LINE OF if_salv_bs_t_data=>t_type_component,
wa_rspar TYPE rsparams,
r_vkorg_line like LINE OF r_vkorg,
r_datab_line like line of r_datab,
wa_output TYPE zbws_price.
* Auxiliary Selection criteria structure
DATA: l_s_select TYPE srsc_s_select.
* Maximum number of lines for DB table
STATICS: s_s_if TYPE srsc_s_if_simple.
* counter
* s_counter_datapakid LIKE sy-tabix,
* cursor
* s_cursor TYPE cursor.
* Select ranges
RANGES: l_r_vkorg FOR komg-vkorg,
l_r_datum FOR rv12l-datint.
FIELD-SYMBOLS <lt_data> TYPE ANY TABLE.
FIELD-SYMBOLS <lt_data_line> TYPE ANY TABLE.
DATA: lr_data TYPE REF TO data,
lr_data_line TYPE REF TO data,
lr_data_descr TYPE REF TO cl_abap_datadescr,
lr_data_line_descr TYPE REF TO cl_abap_datadescr.
* Initialization mode (first call by SAPI) or data transfer mode
* (following calls) ?
IF i_initflag = sbiwa_c_flag_on.
************************************************************************
* Initialization: check input parameters
* buffer input parameters
* prepare data selection
************************************************************************
* Check DataSource validity
**** CASE i_dsource.
**** WHEN '0SAPI_SFLIGHT_SIMPLE'.
**** WHEN OTHERS.
**** IF 1 = 2. MESSAGE e009(r3). ENDIF.
***** this is a typical log call. Please write every error message like this
**** log_write 'E' "message type
**** 'R3' "message class
**** '009' "message number
**** i_dsource "message variable 1
**** ' '. "message variable 2
**** RAISE error_passed_to_mess_handler.
**** ENDCASE.
* APPEND LINES OF i_t_select TO s_s_if-t_select.
*
** Fill parameter buffer for data extraction calls
* s_s_if-requnr = i_requnr.
s_s_if-dsource = i_dsource.
s_s_if-maxsize = i_maxsize.
* Fill field list table for an optimized select statement
* (in case that there is no 1:1 relation between InfoSource fields
* and database table fields this may be far from beeing trivial)
* APPEND LINES OF i_t_fields TO s_s_if-t_fields.
ELSE. "Initialization mode or data extraction ?
************************************************************************
* Data transfer: First Call OPEN CURSOR + FETCH
* Following Calls FETCH only
************************************************************************
* LOOP AT i_t_select INTO l_s_select WHERE fieldnm = 'VKORG'.
* MOVE-CORRESPONDING l_s_select TO l_r_vkorg.
* APPEND l_r_vkorg.
* ENDLOOP.
*
*
* LOOP AT i_t_select INTO l_s_select WHERE fieldnm = 'DATAB'.
* MOVE-CORRESPONDING l_s_select TO l_r_datum.
* APPEND l_r_datum.
* ENDLOOP.
READ TABLE i_t_select INTO l_s_select WITH KEY fieldnm = c_vkorg.
IF sy-subrc = 0.
* MOVE-CORRESPONDING l_s_select TO l_r_vkorg.
l_r_vkorg-sign = l_s_select-sign.
l_r_vkorg-option = l_s_select-option.
l_r_vkorg-low = l_s_select-low.
l_r_vkorg-high = l_s_select-high.
APPEND l_r_vkorg.
ENDIF.
READ TABLE i_t_select INTO l_s_select WITH KEY fieldnm = c_datab.
IF sy-subrc = 0.
* MOVE-CORRESPONDING l_s_select TO l_r_datum.
l_r_datum-sign = l_s_select-sign.
l_r_datum-option = l_s_select-option.
l_r_datum-low = l_s_select-low.
l_r_datum-high = l_s_select-high.
APPEND l_r_datum.
ENDIF.
wa_rspar-selname = c_param. "P_1
wa_rspar-kind = c_kind_s. "S
wa_rspar-sign = c_sign. "I
wa_rspar-option = c_option. "EQ
wa_rspar-low = l_r_vkorg-low.
APPEND wa_rspar TO t_rspar.
CLEAR wa_rspar.
wa_rspar-selname = c_datum. "DATUM
wa_rspar-kind = c_kind_s. "S
wa_rspar-sign = c_sign. "I
wa_rspar-option = c_option. "EQ
wa_rspar-low = l_r_datum-low.
wa_rspar-high = l_r_datum-high.
APPEND wa_rspar TO t_rspar.
CLEAR wa_rspar.
wa_rspar-selname = c_par_staf. "PAR_STAF
wa_rspar-kind = c_kind_p. "P
wa_rspar-sign = c_sign. "I
wa_rspar-option = c_option. "EQ
wa_rspar-low = c_x. "X
APPEND wa_rspar TO t_rspar.
CLEAR wa_rspar.
wa_rspar-selname = c_par_dat. "PAR_DAT
wa_rspar-kind = c_kind_p. "P
wa_rspar-sign = c_sign. "I
wa_rspar-option = c_option. "EQ
wa_rspar-low = c_x. "X
APPEND wa_rspar TO t_rspar.
CLEAR wa_rspar.
wa_rspar-selname = c_par_pos. "PAR_POS
wa_rspar-kind = c_kind_p. "P
wa_rspar-sign = c_sign. "I
wa_rspar-option = c_option. "EQ
wa_rspar-low = c_x. "X
APPEND wa_rspar TO t_rspar.
CLEAR wa_rspar.
wa_rspar-selname = c_par_l. "PAR_L
wa_rspar-kind = c_kind_p. "P
wa_rspar-sign = c_sign. "I
wa_rspar-option = c_option. "EQ
wa_rspar-low = c_x. "X
APPEND wa_rspar TO t_rspar.
CLEAR wa_rspar.
wa_rspar-selname = c_par_excl. "PAR_EXCL
wa_rspar-kind = c_kind_p. "P
wa_rspar-sign = c_sign. "I
wa_rspar-option = c_option. "EQ
wa_rspar-low = c_x. "X
APPEND wa_rspar TO t_rspar.
CLEAR wa_rspar.
CLEAR e_t_data.
REFRESH e_t_data.
cl_salv_bs_runtime_info=>set( EXPORTING display = abap_false
metadata = abap_false
data = abap_true ).
SUBMIT /1sdbf12l/rv14aka4
EXPORTING LIST TO MEMORY WITH
SELECTION-TABLE t_rspar
AND RETURN.
TRY.
IMPORT t_component TO t_component1 FROM MEMORY ID cl_salv_bs_runtime_info=>c_memid_data_def.
IF sy-subrc EQ 0.
READ TABLE t_component1 INTO wa_component INDEX 5.
IF sy-subrc = 0.
wa_component-name = c_vtweg1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 12.
IF sy-subrc = 0.
wa_component-name = c_no1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
cl_salv_bs_ddic=>create_data_from_components(
EXPORTING
t_component = t_component1
IMPORTING
r_data = lr_data
r_datadescr = lr_data_descr ).
ENDIF.
* ENDIF.
IMPORT t_component TO t_component1 FROM MEMORY ID cl_salv_bs_runtime_info=>c_memid_data_line_def.
IF sy-subrc EQ 0.
READ TABLE t_component1 INTO wa_component INDEX 7.
IF sy-subrc = 0.
wa_component-name = c_kschl1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 8.
IF sy-subrc = 0.
wa_component-name = c_kschl2.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 9.
IF sy-subrc = 0.
wa_component-name = c_kunnr1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 10.
IF sy-subrc = 0.
wa_component-name = c_kunnr2.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 11.
IF sy-subrc = 0.
wa_component-name = c_kunnr3.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 14.
IF sy-subrc = 0.
wa_component-name = c_matnr1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 17.
IF sy-subrc = 0.
wa_component-name = c_stfkz1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 19.
IF sy-subrc = 0.
wa_component-name = c_sba1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 20.
IF sy-subrc = 0.
wa_component-name = c_sun1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 25.
IF sy-subrc = 0.
wa_component-name = c_konwa1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 31.
IF sy-subrc = 0.
wa_component-name = c_datbi1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 41.
IF sy-subrc = 0.
wa_component-name = c_no2.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
cl_salv_bs_ddic=>create_data_from_components(
EXPORTING
t_component = t_component1
IMPORTING
r_data = lr_data_line
r_datadescr = lr_data_line_descr ).
ENDIF.
***** First data package -> OPEN CURSOR
**** IF s_counter_datapakid = 0.
****
***** Fill range tables BW will only pass down simple selection criteria
***** of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
**** LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'CARRID'.
**** MOVE-CORRESPONDING l_s_select TO l_r_carrid.
**** APPEND l_r_carrid.
**** ENDLOOP.
****
**** LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'CONNID'.
**** MOVE-CORRESPONDING l_s_select TO l_r_connid.
**** APPEND l_r_connid.
**** ENDLOOP.
****
***** Determine number of database records to be read per FETCH statement
***** from input parameter I_MAXSIZE. If there is a one to one relation
***** between DataSource table lines and database entries, this is trivial.
***** In other cases, it may be impossible and some estimated value has to
***** be determined.
**** OPEN CURSOR WITH HOLD s_cursor FOR
**** SELECT (s_s_if-t_fields) FROM sflight
**** WHERE carrid IN l_r_carrid AND
**** connid IN l_r_connid.
**** ENDIF. "First data package ?
***** Fetch records into interface table.
***** named E_T_'Name of extract structure'.
**** FETCH NEXT CURSOR s_cursor
**** APPENDING CORRESPONDING FIELDS
**** OF TABLE e_t_data
**** PACKAGE SIZE s_s_if-maxsize.
****
**** IF sy-subrc <> 0.
**** CLOSE CURSOR s_cursor.
**** RAISE no_more_data.
**** ENDIF.
****
**** s_counter_datapakid = s_counter_datapakid + 1.
CREATE DATA lr_data TYPE HANDLE lr_data_descr.
CREATE DATA lr_data_line TYPE HANDLE lr_data_line_descr.
ASSIGN lr_data->* TO <lt_data>.
ASSIGN lr_data_line->* TO <lt_data_line>.
cl_salv_bs_runtime_info=>get_data(
IMPORTING
t_data = <lt_data>
t_data_line = <lt_data_line>
).
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE text-t01 TYPE 'E'.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
MOVE <lt_data> TO t_a005.
MOVE <lt_data_line> TO t_pos.
SORT t_a005 BY no1.
SORT t_pos BY no2.
LOOP AT t_pos INTO wa_pos.
READ TABLE t_a005 INTO wa_a005 WITH KEY no1 = wa_pos-no2 BINARY SEARCH.
IF sy-subrc = 0.
wa_output-vkorg = wa_a005-vkorg.
wa_output-vtweg = wa_a005-vtweg.
wa_output-kschl = wa_pos-kschl.
wa_output-kunnr = wa_pos-kunnr.
wa_output-matnr = wa_pos-matnr.
wa_output-mwsk1 = wa_pos-mwsk1.
wa_output-kbetr = wa_pos-kbetr.
wa_output-konwa = wa_pos-konwa.
wa_output-kpein = wa_pos-kpein.
wa_output-kmein = wa_pos-kmein.
wa_output-datab = wa_pos-datab.
wa_output-datbi = wa_pos-datbi.
wa_output-kwaeh = wa_pos-kwaeh.
wa_output-loevm_ko = wa_pos-loevm_ko.
APPEND wa_output TO e_t_data .
CLEAR wa_output.
ENDIF.
ADD 1 TO lv_cnt.
IF lv_cnt > s_s_if-maxsize.
EXIT.
ENDIF.
ENDLOOP.
IF sy-subrc NE 0.
RAISE no_more_data.
ENDIF.
* SORT e_t_data BY vkorg vtweg kschl.
ENDIF. "Initialization mode or data extraction ?
ENDFUNCTION.
Regards
Kumar
Hi Kurmar
Why this code?
ENDLOOP.
IF sy-subrc NE 0. " wrong
RAISE no_more_data.
ENDIF.
If after ENDLOOP everything is ok that is the last data you get.
you should use raise no_more_data in 2 case: error and data get succesfull
at the midle of code
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE text-t01 TYPE 'E'.
RAISE no_more_data.
ENDTRY.
*at the end of FM
Use no_more_data in normal case: try with code below
* IF sy-subrc NE 0.
* RAISE no_more_data.
* ENDIF.
RAISE no_more_data.
Hi Nguyen,
Thanks for your quick reply
Case1,
I tried your below code.But when i changed only the code at the middle i could see the RSA3 results matchs with SE37 output.But when i ran the infopackage in BW side the job is not progressing at all.I could see that the records are getting fetched but the job is not progressing at all due to which i can see only the yellow light in the infopackage.
at the midle of code
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE text-t01 TYPE 'E'.
RAISE no_more_data.
ENDTRY.
Case 2,
I tried your below code like below.Now i can see that in RSA3 i get 0 records but in se37 output i have 32 records.So again something wong .And also when i run the infopackage i get 0 records.
at the midle of code
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE text-t01 TYPE 'E'.
RAISE no_more_data.
ENDTRY.
*at the end of FM
RAISE no_more_data.
Still no end to this..Any suggestions please.
Kumar
CLEAR e_t_data.
REFRESH e_t_data.
cl_salv_bs_runtime_info=>set( EXPORTING display = abap_false
metadata = abap_false
data = abap_true ).
SUBMIT /1sdbf12l/rv14aka4
EXPORTING LIST TO MEMORY WITH
SELECTION-TABLE t_rspar
AND RETURN.
TRY.
IMPORT t_component TO t_component1 FROM MEMORY ID cl_salv_bs_runtime_info=>c_memid_data_def.
IF sy-subrc EQ 0.
READ TABLE t_component1 INTO wa_component INDEX 5.
IF sy-subrc = 0.
wa_component-name = c_vtweg1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 12.
IF sy-subrc = 0.
wa_component-name = c_no1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
cl_salv_bs_ddic=>create_data_from_components(
EXPORTING
t_component = t_component1
IMPORTING
r_data = lr_data
r_datadescr = lr_data_descr ).
ENDIF.
* ENDIF.
IMPORT t_component TO t_component1 FROM MEMORY ID cl_salv_bs_runtime_info=>c_memid_data_line_def.
IF sy-subrc EQ 0.
READ TABLE t_component1 INTO wa_component INDEX 7.
IF sy-subrc = 0.
wa_component-name = c_kschl1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 8.
IF sy-subrc = 0.
wa_component-name = c_kschl2.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 9.
IF sy-subrc = 0.
wa_component-name = c_kunnr1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 10.
IF sy-subrc = 0.
wa_component-name = c_kunnr2.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 11.
IF sy-subrc = 0.
wa_component-name = c_kunnr3.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 14.
IF sy-subrc = 0.
wa_component-name = c_matnr1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 17.
IF sy-subrc = 0.
wa_component-name = c_stfkz1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 19.
IF sy-subrc = 0.
wa_component-name = c_sba1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 20.
IF sy-subrc = 0.
wa_component-name = c_sun1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 25.
IF sy-subrc = 0.
wa_component-name = c_konwa1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 31.
IF sy-subrc = 0.
wa_component-name = c_datbi1.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
READ TABLE t_component1 INTO wa_component INDEX 41.
IF sy-subrc = 0.
wa_component-name = c_no2.
MODIFY TABLE t_component1 FROM wa_component.
ENDIF.
cl_salv_bs_ddic=>create_data_from_components(
EXPORTING
t_component = t_component1
IMPORTING
r_data = lr_data_line
r_datadescr = lr_data_line_descr ).
ENDIF.
***** First data package -> OPEN CURSOR
**** IF s_counter_datapakid = 0.
****
***** Fill range tables BW will only pass down simple selection criteria
***** of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
**** LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'CARRID'.
**** MOVE-CORRESPONDING l_s_select TO l_r_carrid.
**** APPEND l_r_carrid.
**** ENDLOOP.
****
**** LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'CONNID'.
**** MOVE-CORRESPONDING l_s_select TO l_r_connid.
**** APPEND l_r_connid.
**** ENDLOOP.
****
***** Determine number of database records to be read per FETCH statement
***** from input parameter I_MAXSIZE. If there is a one to one relation
***** between DataSource table lines and database entries, this is trivial.
***** In other cases, it may be impossible and some estimated value has to
***** be determined.
**** OPEN CURSOR WITH HOLD s_cursor FOR
**** SELECT (s_s_if-t_fields) FROM sflight
**** WHERE carrid IN l_r_carrid AND
**** connid IN l_r_connid.
**** ENDIF. "First data package ?
***** Fetch records into interface table.
***** named E_T_'Name of extract structure'.
**** FETCH NEXT CURSOR s_cursor
**** APPENDING CORRESPONDING FIELDS
**** OF TABLE e_t_data
**** PACKAGE SIZE s_s_if-maxsize.
****
**** IF sy-subrc <> 0.
**** CLOSE CURSOR s_cursor.
**** RAISE no_more_data.
**** ENDIF.
****
**** s_counter_datapakid = s_counter_datapakid + 1.
CREATE DATA lr_data TYPE HANDLE lr_data_descr.
CREATE DATA lr_data_line TYPE HANDLE lr_data_line_descr.
ASSIGN lr_data->* TO <lt_data>.
ASSIGN lr_data_line->* TO <lt_data_line>.
cl_salv_bs_runtime_info=>get_data(
IMPORTING
t_data = <lt_data>
t_data_line = <lt_data_line>
).
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE text-t01 TYPE 'E'.
RAISE no_more_data.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
MOVE <lt_data> TO t_a005.
MOVE <lt_data_line> TO t_pos.
SORT t_a005 BY no1.
SORT t_pos BY no2.
LOOP AT t_pos INTO wa_pos.
READ TABLE t_a005 INTO wa_a005 WITH KEY no1 = wa_pos-no2 BINARY SEARCH.
IF sy-subrc = 0.
wa_output-vkorg = wa_a005-vkorg.
wa_output-vtweg = wa_a005-vtweg.
wa_output-kschl = wa_pos-kschl.
wa_output-kunnr = wa_pos-kunnr.
wa_output-matnr = wa_pos-matnr.
wa_output-mwsk1 = wa_pos-mwsk1.
wa_output-kbetr = wa_pos-kbetr.
wa_output-konwa = wa_pos-konwa.
wa_output-kpein = wa_pos-kpein.
wa_output-kmein = wa_pos-kmein.
wa_output-datab = wa_pos-datab.
wa_output-datbi = wa_pos-datbi.
wa_output-kwaeh = wa_pos-kwaeh.
wa_output-loevm_ko = wa_pos-loevm_ko.
APPEND wa_output TO e_t_data .
CLEAR wa_output.
ENDIF.
*You will missing data with this code below
* s_s_if-maxsize is only use in cussor base
* ADD 1 TO lv_cnt.
* IF lv_cnt > s_s_if-maxsize.
* EXIT.
* ENDIF.
ENDLOOP.
* IF sy-subrc NE 0.
* RAISE no_more_data.
* ENDIF.
RAISE no_more_data.
* SORT e_t_data BY vkorg vtweg kschl.
ENDIF. "Initialization mode or data extraction ?
ENDFUNCTION.
Hi Nguyen,
I appreciate your timely help Thanks again for the same.
I tried your code but i could see the RSA3 results doesnot match with SE37 output.
In SE37 i got 32 entries but in rsa3 i get 0 entries.
Even when i run the infopackage in BW side I could get only 0 records.
Still no clue whats happening.
Regards
Kumar
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.