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

Automatic Batch Classification.

Former Member
0 Likes
1,710

Hi Experts.

I need to populate batch characteristics automatically when user performs Goods Receipt.

Header data (Mkpf) will be the same data for all positions in GR so I need to copy mkpf-frbnr, mkpf-lfsnr to batch characteristics.

I have activated user exit MBCFC004 in order to catch MKPF data.

Please HElp.

BR.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,222

HI Shailaja.

Following your advice I've coded the following instructions, but batch characteristic still blank, means update is not working.

Do you see anything wrong in my code?

Please help.

BR.

Juan.

_________________________________________________

data: t_characters like characters occurs 0 with header line.

data: t_attributes like api_ch_att occurs 0 with HEADER LINE.

data: t_values like api_val_i OCCURS 0 WITH HEADER LINE.

t_characters[ ] = characters[ ].

t_attributes[ ] = attributes[ ].

t_values[ ] = values[ ].

Loop at t_characters.

Case t_characters-atnam.

When 'LO_PEDIMENTO'.

READ TABLE t_values WITH KEY atinn = t_characters-atinn.

MOVE i_mkpf-frbnr to t_values-atwtb.

Move t_characters-atinn to t_values-atinn.

move t_characters-atnam to t_values-atnam.

append t_values.

endcase.

ENDLOOP.

6 REPLIES 6
Read only

Former Member
0 Likes
1,222

Hi,

Use the exit MBCFC004 >EXIT_SAPMM07M_004> ZXMBCU04.

Table characters contains the characteristics of he batch ......

You can loop the character table based on the field atnam .....you can update the table (values).....fields atinn,atnam,atwtb

Thanks,

Shailaja Ainala.

Read only

0 Likes
1,222

Hi Shailaja.

Regarding your advice, I have coded the following program :

&----


*& Include ZXMBCU04

&----


data: t_characters like characters occurs 0 with header line.

data: t_attributes like api_ch_att occurs 0 with HEADER LINE.

data: t_values like api_val_i OCCURS 0 WITH HEADER LINE.

t_characters[ ] = characters[ ].

t_attributes[ ] = attributes[ ].

t_values[ ] = values[ ].

Loop at t_characters.

Case t_characters-atnam.

When 'LO_PEDIMENTO'.

READ TABLE t_values WITH KEY atinn = t_characters-atinn.

MOVE i_mkpf-frbnr to t_values-atwtb.

Move t_characters-atinn to t_values-atinn.

move t_characters-atnam to t_values-atnam.

append t_values.

endcase.

ENDLOOP.

However Batch clasification is not working. It continues without data.

Hope you can help me.

BR.

Juan.

Read only

0 Likes
1,222

Shailaja, Please don´t take in account my last response...

I had problems with my web browser..

BR.

Juan.

Read only

0 Likes
1,222

Hi Shailaja,

Problem was solved, I had to move T_values data to Values table.

Here is last code.

Thanks a Lot.

BR.

Juan.

DATA: T_CHARACTERS LIKE CHARACTERS OCCURS 0 WITH HEADER LINE.

DATA: T_ATTRIBUTES LIKE API_CH_ATT OCCURS 0 WITH HEADER LINE.

DATA: T_VALUES LIKE API_VAL_I OCCURS 0 WITH HEADER LINE.

T_CHARACTERS[] = CHARACTERS[].

T_ATTRIBUTES[] = ATTRIBUTES[].

T_VALUES[] = VALUES[].

LOOP AT T_CHARACTERS.

READ TABLE T_VALUES WITH KEY ATINN = T_CHARACTERS-ATINN.

CASE T_CHARACTERS-ATNAM.

WHEN 'LO_PEDIMENTO'.

MOVE I_MKPF-FRBNR TO T_VALUES-ATWTB.

WHEN 'LO_FECHA'.

CONCATENATE I_MKPF-BUDAT+6(2)

I_MKPF-BUDAT+4(2)

I_MKPF-BUDAT(4)

into T_VALUES-ATWTB.

"MOVE I_MKPF-BUDAT TO T_VALUES-ATWTB.

WHEN 'LO_GUIAAA'.

MOVE I_MKPF-XBLNR(3) TO T_VALUES-ATWTB.

ENDCASE.

MOVE T_CHARACTERS-ATINN TO T_VALUES-ATINN.

MOVE T_CHARACTERS-ATNAM TO T_VALUES-ATNAM.

APPEND T_VALUES.

MOVE T_VALUES TO VALUES.

APPEND VALUES.

CLEAR T_VALUES.

ENDLOOP.

Read only

Former Member
0 Likes
1,223

HI Shailaja.

Following your advice I've coded the following instructions, but batch characteristic still blank, means update is not working.

Do you see anything wrong in my code?

Please help.

BR.

Juan.

_________________________________________________

data: t_characters like characters occurs 0 with header line.

data: t_attributes like api_ch_att occurs 0 with HEADER LINE.

data: t_values like api_val_i OCCURS 0 WITH HEADER LINE.

t_characters[ ] = characters[ ].

t_attributes[ ] = attributes[ ].

t_values[ ] = values[ ].

Loop at t_characters.

Case t_characters-atnam.

When 'LO_PEDIMENTO'.

READ TABLE t_values WITH KEY atinn = t_characters-atinn.

MOVE i_mkpf-frbnr to t_values-atwtb.

Move t_characters-atinn to t_values-atinn.

move t_characters-atnam to t_values-atnam.

append t_values.

endcase.

ENDLOOP.

Read only

0 Likes
1,222

Hi,

data: t_characters like characters occurs 0 with header line.

data: t_attributes like api_ch_att occurs 0 with HEADER LINE.

data: t_values like api_val_i OCCURS 0 WITH HEADER LINE.

t_characters[ ] = characters[ ].

t_attributes[ ] = attributes[ ].

t_values[ ] = values[ ].

Loop at t_characters.

Case t_characters-atnam.

When 'LO_PEDIMENTO'.

MOVE i_mkpf-frbnr to t_values-atwtb.

Move t_characters-atinn to t_values-atinn.

move t_characters-atnam to t_values-atnam.

append t_values.

clear : t_values.

endcase.

ENDLOOP.

Thanks,

Shailaja Ainala.