ā2015 Dec 01 4:24 AM
Hi All
I Have copied a Supplier performance report program from Production system of one server to the development system of other server.
production system shows ALV display., whereas., though the same program is being copied development server doesnt display the output..
Err Msg pops up : No Data Found.
When Debugged the same., it fails in submit program..(Vendor wise material data is fetched from this Standard program rm06em00)
there is data in rm06em00. But stilll fails..and Can Import and export be used at a time?
Kindly Suggest..
Code fails at below.
* fetch from Tcode ME2M
submit rm06em00 with em_matnr in s_matnr " MATERIALS
with em_werks in s_werks " Plant
with listu eq lc_alv "'ALV' " Scope of List
with s_pstyp in s_pstyp " Item category is populated in pgm as '' & 'L'
with s_lifnr in s_lifnr " Vendor
with s_bedat in s_aedat " PO date
exporting list to memory and return.
create data fs_data like fs_test.
assign fs_data->* to <lft_submit>.
import export = <lft_submit>[] from memory id 'ZME2M_MEMID'." OLD
free memory id 'ZME2M_MEMID'.
* Convert ME2M Field symbl data to simple IT
loop at <lft_submit> assigning <lfs_submit>.
lwa_submit = <lfs_submit>.
append lwa_submit to lt_submit.
endloop.
ā2015 Dec 01 4:44 AM
Hi,
Please try it in the below way. It may work.
DATA : SELTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE.
The below is for Select-options, if you have any parameter in your program then SELTAB-KIND = 'P' and OPTION = 'EQ' and there will not be any HIGH.
SELTAB-SELNAME = 'S_MATNR'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = em_matnr-low.
SELTAB-HIGH = em_matnr-high.
APPEND SELTAB.
CLEAR SELTAB.
SELTAB-SELNAME = 'S_WERKS'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = em_werks-low.
SELTAB-HIGH = em_werks-high.
APPEND SELTAB.
CLEAR SELTAB.
*Similarly code it for the remaining*
SUBMIT rm06em00 USING SELECTION-SCREEN '1000'
WITH SELECTION-TABLE SELTAB AND RETURN.
Regards,
Mounika
ā2015 Dec 01 10:45 AM
Hi Mounika
Thanks Much for your answer.
I find the output for ME2M transaction with your mentioned code..But the requirement is values has to be fetched form ME2M Transaction and display in my selection screen., which is not happening.
Exporting is happening., but not importing..
Iam in need of syntax for Import statement., current syntax is as follows:
DATA : SELTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE.
SUBMIT rm06em00 USING SELECTION-SCREEN '1000'
WITH SELECTION-TABLE SELTAB AND RETURN.
SELTAB-SELNAME = 'S_MATNR'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_matnr-low.
SELTAB-HIGH = S_matnr-high.
APPEND SELTAB.
CLEAR SELTAB.
SELTAB-SELNAME = 'S_WERKS'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_werks-low.
SELTAB-HIGH = S_werks-high.
APPEND SELTAB.
CLEAR SELTAB.
*SELTAB-SELNAME = 'LC_ALV'.
*SELTAB-KIND = 'S'.
*SELTAB-SIGN = 'I'.
*SELTAB-OPTION = 'EQ'.
*SELTAB-LOW = s_lc_alv.
*SELTAB-HIGH =.
*APPEND SELTAB.
*CLEAR SELTAB.
SELTAB-SELNAME = 'S_PSTYP'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_PSTYP-low.
SELTAB-HIGH = S_PSTYP-high.
APPEND SELTAB.
CLEAR SELTAB.
SELTAB-SELNAME = 'S_LIFNR'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_LIFNR-low.
SELTAB-HIGH = S_LIFNR-high.
APPEND SELTAB.
CLEAR SELTAB.
SELTAB-SELNAME = 'S_AEDAT'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_AEDAT-low.
SELTAB-HIGH = S_AEDAT-high.
APPEND SELTAB.
CLEAR SELTAB.
create data fs_data like fs_test.
assign fs_data->* to <lft_submit>.
IMPORT export = <lft_submit>[] from memory id 'ZME2M_MEMID'." OLD
free memory id 'ZME2M_MEMID'.
* Convert ME2M Field symbl data to simple IT
loop at <lft_submit> assigning <lfs_submit>.
lwa_submit = <lfs_submit>.
append lwa_submit to lt_submit.
endloop.
Please Suggest.
Regards
Ssk Bhat
ā2015 Dec 01 11:37 AM
Hi,
What I understood is you want the output from ME2M and use it in your Z program.
You can export the data from ME2M and use it in the Z program using Import.
In the program rm06em00 if you have the final data in itab, then after getting the data into the ITAB use:
export itab to memory id 'DATA'.
and in the Z prog,
submit rm06em00 using selection-screen '1000'
with selection-table SELTAB and return.
import itab = itab from memory id 'DATA'.
As i gone through the program RM06EM00 I got a doubt regarding the code
SELTAB-SELNAME = 'S_MATNR'. "should be 'EM_MATNR'
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_matnr-low.
SELTAB-HIGH = S_matnr-high.
is this working?? As seltab-selname should be the EM_MATNR(this is how the Select-Option for Matnr is declared in RM06EM00).
I hope this might help you.
Regards,
Mounika
ā2015 Dec 02 4:10 AM
Hi Mounika
Thanks much for your time.,
Yes., Your understanding is right.. I use import and export memory ID .,
But Sy-subrc is "4"., at Import Export statement.and the control jumps from loop statement ( loop at <lft_submit> assigning <lfs_submit>.) to Sort . lt_submit itab is not getting filled with values..
*&---------------------------------------------------------------------*
*& Include ZMM_SUPPLIER_MAT_REP_FORM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form GET_BUILD_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_GT_FINAL text
*----------------------------------------------------------------------*
form get_build_data changing lt_final type tt_ty_final.
types: begin of ty_ekbe,
ebeln type ekbe-ebeln,
ebelp type ekbe-ebelp,
zekkn type ekbe-zekkn,
vgabe type ekbe-vgabe,
gjahr type ekbe-gjahr,
belnr type ekbe-belnr,
buzei type ekbe-buzei,
bewtp type ekbe-bewtp,
bwart type ekbe-bwart,
budat type ekbe-budat,
menge type ekbe-menge,
bpmng type ekbe-bpmng,
wrbtr type ekbe-wrbtr,
end of ty_ekbe,
tt_ty_ekbe type standard table of ty_ekbe,
begin of ty_eket,
ebeln type eket-ebeln,
ebelp type eket-ebelp,
etenr type eket-etenr,
eindt type eket-eindt,
end of ty_eket,
tt_ty_eket type standard table of ty_eket,
begin of ty_ekpo,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
loekz type ekpo-loekz,
end of ty_ekpo,
tt_ty_ekpo type standard table of ty_ekpo.
* data : lifnr TYPE lfa1-lifnr.
data: fs_data type ref to data,
fs_test type table of merep_outtab_purchdoc,
lt_submit type table of merep_outtab_purchdoc,
lwa_submit type merep_outtab_purchdoc,
lt_ekbe type tt_ty_ekbe,
lwa_ekbe type ty_ekbe,
lt_eket type tt_ty_eket,
lwa_eket type ty_eket,
lt_ekpo type tt_ty_ekpo,
lwa_ekpo type ty_ekpo,
lwa_final type ty_final.
field-symbols: <lft_submit> type any table,
<lfs_submit> type merep_outtab_purchdoc.
constants : lc_alv type char3 value 'ALV',
lc_e type char1 value 'E',
lc_102 type char3 value '102',
lc_122 type char3 value '122',
lc_m1 type char2 value '-1'.
* fetch from Tcode ME2M
* submit rm06em00 with em_matnr in s_matnr " MATERIALS
* with em_werks in s_werks " Plant
* with listu eq lc_alv "'ALV' " Scope of List
* with s_pstyp in s_pstyp " Item category is populated in pgm as '' & 'L'
* with s_lifnr in s_lifnr " Vendor
* with s_bedat in s_aedat " PO date
* exporting list to memory and return.
DATA : SELTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE.
SUBMIT rm06em00 USING SELECTION-SCREEN '1000'
WITH SELECTION-TABLE SELTAB AND RETURN.
SELTAB-SELNAME = 'EM_MATNR'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_matnr-low.
SELTAB-HIGH = S_matnr-high.
APPEND SELTAB.
CLEAR SELTAB.
SELTAB-SELNAME = 'EM_WERKS'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_werks-low.
SELTAB-HIGH = S_werks-high.
APPEND SELTAB.
CLEAR SELTAB.
*SELTAB-SELNAME = 'LC_ALV'.
*SELTAB-KIND = 'S'.
*SELTAB-SIGN = 'I'.
*SELTAB-OPTION = 'EQ'.
*SELTAB-LOW = s_lc_alv.
*SELTAB-HIGH =.
*APPEND SELTAB.
*CLEAR SELTAB.
SELTAB-SELNAME = 'S_PSTYP'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_PSTYP-low.
SELTAB-HIGH = S_PSTYP-high.
APPEND SELTAB.
CLEAR SELTAB.
SELTAB-SELNAME = 'S_LIFNR'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_LIFNR-low.
SELTAB-HIGH = S_LIFNR-high.
APPEND SELTAB.
CLEAR SELTAB.
SELTAB-SELNAME = 'S_AEDAT'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_AEDAT-low.
SELTAB-HIGH = S_AEDAT-high.
APPEND SELTAB.
CLEAR SELTAB.
create data fs_data like fs_test.
assign fs_data->* to <lft_submit>.
IMPORT export = <lft_submit>[] from memory id 'ZME2M_MEMID'." OLD
free memory id 'ZME2M_MEMID'.
* Convert ME2M Field symbl data to simple IT
loop at <lft_submit> assigning <lfs_submit>.
lwa_submit = <lfs_submit>.
append lwa_submit to lt_submit.
endloop.
if lt_submit is not initial.
* SQL from EKBE - PO History table
select ebeln
ebelp
zekkn
vgabe
gjahr
belnr
buzei
bewtp
bwart
budat
menge
bpmng
wrbtr from ekbe into table lt_ekbe
for all entries in lt_submit
where ebeln = lt_submit-ebeln and
ebelp = lt_submit-ebelp and
bewtp = lc_e AND "'E'
budat IN s_budat.
* SQL from EKET- PO Scheduling Agreement Schedule Lines
select ebeln
ebelp
etenr
eindt from eket into table lt_eket
for all entries in lt_submit
where ebeln = lt_submit-ebeln and
ebelp = lt_submit-ebelp.
* SQL for PO line items deletion / locked
select ebeln
ebelp
loekz from ekpo into table lt_ekpo
for all entries in lt_submit
where ebeln = lt_submit-ebeln and
ebelp = lt_submit-ebelp.
endif.
sort lt_submit by ematn ebeln ebelp.
sort lt_ekbe by ebeln ebelp.
sort lt_eket by ebeln ebelp.
sort lt_ekpo by ebeln ebelp.
loop at lt_submit into lwa_submit.
lwa_final-superfield = lwa_submit-superfield. " Vendor # & name
lwa_final-ematn = lwa_submit-ematn.
lwa_final-txz01 = lwa_submit-txz01.
lwa_final-werks = lwa_submit-werks.
lwa_final-ebeln = lwa_submit-ebeln.
lwa_final-ebelp = lwa_submit-ebelp.
lwa_final-bedat = lwa_submit-bedat.
lwa_final-menge = lwa_submit-menge.
lwa_final-netpr = lwa_submit-netpr.
lwa_final-peinh = lwa_submit-peinh.
* For deletion / locked indicATOR
read table lt_ekpo into lwa_ekpo with key ebeln = lwa_submit-ebeln
ebelp = lwa_submit-ebelp
binary search.
if sy-subrc = 0.
lwa_final-loekz = lwa_ekpo-loekz.
clear: lwa_ekpo.
endif.
* PO doc Scheduled delivery dt
read table lt_eket into lwa_eket with key ebeln = lwa_submit-ebeln
ebelp = lwa_submit-ebelp
binary search.
if sy-subrc = 0.
lwa_final-eindt = lwa_eket-eindt.
clear: lwa_eket.
endif.
* For each ME2M`s O/p record, loop ing the history table EKBE for ALL GRs
loop at lt_ekbe into lwa_ekbe where ebeln = lwa_submit-ebeln and
ebelp = lwa_submit-ebelp.
lwa_final-bwart = lwa_ekbe-bwart.
lwa_final-budat = lwa_ekbe-budat.
if lwa_final-bwart = lc_102 or lwa_final-bwart = lc_122. " make Qty as -ve
lwa_final-menge_h = lwa_ekbe-menge * lc_m1.
else.
lwa_final-menge_h = lwa_ekbe-menge.
endif.
* Only if EKBE`s qty(history) is there, then calculating days b/w Doc Del dt(eindt) to GR`s posting date & Append looped lines
if lwa_final-menge_h is not initial.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = lwa_final-eindt
* I_KEY_DAY_FROM =
i_date_to = lwa_final-budat
* I_KEY_DAY_TO =
i_flg_separate = ' '
importing
e_days = lwa_final-days
* E_MONTHS =
* E_YEARS =
.
endif.
append lwa_final to lt_final.
endloop.
* If no GR history, then only
* If no EKBE`s qty(history), then calculating days b/w Doc Del dt(eindt) to Current System date & append unlooped remaining lines
if lwa_ekbe is initial.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = lwa_final-eindt
* I_KEY_DAY_FROM =
i_date_to = sy-datum "lwa_final-budat
* I_KEY_DAY_TO =
i_flg_separate = ' '
importing
e_days = lwa_final-days
* E_MONTHS =
* E_YEARS =
.
append lwa_final to lt_final.
endif.
clear: lwa_ekbe, lwa_final.
endloop.
DELETE lt_final WHERE budat not IN s_budat.
sort lt_final by superfield ematn ebeln ebelp.
endform. " GET_BUILD_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GT_FINAL text
*----------------------------------------------------------------------*
form display using lt_final type tt_ty_final.
constants: lc_1 type i value '1',
lc_true type sap_bool value 'X'.
try.
call method cl_salv_table=>factory
importing
r_salv_table = gr_alv
changing
t_table = lt_final.
catch cx_salv_msg into gv_oref.
gv_text = gv_oref->get_text( ).
endtry.
*Sorting for Material
call method gr_alv->get_sorts
receiving
value = gr_sorts.
call method gr_sorts->add_sort
exporting
columnname = 'SUPERFIELD'
position = 1 "lc_1 "1
sequence = if_salv_c_sort=>sort_up
subtotal = if_salv_c_bool_sap=>true
group = if_salv_c_sort=>group_none
obligatory = if_salv_c_bool_sap=>true
receiving
value = gr_sort.
* ref is created for get_display setting method for display of alv output.
call method gr_alv->get_display_settings
receiving
value = gr_display.
* enable all the functions
call method gr_alv->get_functions
receiving
value = gr_function.
call method gr_function->set_all
exporting
value = if_salv_c_bool_sap=>true.
*to get all column references.
gr_columns = gr_alv->get_columns( ).
*optimize width of columns
gr_columns->set_optimize( lc_true ).
perform get_col using:
text-000 text-001 text-001 text-001, " EMATN" material #
text-002 text-003 text-003 text-003, " TXZ01" material desc
text-004 text-005 text-005 text-005, " WERKS" plant
text-006 text-007 text-007 text-008, " EBELN" PO
text-008 text-009 text-009 text-009, " EBELP" PO Item
text-010 text-011 text-011 text-011, " BEDAT" PO dt
text-012 text-013 text-013 text-013, " MENGE" Qty ordered
text-014 text-015 text-015 text-015, " EINDT" Doc Delivery Dt
text-016 text-017 text-017 text-017, " NETPR" Net price
text-018 text-019 text-019 text-019, " PEINH" per
text-020 text-021 text-021 text-021, " BWART" Mvnmt type
text-022 text-023 text-023 text-023, " BUDAT" Actual Del Dt
text-024 text-025 text-025 text-025, " MENGE_H" Del Qty
text-026 text-027 text-027 text-027, " DAYS" Days late/Early
text-028 text-029 text-029 text-029, " SUPERFIELD " Vendor # & Name
text-030 text-031 text-031 text-031. " LOEKZ " Del / Lock
call method gr_alv->display( ) .
endform. " DISPLAY
*&---------------------------------------------------------------------*
*& Form GET_COL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_TEXT_000 text
* -->P_TEXT_001 text
* -->P_TEXT_001 text
* -->P_TEXT_001 text
*----------------------------------------------------------------------*
form get_col using text1 type any " P_TEXT_001
text2 type any " P_TEXT_002
text3 type any " P_TEXT_002
text4 type any." P_TEXT_002.
data: l_v_oref type ref to cx_root,
l_v_text1 type string.
try.
call method gr_columns->get_column
exporting
columnname = text1
receiving
value = gr_column.
catch cx_salv_not_found into l_v_oref.
l_v_text1 = l_v_oref->get_text( ).
endtry.
try.
call method gr_column->set_short_text
exporting
value = text2+0(05).
call method gr_column->set_medium_text
exporting
value = text3+0(10).
call method gr_column->set_long_text
exporting
value = text4.
call method gr_column->set_alignment
exporting
value = if_salv_c_alignment=>centered.
*to maintain +ve / -ve sign even when downloaded to Spreadsheet
gr_column->set_sign( abap_true ).
catch cx_salv_not_found.
endtry.
endform. " GET_COL
Please do the needful..
Regards
Ssk bhat
ā2015 Dec 02 4:33 AM
Hi,
You need to append seltab value first and them write the SUBMIT syntax. In the above code you are first submitting the program without any Input. SELTAB is used to provide input from the current prog to the destined program. So, your code should be
SELTAB-SELNAME = 'EM_MATNR'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_matnr-low.
SELTAB-HIGH = S_matnr-high.
APPEND SELTAB.
CLEAR SELTAB.
SELTAB-SELNAME = 'EM_WERKS'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_werks-low.
SELTAB-HIGH = S_werks-high.
APPEND SELTAB.
CLEAR SELTAB.
*SELTAB-SELNAME = 'LC_ALV'.
*SELTAB-KIND = 'S'.
*SELTAB-SIGN = 'I'.
*SELTAB-OPTION = 'EQ'.
*SELTAB-LOW = s_lc_alv.
*SELTAB-HIGH =.
*APPEND SELTAB.
*CLEAR SELTAB.
SELTAB-SELNAME = 'S_PSTYP'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_PSTYP-low.
SELTAB-HIGH = S_PSTYP-high.
APPEND SELTAB.
CLEAR SELTAB.
SELTAB-SELNAME = 'S_LIFNR'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_LIFNR-low.
SELTAB-HIGH = S_LIFNR-high.
APPEND SELTAB.
CLEAR SELTAB.
SELTAB-SELNAME = 'S_AEDAT'.
SELTAB-KIND = 'S'.
SELTAB-SIGN = 'I'.
SELTAB-OPTION = 'BT'.
SELTAB-LOW = S_AEDAT-low.
SELTAB-HIGH = S_AEDAT-high.
APPEND SELTAB.
CLEAR SELTAB.
SUBMIT rm06em00 USING SELECTION-SCREEN '1000'
WITH SELECTION-TABLE SELTAB AND RETURN.
"After this statement use Import
Let me know if you are facing the same problem
Regards,
Mounika
ā2015 Dec 02 5:30 AM
Hi
I tried with both first submit and then seltab., nd viceversa... I need your help on Import Export statement syntax..
Line :
IMPORT export = <lft_submit>[] from memory id 'ZME2M_MEMID'." OLD
free memory id 'ZME2M_MEMID'.
at Import Export statement, the control jumps from loop statement ( loop at <lft_submit> assigning <lfs_submit>.) to Sort .
lt_submit itab is not getting filled with values..
Pls suggest.
Regards
Ssk Bhat.
ā2015 Dec 02 5:46 AM
Hi,
In the above, as you coded, 'export' should be the final table data from ME2M. Did you declare that in the same way? and you need to EXPORT the data from the destined program to the Z program then, debug the code, check what data does the internal table from ME2M contains or whether the table is getting filled or not with the desired result.
Still if you are facing the same problem then attach the necessary screenshots from both the programs.
Regards,
Mounika
ā2015 Dec 02 6:23 AM
Hi,
Try the below way.
export em_matnr from s_matnr to memory id 'MATNR'.
export em_werks from s_werks to memory id 'WERKS'.
"similarly export the remaining.
submit <program> and return. "dont use seltab as you are exporting the inputs already using EXPORT
IMPORT itab = itab from memory id 'MEM'.
the above code should be written in the Z prog.
and in the <program>(Destined prog)
after declaration use:
import em_matnr from memory id 'MATNR'.
import em_werks from memory id 'WERKS'.
"Similarly for the remaining
"the coding starts and lets suppose you got your output in a table 'ITAB', use the below once the desired output is in the particular internal table 'ITAB'.
export itab to memory id 'MEM'.
I hope this will help you.
Regards,
Mounika