Regarding the internal table data by using read table it_mard into wa_mard
hi,
i am reading the internal table it_mard with key matnr .
my code is like this.
*loop at it_final into wa_final.*
*wa_second-matnr = wa_final-matnr.*
wa_second-bwart = wa_final-bwart.
wa_second-bwtar = wa_final-bwtar.
*read table it_mard into wa_mard with key matnr = wa_final-matnr*
*binary search.*
*if sy-subrc = 0.*
*wa_second-labst = wa_mard-labst.*
*endif.*
*append wa_second to it_second.*
clear :wa_final.
*endloop.*
final internal table haveing duplicate values because this table it_final having movement types
so that i am not using delete statement .
is there any logic for handling the duplicate values inside the loop statement
by using read table statement.
could u plz explain clearly \[removed by moderator\]
Edited by: Jan Stallkamp on Jul 11, 2008 2:11 PM
this is my code could u plz explain regarding duplicate material number .
LOOP AT IT_MSEG INTO WA_MSEG.
WA_FINAL-MBLNR = WA_MSEG-MBLNR.
WA_FINAL-MATNR = WA_MSEG-MATNR.
WA_FINAL-BWART = WA_MSEG-BWART.
WA_FINAL-BWTAR = WA_MSEG-BWTAR.
WA_FINAL-MENGE = WA_MSEG-MENGE.
WA_FINAL-SOBKZ = WA_MSEG-SOBKZ.
COLLECT WA_FINAL INTO IT_FINAL.
CLEAR WA_FINAL.
ENDLOOP.
LOOP AT IT_FINAL INTO WA_FINAL.
READ TABLE IT_MARD INTO WA_MARD WITH KEY MATNR = WA_FINAL-MATNR
BINARY SEARCH.
this is reading the duplicate records i need to control duplicate records here .
the labst value is repeating the number of times because of the meterial number duplication
how can i restrict plz explain
IF SY-SUBRC = 0.
WA_FINAL-LABST = WA_MARD-LABST.
ENDIF.
READ TABLE IT_MKPF INTO WA_MKPF WITH KEY MBLNR = WA_FINAL-MBLNR
BINARY SEARCH.
IF SY-SUBRC = 0.
WA_FINAL-BUDAT = WA_MKPF-BUDAT.
ENDIF.
MODIFY IT_FINAL FROM WA_FINAL.
CLEAR WA_FINAL.
ENDLOOP.
LOOP AT IT_FINAL INTO WA_FINAL.
WA_SECOND-BWTAR = WA_FINAL-BWTAR.
IF WA_FINAL-BWART = '101' OR WA_FINAL-BWART = '501' OR WA_FINAL-BWART = '561'.
WA_SECOND-MENGE11 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '201'.
WA_SECOND-MENGE12 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '541' AND WA_FINAL-SOBKZ = 'O' .
WA_SECOND-MENGE13 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '601'.
WA_SECOND-MENGE14 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '543'.
WA_SECOND-MENGE15 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '702'.
WA_SECOND-MENGE16 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '313'.
WA_SECOND-MENGE17 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '315'.
WA_SECOND-MENGE18 = WA_FINAL-MENGE.
ENDIF.
IF WA_FINAL-BWART = '122' OR WA_FINAL-BWART = '161'.
WA_SECOND-MENGE19 = WA_FINAL-MENGE.
ENDIF.
COLLECT WA_SECOND INTO IT_SECOND.
CLEAR WA_SECOND.
ENDLOOP.
Similar Messages
-
How to reduce the number of data blocks used by table
Hi,
I was trying to reduce the space usage of a particular table of my apex application which stores blob content and therefore deleted many records from it.
However, the data block usage remained the same as before.
I have tried to 'analyze' the table and validate the structure,but am unable to overcome this problem.
Could someone throw some light on what needs to be to reduce the number of data blocks used by this table?
Best Regards,
Priya JetleyPriya:
It is likely that the BLOB content defined in your table is being stored 'Out-of-Line'. This means that the LOB columns are stored in segments of their own. These then are the segments that may need shrinking.
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_tables.htm#i1006363
Varad -
I have read all the questions regarding the "Can't send photo using iMessage".
I have read all the questions regarding the "Can't send photo using iMessage". I followed everything and check everything that was in it. It's still the same. I am still not able to send a photo. It started happening last week. It was fine before that. There is no error message.
It will try to send but it will get stuck just before it sends
and the red ! will appear with the "Not Delivered" status.
When i tap on the !, it just says "This iMessage was not delived".
No other message or photo is sending as the same time as the photo.
I did reset it, I checked the email address, removed it as well. Turned it off then back on. Signed out and signed back in. Wi-Fi strength is very good. iOS is 6.0.1. I checked for updates, it is up-to-date I also checked a link http://support.apple.com/kb/TS2755. It did not help at all.
What's wrong?!?!?!?!It is not a matter of reconsidering the decision. There are unsolveable technical problems with trying to run a program such as Firefox on Blackberry OS. We would need Blackberry to distribute a tool similar to Android's NDK to run on Blackberries.
-
How to display table data without using ALV and table element.
Hi,
Its possible to display table data without using ALV and table element.
Every time i am fetching data based on (customer,status) fields and displaying these data in my output using alv
(every time i am fetching single row data ),
But problem is alv occupying more space in the output , i want to display data part only i dont want field names,
settings and header data etc..things.
Give solution to display data part..
Regards,
Rakhi.Hi,
Does you mean that you need ALV without default Function Toolbar...? If this is the case, the easy solution would have been to use Table Element rather. But, if you need to use ALV only without Function Toolbar, you can do away with that as well.
In that case, after calling GET_MODEL, you need to add few more lines of codes to achieve your goal. Those lines are --
DATA LV_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
LV_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
* Standard Filter Function setting to FALSE
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_COMPLEX_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_COMPLEX_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_FILTERLINE_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_DISPLAY_SETTINGS_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_VIEW_LIST_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_HEADERCLICK_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_HIERARCHY_ALLOWED( ABAP_FALSE ).
* Standard Filter Function setting to FALSE Ends
Here as you can easily notice that LV_VALUE is instantiated on CL_SALV_WD_CONFIG_TABLE. Now, using this LV_VALUE, you set standard functions as False to dis-allow their display.
Hope this answers your query.
Thanks.
Kumar Saurav. -
How can you find the Last Modified Date of a particular table
Hi,
I want to show to the LAST MODIFIED date of a particular table to the user before refreshing the table with new data. Experts please suggest me the way using JDBC-SQL connection.There is no generic SQL way for this. It depends completely on the features your DBMS offers. With Oracle you'd need to create column which gets updated in a trigger. I believe MS SQL Server offers a special data type for this, which is updated automatically. I don't know about others.
-
Can I use read table instead of multiple select & loop statements.
Any one please give me the sample code ..how to do it.
Thanks in advanceHi,
Yes you can use read instead of nested loops and select which will affect the performance.
REPORT zkeerthi_ITABLE9 .
tables:vbap,vbak,vbkd.
data:begin of it_vbap occurs 0,
vbeln like vbap-vbeln,
matnr like vbap-matnr,
end of it_vbap.
data:begin of it_vbak occurs 0,
erdat like vbak-erdat,
ernam like vbak-ernam,
vbeln like vbak-vbeln,
end of it_vbak.
data:begin of it_vbkd occurs 0,
konda like vbkd-konda,
kdgrp like vbkd-kdgrp,
vbeln like vbkd-vbeln,
end of it_vbkd.
data:begin of it_final occurs 0,
vbeln like vbap-vbeln,
matnr like vbap-matnr,
erdat like vbak-erdat,
ernam like vbak-ernam,
konda like vbkd-konda,
kdgrp like vbkd-kdgrp,
end of it_final.
parameters:v_matnr type vbap-matnr.
select vbeln
matnr
from vbap
into table it_vbap
where matnr = v_matnr.
select erdat
ernam
vbeln
from vbak
into table it_vbak
for all entries in it_vbap
where vbeln = it_vbap-vbeln.
select konda
kdgrp
vbeln
from vbkd
into table it_vbkd
for all entries in it_vbap
where vbeln = it_vbap-vbeln.
loop at it_vbap.
read table it_vbak with key vbeln = it_vbap-vbeln.
move :it_vbak-erdat to it_final-erdat,
it_vbak-ernam to it_final-ernam,
it_vbap-vbeln to it_final-vbeln,
it_vbap-matnr to it_final-matnr.
append it_final.
read table it_vbkd with key vbeln = it_vbap-vbeln.
move:it_vbkd-konda to it_final-konda,
it_vbkd-kdgrp to it_final-kdgrp.
append it_final.
endloop .
sort it_final by matnr.
loop at it_final.
write:/ it_final-vbeln,
it_final-matnr,
it_final-erdat,
it_final-ernam,
it_final-konda,
it_final-kdgrp.
endloop. -
How to count the days between Date Range using OO ABAP?
hi experts,
i want to count the days between Date Range using OO ABAP for that which class and method can i use?.
Thanks,
Mahesh.Not sure I understand the requirement for it to be OO, but you could always write your own (i.e. use this):
REPORT zz_date_diff.
CLASS date_diff DEFINITION.
PUBLIC SECTION.
METHODS diff IMPORTING i_date_fm TYPE d
i_date_to TYPE d
EXPORTING e_days TYPE i.
ENDCLASS."
CLASS date_diff IMPLEMENTATION.
METHOD diff.
e_days = i_date_to - i_date_fm.
ENDMETHOD."
ENDCLASS."
DATA: g_ref TYPE REF TO date_diff,
g_days TYPE i,
g_date_fm TYPE d VALUE '20080101',
g_date_to TYPE d VALUE '20090101'.
START-OF-SELECTION.
CREATE OBJECT g_ref.
CALL METHOD g_ref->diff
EXPORTING
i_date_fm = g_date_fm
i_date_to = g_date_to
IMPORTING
e_days = g_days.
WRITE g_days. -
Any Bapi fn module to copy bi prd table data to bi dev table
Hi all,
Im BI techno functional consultant here my requirement is to write a report such that when it executes ,
it has to copy bi prd table data to bi dev table.
ex: The same ODS table data moving from BI PRD to BI DEV.
Can U please sujjest me the code to write a report or any fn module..
with regards,
prasad.hi prasad,
From BI point of view, what Amit suggested is the best way to get the data from one system to another sytem.(try to convince your client)
If you want to get the data through ABAP, check with an ABAPer if it possible to have another system(for example, Prod)
in the WHERE condition of a SELECT statement.
There are function modules which can be created with an attribute "remote enabled module"(you can see that in attibute screen of a function module) to get data from another system.(you will need more information than this)
This is more of an ABAP question. A post in the ABAP could be of help.
Thanks. -
How to read internal table data and use to retrive from other table.
Hi all,
I am trying to generate a report using ooabap.
In this scenario, I retrieved data from one standard table (zcust) and successfully displayed using structure 'i_zcust_final' ( i_zcust_final is similar structure of zcust).
Now I want to get some other data from other standard table (zpurch) using the data in i_zcust_final. How....???? I am unable to read data from i_zcust_final even i kept in loop.
I am attaching the code here.. even it too long, please look at the code and suggest me what to do.
code **************************
REPORT ZBAT_OOPS_REPORT1.
TABLES: ZCUST.
D E F I N I T I O N *****
CLASS BATLANKI_CLS DEFINITION.
PUBLIC SECTION.
DATA : ITAB_ZCUST TYPE STANDARD TABLE OF ZCUST,
I_ZCUST_FINAL LIKE LINE OF ITAB_ZCUST,
ITAB_ZCUST1 TYPE STANDARD TABLE OF ZCUST.
TYPES: BEGIN OF IT_ZPURCH,
CUSTNUM TYPE ZPURCH-CUSTNUM,
PURC_DOC TYPE ZPURCH-PURC_DOC,
VENDOR TYPE ZPURCH-VENDOR,
STATUS TYPE ZPURCH-STATUS,
PURC_ORG TYPE ZPURCH-PURC_ORG,
END OF IT_ZPURCH.
DATA : ITAB_ZPURCH TYPE TABLE OF IT_ZPURCH,
I_ZPURCH_FINAL LIKE LINE OF ITAB_ZPURCH.
METHODS: GET_ZCUST,
PRINT_ZCUST,
GET_ZPURCH.
ENDCLASS.
I N I T I A L I Z T I O N *****
SELECT-OPTIONS:S_CUSNUM FOR ZCUST-CUSTNUM.
INITIALIZATION.
S_CUSNUM-LOW = '0100'.
S_CUSNUM-HIGH = '9999'.
S_CUSNUM-OPTION = 'BT'.
S_CUSNUM-SIGN = 'I'.
APPEND S_CUSNUM.
CLEAR S_CUSNUM.
I M P L E M E N T A T I O N *****
CLASS BATLANKI_CLS IMPLEMENTATION.
METHOD GET_ZCUST.
SELECT * FROM ZCUST
INTO TABLE ITAB_ZCUST
WHERE CUSTNUM IN S_CUSNUM.
ENDMETHOD.
METHOD PRINT_ZCUST.
LOOP AT ITAB_ZCUST INTO I_ZCUST_FINAL.
WRITE:/ I_ZCUST_FINAL-CUSTNUM,
I_ZCUST_FINAL-CUSTNAME,
I_ZCUST_FINAL-CITY,
I_ZCUST_FINAL-EMAIL.
ENDLOOP.
ENDMETHOD.
METHOD GET_ZPURCH.
LOOP AT ITAB_ZCUST INTO ITAB_ZCUST1.
SELECT CUSTNUM
PURC_DOC
VENDOR
STATUS
PURC_ORG
FROM ZPURCH
INTO CORRESPONDING FIELDS OF TABLE ITAB_ZPURCH
WHERE CUSTNUM EQ I_ZCUST_FINAL-CUSTNUM.
ENDLOOP.
LOOP AT ITAB_ZPURCH INTO I_ZPURCH_FINAL.
WRITE:/ I_ZPURCH_FINAL-CUSTNUM,
I_ZPURCH_FINAL-PURC_DOC,
I_ZPURCH_FINAL-VENDOR,
I_ZPURCH_FINAL-STATUS,
I_ZPURCH_FINAL-PURC_ORG.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
O B J E C T *****
DATA: BATLANKI_OBJ TYPE REF TO BATLANKI_CLS.
START-OF-SELECTION.
CREATE OBJECT BATLANKI_OBJ.
CALL METHOD:
BATLANKI_OBJ->GET_ZCUST,
BATLANKI_OBJ->PRINT_ZCUST,
BATLANKI_OBJ->GET_ZPURCH.
Can anyone suggest me..
Thanks in advance,
Surender.Hi Surendar..
There is mistake in the Work area specification in this method.
METHOD GET_ZPURCH.
LOOP AT ITAB_ZCUST INTO ITAB_ZCUST1.
SELECT CUSTNUM
PURC_DOC
VENDOR
STATUS
PURC_ORG
FROM ZPURCH
INTO CORRESPONDING FIELDS OF TABLE ITAB_ZPURCH
<b>WHERE CUSTNUM EQ ITAB_ZCUST1-CUSTNUM.</b>
"Instead of I_ZCUST_FINAL-CUSTNUM.
ENDLOOP.
LOOP AT ITAB_ZPURCH INTO I_ZPURCH_FINAL.
WRITE:/ I_ZPURCH_FINAL-CUSTNUM,
I_ZPURCH_FINAL-PURC_DOC,
I_ZPURCH_FINAL-VENDOR,
I_ZPURCH_FINAL-STATUS,
I_ZPURCH_FINAL-PURC_ORG.
ENDLOOP.
ENDMETHOD.
Now it should work..
One more thing : From performance point of view you have to Replace that loop using FOR ALL ENTRIES . And avoid CORRESPONDING FIELDS. it will be slow.
This is the code.
LOOP AT ITAB_ZCUST INTO ITAB_ZCUST1.
if ITAB_ZCUST[] IS NOT INITIAL.
SELECT CUSTNUM
PURC_DOC
VENDOR
STATUS
PURC_ORG
FROM ZPURCH
INTO TABLE ITAB_ZPURCH
<b>for all entries in ITAB_ZCUST1</b>
<b>WHERE CUSTNUM EQ ITAB_ZCUST1-CUSTNUM.</b>
"Instead of I_ZCUST_FINAL-CUSTNUM.
ENDIF.
ENDLOOP.
<b>Reward if Helpful.</b> -
Problem regarding the creation of sales order using bapi.
Hai all,
I am creating sales order using bapi but i am, get following error messages :
TYPE ID NUMBER MESSAGE
E VP 112 Please enter sold-to party or ship-to party
E V4 219 Sales document was not changed
I have entered all the parameters.
my program is as follows :
*& Report ZSD_SALES_ORDER
REPORT ZSD_SALES_ORDER.
Tables
*table definitions
TABLES:vbak, "Sales Document: Header Data
knvv, "Customer Master Sales Data
mara, "General Material Data
t001l, "Plants/Branches
mvke, "Sales Data for Material
vbap, "Sales Document: Item Data
konv. "Conditions (Transaction Data)
Types
*type for upload data
TYPES :BEGIN OF ty_upload,
matnr(20) TYPE c, " Old material number
quantity(20) TYPE c, " Cumulative order quantity in sales units
VALUE TYPE BAPIKWERT1,
value(20) TYPE c, " Condition value
value TYPE konv-kwert, " Condition value
END OF ty_upload.
*type for final output table
TYPES :BEGIN OF ty_main,
bismt TYPE mara-bismt, "Old material number
matnr TYPE vbap-matnr, "Material Number
kunnr TYPE vbak-kunnr, "customer number
auart TYPE vbak-auart, "Sales Document Type
vkorg TYPE vbak-vkorg, "Sales Organization
vtweg TYPE vbak-vtweg, "Distribution Channel
spart TYPE vbak-spart, "Division
vbeln TYPE vbak-vbeln, "Sales document
werks TYPE marc-werks, " Plant
lgort TYPE mard-lgort, "Storage Location
posnr TYPE vbap-posnr, "Sales Document Item
parvw TYPE vbpa-parvw, "Partner function
kwmeng TYPE vbap-kwmeng, "Cumulative order quantity in sales units
kschl TYPE konv-kschl, "Condition type
kwert TYPE konv-kwert, "Condition value
KWERT TYPE BAPIKWERT1,
kwert(20) TYPE c, "Condition value
waers TYPE konv-waers, "Currency
END OF ty_main.
*type for old material number
TYPES: BEGIN OF ty_matnr,
matnr TYPE mara-matnr,
bismt TYPE mara-bismt,
END OF ty_matnr.
*type for order number
TYPES :BEGIN OF ty_output,
vbeln TYPE vbak-vbeln, "Sales Document
END OF ty_output.
Constants Begin with C_ *
CONSTANTS:
c_zpmu(4) TYPE c VALUE 'ZPMU',
c_zpmm(4) TYPE c VALUE 'ZPMM'.
DATA: c_ch(1) TYPE c VALUE 'X'.
Data Begin with W_ *
*global data for validations
DATA: w_count TYPE i,
w_vkorg TYPE vbak-vkorg,
w_vtweg TYPE vbak-vtweg,
w_spart TYPE vbak-spart,
w_werks TYPE t001l-werks,
w_check TYPE c,
w_itemno TYPE posnr_va,
W_COND TYPE C.
w_cond(3) TYPE c.
Internal tables Begin with IT_ *
*internal table definitions
DATA : it_upload TYPE STANDARD TABLE OF ty_upload ,
wa_upload TYPE ty_upload.
DATA : it_main TYPE STANDARD TABLE OF ty_main,
wa_main TYPE ty_main.
DATA: it_matnr TYPE STANDARD TABLE OF ty_matnr,
wa_matnr TYPE ty_matnr.
DATA : it_output TYPE STANDARD TABLE OF ty_output.
Internal table for BAPI.
DATA: it_bapisdhd1 TYPE STANDARD TABLE OF bapisdhd1, "Sales and Distribution Document Header
wa_bapisdhd1 TYPE bapisdhd1.
DATA: it_bapisditm TYPE STANDARD TABLE OF bapisditm , "Sales and Distribution Document Item
wa_bapisditm TYPE bapisditm.
DATA: it_bapiparnr TYPE STANDARD TABLE OF bapiparnr, "SD Document Partner: WWW
wa_bapiparnr TYPE bapiparnr.
DATA: it_bapischdl TYPE STANDARD TABLE OF bapischdl, "Schedule Lines
wa_bapischdl TYPE bapischdl.
DATA: it_bapicond TYPE STANDARD TABLE OF bapicond, "Communication Fields for Maintaining Conditions in the Order
wa_bapicond TYPE bapicond.
DATA: it_bapiret2 TYPE STANDARD TABLE OF bapiret2, "Return Parameter
wa_bapiret2 TYPE bapiret2.
Parameters Begin with PR_ *
*selection screen definition
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME .
PARAMETERS: pr_vkorg TYPE vbak-vkorg OBLIGATORY,
pr_vtweg TYPE vbak-vtweg OBLIGATORY,
pr_spart TYPE vbak-spart OBLIGATORY,
pr_kunnr TYPE kna1-kunnr OBLIGATORY,
pr_werks TYPE marc-werks OBLIGATORY,
pr_lgort TYPE mard-lgort OBLIGATORY.
PARAMETERS: pr_auart TYPE vbak-auart OBLIGATORY,
PR_AUGRU TYPE VBAK-AUGRU OBLIGATORY.
pr_augru TYPE vbak-augru.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME.
PARAMETERS : pr_file TYPE ibipparms-path OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk2.
At selection-screen *
AT SELECTION-SCREEN.
PERFORM f006_validate_vkorg.
PERFORM f007_validate_vtweg.
PERFORM f008_validate_spart.
PERFORM f009_validate_kunnr.
PERFORM f010_validate_werks.
PERFORM f011_validate_lgort.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pr_file.
*for f4 help----
PERFORM f003_f4_help.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
*for material ,quantity and value upload
PERFORM f001_upload_file.
*get data
PERFORM f003_get_data.
*for check the data
PERFORM f002_check_data .
PERFORM f004_process.
*for posting
PERFORM f005_posting.
END-OF-SELECTION.
E N D O F S E L E C T I O N *
*& Form f001_upload_file
upload file
FORM f001_upload_file .
DATA : lw_fname TYPE string.
CLEAR lw_fname.
lw_fname = pr_file.
REFRESH it_upload.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lw_fname
filetype = 'ASC'
has_field_separator = c_ch
TABLES
data_tab = it_upload
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 it_upload INTO wa_upload.
wa_upload-value = ( wa_upload-value ) / 10.
MODIFY it_upload FROM wa_upload.
ENDLOOP.
ENDFORM. "F001_UPLOAD_FILE
*& Form f003_f4_help
f4 help
FORM f003_f4_help .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = pr_file.
ENDFORM. " f003_f4_help
*& Form check_data
text
FORM f002_check_data .
DATA: lw_lines TYPE i.
DESCRIBE TABLE it_main LINES lw_lines.
IF lw_lines LE 0.
RETURN.
ENDIF.
SELECT a~matnr
a~bismt FROM mara AS a INNER JOIN mvke AS b
ON amatnr = bmatnr
INTO CORRESPONDING FIELDS OF TABLE it_matnr
FOR ALL ENTRIES IN it_main
WHERE a~bismt = it_main-bismt.
IF sy-subrc = 0.
LOOP AT it_main INTO wa_main.
CLEAR : wa_matnr.
READ TABLE it_matnr INTO wa_matnr WITH KEY bismt = wa_main-bismt.
IF sy-subrc = 0.
MOVE: wa_matnr-matnr TO wa_main-matnr.
ENDIF.
MODIFY it_main FROM wa_main TRANSPORTING matnr WHERE bismt = wa_main-bismt.
ENDLOOP.
ELSE.
MESSAGE e000(zmsd) WITH text-001.
ENDIF.
ENDFORM. "CHECK_DATA
*& Form F009_validate_vkorg
text
FORM f006_validate_vkorg .
CLEAR w_vkorg.
SELECT SINGLE vkorg
INTO w_vkorg FROM tvko
WHERE vkorg EQ pr_vkorg.
IF sy-subrc <> 0.
MESSAGE e000(zmsd) WITH text-012 pr_vkorg.
ENDIF.
ENDFORM. " F009_validate_vkorg
*& Form f007_validate_vtweg
text
FORM f007_validate_vtweg .
CLEAR:w_vtweg.
SELECT SINGLE vtweg
INTO w_vtweg FROM tvtw
WHERE vtweg EQ pr_vtweg.
IF sy-subrc <> 0.
MESSAGE e089(zmsd).
ENDIF.
ENDFORM. " f007_validate_vtweg
*& Form f008_validate_spart
text
FORM f008_validate_spart .
CLEAR:w_spart.
SELECT SINGLE spart
INTO w_spart FROM tspa
WHERE spart EQ pr_spart.
IF sy-subrc <> 0.
MESSAGE e087(zmsd).
ENDIF.
ENDFORM. " f008_validate_spart
*& Form F010_validate_kunnr
text
FORM f009_validate_kunnr .
DATA: l_kunnr TYPE kunnr.
CLEAR: w_vkorg, w_vtweg,w_spart.
SELECT SINGLE kunnr FROM knvv
INTO l_kunnr
WHERE kunnr = pr_kunnr
AND vkorg = pr_vkorg
AND vtweg = pr_vtweg
AND spart = pr_spart.
IF sy-subrc <> 0.
MESSAGE e000(zmsd) WITH text-010 pr_kunnr text-011 pr_vkorg .
ENDIF.
ENDFORM. " F010_validate_kunnr
*& Form f010_validate_werks
text
FORM f010_validate_werks .
CLEAR:w_werks.
SELECT SINGLE werks
INTO w_werks FROM t001w
WHERE werks EQ pr_werks.
IF sy-subrc <> 0.
MESSAGE e088(zmsd).
ENDIF.
ENDFORM. " f010_validate_werks
*& Form F011_validate_lgort
text
FORM f011_validate_lgort .
CLEAR:w_werks .
SELECT SINGLE werks FROM t001l
INTO w_werks
WHERE werks = pr_werks
AND lgort = pr_lgort.
IF sy-subrc <> 0.
MESSAGE e000(zmsd) WITH text-007 pr_lgort text-008 pr_werks .
ENDIF.
ENDFORM. " F011_validate_lgort
*& Form f003_get_data
text
FORM f003_get_data .
CLEAR wa_main.
REFRESH it_main.
LOOP AT it_upload INTO wa_upload.
CLEAR : wa_main.
MOVE: wa_upload-matnr TO wa_main-bismt,
wa_upload-quantity TO wa_main-kwmeng,
wa_upload-value TO wa_main-kwert,
pr_vkorg TO wa_main-vkorg,
pr_vtweg TO wa_main-vtweg,
pr_spart TO wa_main-spart,
pr_kunnr TO wa_main-kunnr,
pr_werks TO wa_main-werks,
pr_lgort TO wa_main-lgort.
APPEND wa_main TO it_main.
ENDLOOP.
ENDFORM. " f003_get_data
*& Form f004_process
text
FORM f004_process .
CLEAR w_check.
LOOP AT it_main INTO wa_main.
IF wa_main-matnr = ''.
WRITE:/ text-006,
wa_main-bismt.
w_check = 1.
ENDIF.
IF wa_main-kwmeng = 0.
WRITE:/ text-005,
wa_main-bismt.
w_check = 1.
ENDIF.
IF pr_auart <> 'ZM01'.
IF wa_main-kwert IS INITIAL.
WRITE:/ text-004,
wa_main-bismt.
w_check = 1.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " f004_process
*& Form f005_posting
text
FORM f005_posting .
CLEAR: w_itemno,
w_cond.
w_itemno = 10.
w_cond = 1.
IF w_check = '' OR w_check = 1.
wa_bapisdhd1-doc_type = pr_auart.
wa_bapisdhd1-ord_reason = pr_augru.
LOOP AT it_main INTO wa_main.
IF w_cond = 1.
CLEAR: it_bapiret2,
it_bapisditm,
it_bapiparnr,
it_bapischdl,
it_bapicond.
REFRESH:it_bapiret2,
it_bapisditm,
it_bapiparnr,
it_bapischdl,
it_bapicond.
MOVE: wa_main-vkorg TO wa_bapisdhd1-sales_org,
wa_main-vtweg TO wa_bapisdhd1-distr_chan,
wa_main-spart TO wa_bapisdhd1-division.
wa_bapisdhd1-wbs_eleM = 'Y561.1'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = pr_kunnr
IMPORTING
OUTPUT = pr_kunnr.
wa_bapisdhd1-PURCH_NO_S = pr_kunnr.
wa_bapisdhd1-PURCH_NO_C = pr_kunnr.
ENDIF.
MOVE: w_itemno TO wa_bapisditm-itm_number,
wa_main-matnr TO wa_bapisditm-material,
wa_main-BISMT TO wa_bapisditm-material,
wa_main-werks TO wa_bapisditm-plant,
wa_main-lgort TO wa_bapisditm-store_loc.
wa_bapisditm-target_qty = '10'.
wa_bapisditm-PURCH_NO_S = pr_kunnr.
wa_bapisditm-PURCH_NO_C = pr_kunnr.
APPEND wa_bapisditm TO it_bapisditm.
IF w_cond = 1.
wa_bapiparnr-partn_numb = pr_kunnr.
wa_bapiparnr-itm_number = 10.
wa_bapiparnr-partn_role = 'SP'.
APPEND wa_bapiparnr TO it_bapiparnr.
wa_bapiparnr-partn_role = 'AG'.
APPEND wa_bapiparnr TO it_bapiparnr.
CLEAR wa_bapiparnr-partn_role.
wa_bapiparnr-partn_numb = pr_kunnr.
wa_bapiparnr-partn_role = 'RE'.
APPEND wa_bapiparnr TO it_bapiparnr.
CLEAR wa_bapiparnr-partn_role.
wa_bapiparnr-partn_numb = pr_kunnr.
wa_bapiparnr-partn_role = 'RG'.
APPEND wa_bapiparnr TO it_bapiparnr.
CLEAR wa_bapiparnr-partn_role.
wa_bapiparnr-partn_numb = pr_kunnr.
wa_bapiparnr-partn_role = 'WE'.
APPEND wa_bapiparnr TO it_bapiparnr.
ENDIF.
wa_bapischdl-itm_number = w_itemno.
wa_bapischdl-req_qty = wa_main-kwmeng.
wa_bapischdl-PURCH_NO_S = pr_kunnr.
APPEND wa_bapischdl TO it_bapischdl.
wa_bapicond-itm_number = w_itemno.
wa_bapicond-cond_type = 'ZECL'.
IF ( wa_bapisdhd1-doc_type = 'ZPMU' ) OR ( wa_bapisdhd1-doc_type = 'ZPMM' ).
wa_bapicond-cond_type = 'ZVAL'.
ELSE.
wa_bapicond-cond_type = 'ZMRP'. "+PK12122006
ENDIF.
wa_bapicond-cond_value = wa_main-kwert.
APPEND wa_bapicond TO it_bapicond.
w_itemno = w_itemno + 10.
w_cond = w_cond + 1.
ENDLOOP.
data : SALESDOCUMENTIN like BAPIVBELN-VBELN.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = wa_bapisdhd1
IMPORTING
salesdocument = SALESDOCUMENTIN
TABLES
return = it_bapiret2
order_items_in = it_bapisditm
order_partners = it_bapiparnr
order_schedules_in = it_bapischdl
order_conditions_in = it_bapicond.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_ch.
ENDIF.
LOOP AT it_bapiret2 INTO wa_bapiret2.
DATA : w_err(100) TYPE c,
w_matnr TYPE matnr.
IF wa_bapiret2-type = 'E' AND wa_bapiret2-id = 'V1' AND wa_bapiret2-number = 392.
UNPACK wa_bapiret2-message_v1 TO w_matnr.
READ TABLE it_matnr INTO wa_matnr WITH KEY matnr = w_matnr.
IF sy-subrc EQ 0.
CONCATENATE text-013 wa_matnr-bismt INTO w_err SEPARATED BY space.
MESSAGE w_err TYPE 'S'.
ENDIF.
ENDIF.
IF WA_BAPIRET2-TYPE = 'S'. " Comment
WRITE: 40 TEXT-009, WA_BAPIRET2-MESSAGE_V2+0(10).
ENDIF.
ENDLOOP.
ENDFORM. " f005_posting
I have given all the necessary parameters. it is telling that error is in parameter
sales_header_in.
I have checked it.
i have assigned purch_no_s and purch_no_c of the structure BAPISDHD1(ORDER_HEADER_IN)
in the bapi with customer number.
and also i have assigned the partnumber of the structure BAPIPARNR ORDER_PARTNERS
in the bapi with customer number.
but still , it is diplaying the error message, please enter the sold to or ship to party number.
how to resolve this error.
this is urgent requirement.
points will be awarded.
thanking u in advance,
a.srinivas.Hi,
Did u have a look at the standard programs which make use of BAPI_SALESORDER_CREATEFROMDAT1
Heres a list...
LWSSOU08
MV45WF0S
MWWMJF21_BAPI_SALESORDER_CREAT
RBUS2032
Regards,
Tanveer.
<b>Please mark helpful answers</b> -
Dynamic Table data cannot be Read.
Hello,
I have an Adobe Interactive form and I am trying to read the data from the Dynamic Table I have in the Form. The Problem is when I try to read the data using the below code, the data which is entered by user data cannot be read for some reason.
navigate from <CONTEXT> to <ADR_DATA> via lead selection
lo_nd_adr_data = wd_context->get_child_node( name = wd_this->wdctx_adr_data ).
navigate from <ADR_DATA> to <PREV_EMPLOYMENT> via lead selection
lo_nd_prev_employment = lo_nd_adr_data->get_child_node( name = wd_this->wdctx_prev_employment ).
get element via lead selection
lo_el_prev_employment = lo_nd_prev_employment->get_element( ).
get all declared attributes
"lo_el_prev_employment->get_static_attributes_table(
lo_nd_prev_employment->get_static_attributes_table(
IMPORTING
table = form_data-prev_employment ).
I have:-
1. Checked the Binding on Adobe Form
2. Checked the Context for the same.
3. Checked the Cardinality of the Nodes.
Please let me know in case i am missing something.
Regards,
Shishir.PHello,
I have tried other method as well but was unsucessful, the procedure is below:-
1. Get PDF content of online form by reading the context.
2. Convert this data to XML
l_fp = cl_fp=>get_reference( ).
l_pdf = l_fp->create_pdf_object( ).
l_pdf->set_document( pdfdata = pdf_data ).
l_pdf->set_task_extractdata( ).
l_pdf->execute( ).
l_pdf->get_data( IMPORTING formdata = l_xstring ).
CLASS cl_ixml DEFINITION LOAD.
DATA: g_ixml TYPE REF TO if_ixml,
streamfactory TYPE REF TO if_ixml_stream_factory,
istream TYPE REF TO if_ixml_istream,
document TYPE REF TO if_ixml_document,
parser TYPE REF TO if_ixml_parser.
g_ixml = cl_ixml=>create( ).
streamfactory = g_ixml->create_stream_factory( ).
wrap the table containing the file into a stream
istream = streamfactory->create_istream_xstring( l_xstring ).
document = g_ixml->create_document( ).
parser = g_ixml->create_parser( stream_factory = streamfactory
istream = istream
document = document ).
parser->parse( ).
3. Read the data from the XML. (I was able to extract other data on the form but not the one in the table. The data entered in the table row in the interactive form is not getting converted into XML or not being extracted in PDF at all).
form_data = get_adr_from_xml( document ).
The Code Wizard is an old one and does not support table operations as the new code wizard. Please let me know in case you have any other method of resolving this issue.
Please let me know your work around, I am in desparate need for a solution.
Regards,
Shishir.P
Edited by: Shishir Paltanwale on Apr 21, 2010 8:16 PM -
Problem: Z table data updates using SM30
Hi,
I have a requirement, while updating records in a Z table
using SM30 Transaction.
The Structure of the table is below:
APMOD Primary Key Char(3)
KONST Primary Key Char(20)
ENDDA Primary Key DATS
BEGDA Non Key DATS
and some other non key fields....
Problem: This table should act something like Infotype in HR. I mean Delimition of Records while creating or changeing the existing record.
Say there is a record
APMOD = OGMT
KONST = Organization Management
BEGDA = 01/01/2004
ENDDA = 12/31/9999
Whenever i am Inserting a new record with key
APMOD = OGMT and KONST = 'Organization Management'
and BEGDA = '01/01/2006'.
First it should update the old record with
BEGDA = 01/01/2004 and ENDDA = 12/31/2005
Then the new record needs to be inserted with
BEGDA = 01/01/2006 and ENDDA = 12/31/9999.
How can I achieve this using SM30? Can we write our own code somewhere? If yes Where and How? Or is there any settings available for this requirement?
I can write a Z program to update this Table, but i should achieve this using SM30 only.
Let me know if you need any additional info.
Regards,
Sudhakar.Hi Sudhakar,
1. I tried the same at my end. It works fantastic !
In SM30 it shows
'Delimit' Button
'Expand <--> Collapse' Button.
and accordingly delmits the records.
2. in SE11,
Use the menu
Utilities ---> Table Maintenance Generator
and finally build a table maintenance
to use in SM30.
3. When u use in SM30,
u will achieve what u want.
4. Just make sure your field
ENDDA has the data element ENDDA
in table definition.
It should also be key.
5. After this ENDDA column,
there should be no other key column
( not even BEGDA)
I Hope it helps.
Regards,
Amit M. -
How to use Read table with out key fields
Hi Experts,
I need to retrieve the 2 internal tables data into single table.
I have 3 common fields between the 2 tables but I don't have the Key fields. Then how to use the read table in this.
Thanks in Advance.
Edited by: satish4abap on Mar 10, 2010 9:39 AMHi Satish,
Key fields are nothing but the common fields with which you can pick the data from the second internal table.
If you can paste your Internal table fields then we will be able to assit you better.
However, in genral scenarios you can use it as below :
In this scenario, we are putting data from 3 internal table to another single internal table.
LOOP AT T_PRGEN INTO WA_PRGEN.
WA_FINAL-GUID_PR = WA_PRGEN-GUID_PR.
WA_FINAL-ATTR20A = WA_PRGEN-ATTR20A.
WA_FINAL-ATTR05A = WA_PRGEN-ATTR05A.
WA_FINAL-ATTR05B = WA_PRGEN-ATTR05B.
WA_FINAL-ATTR05C = WA_PRGEN-ATTR05C. " + DG1K902190
WA_FINAL-ATTR10A = WA_PRGEN-ATTR10A.
READ TABLE T_V_TCAV201 INTO WA_V_TCAV201 WITH KEY ATTRV20 = WA_PRGEN-ATTR20A BINARY SEARCH.
IF SY-SUBRC = 0.
WA_FINAL-TEXT1 = WA_V_TCAV201-TEXT1. "SUBID-TEXT1
ENDIF.
READ TABLE T_PNTPR INTO WA_PNTPR WITH KEY GUID_PR = WA_PRGEN-GUID_PR BINARY SEARCH.
IF SY-SUBRC = 0.
WA_FINAL-PRVSY = WA_PNTPR-PRVSY. "PROD NO
WA_FINAL-GRVSY = WA_PNTPR-GRVSY. "LOGICAL SYS GROUP
ENDIF.
append wa_final to t_final.
endloop. -
How to write select statement before the loop and how to use read statemnt
Hi,
Recently our system has changed from 4.6 to ECC6.
As its migrated its showing lots of errors like in between loop and endloop there should be no select statemnt........
Can any one please tell how to write that coding in ECC6 , how can i change the code......
In between loop and endloop i am having lots of select statemnts.....ple tell thye coding how can i select before the loop starts and
how to read that internal table in loop.Hi Deepthi,
You can do as per below:
1) Select the required entries from the tables you need (VBAK, VBAP, KNA1, etc)
SELECT VBELN ERDAT KUNNR
into table it_vbak
from VBAK
where VBELN = S_VBELN. "Selection criteria
If sy-subrc = 0.
SELECT VBELN POSNR MATNR
into table it_vbap
from VBAP
for all entries in it_vbak
where VBELN = it_vbak-vbeln
SELECT KUNNR NAME1
into table it_vbak
from VBAK
where VBELN = it_vbak-vbeln.
endif.
2) Loop at the entries, and read internal table it-kna1 for customer info.
Loop at it_vbak into wa_vbak.
read table it_kna1 into wa_kna1 with key kunnr = wa_vbak-kunnr.
if sy-subrc = 0.
endif.
loop at it_vbap into wa_vbap where vbeln = wa_vbak-vbeln.
endloop.
endloop.
This is the basic idea and short example of how to extract entries and read internal table.
Hope this helps.
Regards,
Patrick -
How to load external data without using external tables
Hi,
I'm asked to develop an ETL for loading external data into a database but, unfortunately, the vers. is 8i so I can't use external tables.
I know that it's possible by using SQL-Loader. What I want to know is whether there's another way in 8i to load external data from a text file or a CSV file directly with a stored procedure without having to write CTL of SQL-Loader on the server. I mean, is there a way to write everything on the database the same manner I'd do whether I wrote data from a table to a file using for example UTL_FILE or the unique way is to write control files of SQL-Loader directly on the server?
Thanks!Mark1970 wrote:
Thank you very much Karthick
I didn't know I could use UTL_FILE also for reading files. I've always use it only for writing data into external files.Yes you can use UTL_FILE to read. The version of oracle you are using i last used in 2004 :) Still remember giving the OS path of the file to open the file. That is long gone now. Its surprising that you are still in 8i.
Maybe you are looking for
-
Installation of 27" cinema display with macbook pro silver key and bootcamp
For everyone out there who may be interested in using the new 27" cinema display with an older Macbook Pro Intel with silver keys and bootcamp. What is needed: 1. Apple 27" cinema display. 2. Macbook pro Intel silver key model 3. Altona Dual Link DVI
-
Back ground: I have a long IT career but have never really done any web dev before. This is my first real stab at building a website so this may be a 101 coding error but I had a heck of a time figuring it out so I thought I'd share incase another n
-
Blackberry 9220 getting hold often
Hello everyone. I am new to BB world and currently using BB9220 which is purchased on 23rd Feb. I am quite disspointed with the device. Often my phone gets hanged and i need to pull out the battery to reboot the device. The problem is if some body ca
-
Do I need photo stream if I use photo library beta
if I take a photo on my iPhone (on which photo library beta is enabled but photo stream is not), it is sent to my photo library beta in iCloud and mirrored to my iPad (which also has photo library beta enabled but not photo stream). So far, so good.
-
T500 with LED and 1680*1050
Hi Lenovo, hi *, as my z60m is getting 4 years old, I'm searching for a good replacement. I wait for over an half year for lenovo to bring the t500 with led on the german market. after the t500 with led is sold since Juli/August 08 in the us, it's ar