Skip to Content

Need ABAP help with enrichment of extract structure

Hello everyone,

I'm trying to enrich the extract structure of 2LIS_06_INV with field DMBTR from table BSEG.

Key fields to cross reference the two tables ( MC06M_0ITM = extract structure and BSEG) have to be

EBELN

GJAHR

BUKRS

BUZEI

Unfortunately MC06M_0ITM-ZZDMBTR(NUMC, length = 6) and BSEG-DMBTR(NUMC, length = 3) are of varying length. How do I get to make it work?

Coding so far:

---------------------------------

TYPES:

BEGIN OF ls_bseg,

ebeln TYPE bseg-ebeln,

gjahr TYPE bseg-gjahr,

dmbtr TYPE bseg-dmbtr,

END OF ls_bseg.

DATA: LT_2LIS_06_INV TYPE TABLE OF MC06M_0ITM,

LT_BSEG TYPE TABLE OF ls_BSEG,

LS_BSEG TYPE ls_BSEG.

FIELD-SYMBOLS: <FS_DATA> TYPE MC06M_0ITM.

LT_2LIS_06_INV[] = C_T_DATA[].

SELECT EBELN GJAHR DMBTR FROM BSEG

INTO CORRESPONDING FIELDS OF TABLE LT_BSEG

FOR ALL ENTRIES IN LT_2LIS_06_INV

WHERE

EBELN = LT_2LIS_06_INV-EBELN AND

GJAHR = LT_2LIS_06_INV-GJAHR AND

BUKRS = LT_2LIS_06_INV-BUKRS.

SORT LT_BSEG BY EBELN.

LOOP AT LT_2LIS_06_INV ASSIGNING <FS_DATA>.

READ TABLE LT_BSEG INTO LS_BSEG

WITH KEY EBELN = <FS_DATA>-EBELN

BINARY SEARCH.

*

IF SY-SUBRC = 0.

<FS_DATA>-ZZDMBTR = LS_BSEG-DMBTR.

ENDIF.

ENDLOOP.

*

CLEAR C_T_DATA.

C_T_DATA[] = LT_2LIS_06_INV[].

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Sep 13, 2016 at 08:35 AM

    MC06M_0ITM-ZZDMBTR(NUMC, length = 6) and BSEG-DMBTR(NUMC, length = 3)

    As the receiving variable ZZDMBTR is bigger than the DMBTR, the value should not be lost. What is happening for you?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.