Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Enhancing a BW Extract Structure

Former Member
0 Likes
492

I have created a ZZ field and appended to the Extract Structure for the Material Master BW DataSource.

However, I need to write the logic to populate the component. What I am trying to do is as follows:

1) In my ZZ field I am grouping MARA-MAKTL into 3 categories; IMPLANT, INSTRUMENT and NOT KNOWN.

2) All MARA-MAKTL starting with 1 (maximum of 3 characters) and MARA-MAKTL 991 are IMPLANTS

3) All MARA-MAKTL starting with 2 (maximum of 3 characters) and MARA-MAKTL 992 are INSTRUMENTS

4) All other MARA-MAKTL are NOT KNOWN

The problem I am having is I do not know how to group. Can someone assist with writing this code? Thanks

I have now written some logic as follows:

DATA: gw_mara TYPE biw_mara_s

CLEAR gw_mara.

IF sy-subrc IS INITIAL.

IF

gw_mara-maktl+0(1) = "1" OR gw_mara-maktl = "991"

THEN

gw_mara-ZZBWIMPINST = "IMPLANT".

ELSEIF

gw_mara-maktl+0(1) = "2" OR gw_mara-maktl = "992"

THEN

gw_mara-ZZBWIMPINST = "INSTRUMENT"

ELSE

gw_mara-ZZBWIMPINST = "NOT KNOWN"

ENDIF.

ENDIF.

But get the message:

"Incorrect logical expression...

Why is this? Thanks

Message was edited by: Niten Shah

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
457

Hello Niten

There are some mistakes in the coding.

(1) Literal values are placed inbetween ' ' and not " ".

(2) <i>then</i> (like in Java) does not exist in ABAP

(3) Does the first IF statement have any meaning? I did not see it that's why I inactivated the coding.

DATA: gw_mara TYPE z_biw_mara_s.

CLEAR gw_mara.

*IF sy-subrc IS INITIAL.
IF ( gw_mara-matkl+0(1) = '1'     OR
     gw_mara-matkl      = '991' ).
*then  " does not exist in ABAP
  gw_mara-zzbwimpinst = 'IMPLANT'.
ELSEIF ( gw_mara-matkl+0(1) = '2'     OR
         gw_mara-matkl      = '992' ).
*then  " does not exist in ABAP
  gw_mara-zzbwimpinst = 'INSTRUMENT'.
ELSE.
  gw_mara-zzbwimpinst = 'NOT KNOWN'.
ENDIF.
*ENDIF.

Regards

Uwe

I have created a ZZ field and appended to the Extract Structure for the Material Master BW DataSource.

However, I need to write the logic to populate the component. What I am trying to do is as follows:

1) In my ZZ field I am grouping MARA-MAKTL into 3 categories; IMPLANT, INSTRUMENT and NOT KNOWN.

2) All MARA-MAKTL starting with 1 (maximum of 3 characters) and MARA-MAKTL 991 are IMPLANTS

3) All MARA-MAKTL starting with 2 (maximum of 3 characters) and MARA-MAKTL 992 are INSTRUMENTS

4) All other MARA-MAKTL are NOT KNOWN

The problem I am having is I do not know how to group. Can someone assist with writing this code? Thanks

I have now written some logic as follows:

DATA: gw_mara TYPE biw_mara_s

CLEAR gw_mara.

IF sy-subrc IS INITIAL.

IF

gw_mara-maktl+0(1) = "1" OR gw_mara-maktl = "991"

THEN

gw_mara-ZZBWIMPINST = "IMPLANT".

ELSEIF

gw_mara-maktl+0(1) = "2" OR gw_mara-maktl = "992"

THEN

gw_mara-ZZBWIMPINST = "INSTRUMENT"

ELSE

gw_mara-ZZBWIMPINST = "NOT KNOWN"

ENDIF.

ENDIF.

But get the message:

"Incorrect logical expression...

Why is this? Thanks

Message was edited by: Niten Shah

2 REPLIES 2
Read only

uwe_schieferstein
Active Contributor
0 Likes
458

Hello Niten

There are some mistakes in the coding.

(1) Literal values are placed inbetween ' ' and not " ".

(2) <i>then</i> (like in Java) does not exist in ABAP

(3) Does the first IF statement have any meaning? I did not see it that's why I inactivated the coding.

DATA: gw_mara TYPE z_biw_mara_s.

CLEAR gw_mara.

*IF sy-subrc IS INITIAL.
IF ( gw_mara-matkl+0(1) = '1'     OR
     gw_mara-matkl      = '991' ).
*then  " does not exist in ABAP
  gw_mara-zzbwimpinst = 'IMPLANT'.
ELSEIF ( gw_mara-matkl+0(1) = '2'     OR
         gw_mara-matkl      = '992' ).
*then  " does not exist in ABAP
  gw_mara-zzbwimpinst = 'INSTRUMENT'.
ELSE.
  gw_mara-zzbwimpinst = 'NOT KNOWN'.
ENDIF.
*ENDIF.

Regards

Uwe

Read only

0 Likes
457

Thanks very much UWE that did the trick