Application Development 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: 

function module

Former Member
0 Kudos

Hi,

I am working on a function module where for all the movement types 901,902,903,904,601,602,603,604 from ZTE003_MOVEMENTS table with material number (ZCO_CSTBRK01-MATNR)having valuation class(MBEW-BKLAS) 3300 should not be updated in table ZCO_CSTBRK01.How can i write an IF condition for this?

Useful answers will be rewarded.

Regards,

Hema

3 REPLIES 3

former_member183890
Participant
0 Kudos

Hi,

Pls find the logic for the same.

1. Populate the ranges object of r_mblnr with the movement types 901,902,903,904,601,602,603 and 604 with the sign of 'E' and option of 'EQ'.

2. Populate the ZCO_CSTBRK01 structure withe material and other data.

3. Before updating the data write a following if logic:

select * from ZTE003_MOVEMENTS table where

matnr = ZCO_CSTBRK01-MATNR

movements in r_mblnr and mbew = 3300.

if sy-subrc = 0.

update table ZCO_CSTBRK01.

endif.

Reward if helpful.

- Irudayaraj Peter

Former Member
0 Kudos

Hi,

I have written a select query like this.

read table T_BKLAS with key MATNR = XMCMSEG-MATNR

BWTAR = XMCMSEG-BWTAR

BKLAS = XMCMSEG-BKLAS.

  • The movement types 901, 902, 601, 602 with valuation class

  • 3300 are ignored and the line item is not updated in the ZCO_CSTBRK01 table

IF ( XMCMSEG-BWART = c_901 or

XMCMSEG-BWART = c_902 or

XMCMSEG-BWART = c_903 or

XMCMSEG-BWART = c_904 or

XMCMSEG-BWART = c_601 or

XMCMSEG-BWART = c_602 or

XMCMSEG-BWART = c_603 or

XMCMSEG-BWART = c_604 )

AND t_bklas-bklas = c_3300.

CONTINUE.

SELECT * FROM ZTE003_MOVEMENTS into TABLE t_final_table

FOR ALL ENTRIES IN t_bklas WHERE matnr = t_bklas-matnr AND

bklas = c_3300.

IF SY-SUBRC <> 0.

update TABLE t_final_table.

ENDIF.

ENDIF.

Here it is giving error as 'field MATNR unknown'.

Could u pls suggest me the proper solution for this?

Regards,

Hema

0 Kudos

Hi,

Pls you check if the table ZTE003_MOVEMENTS and the internal table of T_BKLAS has a firld of matnr in the definition / declarations.

- Irudayaraj Peter