Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

help

Former Member
0 Likes
1,011

Hi friends,

plz help me to code for the below description.

Sub-Step (b) GET the price for the material

For each record selected in Sub-Step (a)

SELECT the field KBETR from KONP where

KNUMH = A903-KNUMH

AND KOPOS = 1

regards,

siri..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
947

Hi,

data:begin of itab2 occurs 0,

kbetr like konp-kbetr,

bomat like konp-bomat,

knumh like konp-knumh,

kopos like konp-kopos,

end of itab2.

select kbetr bomat knumh kopos

from konp

into table itab2

for all entires in itab1

where bomat = itab1-matnr and<b> << for each material selected in substep(a)>></b>

knumh = a903-knumh and

kopos = 1.

regards,

sowjanya.

Message was edited by: sowjanya suggula

8 REPLIES 8
Read only

Former Member
0 Likes
948

Hi,

data:begin of itab2 occurs 0,

kbetr like konp-kbetr,

bomat like konp-bomat,

knumh like konp-knumh,

kopos like konp-kopos,

end of itab2.

select kbetr bomat knumh kopos

from konp

into table itab2

for all entires in itab1

where bomat = itab1-matnr and<b> << for each material selected in substep(a)>></b>

knumh = a903-knumh and

kopos = 1.

regards,

sowjanya.

Message was edited by: sowjanya suggula

Read only

0 Likes
947

Hi Sowjanya,

Thankx.

Actuall the whole description is given as below.

3. Sub-Step (a)

For all the records that survived step 2

SELECT all the records from A903 where

KAPPL in S_KAPPL

AND KSCHL in S_KSCHL

AND VKORG in S_VKORG

AND VTWEG in S_VTWEG

AND PLTYP in S_PLTYP

AND KFRST in S_KFRST

AND KNUMH = CDHDR-OBJECTID (saved in step 2)

IF there are multiple records (unlikely, but …) take ONLY the one with the highest end date (DATBI).

Sub-Step (b)

For each record selected in Sub-Step (a)

SELECT the field KBETR from KONP where

KNUMH = A903-KNUMH

AND KOPOS = 1

Only the condition price (KBETR) is retrieved from this table.

Sub-Step (c) GET the NDC-11 for the material

For each record selected in Sub-Step (a)

SELECT the field BISMT (Old Material Number) from MARA where

MATNR = A903-MATNR

IF found

THEN

This is the material number for the output record; REMOVE THE DASHES before exporting.

ELSE

Create an entry in an internal table for the validation report; the entry should lists all the details required by the export file and the fact that no “Old Material Number” = “NDC-11” was found.

ENDIF

can u help to write the code for the above description.

regards,

siri.

Read only

0 Likes
947

SELECT * into table ia903 from A903

where KAPPL in S_KAPPL

AND KSCHL in S_KSCHL

AND VKORG in S_VKORG

AND VTWEG in S_VTWEG

AND PLTYP in S_PLTYP

AND KFRST in S_KFRST

AND KNUMH = CDHDR-OBJECTID.

sort ia903 by knumh.

SELECT knumh KBETR into table ikonp from KONP

for all entries in ia903

where KNUMH = iA903-KNUMH

AND KOPOS = 1.

sort ia903 by matnr.

SELECT MATNR BISMT into imara

from MARA for all entries in ia903

where MATNR = A903-MATNR.

sort ia903 by key fields + datbi descending.

Loop at ia903.

at new key field.

clear imara.

read table imara with key matnr = ia903-matnr.

if sy-subrc = 0.

translate imara-matnr using '- '.

condense imara-matnr no-gap.

ELSE

Create an entry in an internal table for the validation report; the entry should lists all the details required by the export file and the fact that no “Old Material Number” = “NDC-11” was found.

endif.

endat.

endloop.

Regards

Anurag

Read only

0 Likes
947

hi Anurag,

thanx.

what is the meaning of this then.

plz help me with this.

<b>ELSE

Create an entry in an internal table for the validation report; the entry should lists all the details required by the export file and the fact that no “Old Material Number” = “NDC-11” was found.

endif.</b>

regards,

siri.

Read only

0 Likes
947

As per you specification..you need to write the particular information into an internal table. So the code to populate the internal table should be written there..as I am not sure of the structure etc of the validation report ..I did just paste the text.

in short.

ELSE.

clear ivalidationreport.

move imara-matnr to ivalidationreport-matnr.

move 'Old Material Number = NDC-11 not found to ivalidatreport-remarks.

append ivalidationreport.

ENDIF.

--ivalidationreport is the validation report internal table.

Regards

Anurag

Please assign points for helpful answers !!

Read only

anversha_s
Active Contributor
0 Likes
947

hi,

SELECT amatreila sprice

INTO TABEL INT_material_name_price

FROM table_name AS a

INNER JOIN

tabel_price AS s

ON amatrialID = smatrialID.

for any clarifiaction pls mail me.

pls reward points, if this helped u.

regards,

anversha.

anversha.shahul@wipro.com

Read only

Former Member
0 Likes
947

Hello,

if lines( <ITAB_TEMP> ) > 0.

select kbetr from knop into table <ITAB2>

for all entires in <ITAB_TEMP>

where KNUMH = <ITAB_TEMP>-KNUMH and

PRSCH = <ITAB_TEMP>-KBETR and

KOPOS = 1.

if sy-subrc EQ 0.

sort <ITAB2> by knumh.

endif.

endif.

Regs,

Venkat Ramanan N

Read only

Former Member
0 Likes
947

Hi Sireesha,

select * from a903

into table itab

where KAPPL in S_KAPPL

AND KSCHL in S_KSCHL

AND VKORG in S_VKORG

AND VTWEG in S_VTWEG

AND PLTYP in S_PLTYP

AND KFRST in S_KFRST

AND KNUMH = CDHDR-OBJECTID.

if sy-subrc = 0.

describe table itab lines ln.

if ln > 1. <b><< in case of more than one record>></b>sort itab by datbi descending.

read table itab index 1.

move itab-datbi to itab2-datbi.

append itab2.

endif.

select kbetr from konp

into table itab3

for all entires in itab1

where knumh = itab1-knumh and

kopos = 1.

select bismt from mara

into table itab4

for all entries in itab1

where matnr = itab1-matnr.

if sy-subrc = 0. <b><<remove '-'s in the matnr>></b>

translate itab4-matnr using '- '.

condense itab4-matnr no-gap.

else.

write:/ "no material found with',itab4-matnr.

endif.

Regards,

Sowjanya.