对于自定义表,通过转换出口转换 MATNR 失败 [英] Converting MATNR via conversion exit fails for custom table

查看:25
本文介绍了对于自定义表,通过转换出口转换 MATNR 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 MSEG 中选择材料移动的最新日期,但材料需要有库存,并且来自使用未转换材料名称的定制表.

I'm trying to select the latest date of a material movement from MSEG, but the material needs to be in stock and that is sourced from a bespoke table which uses unconverted Material names.

我已经尝试使用 CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'(和 INPUT),但我不确定如何在选择语句中正确使用它.>

I've tried using the CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT' (and INPUT) but I'm not sure how to properly utilize it in a select statement.

IF MSEG-BWART = '101'.

  CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
    EXPORTING
      INPUT  = ZBJSTOCK-ZMAT10
    IMPORTING
      OUTPUT = WA2-MATNR.

  SELECT MAX( BUDAT_MKPF )
  FROM MSEG
  INTO GRDT
  WHERE MATNR = WA2-MATNR.

ENDIF.

目前,WA2-MATNR 似乎显示为空白,因此不会从 MSEG 中提取数据.

Currently, WA2-MATNR seems to come out as blank and therefore is not pulling the data from MSEG.

推荐答案

你不应该在这里使用转换出口.SAP 表中的物料编号采用内部 (INPUT) 格式,您将其转换为可读格式 (OUTPUT) 以查询表.很明显你不会找到任何东西.

You shouldn't use conversion exit here. Material number in SAP tables lays in internal (INPUT) format and you are converting it into readable format (OUTPUT) in order to query table. It is obvious you will not find anything.

示例:

MATNR 内部格式(用于 OUT 出口)

MATNR internal format (for OUT exits)

000000000000025567

000000000000025567

MATNR 外部格式(用于 IN 出口)

MATNR external format (for IN exits)

25567

转化案例:

000000000000025567 -> CONVERSION_EXIT_MATN1_OUTPUT -> 25567 ✔️

000000000000025567 -> CONVERSION_EXIT_MATN1_OUTPUT -> 25567 ✔️

25567             ;  -> CONVERSION_EXIT_MATN1_OUTPUT -> 25567 ❌ 没有任何变化

25567                           -> CONVERSION_EXIT_MATN1_OUTPUT -> 25567 ❌ nothing changes

25567                  -> CONVERSION_EXIT_MATN1_INPUT -> 000000000000025567 ✔️

25567                           -> CONVERSION_EXIT_MATN1_INPUT -> 000000000000025567 ✔️

000000000000025567 -> CONVERSION_EXIT_MATN1_INPUT -> 000000000000025567 ❌ nng 变化

最有可能的是,您的定制表包含错误的材料编号,因此退出不会返回任何内容.或退出不期望格式的材料编号,例如19 个字符而不是 18 个等等.

000000000000025567 -> CONVERSION_EXIT_MATN1_INPUT -> 000000000000025567 ❌ nng changes

Most likely, your bespoke table contains faulty material number so exit doesn't return anything. Or material number in format that exit doesn't expect, e.g. 19 characters instead of 18 and so on.

附言

仅供参考,您可以使用模板进行转换.与调用转换FM相同

Just for you info, you can use templates for conversion. It is the same as calling conversion FMs

SELECT SINGLE matnr FROM mara INTO @DATA(l_matnr) WHERE EXISTS ( SELECT * FROM mseg WHERE matnr = mara~matnr ).

l_matnr = | { l_matnr ALPHA = OUT } |. <<-- templating

SELECT SINGLE matnr, budat_mkpf
  FROM mseg
  INTO @DATA(l_mkpf)
  WHERE matnr = @l_matnr.

在上面的示例中,SELECT 不会返回任何内容,但如果您注释掉模板行,它会返回.

In the above sample SELECT will not return anything, but if you comment out the template line it will.

这篇关于对于自定义表,通过转换出口转换 MATNR 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆