Material po text repeating in a table loop for delivery schedules
Hello,
i am displaying a purchase order in a smart form. In the main area of the table(where i am displayin the material and the delivery schedules) after displayin the material i have created a loop node in which i am displayin the delivery schedules(against each material). Inside the loop i have a text node in which i am displaying a 'material po text'. What is happening is, the 'material PO text' is repeating for every delivery schedule (cuz its inside the loop, so every time the loop iterates the text is repeated).
I want to have a condition or an event by which i can display the 'material PO text' once for every material.
NOTE: the 'material PO text' to be displayed is inside the loop(for delivery schedules)
i know its a mess , but i hope u have understood ...
thanks..
Hii,
please reward points if the post helps you..
Ok just forget whatever is written above:
Just follow the steps below:
1. declare a global variable called Last_material.
2. Inside the loop in the text node where you are printing the material PO text -> goto the conditions tab -> give a condition -> itab-matnr ne last_material.
3. create a code node(program lines) just after the loop node. Assign the material number you are printing(itab-matnr) to Last_Material.
This should solve your problem..
Lokesh
Similar Messages
-
Hi
I like to know the table name for the field Delivery dateHi Mahesh,
The table is: LIKP (SD Document: Delivery Header Data)
Delivery Date Field : LFDAT
Hope this helps you.
Regards,
Chandra Sekhar -
Block the Material at Item level in Sales Order automatically for delivery
Hi!
My business scenario needs a material to be Ckecked for Inspection after raising the Sales Order by thirdparty person. So, I need to block that particular material at Item level automatically for delivery and rest of the line items can get delivered. I can do this by selecting the reason for Block at Item level manually, but I want the system to get detemine this block. And one more thing is that there is NO Quality Management module for this. So, let me know what I need to configure for this effect. Thank you.....hi,
pl check the user exit " userexit_save_document_prepare" or "userexit_save_document".
Take the help of your abaper to see if the logic written here can affect the item level block in the sales order for inspection. Create new reason for the item level block and have it triggered with this exit. Instead of hard coding which might require regular intervention of abaper for code changes for the business to be able to manage it, maintain a master data in the material master against some field with a key.
now use that key to identify if these materials require to be blocked at the sales order level for inspection. To release this item again the user has to go in VA02 mode to release the block. Let this be done after the inspection of that material.
regards
sadhu kishore -
Find the table name for Delivery quantity in production order
Hi,
Pls can you tell me what is table name for delivered quantity field in General tab for that production order number.
With Regards,
P.Arunkumar.Hi
You can find it GR qty via following 2 Tables.
Table AFPO Order item
Field WEMNG - Gr Qty
Or
Table AUFM
Field SHKZG (Debit Credit Indicator ) Select Debit Indicator - S
Field KZBEW Movement type ind.- Selct F Goods movement for production order.
Regards,
Dhaval -
Dynamic table generation for Employee Schedule Project
Hi,
I am new to Jave programming and attempting to teach myself Java using the Sun tutorials & these forums. As a first step of learning, I want to do a Automated Employee Schedule Project in Java. (JSP)
There are two main parts of the project. The first part will be a table with the employees listed down the left, the days of the week across the top, and with each cell being that employee's shift for the day. There are four different types of shift in a day ( M- Morning, R- Regular, A- Afternoon and N- Night).
The second part will allows the user to enter in a new employee or display/edit an existing employee's information, including a list of scheduling constraints, like can?t work in Morning shift / Night shift. Apart from that number of employee in a shift may vary based on situation.
Could you please help me to understand the flow for creating this Automated Employee Schedule project?
Thanks in advance.
AmitavaI need the logic as to how to generate the shift plan. Could you tell me how to get about creating this dynamic table and any idea what i should take as baseline? I was thinking to read the employees from the database and take them as input for the first column. and the number of days as the column list. Can you tell me if this is the correct approach?
-
Table name for order schedule line changes
Hi Friends,
There is a background program running periodically. Sometimes line items confirmed dates changed, we want to know a way that what line items for orders are changed. Is there any table, which would give the schedule changes information for the line item or there any other method to find it. Your answered much appreciated. Thank you!
Regards
Raji
Edited by: raji reddy on Jun 5, 2008 4:24 PMHi Raji,
These are the standard tables where SAP stores change details for all areas of the system. The initial key is the object class and you need to enter this to get a quick access via SE16 - VERKBELEG is the key for sales documents. If you then have, for example, a sales order number you can enter that (but ensure you enter leading zeroes) and a table and/or field name.
Regards,
Brian -
Problem in using FM READ_TEXT to read Material Sales Text.
Hi Guys,
I am developing a Customer Outstanding report in which I display all the invoices of a particular customer.
I need to read "Material Sales Text" which comes under "Item Text" tab in transaction FBL5N.
I have used READ_TEXT in my program. I have identified the Object, and ID but I am stuck up with the Name. I dont know what Name to pass. I have tried passing the Invoice Number in "Name" but couldnt get the text.
Request you to please help me out. Please check the below code.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = '0001'
language = SY-LANGU
name = -
object = 'VBBP'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
tables
lines = tl001
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OTHERS = 8
Thanks.*& Form READ_TEXT
FORM read_text USING p_tdid p_tdname
CHANGING p_tdline.
DATA: it_line TYPE STANDARD TABLE OF tline,
wa_line TYPE tline ,
l_tdid TYPE thead-tdid,
l_tdname TYPE thead-tdname.
l_tdid = p_tdid.
l_tdname = p_tdname.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = l_tdid
language = 'E'
name = l_tdname
object = 'VBBP'
TABLES
lines = it_line
EXCEPTIONS
OTHERS = 8.
LOOP AT it_line INTO wa_line.
IF NOT wa_line-tdline IS INITIAL.
p_tdline = wa_line-tdline.
ENDIF.
ENDLOOP.
ENDFORM. " READ_TEXT -
Display 'item text' and 'material PO text' in a purchase order ?
hello,
i am creating a purchase order and i have inputted the 'item text' and 'material PO text' in the ITEM TEXT of the ITEM DETAILS section. I have a smart forms where i am displaying the purchase order by displaying fields from various tables like ekko,ekpo,t024,eket etc ..
I want ti display the 'item text' and the 'material PO text' on the smartform but i cant find the table or the fields which keep these values(text) ??
help me on this one ? thanks for yur time...c the example below:
PERFORM read_text USING g_transp 'Z010'.
FORM read_text USING l_text l_id.
DATA : lt_text TYPE TABLE OF tline WITH HEADER LINE.
DATA : l_name LIKE thead-tdname.
CLEAR l_name.
l_name = g_delivery.
CLEAR lt_text.
REFRESH lt_text.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = l_id
language = sy-langu
name = l_name
object = 'VBBK'
TABLES
lines = lt_text
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR l_text.
LOOP AT lt_text.
CONCATENATE l_text lt_text-tdline INTO l_text.
ENDLOOP.
ENDFORM. "read_text -
PO line item text and material po text
Hi,
I want to fetch the text maintained at item po level and print the same with form..
I am passing following parameters in my Include text in smartforms..
Text name &VAR6& ..... concatenated po number and item
( 4700000011 + 00010) = 470000001100010
Text object EKKO
Text ID F01
Language EN
but its failing to fetch the same....I guess the problem is with var6 value...not sure
also for material po text i m passing
Text name &G_ZEKPO-MATNR& ..
Text object MATERIAL
Text ID BEST
Language EN
This is also failing.....
In both cases text is maintained... what is the problem??
Pls help..See this sample code
ABAP READ_TEXT functions to read the SAP Long Text
You have to used the READ_TEXT functions to read the SAP long text. e.g. Sales Order, Purchase Order Item text etc.
To check your long text header, go into the long text. Click Goto -> Header
Example of READ_TEXT functions reading tables PBIM - Independent requirements for material.
REPORT ZTEXT .
TABLES: PBIM.
stxh, stxl, stxb - trans tables for text
ttxit - text on text-ids
ttxot - Short texts on text objects
Transaction MD63
SELECT-OPTIONS: S_MATNR FOR PBIM-MATNR,
S_WERKS FOR PBIM-WERKS.
DATA: BEGIN OF HTEXT.
INCLUDE STRUCTURE THEAD.
DATA: END OF HTEXT.
DATA: BEGIN OF LTEXT OCCURS 50.
INCLUDE STRUCTURE TLINE.
DATA: END OF LTEXT.
DATA: BEGIN OF DTEXT OCCURS 50.
DATA: MATNR LIKE PBIM-MATNR.
INCLUDE STRUCTURE TLINE.
DATA: END OF DTEXT.
DATA: TNAME LIKE THEAD-TDNAME.
SELECT * FROM PBIM WHERE WERKS IN S_WERKS.
MOVE PBIM-BDZEI TO TNAME.
CALL FUNCTION <b>'READ_TEXT'</b>
EXPORTING
CLIENT = SY-MANDT
ID = 'PB'
LANGUAGE = 'E'
NAME = TNAME
OBJECT = 'PBPT'
ARCHIVE_HANDLE = 0
IMPORTING
HEADER = HTEXT
TABLES
LINES = LTEXT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT LTEXT.
IF LTEXT-TDLINE NE ''.
MOVE LTEXT-TDLINE TO DTEXT-TDLINE.
MOVE PBIM-MATNR TO DTEXT-MATNR.
APPEND DTEXT.
ENDIF.
ENDLOOP.
ENDSELECT.
LOOP AT DTEXT.
WRITE:/ DTEXT-MATNR, DTEXT-TDLINE.
ENDLOOP.
http://www.sapdevelopment.co.uk/sapscript/sapscript_texts.htm
Also
*Internal table to store standard texts
DATA: IT_TEXTS like T_LINE occurs o with header line.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = "Text ID
language = "Laguage
name = "Text name
object = "text object
ARCHIVE_HANDLE = 0
IMPORTING
HEADER =
tables
lines = IT_TEXTS "Internal table
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Material PO text in Material Master upload
Hello,
I want to upload the Material Master and want to upload the Material PO text field as well How do i upload this field. I cant find any technical name of the field nor any field in the object while uploading thru LSMW ? Kindly respond.
Thanks,
Shehryar DaharHi
see this
Re: upload longtext from excel file
REPORT zupload_excel_to_itab.
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.
TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
*START-OF-SELECTION.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 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.
END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.
http://www.sapdevelopment.co.uk/file/file_upexcel.htm
Reward if useful
Regards
Anji -
How to download material sales text and purchase order text information
Here is situation:
goto MM03 transaction,
Take any material -- and select below views
1. sales text
2. purchase order text
i have to write the download program with the sales text and purchasing text information of all the materials.
could you pls tell me in which table I will get all the above sales text and purchase order text infrmation.
I think it will store in standard text. I checked STXH table also for getting information text object, text id, text name, language, etc.
If anybody knows .. please share.
Thanks in advance.
Regards
RaghuDeclare internal tables as follows: - An example
TYPES: BEGIN OF TY_PO_LINES,
INCLUDE STRUCTURE TLINE.
END OF TY_PO_LINES,
TY_PO_LINES_T TYPE STANDARD TABLE OF TY_PO_LINES.
TYPES: BEGIN OF TY_PO_TEXT,
TDOBJECT TYPE TDOBJECT
TDNAME TYPE TDOBNAME,
TDID TYPE TDID,
SPRAS TYPE SPRAS,
TDLINES TYPE TY_PO_LINES OCCURS 0,
END OF TY_PO_TEXT,
PO_TEXT_T TYPE STANDARD TABLE OF TY_PO_TEXT.
DATA: PO_TEXT TYPE TY_PO_TEXT_T
PO text:
Looping at your internal table which consists of PO number,
SELECT TDID TDSPRAS FROM STXH INTO A INTERNAL TABLE say PO_TEXT
TDOBJECT = EKKO "PO Header Text
TDNAME = PO NUMBER
SELECT TDID TDSPRAS FROM STXH INTO A INTERNAL TABLE say PO_TEXT
TDOBJECT = EKPO "PO line item text
TDNAME = PO NUMBER
ENDLOOP
Looping at PO_TEXT
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = PO_TEXT-TDID
LANGUAGE = PO_TEXT-TDSPRAS
NAME = PO_TEXT-TDNAME
OBJECT = PO_TEXT-TDOBJECT
TABLES
LINES = PO_TEXT-TDLINES
ENDLOOP
Follow the same above logic for material with suitable TDID you need to extract
Hope this helps,
SKJ -
Hi,
We need to retrieve Material Sales Text for thousands of materials.We are using the function module READ_TEXT to retrieve text one material at a time.Is there any best possible way of handling this? like retrieving sales text for bunch of materials at a time rather than one at a time.Hai
variable "id1" contains Document No , Check With other Id No , and your material table
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = '0014'
language = sy-langu
name = id1
object = 'VBBK'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
lines = itab_w
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT itab_w INTO g_text3.
nu = nu + 1 .
IF nu = 1 .
MOVE : g_text3 TO g_text4 .
ENDIF .
APPEND g_text3 .
*clear g_text4 .
ENDLOOP.
Regards
Sarath P G -
Writing from a text file into a table
Hi,
I have a problem with dearchiving the data from the txt file to the respective table.
The table name is dynamic & I get the required columns from all_tab_columns.
I use UTL_FILE.GET_LINE() to get the data one line at a time and INSTR() & SUBSTR() to break them into the respective columns.
My dynamic insert contains a set of bind variables equal to the no. of columns of the table.
The statement gets constructed correctly but I tried to use execute_immediate , i realised that i cannot construct the USING clause for it & hence I switced to DBMS_SQL.
The DBMS_SQL.BIND_VARIABLE() binds all of the bind variables to a table of varchar2. I've taken care to convert the date & the number variables while binding.
When i do DBMS_SQL.EXECUTE() I get the error,
ORA-01008 Not all variables bound .
I don't know the reason since the no. of bind variables & the no. of table variables are the same & the value in the table looks fine too!
Could this be a date issue ??? am using the default format DD-MON-YY both to write to the text file and to read from it.
Any help would be appreciated.
thx
kalpana
Part of the code :
Begin
destination_file := upper(p_table_name)||'_ARCH'||to_char
(p_process_date,'yyyymmdd')||'.dat';
dbms_output.put_line(destination_file);
file_id := UTL_FILE.FOPEN(file_path, destination_file,'r');
-- Get the number of columns in the table to be archived
select count(column_name)
into col_ctr
from all_tab_columns
where table_name = upper(p_table_name)
order by column_name;
sql_stmt1 := 'Insert into '||p_table_name||'(';
sql_stmt2 := ' values(';
For col_rec in column_cur loop
if col_ctr = column_cur%rowcount then -- last column in
the select statement
sql_stmt1 := sql_stmt1 || col_rec.column_name;
sql_stmt2 := sql_stmt2||':b'||column_cur%rowcount;
else
sql_stmt1 := sql_stmt1 || col_rec.column_name ||',';
sql_stmt2 := sql_stmt2||':b'||column_currowcount||',';
end if;
type_rec(column_cur%rowcount) := col_rec.data_type;
end loop;
sql_stmt1 := sql_stmt1||')';
sql_stmt2 := sql_stmt2||')';
sql_stmt := sql_stmt1||sql_stmt2;
loop
Begin
UTL_FILE.GET_LINE(file_id,v_column_value);
For i in 1..col_ctr loop
v_next_position := INSTR(v_column_value,';',1,i);
if i = 1 then
v_rec(i) := SUBSTR(v_column_value, v_prev_position, v_next_position - 1);
elsif i = col_ctr then -- last but one column
v_rec(i) := SUBSTR(v_column_value, v_prev_position);
else
v_rec(i) := SUBSTR(v_column_value, v_prev_position, (v_next_position - v_prev_position));
end if;
v_prev_position := v_next_position + 1;
end loop;
v_cursor := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(v_cursor, sql_stmt, dbms_sql.native);
For i in 1..col_ctr loop
if type_rec(i) = 'DATE' then
DBMS_SQL.BIND_VARIABLE(v_cursor,':b'||i, to_date(v_rec(i),'DD-MON-YY'));
elsif type_rec(i) = 'NUMBER' then
DBMS_SQL.BIND_VARIABLE(v_cursor,':b'||i, to_number(v_rec(i)));
end if;
end loop;
-- Insert the row into the history table
-- execute immediate sql_stmt USING value(v_rec);
v_dummy := DBMS_SQL.EXECUTE(v_cursor);
if SQL%NOTFOUND then
dbms_output.put_line('CPN_HISTORY_ARCHIVE_PKG.DEARCHIVE_DATA : No records to insert');
end if;
Exception -- for UTL_FILE.GET_LINE
when NO_DATA_FOUND then
DBMS_SQL.CLOSE_CURSOR(v_cursor);
UTL_FILE.FCLOSE(file_id);
exit;
End;
end loop; -- end of loop for UTL_FILE.GET_LINE
DBMS_SQL.CLOSE_CURSOR(v_cursor);
UTL_FILE.FCLOSE(file_id);your program is currect except u r not building bind variables for varchar2 columns
declare
type tab133 is table of varchar2(4000) index by binary_integer;
file_id utl_file.file_type;
sql_stmt1 varchar2(1000);
sql_stmt2 varchar2(1000);
v_column_value varchar2(1000);
sql_stmt varchar2(2000);
col_ctr number:=0;
p_table_name varchar2(30):='emp1';
cursor column_cur is select column_name,data_type from user_tab_columns
where table_name=upper(p_table_name);
mainstr VARCHAR2(40) := '';
splitstr VARCHAR2(30) := '';
l_count NUMBER(20) := 1;
itr_count NUMBER(20) := 0;
processed BOOLEAN := FALSE;
v_rec tab133;
type_rec tab133;
v_cursor integer;
column_currowcount number;
v_dummy number:=0;
Begin
--dbms_output.put_line(destination_file);
file_id := UTL_FILE.FOPEN('c:\suresh', 'emp.txt','r');
-- Get the number of columns in the table to be archived
select count(column_name)
into col_ctr
from user_tab_columns
where table_name = upper(p_table_name)
order by column_name;
sql_stmt1 := 'Insert into '||p_table_name||'(';
sql_stmt2 := ' values(';
For col_rec in column_cur loop
if col_ctr = column_cur%rowcount then
sql_stmt1 := sql_stmt1 || col_rec.column_name;
sql_stmt2 := sql_stmt2||':b'||column_cur%rowcount;
else
sql_stmt1 := sql_stmt1 || col_rec.column_name ||',';
sql_stmt2 := sql_stmt2||':b'||column_cur%rowcount||',';
end if;
type_rec(column_cur%rowcount) := col_rec.data_type;
end loop;
sql_stmt1 := sql_stmt1||')';
sql_stmt2 := sql_stmt2||')';
sql_stmt := sql_stmt1||sql_stmt2;
dbms_output.put_line(sql_stmt);
loop
Begin
UTL_FILE.GET_LINE(file_id,v_column_value);
itr_count := 0;
l_count :=1;
processed := FALSE;
mainstr:=v_column_value;
LOOP
itr_count := itr_count+1;
IF instr(mainstr,',',1,itr_count)>0 THEN
splitstr := SUBSTR(mainstr,l_count,(INSTR(mainstr,',',1,itr_count)-l_count));
l_count := INSTR(mainstr,',',1,itr_count)+1;
ELSE
splitstr := SUBSTR(mainstr,l_count,LENGTH(mainstr)+1-l_count);
processed := TRUE;
END IF;
v_rec(itr_count):=splitstr;
IF processed THEN
EXIT ;
END IF;
END LOOP;
v_cursor := DBMS_SQL.OPEN_CURSOR;
--dbms_output.put_line(col_ctr);
DBMS_SQL.PARSE(v_cursor, sql_stmt, dbms_sql.native);
For i in 1..col_ctr loop
if type_rec(i) = 'DATE' then
DBMS_SQL.BIND_VARIABLE(v_cursor,':b'||to_char(i), to_date(v_rec(i),'DD/mm/yyyy'));
elsif type_rec(i) = 'NUMBER' then
DBMS_SQL.BIND_VARIABLE(v_cursor,':b'||to_char(i), to_number(v_rec(i)));
elsif type_rec(i) = 'VARCHAR2' then
DBMS_SQL.BIND_VARIABLE(v_cursor,':b'||to_char(i), v_rec(i));
end if;
end loop;
v_dummy := DBMS_SQL.EXECUTE(v_cursor);
if SQL%NOTFOUND then
dbms_output.put_line('CPN_HISTORY_ARCHIVE_PKG.DEARCHIVE_DATA : No records to insert');
end if;
DBMS_SQL.CLOSE_CURSOR(v_cursor);
Exception
when NO_DATA_FOUND then
UTL_FILE.FCLOSE(file_id);
exit;
End;
end loop;
UTL_FILE.FCLOSE(file_id);
EXCEPTION
when others then
dbms_output.put_line(sqlerrm);
UTL_FILE.FCLOSE(file_id);
END;
TEST:
SQL> DESC EMP1
Name Null? Type
ENAME VARCHAR2(15)
SUBJ VARCHAR2(15)
SDATE DATE
DATA FILE:
AABC,oracle,08/08/2001
xyz,social,12/12/2001
SQL> select * from emp1;
ENAME SUBJ SDATE
AABC oracle 08/08/2001 00:00:00
xyz social 12/12/2001 00:00:00 -
How to pass text to Material Sales text, item note, while creating a sales
hi ,
i tried my level best with the help of friends (SDN).
but i am unable to reach the target.
my requirement is to enter text into
1) material sales text
2) item note
3) packing note
4) delivery text
5) purchase order text
6) production memo
in sales order using bapi. here i am submitting the code i wrote.
kindly some one help me.
thanks in advance
regards,
pavan
<i>report zmybapi1 .
data : my_order_header_in like bapisdhd1 occurs 0 with header line,
my_order_header_ix like bapisdhd1x occurs 0 with header line.
data : my_orderitemsin like bapisditm occurs 0 with header line,
my_orderitemsix like bapisditmx occurs 0 with header line.
data : my_order_partners like bapiparnr occurs 0 with header line.
data : my_return like bapiret2 occurs 0 with header line.
data : w_vbeln like bapivbeln-vbeln.
data:
my_orderschedulesin like bapischdl occurs 0 with header line,
my_orderschedulesinx like bapischdlx occurs 0 with header line.
data : my_orderconditionsin like bapicond occurs 0 with header line,
my_orderconditionsinx like bapicondx occurs 0 with header line.
<b>data : my_ordertext like bapisdtext occurs 0 with header line.</b>
start-of-selection.
this is to assign values to internal table my_order_header_in
my_order_header_in-doc_type = 'TA'.
my_order_header_in-sales_org = 'JNJ1'.
my_order_header_in-distr_chan = '02'.
my_order_header_in-division = 'J1'.
my_order_header_in-sales_off = 'JNJ1'.
my_order_header_in-purch_no_c = 'testbapipo'.
my_order_header_in-purch_date = sy-datum.
my_order_header_in-req_date_h = sy-datum.
append my_order_header_in.
this is to assign values to internal table my_orderitemsin
my_orderitemsin-material = '000000000000000727'.
my_orderitemsin-plant = 'JNJ1'.
my_orderitemsin-target_qu = 'EA'.
my_orderitemsin-target_qty = '10'.
append my_orderitemsin.
this is to assign values to internal table my_order_partners
my_order_partners-partn_role = 'AG'.
my_order_partners-partn_numb = '0000000011'.
append my_order_partners.
my_order_partners-partn_role = 'WE'.
my_order_partners-partn_numb = '0000000011'.
append my_order_partners.
This is to assign values to internal table my_orderschedulesin
my_orderschedulesin-itm_number = '10'.
my_orderschedulesin-itm_number = '000010'.
my_orderschedulesin-req_qty = '10'.
my_orderschedulesin-SCHED_LINE = '0001'.
append my_orderschedulesin.
*This is to assign values to internal table my_orderconditionin
my_orderconditionsin-itm_number = '000010'.
my_orderconditionsin-cond_type = 'ZPR1'.
my_orderconditionsin-cond_st_no = ''.
my_orderconditionsin-cond_count = '1'.
my_orderconditionsin-cond_value = '40'.
my_orderconditionsin-cond_p_unt = '1'.
my_orderconditionsin-currency = 'INR'.
append my_orderconditionsin.
<b> my_ordertext-itm_number = '00010'.
my_ordertext-text_id = '0002'.
my_ordertext-langu = 'EN'.
my_ordertext-langu_iso = 'EN'.
my_ordertext-text_line = 'This is for item note'.
my_ordertext-format_col = '*'.
my_ordertext-function = '009'.
*</b> <b>append my_ordertext.</b>
my_order_header_ix-updateflag = 'I'.
my_order_header_ix-doc_type = 'X'.
my_order_header_ix-sales_org = 'X'.
my_order_header_ix-distr_chan = 'X'.
my_order_header_ix-division = 'X'.
my_order_header_ix-sales_off = 'X'.
my_order_header_ix-purch_no_c = 'X'.
my_order_header_ix-purch_date = 'X'.
my_order_header_ix-req_date_h = 'X'.
append my_order_header_ix.
my_orderitemsix-updateflag = 'I'.
my_orderitemsix-material = 'X'.
my_orderitemsix-target_qty = 'X'.
my_orderitemsix-plant = 'X'.
my_orderitemsix-target_qu = 'X'.
append my_orderitemsix.
my_orderschedulesinx-updateflag = 'I'.
my_orderschedulesinx-sched_line = '0001'.
my_orderschedulesinx-req_qty = 'X'.
append my_orderschedulesinx.
my_orderconditionsinx-itm_number = '000010'.
my_orderconditionsinx-cond_type = 'ZPR1'.
my_orderconditionsinx-cond_st_no = 'X'.
my_orderconditionsinx-cond_count = 'X'.
my_orderconditionsinx-updateflag = 'U'.
my_orderconditionsinx-cond_value = 'X'.
my_orderconditionsinx-cond_p_unt = 'X'.
my_orderconditionsinx-currency = 'X'.
append my_orderconditionsinx.
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
exporting
SALESDOCUMENTIN =
order_header_in = my_order_header_in
order_header_inx = my_order_header_ix
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
importing
salesdocument = w_vbeln
tables
return = my_return
order_items_in = my_orderitemsin
order_items_inx = my_orderitemsix
order_partners = my_order_partners
ORDER_SCHEDULES_IN = my_orderschedulesin
order_schedules_inx = my_orderschedulesinx
ORDER_CONDITIONS_IN = my_orderconditionsin
ORDER_CONDITIONS_INX = my_orderconditionsinx
ORDER_CFGS_REF =
<b>ORDER_TEXT = my_ordertext</b>
if sy-subrc ne 0.
write: my_return-message, my_return-number, my_return-type.
else.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
write: my_return-message, my_return-number, my_return-type.</i>hi prashant,
i tried the save_text but , i am unable find the exact value which i have to enter for the field tdobject.
this is updated program as per u r instruction.
<b>Text object not found</b>
the code now is
<b>report zmybapi1 .
data : my_order_header_in like bapisdhd1 occurs 0 with header line,
my_order_header_ix like bapisdhd1x occurs 0 with header line.
data : my_orderitemsin like bapisditm occurs 0 with header line,
my_orderitemsix like bapisditmx occurs 0 with header line.
data : my_order_partners like bapiparnr occurs 0 with header line.
data : my_return like bapiret2 occurs 0 with header line.
data : w_vbeln like bapivbeln-vbeln.
data:
my_orderschedulesin like bapischdl occurs 0 with header line,
my_orderschedulesinx like bapischdlx occurs 0 with header line.
data : my_orderconditionsin like bapicond occurs 0 with header line,
my_orderconditionsinx like bapicondx occurs 0 with header line.
data : my_ordertext like bapisdtext occurs 0 with header line.
data : my_header like thead occurs 0 with header line.
data : my_tline like tline occurs 0 with header line.
start-of-selection.
this is to assign values to internal table my_order_header_in
my_order_header_in-doc_type = 'TA'.
my_order_header_in-sales_org = 'JNJ1'.
my_order_header_in-distr_chan = '02'.
my_order_header_in-division = 'J1'.
my_order_header_in-sales_off = 'JNJ1'.
my_order_header_in-purch_no_c = 'testbapipo'.
my_order_header_in-purch_date = sy-datum.
my_order_header_in-req_date_h = sy-datum.
append my_order_header_in.
this is to assign values to internal table my_orderitemsin
my_orderitemsin-material = '000000000000000727'.
my_orderitemsin-plant = 'JNJ1'.
my_orderitemsin-target_qu = 'EA'.
my_orderitemsin-target_qty = '10'.
append my_orderitemsin.
this is to assign values to internal table my_order_partners
my_order_partners-partn_role = 'AG'.
my_order_partners-partn_numb = '0000000011'.
append my_order_partners.
my_order_partners-partn_role = 'WE'.
my_order_partners-partn_numb = '0000000011'.
append my_order_partners.
This is to assign values to internal table my_orderschedulesin
my_orderschedulesin-itm_number = '10'.
my_orderschedulesin-itm_number = '000010'.
my_orderschedulesin-req_qty = '10'.
my_orderschedulesin-SCHED_LINE = '0001'.
append my_orderschedulesin.
*This is to assign values to internal table my_orderconditionin
my_orderconditionsin-itm_number = '000010'.
my_orderconditionsin-cond_type = 'ZPR1'.
my_orderconditionsin-cond_st_no = ''.
my_orderconditionsin-cond_count = '1'.
my_orderconditionsin-cond_value = '40'.
my_orderconditionsin-cond_p_unt = '1'.
my_orderconditionsin-currency = 'INR'.
append my_orderconditionsin.
my_ordertext-doc_number = '0000008632'.
my_ordertext-itm_number = '00010'.
my_ordertext-text_id = '0002'.
my_ordertext-langu = 'EN'.
my_ordertext-langu_iso = 'EN'.
my_ordertext-text_line = 'This is for item note'.
my_ordertext-format_col = '*'.
my_ordertext-function = '009'.
append my_ordertext.
my_order_header_ix-updateflag = 'I'.
my_order_header_ix-doc_type = 'X'.
my_order_header_ix-sales_org = 'X'.
my_order_header_ix-distr_chan = 'X'.
my_order_header_ix-division = 'X'.
my_order_header_ix-sales_off = 'X'.
my_order_header_ix-purch_no_c = 'X'.
my_order_header_ix-purch_date = 'X'.
my_order_header_ix-req_date_h = 'X'.
append my_order_header_ix.
my_orderitemsix-updateflag = 'I'.
my_orderitemsix-material = 'X'.
my_orderitemsix-target_qty = 'X'.
my_orderitemsix-plant = 'X'.
my_orderitemsix-target_qu = 'X'.
append my_orderitemsix.
my_orderschedulesinx-updateflag = 'I'.
my_orderschedulesinx-sched_line = '0001'.
my_orderschedulesinx-req_qty = 'X'.
append my_orderschedulesinx.
my_orderconditionsinx-itm_number = '000010'.
my_orderconditionsinx-cond_type = 'ZPR1'.
my_orderconditionsinx-cond_st_no = 'X'.
my_orderconditionsinx-cond_count = 'X'.
my_orderconditionsinx-updateflag = 'U'.
my_orderconditionsinx-cond_value = 'X'.
my_orderconditionsinx-cond_p_unt = 'X'.
my_orderconditionsinx-currency = 'X'.
append my_orderconditionsinx.
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
exporting
SALESDOCUMENTIN =
order_header_in = my_order_header_in
order_header_inx = my_order_header_ix
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
importing
salesdocument = w_vbeln
tables
return = my_return
order_items_in = my_orderitemsin
order_items_inx = my_orderitemsix
order_partners = my_order_partners
ORDER_SCHEDULES_IN = my_orderschedulesin
order_schedules_inx = my_orderschedulesinx
ORDER_CONDITIONS_IN = my_orderconditionsin
ORDER_CONDITIONS_INX = my_orderconditionsinx
ORDER_CFGS_REF =
ORDER_TEXT = my_ordertext
if sy-subrc ne 0.
write: my_return-message, my_return-number, my_return-type.
else.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
write: my_return-message, my_return-number, my_return-type.
my_header-tdobject = ''.
my_header-tdname = ' '.
my_header-tdid = '0002'.
my_header-tdspras = 'EN'.
append my_header.
my_tline-tdformat = '*'.
my_tline-tdline = 'This is for item note'.
append my_tline.
call function 'SAVE_TEXT'
exporting
CLIENT = SY-MANDT
header = my_header
INSERT = ' '
SAVEMODE_DIRECT = ' '
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
tables
lines = my_tline
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 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.
endif.</b>
thanks in advance
regards,
pavan -
How to extract data from text file to database table
Hi ,
I am trying to upload data in text file to database table using GUI_UPLOAD function .what would be the program for that.
thanks in advance.Hi,
I don't think you have a standard sap program to upload data from file to database table...
Instead you can create a custom program like this..
DATA: T_FILEDATA(1000) OCCURS 0 WITH HEADER LINE.
DATA: T_ZTABLE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\TEST.TXT'
tables
data_tab = T_FILEDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT T_FILEDATA.
T_ZTABLE = T_FILEDATA.
APPEND T_ZTABLE.
ENDLOOP.
MODIFY ZTABLE FROM TABLE T_ZTABLE.
COMMIT WORK..
Thanks,
Naren
Maybe you are looking for
-
Adobe Acrobat 9 Pro Crashes When Scanning with Canon DR-4010C Native Interface
When doing a custom scan in Adobe Acrobat Pro 9.2, I need to be able to show the Canon DR-4010C native interface so that it will auto-crop when I am scanning small documents such as receipts, etc. I have another model scanner that does it automatica
-
I am somewhat new to Flash and have been teaching myself through tutorials. I am working with Flash CS6 and have created a movie and exported it as an SWF onto my website. In the testing area in the program it works and the buttons link to the web pa
-
How to change the voice in maps
I've selected English, Italian and German on my iPad, because I have to write letters in these languages. But I'm living in Italy. To hear the Maps Voice of the Italian Streetnames with the English pronuniation is quite difficult for me. How can I ch
-
Email on Idoc Failure with Status 56 64 68 69 70
We have standard inbound idoc processing for Basic Type : DELVRY01 and Message Type : DESADV using the function module IDOC_INPUT_DESADV1. We currently have a requirement to send an email, when any of these type of Idocs fail with status 56, 64, 68,
-
Adobe Acrobat 8 in Creative Suite 3 for Mac OS abruptly quits
Adobe Acrobat 8 opens OK but then abruptly quits and closes completely. InDesign and Photoshop in CS3 work without any problem so far. I downloaded CS3 from the Adobe Website. I even re-downloaded it and reinstalled Acrobat 8 but had the same results