SAP for Utilities Discussions
Connect with fellow SAP users to share best practices, troubleshoot challenges, and collaborate on building a sustainable energy future. Join the discussion.
cancel
Showing results for 
Search instead for 
Did you mean: 

about how to code for below mentioned requirement

Former Member
0 Kudos

Hi,

i need code for this....

 GPC Data (logic to get GPC code is as follows:)

• Read AMPL with BMATN = material number and sy-datum GE datuv and sy-datum LE datub

If record found, set GPC Code = ampl-ematn

Else.

Select mara where bmatn = material number

If record found, set GPC code = MARA-MFRPN

Else GPC code is blank.

please help, points sure.

Anshuman

1 REPLY 1

Former Member
0 Kudos

Hi Anshu,

I did not get what actually you are looking for but the simple

logic could be as below:

Select single * from AMPL into itab where BMATN = material number and sy-datum GE datuv and sy-datum LE datub.

If sy-subrc eq 0.

GPC Code = ampl-ematn

else.

Select mara where bmatn = material number.

if sy-subrc eq 0.

GPC code = MARA-MFRPN

else.

GPC code = ' '.

endif.

endif.

I hope I have tried to answer your question to the best of my ability.

Do let me know in case you have any further queries.

Regards,

Puneet Jhari.