on 2024 Aug 05 5:33 PM
Hi All,
I am calling RFC FM from unmanaged RAP as below :
io_request->get_parameters( ) - having empty values when I run the preview of service.
I am providing values - Matnr , Comp code & Batch in the preview fiori selection screen.
But when I run the through gateway - using URI - /sap/opu/odata/sap/YRCXXX/YRFC(im_matnr='2013559',im_plant='1000',im_batch='1003045037')/Set
io_request->get_parameters( ) - has paraemeter values and fetches records from RFC.
---------------------------------------------------------------
@EndUserText.label: 'RFCXXX'
@ObjectModel.query.implementedBy: 'ABAP:ycl_XXX'
@ui: {
headerInfo: {
typeName: 'xxxxxx',
typeNamePlural: 'xxxxx RFC'
}
}
define root custom entity YXXX
with parameters
im_matnr : matnr,
im_plant : werks_d,
im_batch : charg_d
{
@ui.facet : [
{
id : 'KEY_MATERIAL',
purpose : #STANDARD,
type : #IDENTIFICATION_REFERENCE,
label : 'Product',
position : 10 }
]
@ui : {
lineItem : [{position: 10, importance: #HIGH}],
identification: [{position: 10}],
selectionField: [{position: 10}]
}
key KEY_MATERIAL : matnr;
@ui : {
lineItem : [{position: 20, importance: #HIGH}],
identification: [{position: 20}]
//selectionField: [{position: 20}]
}
KEY_BATCH : charg_d;
@ui : {
lineItem : [{position: 30, importance: #HIGH}],
identification: [{position: 30}]
//selectionField: [{position: 30}]
}
KEY_PLANT : werks_d;
KEY_MAKTX : maktx;
KEY_NAME : name1;
CHARG : charg_d;
MATNR : matnr;
MAKTX : maktx;
WERKS : werks_d;
STAT : j_status;
PRUEFLOS : qplos;
ATWRT : atwrt;
}
-------------------------------------------------------------
CLASS ycl_XXX DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_rap_query_provider .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ycl_XXX IMPLEMENTATION.
METHOD if_rap_query_provider~select.
DATA lt_result TYPE STANDARD TABLE OF YGENEO.
DATA: lv_mat TYPE matnr,
lv_matnr TYPE matnr18,
lv_batch TYPE charg_d,
lv_plant TYPE werks_d.
TRY.
TRY.
TRY.
IF io_request->is_data_requested( ).
io_request->get_paging( ).
DATA(lt_filter_cond) = io_request->get_parameters( ).
DATA(lt_filter_cond2) = io_request->get_filter( ).
lv_mat = VALUE #( lt_filter_cond[ parameter_name = 'IM_MATNR' ]-value OPTIONAL ). "Fetching the parameter value
* Convert material to 18 character
lv_matnr = lv_mat.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_matnr
IMPORTING
output = lv_matnr.
lv_mat = lv_matnr.
lv_batch = VALUE #( lt_filter_cond[ parameter_name = 'IM_BATCH' ]-value OPTIONAL ). "Fetching the parameter value
lv_plant = VALUE #( lt_filter_cond[ parameter_name = 'IM_PLANT' ]-value OPTIONAL ).
"Initialize values
DATA(ls_error) = VALUE com_err( ).
CALL FUNCTION 'Z_RFC_XXXX'
EXPORTING
iv_material = lv_mat
iv_batch = lv_batch
iv_plant = lv_plant
iv_Result = 'X'
IMPORTING
et_Result = lt_result.
DATA(lv_offset) = io_request->get_paging( )->get_offset( ).
DATA(lv_page_size) = io_request->get_paging( )->get_page_size( ).
io_response->set_total_number_of_records( lines( lt_result ) ).
io_response->set_data( lt_result ).
ENDIF.
CATCH cx_rap_query_provider INTO DATA(lx_exc).
ENDTRY.
CATCH cx_rfc_dest_provider_error INTO DATA(lx_dest).
ENDTRY.
CATCH cx_rap_query_filter_no_range.
ENDTRY.
ENDMETHOD.
ENDCLASS.
preview probably won't work.
try to create an app to consume the service.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
63 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.