‎2007 Nov 01 4:38 PM
Hi gurus,
I have a condition where I need to do some action based on the file name, for example if there id "SP" in the file name then its meant for Sold to party and if there is " SH" somewhere in the file name then it is meant ship to party.... and then based on this I have to perform some routines, for example if v_name = " SP" then perform v_sp else v_sh,
so can you please tell me how to acheive this thing, my file name is in v_name
‎2007 Nov 01 4:42 PM
Try:
IF v_name CS 'SP'.
PERFORM v_sp.
ELSEIF v_name CS 'SH'.
PERFORM v_sh.
ENDIF.You could have solved this very easily yourself by simply putting your cursor on an IF statement and pressing F1.
Rob
Message was edited by:
Rob Burbank
‎2007 Nov 01 4:42 PM
Hi ,
Try this way...
IF v_name CS 'SP'.
PERFORM v_sp.
ELSEIF v_name CS 'SH'.
PERFORM v_sa.
ENDIF.
Message was edited by:
Perez C
Message was edited by:
Perez C
‎2007 Nov 01 4:43 PM
If V_name CS 'SP'
Do actions for Sold-to-party
ELSEIF V_NAME CS 'SH'
Do actions for Ship-to-party
ENDIF.
Regards
Nishant
‎2007 Nov 01 4:44 PM
‎2007 Nov 01 4:43 PM
Use the contains string CS statement:
IF v_name CS 'SH'.
do ship to party logic
ELSE IF v_name CS 'SP'.
do Sold to party logic
ENDOF.
‎2007 Nov 01 4:44 PM
Try this code:
REPORT ZTEST_NP.
data: v_name(200) type c value 'SH_1000.txt'.
search v_name for 'SH'.
if sy-subrc = 0.
* call Peform for SH
endif.
search v_name for 'SP'.
if sy-subrc = 0.
* call Peform for SP - Sold to party
endif.Regards,
Naimesh Patel
‎2007 Nov 01 5:15 PM
Pass the complete file name to FM SPLIT_FILENAME .
You will have value in PURE_FILENAME ( FM Export parameter).
now compare with
if pure_filename+0(2) 'SH'.
write the logic
elseif pure_filename+0(2) 'SH'.
write the logic
elseif pure_filename+0(2) 'SH'
write the logic
endif.
Thanks
Seshu