‎2006 Jan 15 12:47 PM
FORM get_lgpbe TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
DATA: lv_matnr TYPE mard-matnr,
lv_lgort TYPE mard-lgort,
lv_lgpbe TYPE mard-lgpbe.
LOOP AT in_par.
CASE in_par-name.
WHEN 'LGORT'.
MOVE in_par-value TO lv_lgort.
WHEN 'MATNR'.
MOVE in_par-value TO lv_matnr.
ENDCASE.
ENDLOOP.
<b>SELECT SINGLE lgpbe INTO lv_lgpbe
FROM mard
WHERE matnr = lv_matnr
and lgort = lv_lgort</b> .
LOOP AT out_par.
CASE out_par-name.
WHEN 'EXT_LGPBE'.
move lv_lgpbe to out_par-value .
ENDCASE.
MODIFY out_par.
ENDLOOP.
ENDFORM. "get_lgpbe
this is my program
if i made this select
<b>SELECT SINGLE lgpbe INTO lv_lgpbe
FROM mard
WHERE matnr = lv_matnr
and lgort = lv_lgort</b> .
in se16 i get value but in the program i dont get' why?
thanks.
‎2006 Jan 15 1:02 PM
check whether you get proper value passed ot lv_matnr
also just before the select statement add the following code
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = lv_matnr
IMPORTING
OUTPUT = lv_matnr
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2 .
Regards
Raja
‎2006 Jan 15 1:00 PM
Hi
Perhaps the code of material number is wrong, infact you have the code in output format (because you're using the value got out from sapscript) and it can have a differen value so your query is failing.
Try that:
LOOP AT IN_PAR.
CASE IN_PAR-NAME.
WHEN 'LGORT'.
MOVE IN_PAR-VALUE TO LV_LGORT.
WHEN 'MATNR'.
MOVE IN_PAR-VALUE TO LV_MATNR.
Convertion for input format:
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = LV_MATNR
IMPORTING
OUTPUT = LV_MATNR.
ENDCASE.
ENDLOOP.
Max
‎2006 Jan 15 1:02 PM
check whether you get proper value passed ot lv_matnr
also just before the select statement add the following code
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = lv_matnr
IMPORTING
OUTPUT = lv_matnr
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2 .
Regards
Raja
‎2006 Jan 15 1:07 PM
‎2006 Jan 15 1:12 PM
foe ebeln use FM
CONVERSION_EXIT_ALPHA_INPUT
to find out which conversion exit to use, check the underlying domain to see the conversion FM
Regards
Raja
Message was edited by: Durairaj Athavan Raja
‎2006 Jan 15 1:17 PM
for another select i made this
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = lv_matnr
IMPORTING
OUTPUT = lv_matnr
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2 .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = lv_ebeln
IMPORTING
OUTPUT = lv_ebeln
.
SELECT SINGLE uptyp INTO lv_uptyp
FROM ekpo
WHERE ebeln = lv_ebeln
AND matnr = lv_matnr.
and it's not working.help pls
‎2006 Jan 15 1:19 PM
Hi
Yes I think you're right.
When you have to use a data got out fro sapscript, you should always check the data domain.
Infact here you can see if it's assigned the routine input/output convertions.
For example:
The domain of your field for material code is MATNR and it has the routine MAT1. So you have to use fm:
CONVERSION_EXIT_MAT1_INPUT
The domain of your field for purchase number is EBELN and it has the routine ALPHA:
CONVERSION_EXIT_ALPHA_INPUT
Generally if the domain has the routine <ROUTINE>, you have to use the fm:
CONVERSION_EXIT_<ROUTINE>_INPUT
Max
‎2006 Jan 15 1:22 PM
whats the data type of lv_ebeln?
it has to be type ebeln.
Regards
Raja
‎2006 Jan 15 1:38 PM
‎2006 Jan 15 1:42 PM
Hi
Yes, FM CONVERSION_EXIT_ALPHA_INPUT is right, see my previous answer.
Max
‎2006 Jan 15 1:43 PM
why i dont get value and in se16 i get
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = lv_matnr
IMPORTING
OUTPUT = lv_matnr
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = lv_ebeln
IMPORTING
OUTPUT = lv_ebeln.
SELECT SINGLE uptyp INTO lv_uptyp
FROM ekpo
WHERE ebeln = lv_ebeln
AND matnr = lv_matnr.
if lv_uptyp = 2.
lv_bonus = 'X'.
endif.
‎2006 Jan 15 1:51 PM
Hi
Are you sure there's the record you're looking for?
Your code is correct but you shouldn't use SELECT SINGLE statament because you aren't using all fields key.
If in your order there are more items than one with the same material, SELECT SINGLE statament'll always give the first record.
SELECT uptyp INTO lv_uptyp FROM ekpo
WHERE ebeln = lv_ebeln
AND matnr = lv_matnr.
if lv_uptyp = 2.
lv_bonus = 'X'.
exit.
endif.
endselect.
Max
‎2006 Jan 15 2:01 PM
it's not workin i add ebelp too
SELECT single uptyp INTO lv_uptyp
FROM ekpo
WHERE ebeln = lv_ebeln
AND matnr = lv_matnr
AND EBELP = lv_line.
‎2006 Jan 15 2:08 PM
Make sure the field lv_line is correctly filled and try this:
data: w_ekpo like ekpo.
BREAK-POINT.
SELECT single * INTO w_ekpo FROM ekpo
WHERE ebeln = lv_ebeln
aND EBELP = lv_line.
IF lv_matnr = w_ekpo-matnr.
lv_uptyp = W_EKPO-UPTYP.
ENDIF.
Max