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

need help

Former Member
0 Likes
473

i have written the following code

LOOP AT gt_ekpo WHERE ebeln NE ' '.

MOVE gt_ekpo-ebeln TO gt_final-ebeln.

MOVE gt_ekpo-matnr TO gt_final-matnr.

READ TABLE gt_mara WITH KEY matnr = gt_ekpo-matnr BINARY SEARCH.

IF sy-subrc = 0.

MOVE gt_mara-bismt TO gt_final-bismt.

ENDIF.

READ TABLE gt_equi WITH KEY matnr = gt_ekpo-matnr BINARY SEARCH.

IF sy-subrc = 0.

MOVE gt_equi-invnr TO gt_final-invnr.

MOVE gt_equi-sernr TO gt_final-sernr.

ENDIF.

APPEND gt_final.

clear gt_final.

the problem is i am comparing all the fields with matnr and reading the remaing fields.

if matnr field is empty, then all the remaing fields are also empty except ebeln.

then when matnr is empty it should not display in the output.

please help me how to write code for this.

4 REPLIES 4
Read only

Former Member
0 Likes
455

if so,

then delete the entries from internal table if matnr is empty.

if you cant do that...then add the condition

LOOP AT gt_ekpo WHERE ebeln NE ' ' and matnr ne ''.

regards,

madhumitha

Read only

Former Member
0 Likes
455

Hi,

Add the condition "check gt_ekpo-matnr ne space", immediatley after the loop as shown in the below code.

LOOP AT gt_ekpo WHERE ebeln NE ' '.

*******

check gt_ekpo-matnr ne space.

*******

MOVE gt_ekpo-ebeln TO gt_final-ebeln.

MOVE gt_ekpo-matnr TO gt_final-matnr.

READ TABLE gt_mara WITH KEY matnr = gt_ekpo-matnr BINARY SEARCH.

IF sy-subrc = 0.

MOVE gt_mara-bismt TO gt_final-bismt.

ENDIF.

READ TABLE gt_equi WITH KEY matnr = gt_ekpo-matnr BINARY SEARCH.

IF sy-subrc = 0.

MOVE gt_equi-invnr TO gt_final-invnr.

MOVE gt_equi-sernr TO gt_final-sernr.

ENDIF.

APPEND gt_final.

clear gt_final.

Regards,

Satya

Read only

Former Member
0 Likes
455

LOOP AT gt_ekpo WHERE ebeln NE ' '.

if gt_ekpo-matnr = ' '.

CONTINUE.

ELSE.

MOVE gt_ekpo-ebeln TO gt_final-ebeln.

MOVE gt_ekpo-matnr TO gt_final-matnr.

READ TABLE gt_mara WITH KEY matnr = gt_ekpo-matnr BINARY SEARCH.

IF sy-subrc = 0.

MOVE gt_mara-bismt TO gt_final-bismt.

ENDIF.

READ TABLE gt_equi WITH KEY matnr = gt_ekpo-matnr BINARY SEARCH.

IF sy-subrc = 0.

MOVE gt_equi-invnr TO gt_final-invnr.

MOVE gt_equi-sernr TO gt_final-sernr.

ENDIF.

APPEND gt_final.

clear gt_final.

ENDIF.

ENDLOOP.

CHECK THE ABOVE CODE AND TRY.

Regards,

Madan.

Read only

Former Member
0 Likes
455

LOOP AT gt_ekpo WHERE ebeln NE ' '

matnr NE ' '.