cancel
Showing results for 
Search instead for 
Did you mean: 

Dump Inner Join in Badi RSU5_SAPI_BADI for User-Exits ?

0 Kudos

Hi, i am try implement BADI CODE for BW extractor and use inner join BUT ABAP code get the Dump.

When we remove INNER Join sintaxis this working, any idea how fix the problem or alternative code for same result ?

SELECT H~OBJECTCLAS H~OBJECTID H~CHANGENR H~USERNAME H~UDATE H~UTIME A~DEPARTMENT INTO TABLE LT_CDHDR FROM CDHDR AS H INNER JOIN USER_ADDR AS A ON H~USERNAME = A~BNAME WHERE H~OBJECTCLAS EQ 'MELDUNG' * AND H~OBJECTID EQ <L_S_DATA>-QMNUM AND A~DEPARTMENT EQ 'Informatica'.

Thank you.

marcobeer
Active Participant
0 Kudos

Hello Victor,

the only reason that seems to cause a dump here could be that "<L_S_DATA>" is not assigned. Could you please post a screenshot of the dump and some more of your code?

Best Regards
Marco

0 Kudos

This Working :

******************** FUNCIONA
SELECT *
INTO TABLE lt_cdhdr
FROM cdhdr
WHERE objectclas = 'MELDUNG'
AND objectid = <L_S_DATA>-QMNUM.

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

This is Code Workin. only need READTABLE for insert in LS_DATA values the Username, Utime, Udate.

FIELD-SYMBOLS: <L_S_DATA> TYPE BWE_QMEL.

DATA:
LT_CDPOS TYPE TABLE OF CDPOS.

DATA: lt_USER_ADDR TYPE STANDARD TABLE OF USER_ADDR,
lt_cdhdr type STANDARD TABLE OF cdhdr.



REFRESH: LT_CDHDR, LT_CDPOS.


LOOP AT C_T_DATA ASSIGNING <L_S_DATA>.


SELECT * FROM user_addr
INTO TABLE lt_user_addr
where DEPARTMENT = 'Compras'.

IF sy-subrc EQ 0.

SELECT * FROM cdhdr
INTO TABLE lt_cdhdr
FOR ALL ENTRIES IN lt_user_addr
WHERE username EQ lt_user_addr-bname
AND OBJECTCLAS EQ 'MELDUNG'
AND OBJECTID EQ <L_S_DATA>-QMNUM.

IF sy-subrc EQ 0.

<L_S_DATA>-ZULMOD = 'CLEFLECH'.
<L_S_DATA>-ZFULMOD = '20221201'.
<L_S_DATA>-ZHULMOD = 50.

ENDIF.


ENDIF.


ENDLOOP.

Thank you.

marcobeer
Active Participant

Hi Victor,

Here you go:

IF sy-subrc EQ 0.
  LOOP AT lt_user_addr ASSIGNING FIELD-SYMBOL(<ls_user_addr>).
    <L_S_DATA>-ZULMOD = <ls_user_addr>-bname.
    <L_S_DATA>-ZFULMOD = '20221201'.
    <L_S_DATA>-ZHULMOD = 50.
	"...do more here
  ENDLOOP.
ENDIF.

Best Regards
Marco

0 Kudos

I try get bname to LS_DATA not working.


SELECT bname FROM user_addr
INTO TABLE lt_user_addr
where DEPARTMENT = 'Compras'.

IF sy-subrc EQ 0.

SELECT * FROM cdhdr
INTO TABLE lt_cdhdr
FOR ALL ENTRIES IN lt_user_addr
WHERE username EQ lt_user_addr-bname
AND OBJECTCLAS EQ 'MELDUNG'
AND OBJECTID EQ <L_S_DATA>-QMNUM.

IF sy-subrc EQ 0.

<L_S_DATA>-ZULMOD = lt_user_addr-bname.
<L_S_DATA>-ZFULMOD = '20221201'.
<L_S_DATA>-ZHULMOD = 50.

ENDIF.


ENDIF.

Any idea. ?

marcobeer
Active Participant
0 Kudos

Hi Victor,

you cannot put a table-field (lt_user_addr-bname) into a field symbol value, you have to read the local table first (READ TABLE) into a structure (LS or WA), since a table can contain multiple values, a structure can only contain one, so you have to declare, which one you want to read, or place a loop over lt_user_addr within the IF-clause.

Best Regards
Marco

0 Kudos

Hi Marco, you can help me in code for insert value the Bname in the Field the Extractor ?

Thank you.

0 Kudos

Hi, i tri using : FOR ALL ENTRIES IN (But have Error)

Any idea ?

marcobeer
Active Participant
0 Kudos

Hi Victor,

please post more information, such as your code and the exact error(s) you receive. Thank you.

Best Regards
Marco

0 Kudos

hi,

METHOD NOTIFICATN_ATTR.

FIELD-SYMBOLS: <L_S_DATA> TYPE BWE_QMEL.

DATA: LV_TABIX TYPE SY-TABIX,
LV_TABKEY TYPE CDPOS-TABKEY,
LT_CDHDR TYPE TABLE OF CDHDR,
ls_cdhdr type standard table of CDHDR,
LT_CDPOS TYPE TABLE OF CDPOS.


TYPES: BEGIN OF ty_cdhdr,
OBJECTCLAS TYPE cdhdr-OBJECTCLAS,
OBJECTID TYPE cdhdr-OBJECTID,
CHANGENR TYPE cdhdr-CHANGENR,
USERNAME TYPE cdhdr-USERNAME,
UDATE TYPE cdhdr-UDATE,
DEPARTMENT type USER_ADDR-DEPARTMENT,
END OF ty_cdhdr.

DATA: WA_CDHDR TYPE STANDARD TABLE OF ty_cdhdr.

LOOP AT C_T_DATA ASSIGNING <L_S_DATA>.

SELECT H~OBJECTCLAS H~OBJECTID H~CHANGENR
H~USERNAME H~UDATE H~UTIME A~DEPARTMENT INTO TABLE WA_CDHDR
FROM CDHDR AS H
INNER JOIN USER_ADDR AS A ON H~USERNAME = A~BNAME
WHERE H~OBJECTCLAS EQ 'MELDUNG'
AND H~OBJECTID EQ <L_S_DATA>-QMNUM
AND A~DEPARTMENT EQ 'Telesoporte'.

IF SY-SUBRC EQ 0.

Any idea ?

marcobeer
Active Participant
0 Kudos

Hi Victor,

Thank you.
"Nicht zugeordnet" at the top of the dump is German and means "Not assigned", which is what I was guessing. But apparently, your field symbol is located within the loop and thus should be assigned. Could you please scroll down in your dump and check the detailed information which states what exactly is not assigned?

PS: You shouldn't call tables "WA_...", since WA means "Work Area" and describes a single lined structure (like LS_ = Local Structure). You should call a local table "LT_...".

Best Regards
Marco

0 Kudos

Hi, i am try : FOR ALL ENTRIES IN

marcobeer
Active Participant
0 Kudos

Hi Victor,

this does not make any sense. You are first of all trying to read "cdhdr" into "lt_user_addr", which can not work, due to both tables having a completely different structure. And secondly, you are not using lt_user_addr in your WHERE clause, you have to do that, when using FOR ALL ENTRIES.

Please see here:
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/de-DE/abenwhere_logexp_itab.htm

Best Regards
Marco

0 Kudos

HI, this is working. but not can get value from bname for insert in LS_DATA


SELECT bname FROM user_addr
INTO TABLE lt_user_addr
where DEPARTMENT = 'Compras'.

IF sy-subrc EQ 0.

SELECT * FROM cdhdr
INTO TABLE lt_cdhdr
FOR ALL ENTRIES IN lt_user_addr
WHERE username EQ lt_user_addr-bname
AND OBJECTCLAS EQ 'MELDUNG'
AND OBJECTID EQ <L_S_DATA>-QMNUM.

IF sy-subrc EQ 0.

<L_S_DATA>-ZULMOD = lt_user_addr-bname.
<L_S_DATA>-ZFULMOD = '20221201'.
<L_S_DATA>-ZHULMOD = 50.

ENDIF.


ENDIF.

Any idea. ?