2005 Dec 28 6:48 AM
Hi,
I am comparing a field with two variables where the first four characters of the variable are equal to var1 and rest of the characters are equal to var2.
TYPES: BEGIN OF T_ZWIPSTAT,
LOTNUM TYPE ZMES_LOT, "MES LOT NUMBER
ORDERNUM TYPE AUFNR, "ORDER NUMBER
OPR_DESCP TYPE ZOPRDESCP, "OPERATION DESCRIPTION
ROUTE(36) TYPE C,
OPR_DES(4) TYPE C,
END OF T_ZWIPSTAT.
SELECT LOTNUM
ORDERNUM
OPR_DESCP
FROM ZWIPSTAT
INTO TABLE I_ZWIPSTAT1
FOR ALL ENTRIES IN I_ZLHSTOCKOVERVIEW
WHERE WERKS = I_ZLHSTOCKOVERVIEW-WERKS
AND ORDERNUM = I_ZLHSTOCKOVERVIEW-ORNUM.
ENDIF.
LOOP AT I_ZWIPSTAT1 INTO IS_ZWIPSTAT1.
V_INDEX = SY-TABIX.
IF NOT IS_ZWIPSTAT1-OPR_DESCP+0(4) IN S_OPNUM AND
NOT IS_ZWIPSTAT1-OPR_DESCP+4(36) IN S_OPRDES.
DELETE I_ZWIPSTAT1 INDEX V_INDEX.
ELSE.
MOVE I_ZWIPSTAT1 TO I_ZWIPSTAT.
ENDIF.
ENDLOOP.
with the above code i have only those records which i need in the internal table.
My requirement is to split the field ""OPR_DESCP"" and get the first 4 charaters to ""opr_des"" and the rest of the characters to ""route"" as defined in the types statement.
Can any one pls tell how write the code for this and where should I write that.
2005 Dec 28 7:15 AM
Hi Hema,
Try this code.
TYPES: BEGIN OF T_ZWIPSTAT,
LOTNUM TYPE ZMES_LOT, "MES LOT NUMBER
ORDERNUM TYPE AUFNR, "ORDER NUMBER
OPR_DESCP TYPE ZOPRDESCP, "OPERATION DESCRIPTION
ROUTE(36) TYPE C,
OPR_DES(4) TYPE C,
END OF T_ZWIPSTAT.
SELECT LOTNUM
ORDERNUM
OPR_DESCP
FROM ZWIPSTAT
INTO TABLE I_ZWIPSTAT1
FOR ALL ENTRIES IN I_ZLHSTOCKOVERVIEW
WHERE WERKS = I_ZLHSTOCKOVERVIEW-WERKS
AND ORDERNUM = I_ZLHSTOCKOVERVIEW-ORNUM.
LOOP AT I_ZWIPSTAT1 INTO IS_ZWIPSTAT1.
V_INDEX = SY-TABIX.
I_ZWIPSTAT1-OPR_DESCP+0(4) = IS_ZWIPSTAT1-OPR_DES.
I_ZWIPSTAT1-OPR_DESCP+4(36) = IS_ZWIPSTAT1-ROUTE.
MODIFY I_ZWIPSTAT1 FROM IS_ZWIPSTAT1 INDEX V_INDEX.
ENDLOOP.
Before that make sure that your Internal table and Work area has same structure.
Thanks,
Sreekanth G
2005 Dec 28 6:52 AM
Hi Hema,
1. opr_des = IS_ZWIPSTAT1-OPR_DESCP+0(4)
route = IS_ZWIPSTAT1-OPR_DESCP+4(36)
regards,
amit m.
Message was edited by: Amit Mittal
2005 Dec 28 6:55 AM
Hi,
LOOP AT I_ZWIPSTAT1 INTO IS_ZWIPSTAT1.
IS_ZWIPSTAT1-opr_des = IS_ZWIPSTAT1-opr_descp+0(4).
IS_ZWIPSTAT1-route = IS_ZWIPSTAT1-opr_descp+4(36).
modify I_ZWIPSTAT1 from IS_ZWIPSTAT1 index sy-tabix.
ENDLOOP.
Kindly reward points by clikcing the star on the left of reply,if it helps.
2005 Dec 28 6:55 AM
opr_des = IS_ZWIPSTAT1-OPR_DESCP+0(4) .
route = IS_ZWIPSTAT1-OPR_DESCP+4(36) .
this way you can do, if you have any delimiter then you can use split.
regards
vijay
2005 Dec 28 7:03 AM
Hi Hema,
Here IT is ur internal Table.
Afer getting value of OPR_DESCP in Internal table Use following code :
LOOP AT IT.
IT-OPR_DES = IT-OPR_DESCP+0(4).
IT-ROUTE = IT-OPR_DESCP+4(36).
modify IT.
ENDLOOP.
It surely solve ur problem.
Regards,
Digesh Panchal
2005 Dec 28 7:15 AM
Hi Hema,
Try this code.
TYPES: BEGIN OF T_ZWIPSTAT,
LOTNUM TYPE ZMES_LOT, "MES LOT NUMBER
ORDERNUM TYPE AUFNR, "ORDER NUMBER
OPR_DESCP TYPE ZOPRDESCP, "OPERATION DESCRIPTION
ROUTE(36) TYPE C,
OPR_DES(4) TYPE C,
END OF T_ZWIPSTAT.
SELECT LOTNUM
ORDERNUM
OPR_DESCP
FROM ZWIPSTAT
INTO TABLE I_ZWIPSTAT1
FOR ALL ENTRIES IN I_ZLHSTOCKOVERVIEW
WHERE WERKS = I_ZLHSTOCKOVERVIEW-WERKS
AND ORDERNUM = I_ZLHSTOCKOVERVIEW-ORNUM.
LOOP AT I_ZWIPSTAT1 INTO IS_ZWIPSTAT1.
V_INDEX = SY-TABIX.
I_ZWIPSTAT1-OPR_DESCP+0(4) = IS_ZWIPSTAT1-OPR_DES.
I_ZWIPSTAT1-OPR_DESCP+4(36) = IS_ZWIPSTAT1-ROUTE.
MODIFY I_ZWIPSTAT1 FROM IS_ZWIPSTAT1 INDEX V_INDEX.
ENDLOOP.
Before that make sure that your Internal table and Work area has same structure.
Thanks,
Sreekanth G