我目前正在创建一个自定义程序,该程序要求F.M.'sd_salesdocument_create'。
该程序的目的是通过SE38大规模创建SELES订单,从填充有详细信息的.CSV文件开始。
该程序似乎可以正常工作并且创建了订单,但是当我尝试编写销售文档编号(在salesdocument_ex字段中保存)时,程序将打印27个空白行,然后打印消息字符串。
我已经尝试使用设定的空白行,什么也没发生。我的一所大学使用Skip来解决问题和位置命令,但我想知道是否有另一种方法可以这样做,而不会以这种方式强迫输出。
由于我已经试图在SAP官方网站上查找,但没有找到有关如何解决此问题的任何线索,所以我要向您询问。
谢谢您,我正在复制下面的代码:
FORM BAPI .
data: COUNTER1 TYPE N VALUE 0,
COUNTER2 TYPE N VALUE 0,
NUM_CLI like KNA1-KUNNR.
SORT TESTATA BY N_ORDINE.
LOOP AT TESTATA.
AT NEW N_ORDINE.
READ TABLE TESTATA INDEX 1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = TESTATA-N_CLIENTE
IMPORTING
OUTPUT = TESTATA-N_CLIENTE.
SELECT single KUNNR INTO NUM_CLI FROM KNA1
WHERE KUNNR = TESTATA-N_CLIENTE.
IF SY-SUBRC = 0.
COUNTER1 = COUNTER1 + 1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = TESTATA-N_DESTINATARIO
IMPORTING
OUTPUT = TESTATA-N_DESTINATARIO.
SALES_HEADER_IN-DOC_TYPE = TESTATA-TIPO_DOC.
SALES_HEADER_IN-SALES_ORG = 'ZCOM'.
SALES_HEADER_IN-DISTR_CHAN = '01'.
SALES_HEADER_IN-DIVISION = '01'.
SALES_HEADER_IN-REQ_DATE_H = testata-data_comsegna.
SALES_HEADER_IN-PURCH_DATE = testata-data_or_acq_cli.
APPEND SALES_HEADER_IN.
* COUNTER = 0.
SORT CORPO BY N_ORDINE.
LOOP AT CORPO WHERE N_ORDINE = TESTATA-N_ORDINE.
COUNTER = COUNTER + 10.
SELECT SINGLE MATNR INTO MAT_COD FROM MARA WHERE EAN11 =
CORPO-EAN_MAT.
SALES_ITEMS_IN-ITM_NUMBER = COUNTER.
SALES_ITEMS_IN-MATERIAL = MAT_COD.
SALES_ITEMS_IN-PLANT = 'ZDIV'.
SALES_ITEMS_IN-STORE_LOC = 'ZMAG'.
APPEND SALES_ITEMS_IN.
SALES_PARTNERS-PARTN_ROLE = 'AG'.
SALES_PARTNERS-PARTN_NUMB = TESTATA-N_CLIENTE.
APPEND SALES_PARTNERS.
SALES_PARTNERS-PARTN_ROLE = 'WE'.
SALES_PARTNERS-PARTN_NUMB = TESTATA-N_DESTINATARIO.
APPEND SALES_PARTNERS.
SALES_SCHEDULES_IN-ITM_NUMBER = COUNTER.
SALES_SCHEDULES_IN-REQ_QTY = CORPO-QTA.
APPEND SALES_SCHEDULES_IN.
REPLACE ALL OCCURRENCES OF ',' IN CORPO-PREZZO WITH '.'.
SALES_CONDITIONS_IN-ITM_NUMBER = COUNTER.
SALES_CONDITIONS_IN-COND_TYPE = 'PR00'.
SALES_CONDITIONS_IN-COND_VALUE = CORPO-PREZZO.
SALES_CONDITIONS_IN-CURRENCY = TESTATA-VALUTA.
APPEND SALES_CONDITIONS_IN.
ENDLOOP.
CLEAR COUNTER.
PERFORM CALL_FUNCTION.
COMMIT WORK AND WAIT.
WRITE:/ 'COUNTER TESTATA', COUNTER1.
WRITE:/ 'DOCUMENTO', SALESDOCUMENT_EX, 'SCRITTO'.
ENDIF.
ENDAT.
CLEAR SALES_HEADER_IN.
CLEAR SALES_PARTNERS.
CLEAR SALES_ITEMS_IN.
CLEAR SALES_SCHEDULES_IN.
CLEAR SALES_CONDITIONS_IN.
CLEAR NUM_CLI.
LOOP AT RETURN.
WRITE:/ RETURN-MESSAGE.
ENDLOOP.
ENDLOOP.
CLEAR COUNTER1.
ENDFORM. " BAPI
this is the bapi form in which is nested the call function:
FORM CALL_FUNCTION .
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
* SALESDOCUMENT = SALESDOCUMENT_EX
SALES_HEADER_IN = SALES_HEADER_IN
*
** SALES_HEADER_INX =
** SENDER =
** BINARY_RELATIONSHIPTYPE = ' '
INT_NUMBER_ASSIGNMENT = 'X'
** BEHAVE_WHEN_ERROR = ' '
** LOGIC_SWITCH = ' '
BUSINESS_OBJECT = 'BUS2032'
TESTRUN = ' '
* CONVERT_PARVW_AUART = ' '
* STATUS_BUFFER_REFRESH = 'X'
IMPORTING
SALESDOCUMENT_EX = SALESDOCUMENT_EX
* SALES_HEADER_OUT =
* SALES_HEADER_STATUS =
TABLES
RETURN = RETURN
SALES_ITEMS_IN = SALES_ITEMS_IN
* SALES_ITEMS_INX =
SALES_PARTNERS = SALES_PARTNERS
SALES_SCHEDULES_IN = SALES_SCHEDULES_IN
* SALES_SCHEDULES_INX =
SALES_CONDITIONS_IN = SALES_CONDITIONS_IN
* SALES_CONDITIONS_INX =
* SALES_CFGS_REF =
* SALES_CFGS_INST =
* SALES_CFGS_PART_OF =
* SALES_CFGS_VALUE =
* SALES_CFGS_BLOB =
* SALES_CFGS_VK =
* SALES_CFGS_REFINST =
* SALES_CCARD =
* SALES_TEXT = testi e liìni
* SALES_KEYS =
* SALES_CONTRACT_IN =
* SALES_CONTRACT_INX =
* EXTENSIONIN =
* PARTNERADDRESSES =
* SALES_SCHED_CONF_IN =
* ITEMS_EX =
* SCHEDULE_EX =
* BUSINESS_EX =
* INCOMPLETE_LOG =
* EXTENSIONEX =
* CONDITIONS_EX =
* PARTNERS_EX =
* TEXTHEADERS_EX =
* TEXTLINES_EX =
* BATCH_CHARC =
* CAMPAIGN_ASGN =
* CONDITIONS_KONV_EX =
.
ENDFORM. " CALL_FUNCTION
我不确定您的意思是"跳到线和位置命令"。salesdocument_ex是VBELN类型的字段,如果创建了Salsorder,则将包含文档编号。
但是您确定会创建订单吗?在"代码"中,您发布了sales_header_inx和_inx结构,用于项目/计划行。即使创建订单的订单(我认为会),它也不会根据您的输入值。