on 10-28-2019 9:49 AM
I create a RFC function module in SE38 with table parameter COMPANY_LIST and import parameter companyID
the code is like below
FUNCTION BAPI_COMPANY_GETDETAIL1.
CLEAR COMPANY_LIST.
CLEAR T880.
*authority check: S_TABU_DIS V_T001
PERFORM CHECK_AUTHORITY_T880 CHANGING RETURN.
CHECK RETURN IS INITIAL.
SELECT SINGLE RCOMP NAME1 FROM T880 INTO COMPANY_LIST WHERE RCOMP = COMPANYID.
IF SY-SUBRC NE 0.
CLEAR MESSAGE.
MESSAGE-MSGTY = 'E'.
MESSAGE-MSGID = 'FN'.
MESSAGE-MSGNO = 030.
MESSAGE-MSGV1 = COMPANYID.
PERFORM SET_RETURN_MESSAGE USING MESSAGE
CHANGING RETURN.
IF 1 = 2. " Für Verwendungsnachweis Messages
MESSAGE E030(FN) WITH COMPANYID.
* Die Gesellschaft & ist nicht vorhanden
ENDIF.
ENDIF.
CHECK RETURN IS INITIAL.ENDFUNCTION.
then I called the function with below code and nothing returned.
REPORT Z_LOKI_TEST07.
DATA :
companyid TYPE BAPI0014_2-COMPANY,
li_clist TYPE BAPI0014_1,
l_clist TYPE STANDARD TABLE OF BAPI0014_1.
companyid = '001000'.
CALL FUNCTION 'BAPI_COMPANY_GETDETAIL1'
EXPORTING
COMPANYID = companyid
TABLES
COMPANY_LIST = l_clist.
READ TABLE l_clist INTO li_clist INDEX 1.
I debugged and the COMPANY_LIST has data in the module. But the after calling the l_clist table is empty. What's the reason?can someone help? Thx.
Not sure how you've managed to create an FM that doesn't start with Z (and why?) but, as others said, the SELECT statement in FM doesn't fill in the table.
I don't see it mentioned in the question that you've already debugged the FM and confirmed that it actually finds any data though. The calling program does not analyze any error messages returned by FM, so there could be any number of errors (e.g. authorization check) occurring without the calling program doing anything about it.
As a side note, if this FM just reads one record for one company code then it should be returning a structure, not a table. Just like the BAPI without "1" does. It also doesn't make any sense to have CHECK statement as the last command in any block of code. Might want to use Extended Check tool.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Something strange, your SELECT statement used INTO instead of INTO TABLE, that means the COMPANY_LIST is used as a structure
Maybe your data stay in the header line of hte internal table
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think you have to use INTO TABLE insted of INTO
SELECT SINGLE RCOMP NAME1 FROM T880 INTO TABLE COMPANY_LIST WHERE RCOMP = COMPANYID.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.