Skip to Content
author's profile photo Former Member
Former Member

Regarding Abap/4 code

hai

pls tell me the code means in detail , i ll assing maximum points please........

data: begin of str_equipment occurs 0,

/bic/zpmtechid like /bi0/pequipment-/bic/zpmtechid,

equipment like /bi0/pequipment-equipment,

equitype like /bi0/qequipment-equitype,

end of str_equipment.

data: int_equipment like str_equipment occurs 0 with header line.

if firstpckg is initial.

clear: int_equipment. refresh: int_equipment.

select equipment /bic/zpmtechid equitype dateto from /bi0/mequipment

into corresponding fields of table

int_equipment where objvers = 'A' and dateto = '99991231'.

sort int_equipment by /bic/zpmtechid.

firstpckg = 'X'.

endif.

loop at DATA_PACKAGE.

clear: int_equipment.

  • map equipment

read table int_equipment with key /bic/zpmtechid =

DATA_PACKAGE-/bic/zpmlapn binary search.

if not int_equipment-equipment is initial.

move int_equipment-equipment to DATA_PACKAGE-equipment.

move int_equipment-equitype to DATA_PACKAGE-equitype.

else.

concatenate DATA_PACKAGE-/bic/zapncls(2) 'X' into

DATA_PACKAGE-equitype.

endif.

  • map order typw

case DATA_PACKAGE-/bic/zpmlwotyp.

when '0'.

DATA_PACKAGE-coord_type = 'PM04'.

when '1'.

DATA_PACKAGE-coord_type = 'PM02'.

when '2'.

DATA_PACKAGE-coord_type = 'PM03'.

when '3'.

DATA_PACKAGE-coord_type = 'PM01'.

when '4'.

DATA_PACKAGE-coord_type = 'PM01'.

when '5'.

DATA_PACKAGE-coord_type = 'PM05'.

when '6'.

DATA_PACKAGE-coord_type = 'PM01'.

when '7'.

DATA_PACKAGE-coord_type = 'PM07'.

when '8'.

DATA_PACKAGE-coord_type = 'PM02'.

when '9'.

DATA_PACKAGE-coord_type = 'PM06'.

endcase.

modify DATA_PACKAGE.

endloop.

  • if abort is not equal zero, the update process will be canceled

ABORT = 0.

txs

rizwan

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 02, 2006 at 06:02 AM

    Hi,

    1. data: begin of str_equipment occurs 0 means internal tables str_equipment has been defined with structure including fields

    bic/zpmtechid like /bi0/pequipment-/bic/zpmtechid,

    equipment like /bi0/pequipment-equipment,

    equitype like /bi0/qequipment-equitype,

    2. variable int_equipment has been defined as another internal table with same structre as str_equipment.

    3.clear means int_equipment is cleard

    4.Select is fired on table /bi0/mequipment and values is stored in the internal table int_equipment based on the condition on objvers = 'A' and dateto = '99991231' and sorting is done while values is stored in the internal table

    5. Then there is iternation as datapackage level

    6. Data is read from internal table int_equipment with matching key values /bic/zpmtechid equal to the value in the datapackage-/bic/zpmtechid

    7. if int_equipment-equipment is not blank then

    values is moved from int_equipment-equipment to DATA_PACKAGE-equipment and int_equipment-equitype to DATA_PACKAGE-equitype.

    8. If the condition above isnot true then first two values form DATA_PACKAGE-/bic/zapncls(2) is concatenated with 'X' and stored in the DATA_PACKAGE-equitype.

    9. Case is like if condition it checks the condition

    based on the values of DATA_PACKAGE-/bic/zpmlwotyp let say the value of DATA_PACKAGE-/bic/zpmlwotyp = 2 then the value of DATA_PACKAGE-coord_type will be eq to 'PM03'.

    10. After all the above changes the datapackage is modified.

    11. this is itenrated for all the records in the data package.

    Hope this helps!!!

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 02, 2006 at 06:07 AM

    Hi Rizwan,

    Find below the details and hope, it helps.

    ==========

    1) ****Internal table declaration

    data: begin of str_equipment occurs 0,

    /bic/zpmtechid like /bi0/pequipment-/bic/zpmtechid,

    equipment like /bi0/pequipment-equipment,

    equitype like /bi0/qequipment-equitype,

    end of str_equipment.

    data: int_equipment like str_equipment occurs 0 with header line.

    2) Code checks whether this is first package if yes, then select equipment, id and type from the table /bi0/mequipment (info-object) where data is active and to date is 12/31/9999. Move to internal table int_equipment. Sets flag to initial package eq 'X' to restrict the data selection.

    if firstpckg is initial.

    clear: int_equipment. refresh: int_equipment.

    select equipment /bic/zpmtechid equitype dateto from /bi0/mequipment

    into corresponding fields of table

    int_equipment where objvers = 'A' and dateto = '99991231'.

    sort int_equipment by /bic/zpmtechid.

    firstpckg = 'X'.

    endif.

    3) Next loop into data package and reads data from the internal table where equipid = /bic/zpmlapn (check the update rule maping for exact business term). If read passes, move equipment and its type to datapackage equipment and type fields. Suppose no match found, then update the datapacakge field equipment type with value of "DATA_PACKAGE-/bic/zapncls(2) and 'X' (suppose zapncls has value '10' then it stores as 10X).

    • map equipment

    read table int_equipment with key /bic/zpmtechid =

    DATA_PACKAGE-/bic/zpmlapn binary search.

    if not int_equipment-equipment is initial.

    move int_equipment-equipment to DATA_PACKAGE-equipment.

    move int_equipment-equitype to DATA_PACKAGE-equitype.

    else.

    concatenate DATA_PACKAGE-/bic/zapncls(2) 'X' into

    DATA_PACKAGE-equitype.

    endif.

    4) Next mapping is just stright. Check the data package field DATA_PACKAGE-/bic/zpmlwotyp and assign the order type based on its value. Example if 0, then order type is PM04'.

    • map order typw

    case DATA_PACKAGE-/bic/zpmlwotyp.

    when '0'.

    DATA_PACKAGE-coord_type = 'PM04'.

    when '1'.

    DATA_PACKAGE-coord_type = 'PM02'.

    when '2'.

    DATA_PACKAGE-coord_type = 'PM03'.

    when '3'.

    DATA_PACKAGE-coord_type = 'PM01'.

    when '4'.

    DATA_PACKAGE-coord_type = 'PM01'.

    when '5'.

    DATA_PACKAGE-coord_type = 'PM05'.

    when '6'.

    DATA_PACKAGE-coord_type = 'PM01'.

    when '7'.

    DATA_PACKAGE-coord_type = 'PM07'.

    when '8'.

    DATA_PACKAGE-coord_type = 'PM02'.

    when '9'.

    DATA_PACKAGE-coord_type = 'PM06'.

    endcase.

    6) Finally update the changes made to data package.

    modify DATA_PACKAGE

    =================================

    Add comment
    10|10000 characters needed characters exceeded