Skip to Content
0

Calling MB5B T.code variant from Function Module and usen that FM in Generic Datasource.

Jul 09, 2017 at 07:07 AM

82

avatar image

Hi All,

My requirement is to fetch MB5B t.code variant using functional module, and I have to use that functional module in generic datasource (RSO2). Finally I have to replicate and load data in SAP BW.

I have created custom function module and fethced the variant details by using FM RS_VAR_CONTENT and by using SUBMIT_REPORT I have called the MB5B report. Now if I execute FM its giving same details as MB5B t.code. I have included my FM in generic datasource but I cant load it in BW as we are not filling the fields and Extract Structure is not fetching values from tables. Is there any can we pass the variant values to extract structure. Is it possible to load data to BW via this method or please let me know if;any other alternative available. Please find below code for easy understanding.

FUNCTION ZFG_NEW_1.*"----------------------------------------------------------------------*"*"Local Interface:*" TABLES*" ZZMB5B STRUCTURE ZZMB5B OPTIONAL*" E_T_DATA STRUCTURE ZZMB5B OPTIONAL*"----------------------------------------------------------------------


*{ INSERT EH5K900015 1DATA: it TYPE STANDARD TABLE OF RSPARAMS INITIAL SIZE 0,
wa type rsparams.*CALL TRANSACTION 'MB5B'.
*SUBMIT RM07MLBD AND RETURN WITH SELECTION-SET 'Z_L1'.CALL FUNCTION 'RS_VARIANT_CONTENTS'EXPORTINGREPORT = 'RM07MLBD'
VARIANT = 'Z_L1_1'* MOVE_OR_WRITE = 'W'* NO_IMPORT = ' '* EXECUTE_DIRECT = ' '* IMPORTING* SP =TABLES* L_PARAMS =* L_PARAMS_NONV =* L_SELOP =* L_SELOP_NONV =
VALUTAB = it* OBJECTS =* FREE_SELECTIONS_DESC =* FREE_SELECTIONS_VALUE =* EXCEPTIONS* VARIANT_NON_EXISTENT = 1* VARIANT_OBSOLETE = 2* OTHERS = 3.IF SY-SUBRC <> 0.* Implement suitable error handling hereENDIF.REad TABLE it into wa with key selname = 'DATUM'.
CONCATENATE wa-LOW+6(10) wa-LOW+3(2) wa-LOW+0(2) INTO
wa-low.
CONCATENATE wa-high+6(10) wa-high+3(2) wa-high+0(2) INTO
wa-high.**IF wa-low = '00000000'.*clear wa-low.*ENDIF.**IF wa-high = '00000000'.*clear wa-high.*ENDIF.
MODIFY it FROM wa INDEX sy-tabix TRANSPORTING low high." WHERE selname = 'DATUM'.
CALL FUNCTION 'SUBMIT_REPORT'EXPORTINGreport = 'RM07MLBD'
VARIANT = 'Z_L1_1'
SKIP_SELSCREEN = 'X'TABLES
SELECTION_TABLE = itEXCEPTIONS
JUST_VIA_VARIANT = 1
NO_SUBMIT_AUTH = 2OTHERS = 3 .
*} INSERT

ENDFUNCTION.

Thanks and Regards, Asim.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Matthias Schober Jul 10, 2017 at 06:35 AM
0

Why don´t you use the LBWE Standard Datasources, 2LIS_03_XX ? All relevant information from MB5B should be included there. And you can create a query working like MB5B in BW.

Share
10 |10000 characters needed characters left characters exceeded
Ubaid Khan Jul 11, 2017 at 02:09 PM
0

Hi Matthias,

Thanks for your reply, I have given MB5B t.code just for an example. I have to pass variant values of any ABAP report to extract structure so that we can load in BW.

Please Advice,

Thanks In Advance,

Asim.

Share
10 |10000 characters needed characters left characters exceeded