Functional Spec for Purchase Order Layout Sample
Hi,
Can somebody please assist me with a sample Functional spec. for defining a PO form/ layout?
Thanks
Hi
yes usually customers ask to adopt the same layout as they are already using. Usually I draw the layout on visio and assign a number for each field. In the spec I put the layout picture and and mention for which field where data will come from.
For example:
A. PO header:
Field number | Description | Source
1 | PO number | EKKO-EBELN
2 | Vendor code | EKKO-LIFNR
3 | Vendor name | LFA1-NAME1 * rule 1
C. Rules:
1 - select NAME1 from table LFA1 where LFA1-LIFNR = EKKO-LIFNR
Hope this helps.
Regards
Eduardo Chagas
Similar Messages
-
Is there any function module for purchase order change
Hi Experts,
Is there any function module for purchase order change or i need to do new recording in me22n.
Thanks,
SenthilHi
Function module <b>BAPI_PO_CHANGE</b> enables you to change purchase orders. The Change method uses the technology behind transaction ME22N.
Regards,
Viven -
PO Output For communication does not Show 'Purchase Order Layout' parameter
Hi,
I am working on Implementing PO PDF with XML data and RTF Template. I have created a new template in XML Publisher and followed the following set up steps
Setup / Organizations / Purchasing Options / Control TAB / set 'PO Output Format' = 'PDF'
setup / purchasing / document types / select "Standard Purchase Order" / Set the Document Type Layout to your new template.
When I view the document from PO Summary > inquire > View Document, I get an adobe reader error
'File does not begin with '%PDF-', how ever when I preview it from the template definition, it opens fine.
I tried running PO Output for communication with my custom template but I don't see the parameter 'Purchase Order Layout'. The last parameter in the list is 'Include Blanket'.
Am I missing any set up steps? However when I use the standard Purchase Order Layout in Document Types set up, the Inquire > View Document created a PDF output.
Any help is greatly appreciated.
Thanks,
SharmilaHi,
I am not using a barcode font. I am using RenderX's XSL stylesheets to generate the barcode. As I said, the barcode generate's fine in the PDF on my computer but does not appear in the PDF when the code is moved to Oracle.
Thanks,
Suzanne -
Screen Layout for Purchase Orders
Hello,
Using the screen layout settings in config, I want to set a particular field to display only in change mode in ME22N.
But enjoy PO's are all controlled by entry ME21N only in config, So this means if I set AKTV (change) to display in ME21N transaction the field is display also, something I don't want to happen.
Using ME22 etc it is no issue.
Any thoughts on how to set change mode for enjoy PO's?
Thanks.screen layout for purchase orders are done for document type wise.
go to document type and check the field selecton. now you can change field selection for that document type
spro > mm > purchasing > purchase order > define screen layout for document type.
find the fileld selection key at purchase order > difine document type -
Purchase order layout using Smartform
Hi All,
Can anyone let me know how to create Purchase order layout using smartforms and assigning it to output type.
Is there standard smartform for purchase order?http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
http://www.sap-basis-abap.com/sapsf001.htm
http://help.sap.com/printdocu/core/Print46c/de/data/pdf/BCSRVSCRSF/BCSRVSCRSF.pdf
http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm
http://www.esnips.com/doc/13b7ae7a-b32c-4b96-b588-881859d4ac99/Template,Table,Loop,Command-in-Smartforms.doc
http://www.esnips.com/doc/97acb00a-e513-4611-91f0-c626f460bfc5/Smart_Form_Overview.pdf
http://www.esnips.com/doc/77a981b9-8fe3-4fbb-8101-67745c1fe60c/SMART-FORMS_shail.ppt
http://www.sap-basis-abap.com/sapsf001.htm
http://www.sap-press.com/downloads/h955_preview.pdf
http://www.ossincorp.com/Black_Box/Black_Box_2.htm
http://www.sap-img.com/smartforms/sap-smart-forms.htm
Try this. A simple sample Smart Form.
SAP Smartforms can be used for creating and maintaining forms for mass printing in SAP Systems. The output medium for Smartforms support printer, fax, e-mail, or the Internet (by using the generated XML output).
According to SAP, you need neither have any programming knowledge nor use a Script language to adapt standard forms. However, basic ABAP programming skills are required only in special cases (for example, to call a function module you created or for complex and extensive conditions).
1. Create a new smartforms
Transaction code SMARTFORMS
Create new smartforms call ZSMART
2. Define looping process for internal table
Pages and windows
First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
Here, you can specify your title and page numbering
&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
Main windows -> TABLE -> DATA
In the Loop section, tick Internal table and fill in
ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
3. Define table in smartforms
Global settings :
Form interface
Variable name Type assignment Reference type
ITAB1 TYPE Table Structure
Global definitions
Variable name Type assignment Reference type
ITAB2 TYPE Table Structure
4. To display the data in the form
Make used of the Table Painter and declare the Line Type in Tabstrips Table
e.g. HD_GEN for printing header details,
IT_GEN for printing data details.
You have to specify the Line Type in your Text elements in the Tabstrips Output options.
Tick the New Line and specify the Line Type for outputting the data.
Declare your output fields in Text elements
Tabstrips - Output Options
For different fonts use this Style : IDWTCERTSTYLE
For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
5. Calling SMARTFORMS from your ABAP program
REPORT ZSMARTFORM.
Calling SMARTFORMS from your ABAP program.
Collecting all the table data in your program, and pass once to SMARTFORMS
SMARTFORMS
Declare your table type in :-
Global Settings -> Form Interface
Global Definintions -> Global Data
Main Window -> Table -> DATA
Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
http://sapr3.tripod.com
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc <> 0.
WRITE: / 'ERROR 1'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function FM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
GS_MKPF = INT_MKPF
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
SMARTFORMS GENERATION: (calling internal table fields)
 Open a smartform using the tcode smartforms.
 Usually form attributes shows admn data.
 In the form interface declare import/export parameters if any. Else declare the tables in tables tab button.
 In the windows and pages expand and create a table. It automatically generates header, main area and footer for the table.
 In data tab button in the table we usually declare a work area to bring the data from se38. Like: ktab into wa. ( The purpose of declaring the wa is , to get the data of the ktab in to header from the body area of the internal table).
 And in the tablepainter pushbutton in table we can have any no of line types. Depending on the requirement. ( for ex: If we want to devide a row in to 4 columns, we can devide it as 4,4,4,4cm as line type 1, And usually for the footer we dont need no of columns, So, we declare it as one column with 16cm measure with the name line type 2.). We can use these line types in the tables.
 In the header right click>>create>>tableline. It asks for line type. Select one line type which is appropriate.
 Like same create a row2 in main area using right click. If we select the line type 1, it automatically generates 4 cells. We can create text in each cell as per requirement.
 We can generate general attributes using general attributes tab button in the text. Or in the other way. We can switch on the field list on/off button from the application tool bar. It displays all the attributes in the left down corner of the screen. We can drag and drop the required fields in the general attributes tab button of the text.
 We continue the same procedure for all the texts. The texts should be displayed in the gray color. Then only it can collects the data from the abap editor fields.
 If it wont turns gray, we can check the fields in the editor by changing it to the line editor. The best thing is to drag the fields from the list, rather than declaring like &wa-matnr&
 In the footer also we create a line type and in that table line we create text.
SE38 PROGRAM(method I):
REPORT Z_CALLING_SMARTFORM2 .
tables: mara.
select-options: S_MATNR for MARA-MATNR.
DATA: kTAB LIKE MARA OCCURS 1 WITH HEADER LINE.
data: FM_NAME TYPE RS38L_FNAM.
SELECT * FROM MARA INTO TABLE kTAB WHERE MATNR in
S_MATNR.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_MYFIRST_FORM2'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
ktab = ktab
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IN THE OTHER WAY(method II):
REPORT Z_CALLING_SMARTFORM2 .
tables: mara.
select-options: S_MATNR for MARA-MATNR.
DATA: kTAB LIKE MARA OCCURS 1 WITH HEADER LINE.
SELECT * FROM MARA INTO TABLE kTAB WHERE MATNR in S_MATNR.
CALL FUNCTION '/1BCDWB/SF00000199'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
ktab = ktab
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
In the method I we are calling the amartform dynamically using the function module 'SSF_FUNCTION_MODULE_NAME'.
Here we are exporting form name and importing fm_name.
So we need to declare the variable fm_name as
data: FM_NAME TYPE RS38L_FNAM.
We can have the type of the fm_name in the function module 'SSF_FUNCTION_MODULE_NAME' (in the export tab button).
Since we are passin the name of the Function module generated by the smart form in to the fm_name variable. We run the function module with the name fm_name, but not the FM generated by the smartform(like /1BCDWB/SF00000199)¬¬¬¬¬¬.
In the method II we directly call the smartform generated function module (i.e, /1BCDWB/SF00000199).
But the method I is recommended. In the method I, The fm_name is a variable we dont put it in the quotes while calling.
In the both methods we declare the internal table using the like option, but not begin of . end of. And in select statement we select *, But not individual fields.
EX2:
SMART FORM NAME: ZGITI_FORM1.
SE38:
REPORT Z_CALL_GIRI_FORM1 .
TABLES: VBRK.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE T1.
SELECT-OPTIONS: S_VBELN FOR VBRK-VBELN.
SELECTION-SCREEN END OF BLOCK B1.
*INITIALIZATION.
*T1 = 'SELECTION-CRIETERIA'.
DATA: BEGIN OF I_INVOICE OCCURS 1.
INCLUDE STRUCTURE ZSTR_INVOICE.
DATA: END OF I_INVOICE.
DATA: VAR1 LIKE VBRP-NETWR.
DATA: BEGIN OF I_ADDRESS OCCURS 1.
INCLUDE STRUCTURE ZSTR_ADDRESS.
DATA: END OF I_ADDRESS.
DATA: BEGIN OF I_ORDER OCCURS 1.
INCLUDE STRUCTURE ZSTR_ORDER.
DATA: END OF I_ORDER.
DATA: BEGIN OF I_ITEM OCCURS 1.
INCLUDE STRUCTURE ZSTR_ITEM.
DATA: END OF I_ITEM.
DATA: BEGIN OF I_VBFA OCCURS 1,
VBELV LIKE VBFA-VBELV,
VBELN LIKE VBFA-VBELN,
END OF I_VBFA.
SELECT KUNAG VBELN VKORG VTWEG SPART FROM VBRK INTO TABLE I_INVOICE
WHERE VBELN IN S_VBELN.
IF I_INVOICE[] IS NOT INITIAL.
SELECT KUNNR LAND1 NAME1 NAME2 ORT01 PSTLZ REGIO FROM
KNA1 INTO CORRESPONDING FIELDS OF TABLE I_ADDRESS FOR ALL ENTRIES IN
I_INVOICE WHERE KUNNR = I_INVOICE-KUNAG.
ENDIF.
IF I_INVOICE[] IS NOT INITIAL.
SELECT VBELV VBELN FROM VBFA INTO TABLE I_VBFA FOR ALL ENTRIES IN
I_INVOICE WHERE VBELN = I_INVOICE-VBELN.
ENDIF.
IF I_VBFA[] IS NOT INITIAL.
SELECT VBELN BSTNK FROM VBAK INTO CORRESPONDING FIELDS OF TABLE I_ORDER
FOR ALL ENTRIES IN I_VBFA WHERE VBELN = I_VBFA-VBELV.
ENDIF.
IF I_INVOICE[] IS NOT INITIAL.
SELECT POSNR MATNR ARKTX FKIMG NETWR FROM VBRP INTO TABLE I_ITEM FOR ALL
ENTRIES IN I_INVOICE WHERE VBELN = I_INVOICE-VBELN.
ENDIF.
LOOP AT I_ITEM.
AT LAST.
SUM.
VAR1 = I_ITEM-NETWR.
ENDAT.
ENDLOOP.
CALL FUNCTION '/1BCDWB/SF00000223'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
var = VAR1
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
tables
i_vbrk = I_INVOICE
i_vbak = I_ORDER
i_vbrp = I_ITEM
i_kna1 = I_ADDRESS
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Open items for purchase order its very urgent
hi
my requirement is to write extract program for purchase order(me21) to extract only open items.
please provide sample code its very urgent.
thanks in advance.
points will be rewarded.
thanks
hari prasad reddycheck the below report :
REPORT ZMM_OPEN_PO_REPORT no standard page heading
line-size 255
message-id zwave.
======================================================================
Program Name : ZMM_OPEN_PO_REPORT *
Description : This report displays all Open PO Items and output *
would be PO Number,Material number and so on *
Author : Seshu *
Date : 01/24/2007 *
MODIFICATION HISTORY *
DATE | AUTHOR | CHANGE # | DESCRIPTION OF MODIFICATION *
--|||--
01/24/07| Seshu | DEVK921979 | Initial *
D A T A D E C L A R A T I O N P A R T ***
type-pools
type-pools : slis.
Tables
tables : ekko, " Purchase order Header
ekpo, " Purchase order Item
marc. " Material with Plant data
Internal table for output.
data : begin of i_output occurs 0,
ebeln like ekko-ebeln,
matnr like ekpo-matnr,
end of i_output.
ALV Data declaration.
data : v_repid like sy-repid.
ALV Function Module Variables
DATA: gs_layout type slis_layout_alv,
g_exit_caused_by_caller,
gs_exit_caused_by_user type slis_exit_by_user.
DATA: gt_fieldcat type slis_t_fieldcat_alv,
gs_print type slis_print_alv,
gt_events type slis_t_event,
gt_list_top_of_page type slis_t_listheader,
g_status_set type slis_formname value 'PF_STATUS_SET',
g_user_command type slis_formname value 'USER_COMMAND',
g_top_of_page type slis_formname value 'TOP_OF_PAGE',
g_top_of_list type slis_formname value 'TOP_OF_LIST',
g_end_of_list type slis_formname value 'END_OF_LIST',
g_variant LIKE disvariant,
g_save(1) TYPE c,
g_tabname_header TYPE slis_tabname,
g_tabname_item TYPE slis_tabname,
g_exit(1) TYPE c,
gx_variant LIKE disvariant.
data : gr_layout_bck type slis_layout_alv.
Ranges
ranges r_eindt for eket-eindt.
initialization.
v_repid = sy-repid.
start-of-selection.
Get the data from EKKO ,EKPO and MARC Table
perform get_data_tables.
end-of-selection.
display the data in the form of ALV
perform display_data.
*& Form get_data_tables
Get the data from EKKO,EKPO and MARC Table
FORM get_data_tables.
clear : i_output.
refresh : i_output.
fill the dates in ranges
r_eindt-low = sy-datum - 7.
r_eindt-high = sy-datum + 14.
r_eindt-option = 'BT'.
r_eindt-sign = 'I'.
append r_eindt.
Get the data from EKKO,EKPO and EKET Tables
select aebeln bmatnr into table i_output
from ekko as a inner join
ekpo as b on aebeln = bebeln
inner join marc as c on cmatnr = bmatnr
inner join mara as d on dmatnr = bmatnr
inner join eket as e on eebeln = aebeln
and eebelp = bebelp
where c~beskz = 'E'
and c~werks = '1000'
and d~mtart = 'FERT'
and b~loekz = space
and b~elikz = space
and e~eindt in r_eindt.
if sy-subrc ne 0.
message e000(zwave) with 'No open purchase order found'.
endif.
ENDFORM. " get_data_tables
*& Form display_data
text
FORM display_data.
Fill the Fiedlcat
PERFORM fieldcat_init using gt_fieldcat[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = g_user_command
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = gr_layout_bck
IT_FIELDCAT = gt_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = g_save
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_output
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " display_data
*& Form fieldcat_init
text
-->P_GT_FIELDCAT[] text
FORM fieldcat_init USING e01_lt_fieldcat type slis_t_fieldcat_alv.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
Purchase order number
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'EBELN'.
LS_FIELDCAT-ref_fieldname = 'EBELN'.
LS_FIELDCAT-ref_tabname = 'EKKO'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
ls_fieldcat-seltext_L = 'Purchase Order'.
ls_fieldcat-seltext_M = 'Purchase Order'.
ls_fieldcat-seltext_S = 'Purchase Order'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Material #
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MATNR'.
LS_FIELDCAT-ref_fieldname = 'MATNR'.
LS_FIELDCAT-ref_tabname = 'EKPO'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
ls_fieldcat-seltext_L = 'Material'.
ls_fieldcat-seltext_M = 'Material'.
ls_fieldcat-seltext_S = 'Material'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
ENDFORM. " fieldcat_init -
Goods Receipts for Purchase Order using BAPI_GOODSMVT_CREAT
Hi experts,
I am working on the a program where am generating Goods Receipts for Purchase Order. the BAPI_GOODSMVT_CREAT returns an error saying "Material 6003022 not maintained in plant 1001"
Can any one assist? is there a field I may be missing?
Here is a sample code.
DATA: gm_header TYPE bapi2017_gm_head_01.
DATA: gm_code TYPE bapi2017_gm_code.
DATA: gm_headret TYPE bapi2017_gm_head_ret.
DATA: gm_item TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE.
DATA: gm_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: gm_retmtd TYPE bapi2017_gm_head_ret-mat_doc.
CLEAR: gm_return, gm_retmtd.
REFRESH gm_return.
Setup BAPI header
"data
gm_header-pstng_date = sy-datum.
gm_header-doc_date = sy-datum.
gm_code-gm_code = '02'.
" MB1A * Write 971 movement to table CLEAR GM_ITEM.
MOVE '101' TO gm_item-move_type .
" MOVE 'Q' TO GM_ITEM-SPEC_STOCK.
MOVE '6003022' TO gm_item-material.
MOVE '10' TO gm_item-entry_qnt.
MOVE 'EA' TO gm_item-entry_uom.
MOVE '1001' TO gm_item-plant.
MOVE '' TO gm_item-stge_loc.
MOVE '0901' TO gm_item-move_reas.
" MOVE '4500006877' TO GM_ITEM-WBS_ELEM.
" MOVE '0020' TO GM_ITEM-VAL_WBS_ELEM.
MOVE '0020' TO gm_item-deliv_numb.
MOVE '4500006881' TO gm_item-po_number.
MOVE '0010' TO gm_item-po_item.
APPEND gm_item.
Call goods movement BAPI
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = gm_header
goodsmvt_code = gm_code
IMPORTING
goodsmvt_headret = gm_headret
materialdocument = gm_retmtd
TABLES
goodsmvt_item = gm_item
return = gm_return.
IF NOT gm_retmtd IS INITIAL.
COMMIT WORK AND WAIT.
CALL FUNCTION 'DEQUEUE_ALL'.
ELSE.
COMMIT WORK AND WAIT.
CALL FUNCTION 'DEQUEUE_ALL'.
ENDIF.>
Spark842 wrote:
> Hi experts,
> I am working on the a program where am generating Goods Receipts for Purchase Order. the BAPI_GOODSMVT_CREAT returns an error saying "Material 6003022 not maintained in plant 1001"
> Can any one assist? is there a field I may be missing?
>
> Here is a sample code.
>
> DATA: gm_header TYPE bapi2017_gm_head_01.
> DATA: gm_code TYPE bapi2017_gm_code.
> DATA: gm_headret TYPE bapi2017_gm_head_ret.
> DATA: gm_item TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE.
> DATA: gm_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE.
> DATA: gm_retmtd TYPE bapi2017_gm_head_ret-mat_doc.
> CLEAR: gm_return, gm_retmtd.
> REFRESH gm_return.
> * Setup BAPI header
> "data
> gm_header-pstng_date = sy-datum.
> gm_header-doc_date = sy-datum.
> gm_code-gm_code = '02'.
>
>
> " MB1A * Write 971 movement to table CLEAR GM_ITEM.
> MOVE '101' TO gm_item-move_type .
> " MOVE 'Q' TO GM_ITEM-SPEC_STOCK.
> MOVE '6003022' TO gm_item-material.
> MOVE '10' TO gm_item-entry_qnt.
> MOVE 'EA' TO gm_item-entry_uom.
> MOVE '1001' TO gm_item-plant.
> MOVE '' TO gm_item-stge_loc.
> MOVE '0901' TO gm_item-move_reas.
> " MOVE '4500006877' TO GM_ITEM-WBS_ELEM.
> " MOVE '0020' TO GM_ITEM-VAL_WBS_ELEM.
> MOVE '0020' TO gm_item-deliv_numb.
> MOVE '4500006881' TO gm_item-po_number.
> MOVE '0010' TO gm_item-po_item.
> APPEND gm_item.
>
> * Call goods movement BAPI
>
> CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
> EXPORTING
> goodsmvt_header = gm_header
> goodsmvt_code = gm_code
> IMPORTING
> goodsmvt_headret = gm_headret
> materialdocument = gm_retmtd
> TABLES
> goodsmvt_item = gm_item
> return = gm_return.
>
> IF NOT gm_retmtd IS INITIAL.
>
> COMMIT WORK AND WAIT.
> CALL FUNCTION 'DEQUEUE_ALL'.
> ELSE.
> COMMIT WORK AND WAIT.
>
> CALL FUNCTION 'DEQUEUE_ALL'.
> ENDIF.
My guess, is that this material is not really maintained in the Plant '1001', to be on the safer side, get the exact values from EKPO itself, also check if this material exists in the table MARC for the plant and storage location.
MOVE '1001' TO gm_item-plant. "<< Hard coded
MOVE '' TO gm_item-stge_loc.
Replace the above hardcodes to something like this to get the actual value from EKPO.
select werks lgort into (gm_item-plant, gm_item-stge_loc) from ekpo
where ebeln = gm_item-po_number
and ebelp = gm_item-po_item. -
Getting errors when iam using BAPI_PO_CREATE1 for Purchase Order creation
Hi sap Gurus,
I am getting Errors when iam using BAPI_PO_CREATE1 for Purchase Order creation that Material (144) does not exist but it is alreardy maintained in MM01.
I dont get how it is coming.and what are the mandatory fields in bapi BAPI_PO_CREATE1 in item level .that is too material only.
pls let me know .
thanks in advance.Hi,
Check the sample code..
report zpo_test .
*DATA DECLARATION
constants : c_x value 'X'.
*Structures to hold PO header data
data : header like bapimepoheader ,
headerx like bapimepoheaderx .
*Structures to hold PO account data
data : account like bapimepoaccount occurs 0 with header line ,
accountx like bapimepoaccountx occurs 0 with header line .
*Internal Tables to hold PO ITEM DATA
data : item like bapimepoitem occurs 0 with header line,
itemx like bapimepoitemx occurs 0 with header line,
*Internal table to hold messages from BAPI call
return like bapiret2 occurs 0 with header line,
*Internal table to hold messages from BAPI call
pocontractlimits like bapiesucc occurs 0 with header line.
data : w_header(40) value 'PO Header',
purchaseorder like bapimepoheader-po_number,
delivery_date like bapimeposchedule-delivery_date.
data : ws_langu like sy-langu.
*text-001 = 'PO Header' - define as text element
selection-screen begin of block b1 with frame title text-001.
parameters : company like header-comp_code default '122' ,
doctyp like header-doc_type default 'NB' ,
cdate like header-creat_date default sy-datum ,
vendor like header-vendor default '2000000012' ,
pur_org like header-purch_org default 'PU01' ,
pur_grp like header-pur_group default '005' .
*sociedad like HEADER-COMP_CODE default '122' ,
*vendedor like HEADER-SALES_PERS default 'sale person'.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters : item_num like item-po_item default '00010',
material like item-material default '12000000' ,
tipo_imp like item-acctasscat default 'K' ,
*pos_doc like ITEM-ITEM_CAT default 'F' ,
shorttxt like item-short_text default 'PRUEBA BAPI' ,
grup_art like item-matl_group default '817230000' ,
plant like item-plant default '3001' ,
mpe like item-trackingno default '9999' ,
*contrato like ITEM-AGREEMENT default '4904000003' ,
*quantity like ITEM-QUANTITY default 1 .
po_unit like item-po_unit default 'EA'.
selection-screen end of block b2.
Par?mnetros de imputaci?n
selection-screen begin of block b3 with frame title text-004.
parameters : centro like account-costcenter default '1220813150',
cuenta like account-gl_account default '6631400' ,
num_pos like account-po_item default '10' ,
serial like account-serial_no default '01' ,
ind_imp like account-tax_code default 'I2' .
selection-screen end of block b3.
start-of-selection.
*DATA POPULATION
ws_langu = sy-langu. "Language variable
*POPULATE HEADER DATA FOR PO
*HEADER-COMP_CODE = sociedad .
header-doc_type = doctyp .
header-vendor = vendor .
header-creat_date = cdate .
header-created_by = 'TD17191' .
header-purch_org = pur_org .
header-pur_group = pur_grp .
header-comp_code = company .
header-langu = ws_langu .
*HEADER-SALES_PERS = vendedor .
*HEADER-CURRENCY = 'DOP' .
*HEADER-ITEM_INTVL = 10 .
*HEADER-PMNTTRMS = 'N30' .
*HEADER-EXCH_RATE = 1 .
*POPULATE HEADER FLAG.
headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-vendor = c_x.
headerx-creat_date = c_x.
headerx-created_by = c_x.
headerx-purch_org = c_x.
headerx-pur_group = c_x.
headerx-langu = c_x.
*HEADERX-sales_pers = c_x.
*HEADERX-CURRENCY = c_x.
*HEADER-ITEM_INTVL = c_x.
*HEADER-PMNTTRMS = c_x.
*HEADER-EXCH_RATE = c_x.
*HEADER-EXCH_RATE = c_x.
*POPULATE ITEM DATA.
item-po_item = item_num.
item-quantity = '1'.
*ITEM-MATERIAL = material .
item-short_text = 'prueba bapi_po_create1'.
*ITEM-TAX_CODE = ''.
item-acctasscat = 'K' .
*ITEM-ITEM_CAT = 'D' .
item-matl_group = '817230000' .
item-plant = '3001' .
item-trackingno = '99999'.
item-preq_name = 'test'.
*ITEM-AGREEMENT = '' .
*ITEM-AGMT_ITEM = ''.
item-quantity = '1' .
item-po_unit = 'EA'.
*ITEM-ORDERPR_UN = 'EA'.
item-conv_num1 = '1'.
item-conv_den1 = '1'.
item-net_price = '1000000' .
item-price_unit = '1'.
item-gr_pr_time = '0'.
item-prnt_price = 'X'.
item-unlimited_dlv = 'X'.
item-gr_ind = 'X' .
item-ir_ind = 'X' .
item-gr_basediv = 'X'.
*ITEM-PCKG_NO = '' .
append item. clear item.
*POPULATE ITEM FLAG TABLE
itemx-po_item = item_num.
itemx-po_itemx = c_x.
*ITEMX-MATERIAL = C_X.
itemx-short_text = c_x.
itemx-quantity = c_x.
*ITEMX-TAX_CODE = C_X.
itemx-acctasscat = c_x.
*ITEMX-ITEM_CAT = c_x.
itemx-matl_group = c_x.
itemx-plant = c_x.
itemx-trackingno = c_x.
itemx-preq_name = c_x.
*ITEMX-AGREEMENT = C_X.
*ITEMX-AGMT_ITEM = c_x.
itemx-stge_loc = c_x.
itemx-quantity = c_x.
itemx-po_unit = c_x.
*ITEMX-ORDERPR_UN = C_X.
itemx-conv_num1 = c_x.
itemx-conv_den1 = c_x.
itemx-net_price = c_x.
itemx-price_unit = c_x.
itemx-gr_pr_time = c_x.
itemx-prnt_price = c_x.
itemx-unlimited_dlv = c_x.
itemx-gr_ind = c_x .
itemx-ir_ind = c_x .
itemx-gr_basediv = c_x .
append itemx. clear itemx.
*POPULATE ACCOUNT DATA.
account-po_item = item_num.
account-serial_no = serial .
account-creat_date = sy-datum .
account-costcenter = centro .
account-gl_account = cuenta .
account-gr_rcpt = 'tester'.
append account. clear account.
*POPULATE ACCOUNT FLAG TABLE.
accountx-po_item = item_num .
accountx-po_itemx = c_x .
accountx-serial_no = serial .
accountx-serial_nox = c_x .
accountx-creat_date = c_x .
accountx-costcenter = c_x .
accountx-gl_account = c_x .
account-gr_rcpt = c_x.
append accountx. clear accountx.
*BAPI CALL
call function 'DIALOG_SET_NO_DIALOG'.
call function 'BAPI_PO_CREATE1'
exporting
poheader = header
poheaderx = headerx
importing
exppurchaseorder = purchaseorder
tables
return = return
poitem = item
poitemx = itemx
poaccount = account
poaccountx = accountx.
*Confirm the document creation by calling database COMMIT
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
IMPORTING
RETURN =
end-of-selection.
*Output the messages returned from BAPI call
loop at return.
write / return-message.
endloop.
Regards
Sudheer -
What is Sap Scripts for purchase order
hai,
what is the sap script or smart form for purchase order,
and how to modify the existing standerd one.
explain me in step by step.hi
Please ask question on sapscript in sapscript forum.
use sap script form medruck for PO
SmartForm /BPR3PF/MMPO_L is the standard delivered Purchase Order in 4.6c
Transaction code m/34 allows you to associate your 'Y' copy of the standad PO to your included company specific PO requirements such as company log graphic and other particulars.
Go to transaction OMFE. Tell me what you see there for the output type you are interested in. Let me take the standard output type NEU. The entry looks something like this.
NEU Purchase order 1 SAPFM06P ENTRY_NEU MEDRUCK.
The first one is your output type, next is its description, next is the medium, then the program, routine, and the form name.
You already copied the layout MEDRUCK to ZMEDRUCK. Now copy SAPFM06P to ZZSAPFM06P. Now ENTRY_NEU routine is in the include FM06PE02. You need to make your changes here to accommodate for the new field. So copy this include to ZZFM06PE02 and make your changes. Also, in ZZSAPFM06P, change the line where it says INCLUDE FM06PE02 to INCLUDE ZZFM06PE02.
Now in this routine ENTRY_NEU, there is a function module call ME_READ_PO_FOR_PRINTING which reads in the PO data from the tables. We need to copy this function module as well as this is where you will do your extra selections for the new fields. You will do the same with the other function call ME_PRINT_PO, if you need to change anything on the print.
after this to define output type...
NACE
You can track the form and the print program used for that form
NACE is used to create output type while creating the output type you will mention forms, and driver program.
that will be maintained in the table TNAPR.if you create the output type using NACE then it will be automatically visible in table NAST and TNAPR.
so check in NAST, TNAPR table
http://help.sap.com/saphelp_erp2005/helpdata/en/c8/1989fe43b111d1896f0000e8322d00/frameset.htm
Condition records in NACE?
EX--in simple terms..take a transaction say ME21N ( Purchase Order ), u can see a Print icon there. now when u click on this icon, it has to print the PO document. Now how does it do that? when u click Print, the control gets transffered to a print program, now which program gets triggered is decided by what program name u specify in NACE.
So in NACE>EF>Output Type>NEU>processing routine--> u can see some standard program already configured( maybe SAPFM06P n form MEDRUCK )..these are the programs n sapscript that gets executed wen u say "PRINT" in the transactrion...so u can customise the print program for customer changes over here by copying the standard program n form into a Z/Y one and replacing the program names in NACE.
Yogesh N
Edited by: Yogesh N on Aug 20, 2008 3:19 AM -
The long text for purchase order text field in mm03
Hi,
Please provide me long text for purchase order field.in mm03 the view purchase order text having the long text for purchase order.this is enter when ever your creating the material.but we have table and field name for that and also how to handle this long text.please provide me urgently.
Thanks & Regards,
Radhakrishna.Hi,
A sample code for ur requirement.
TABLES : ekko, "Purchasing Document Header
ekpo, "Purchasing Document Item
thead. "SAPscript: Text Header
DATA: t_theads LIKE stxh OCCURS 0 WITH HEADER LINE.
DATA: t_tlines LIKE tline OCCURS 0 WITH HEADER LINE.
DATA: v_ebeln_ebelp(15) TYPE c.
TYPES: BEGIN OF t_download,
ebeln LIKE ekko-ebeln,
ebelp LIKE ekpo-ebelp,
tdobject LIKE stxh-tdobject,
tdid LIKE stxh-tdid,
tdspras LIKE stxh-tdspras,
count(4) TYPE c,
tdformat LIKE tline-tdformat,
tdline LIKE tline-tdline,
END OF t_download.
TYPES: BEGIN OF t_header,
line1(20) TYPE c,
line2(20) TYPE c,
line3(20) TYPE c,
line4(10) TYPE c,
line5(10) TYPE c,
line6(10) TYPE c,
line7(10) TYPE c,
line8(10) TYPE c,
END OF t_header.
DATA: g_filename TYPE string.
DATA: gt_header TYPE STANDARD TABLE OF t_header.
DATA: gs_header TYPE t_header.
DATA: gt_download TYPE STANDARD TABLE OF t_download.
DATA: gs_download TYPE t_download,
gt_tlines LIKE tline OCCURS 0 WITH HEADER LINE.
DATA: v_subrc TYPE subrc.
DATA: v_nb_lines TYPE i.
DATA: v_ok TYPE i.
DATA: v_ko TYPE i.
DATA: v_ow TYPE i.
DATA: p_fname TYPE string.
DATA: g_append.
SELECTION SCREEN *
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln.
PARAMETERS:
p_filedn(132) TYPE c OBLIGATORY,
p_file(132) TYPE c OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filedn.
PERFORM file_f4_get CHANGING p_filedn.
START-OF-SELECTION.
*Select all the purchase order corresponding to select criteria
CLEAR t_theads. REFRESH t_theads.
SELECT *
FROM ekko
WHERE ebeln IN s_ebeln.
*Select all the text for P.O. header
SELECT * FROM stxh
APPENDING TABLE t_theads
WHERE tdobject = 'EKKO'
AND tdname = ekko-ebeln.
*Select Item of each P.O.
SELECT *
FROM ekpo
WHERE ebeln = ekko-ebeln.
CONCATENATE ekpo-ebeln ekpo-ebelp
INTO v_ebeln_ebelp.
*Select the text for P.O. item.
SELECT * FROM stxh
APPENDING TABLE t_theads
WHERE tdobject = 'EKPO'
AND tdname = v_ebeln_ebelp.
ENDSELECT. "select ekpo
ENDSELECT. "select ekko
DESCRIBE TABLE t_theads LINES v_nb_lines.
LOOP AT t_theads.
Read the text from pool
CLEAR thead.
REFRESH t_tlines.
CALL FUNCTION 'READ_TEXT' "#EC *
EXPORTING
id = t_theads-tdid
language = t_theads-tdspras
name = t_theads-tdname
object = t_theads-tdobject
IMPORTING
header = thead
TABLES
lines = t_tlines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
MOVE-CORRESPONDING thead TO gs_download.
gs_download-ebeln = thead-tdname+0(10).
IF thead-tdobject = 'EKPO'.
gs_download-ebelp = thead-tdname+10(5).
ENDIF.
gs_download-count = 0.
LOOP AT gt_tlines.
gs_download-tdformat = gt_tlines-tdformat.
gs_download-tdline = gt_tlines-tdline.
gs_download-count = gs_download-count + 1.
APPEND gs_download TO gt_download.
ENDLOOP.
CLEAR gs_download.
ENDLOOP.
END-OF-SELECTION.
Hope this helps.
please reward points if useful.
Regards
rose -
Use of SAVE_TEXT in customer exits / BADI for purchase order
Hi All,
I am trying to save some long text by using SAVE_TEXT function module in a badi implementation for purchase order header text. The same is working fine if i try to update the PO header text via a report. But if i try using badi (the code is written in a PAI event for the BADI), then though the text transfer and save is successful during the code excution, but for the first time when i add any text its not visible in ME22N tcode. Since its an online event. But when i double click on that editor and the sap script editor gets opened. then i press back button, the text is appearing on the same small screen edtor . after this any number of time i edit or delete text, the save_text function module works fine.
My issue is why for the first time always i have to double click on the editor to open the sap script editor. I have also included commit_text in this case after save_text FM.
the requirement here goes like this. in one tab for PO header the user will enter some number (This is a customizing screen implemented through badi.) and the corresponsing discription should appear when user clicks on text tab in po header screen (me21n / me22n).
Kindly help.
Thanks
MamataHi mamata rath
I have solve the problem which similar to yours. the code which is as the following
DATA: textline TYPE tdline,
name TYPE c LENGTH 70,
glines TYPE TABLE OF tline,
gline LIKE LINE OF glines,
ls_header TYPE thead.
CONCATENATE ch_eban-banfn ch_eban-bnfpo INTO name.
ls_header-tdobject = 'EBAN'.
ls_header-tdname = name.
ls_header-tdid = 'B01'.
ls_header-tdspras = sy-langu.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
* CLIENT = SY-MANDT
header = ls_header
* INSERT = ' '
* SAVEMODE_DIRECT = ' '
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
tables
lines = glines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF sy-subrc = 0.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = 'EBAN'
NAME = name
* ID = '*'
* LANGUAGE = '*'
* SAVEMODE_DIRECT = ' '
* KEEP = ' '
* LOCAL_CAT = ' '
* IMPORTING
* COMMIT_COUNT =
* TABLES
* T_OBJECT =
* T_NAME =
* T_ID =
* T_LANGUAGE =
ENDIF. -
Problem in creating a SyncBo for Purchase Order BAPIs
Hello Everybody,
I am trying to create a smart sync application for Purchase Orders.
I have used standard bapis like BAPI_PO_GETDETAIL AND BAPI_PO_CREATE1.
I have developed my own wrapper functions using these std bapis. For the PO creation i only plan to insert the necessary and mandatory data. The problem i face is that some of the tables in the create bapi which are mandatory for a PO creation are freezed in the SyncBo.
Tables like POITEMX, POADDRDELIVERY, POSCHEDULE and structure POHEADERX are all required for the creation of a PO. Without this minimum data a PO cannot be created.
After i have created the syncBo, on the mapping screen i can only see these tables under the create BAPI. But i am not able to perform the mapping of their fields. These are non-editable or i must say that they are freezed.
And if i cannot map them then i cannot pass data for them from the client. Although i can do the mapping for the table PO_ITEM and the structure PO_HEADER.
I hope i am able to expplain my problem. Kindly get back to me if i am not clear. Any sort of help is welcome.
Thanking in advance,
Saurabh.Hi Saurabh,
Hope you are aware of the prerequisites for creating the BAPI Wrappers.
If you want to insert some data into the Business Object, then you have to include
GETLIST, GETDETAIL and CREATE Bapi Wrappers.
I think in your case,
You might not have mapped those fields in your GETLIST Bapi Wrapper.Just check whether you have mapped those fields that are necessary for PO creation in your GETLIST and GETDETAIL BApi wrapper mapping screen.
Those fields you have mapped in the GETLIST and GETDETAIL BAPI wrappers will be visible (for selection - checkboxes will be editable) in the mapping screen for CREATE BAPI Wrapper.
So first of all, you have to map fields there in the mapping screens for GETLIST and GETDETAIL Bapi Wrappers...
check this thing...
refer these links..
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/com.sap.km.cm.docs/library/mobile/mobile%20infrastructure/mobile%20development%20kit%202.5/content/appdev/smartsync/introduction.html
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/com.sap.km.cm.docs/library/mobile/mobile%20infrastructure/mobile%20development%20kit%202.5/content/appdev/smartsync/bapi_wrapper_types.html
In the second link, you can see one figure, which is explaining the things that are to be satisfied by the BAPI Wrappers for SyncBO creation...
Let me know If you have doubts in the prerequisite section itself...
Regards,
Kishor Gopinathan -
Call BAPI_GOODSMVT_CREATE to create a goods receipt for purchase order
Hi,
I'm calling the bapi BAPI_GOODSMVT_CREATE to create a goods receipt for purchase order, but the following code doesn't work. It doesn't give me any kind of error message but it does nothing as well...
Can anyone help me please?
Thank You
Hugo
Code
DATA: wa_goodsmvt_header LIKE bapi2017_gm_head_01,
wa_goodsmvt_code LIKE bapi2017_gm_code,
wa_bapi2017_gm_head TYPE bapi2017_gm_head_ret-mat_doc.
DATA: it_goodsmvt_item LIKE bapi2017_gm_item_create OCCURS 0 WITH HEADER LINE,
it_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
wa_goodsmvt_header-pstng_date = SY-DATUM.
wa_goodsmvt_header-doc_date = SY-DATUM.
wa_goodsmvt_header-ref_doc_no = '4500000020'.
wa_goodsmvt_code-gm_code = '01'. "Goods receipt for purchase Order
it_goodsmvt_item-stge_loc = 'BPF2'.
it_goodsmvt_item-move_type = '101' .
it_goodsmvt_item-entry_qnt = 17.
it_goodsmvt_item-entry_uom = 'KG'.
it_goodsmvt_item-mvt_ind = 'B'.
it_goodsmvt_item-po_number = '4500000020'.
it_goodsmvt_item-po_item = '00010'.
it_goodsmvt_item-material = '50'.
APPEND it_goodsmvt_item.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_goodsmvt_header
goodsmvt_code = wa_goodsmvt_code
IMPORTING
materialdocument = wa_bapi2017_gm_head
TABLES
goodsmvt_item = it_goodsmvt_item
return = it_return.
data: begin of errmsg occurs 10.
include structure bapiret2.
data: end of errmsg.
data: wmenge like iseg-menge,
errflag.
clear errflag.
loop at errmsg.
if errmsg-type eq 'E'.
write:/'Error in function', errmsg-message.
errflag = 'X'.
else.
write:/ errmsg-message.
endif.
endloop.
if errflag is initial.
commit work and wait.
if sy-subrc ne 0.
write:/ 'Error in updating'.
exit.
else.
write:/ 'Ok'.
endif.
endif.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = ' '.Hi,
Thank you for the asnwer! I'm a rookie at ABAP so please forgive my stupid questions
I've changed the code to:
DATA: wa_goodsmvt_header LIKE bapi2017_gm_head_01,
wa_goodsmvt_code LIKE bapi2017_gm_code,
wa_bapi2017_gm_head TYPE bapi2017_gm_head_ret-mat_doc.
DATA: it_goodsmvt_item LIKE bapi2017_gm_item_create OCCURS 0 WITH HEADER LINE,
it_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
wa_goodsmvt_header-pstng_date = SY-DATUM.
wa_goodsmvt_header-doc_date = SY-DATUM.
wa_goodsmvt_header-ref_doc_no = '4500000020'.
wa_goodsmvt_code-gm_code = '01'. "Goods receipt for purchase Order
it_goodsmvt_item-plant = 'BP01'.
it_goodsmvt_item-stge_loc = 'BPF2'.
it_goodsmvt_item-move_type = '101' .
it_goodsmvt_item-entry_qnt = 10.
it_goodsmvt_item-entry_uom = 'KG'.
it_goodsmvt_item-mvt_ind = 'B'.
it_goodsmvt_item-po_number = '4500000020'.
it_goodsmvt_item-po_item = '10'.
it_goodsmvt_item-material = '50'.
APPEND it_goodsmvt_item.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_goodsmvt_header
goodsmvt_code = wa_goodsmvt_code
IMPORTING
materialdocument = wa_bapi2017_gm_head
TABLES
goodsmvt_item = it_goodsmvt_item
return = it_return.
write:/ it_return-message.
And the return message is : Material document data and PO data do not match (Material)
Any idea of what might be the problem?
Thanks -
Change of company name in purchase order layout
Hello SAP gurus,
our company changes its name. Please, can you advice me, how to change company name in purchase order?
But in <SPRO- Materials management - Purchasing - Purchase order - Define screen layout> it is not possible, the form here is empty. Probably we use some other way for specifying purchase order layout.
Thank you,
OndrejHi
Edit name of company in SPRO. It will update related field automatically
Path
SPRo>Enterprise Structure>Definition>Financial Accounting>Edit, Copy, Delete, Check Company Code-->Edit Company Code Data
Reward if usefull
Vishal...
Pls check if ur requirement is for plant name or company name as Po contains plant name and not company name -
Goods receipt for purchase order not allowed for a particular wbs
hello everybody..
Am creating a good receipt for a purchase order using the T-CODE-: MIGO...
While doing so am getting an error as " goods receipt for purchase order not allowed(wbs element)".
What can be done to rectify this error?
Plz do help me....
Regards,
Deepika
Moderator message: not directly related to ABAP development, please have a look in the appropriate functional forum, study the long text of this error message.
Edited by: Thomas Zloch on Dec 1, 2010 5:52 PMHi Br. Ajay M,
Released the order and Status line as follow
REL AVAC BUDG GMPS
but the error changed while reverse the document
item 0001 Order is invalid.
Many thanks for your kindly reply.
regards,
Steven
Maybe you are looking for
-
After AFAB, I've changed depreciation key for an asset from 20% to 0%
Hi All, I've posted depreciation (AFAB) for periods from 01 to 04 (Depreciation Area 20). Later I've changed the depreciation key for an asset from 20% to 0%. In my test SAP allows me to update depreciation data only in the period 05 (for previous da
-
Error when posting to Facebook
Hi Folks, I'm using IPhoto 11. I highlighted a photo--->share---->Facebook. Entered my login informaton. hit the button. waited several seconds. I get "There was an unexpected error, please try again later". Anyone else having trouble with this or a
-
Pre-CS6 there was a "Combine" button when you used the Path Selection Tool (A) to select multiple shapes within the same layer. How does one accomplish said action now that the combine button is gone? Merging two layers has not got the same effect. P
-
Online recorded seminars link not working
http://www.oracle.com/technology/tech/java/newsletter/seminars.html
-
I updated my phone to IOS 6 and now I can't make calls or receive them
help!!